/* =========================================================
   MAHALAXMI TRADERS — GALLERY PAGE STYLES
   ========================================================= */


/* =========================================================
   1. GALLERY HERO
   ========================================================= */

.gallery-hero {
    position: relative;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(160deg, #0d2a22 0%, #173f35 40%, #1a4a3d 70%, #245b4c 100%);
    overflow: hidden;
    padding: 100px 20px 60px;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(198,154,69,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(198,154,69,0.08) 0%, transparent 40%);
    pointer-events: none;
}

.gallery-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, var(--cream-light, #fcfaf5), transparent);
    pointer-events: none;
}

/* Floating particles in hero */
.gallery-hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.gallery-hero-particles span {
    position: absolute;
    display: block;
    width: 6px;
    height: 6px;
    background: rgba(198,154,69,0.3);
    border-radius: 50%;
    animation: galleryFloat 8s infinite ease-in-out;
}

.gallery-hero-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 7s; }
.gallery-hero-particles span:nth-child(2) { left: 25%; top: 60%; animation-delay: 1.2s; animation-duration: 9s; width: 4px; height: 4px; }
.gallery-hero-particles span:nth-child(3) { left: 50%; top: 30%; animation-delay: 2.5s; animation-duration: 6s; width: 8px; height: 8px; }
.gallery-hero-particles span:nth-child(4) { left: 70%; top: 70%; animation-delay: 0.8s; animation-duration: 10s; }
.gallery-hero-particles span:nth-child(5) { left: 85%; top: 25%; animation-delay: 3s; animation-duration: 8s; width: 5px; height: 5px; }
.gallery-hero-particles span:nth-child(6) { left: 40%; top: 80%; animation-delay: 1.8s; animation-duration: 7.5s; width: 3px; height: 3px; }

@keyframes galleryFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
    50% { transform: translateY(-30px) scale(1.5); opacity: 0.7; }
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
}

.gallery-hero-label {
    display: inline-block;
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold, #c69a45);
    margin-bottom: 16px;
    opacity: 0;
    animation: heroFadeUp 0.8s 0.3s forwards;
}

.gallery-hero-title {
    font-family: "Playfair Display", serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 14px;
    opacity: 0;
    animation: heroFadeUp 0.8s 0.5s forwards;
}

.gallery-hero-title span {
    color: var(--gold-light, #e7c77b);
}

.gallery-hero-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    max-width: 500px;
    margin: 0 auto;
    opacity: 0;
    animation: heroFadeUp 0.8s 0.7s forwards;
}

@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Decorative lines */
.gallery-hero-deco {
    position: absolute;
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(198,154,69,0.4), transparent);
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}


/* =========================================================
   2. FILTER TABS
   ========================================================= */

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px 30px;
    flex-wrap: wrap;
}

.gallery-filter-btn {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px 28px;
    border: 2px solid var(--border, #e5ddd0);
    background: transparent;
    color: var(--text-light, #646b66);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.gallery-filter-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--green, #173f35);
    border-radius: 50px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.gallery-filter-btn:hover {
    border-color: var(--green, #173f35);
    color: var(--green, #173f35);
}

.gallery-filter-btn.active {
    border-color: var(--green, #173f35);
    background: var(--green, #173f35);
    color: #fff;
}

.gallery-filter-btn.active::before {
    transform: scaleX(1);
}

/* Item count badge */
.gallery-filter-count {
    display: inline-block;
    background: rgba(198,154,69,0.2);
    color: var(--gold, #c69a45);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

.gallery-filter-btn.active .gallery-filter-count {
    background: rgba(255,255,255,0.2);
    color: #fff;
}


/* =========================================================
   3. MASONRY GALLERY GRID
   ========================================================= */

.gallery-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    gap: 14px;
}

/* Random size classes assigned by JS */
.gallery-card.size-large {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-card.size-tall {
    grid-row: span 2;
}

.gallery-card.size-wide {
    grid-column: span 2;
}

/* Base card */
.gallery-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #e8ddcd;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

/* Shuffle animations */
.gallery-card.shuffle-out {
    animation: shuffleOut 0.4s forwards;
}

.gallery-card.shuffle-in {
    animation: shuffleIn 0.5s forwards;
}

@keyframes shuffleOut {
    0% { opacity: 1; transform: scale(1) rotateY(0); }
    100% { opacity: 0; transform: scale(0.85) rotateY(8deg); }
}

@keyframes shuffleIn {
    0% { opacity: 0; transform: scale(0.85) rotateY(-8deg); }
    100% { opacity: 1; transform: scale(1) rotateY(0); }
}

/* Scroll reveal */
.gallery-card.reveal {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

.gallery-card.reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger reveal delays */
.gallery-card.reveal.visible:nth-child(1) { transition-delay: 0s; }
.gallery-card.reveal.visible:nth-child(2) { transition-delay: 0.08s; }
.gallery-card.reveal.visible:nth-child(3) { transition-delay: 0.16s; }
.gallery-card.reveal.visible:nth-child(4) { transition-delay: 0.24s; }
.gallery-card.reveal.visible:nth-child(5) { transition-delay: 0.32s; }
.gallery-card.reveal.visible:nth-child(6) { transition-delay: 0.4s; }
.gallery-card.reveal.visible:nth-child(7) { transition-delay: 0.48s; }
.gallery-card.reveal.visible:nth-child(8) { transition-delay: 0.56s; }

/* Image */
.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover img {
    transform: scale(1.08);
}

/* Video card */
.gallery-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(13,42,34,0.85) 0%,
        rgba(13,42,34,0.3) 40%,
        transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card-overlay h4 {
    font-family: "Playfair Display", serif;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    transform: translateY(10px);
    transition: transform 0.4s ease 0.05s;
}

.gallery-card:hover .gallery-card-overlay h4 {
    transform: translateY(0);
}

.gallery-card-overlay span {
    font-size: 12px;
    color: var(--gold-light, #e7c77b);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    transform: translateY(10px);
    transition: transform 0.4s ease 0.1s;
}

.gallery-card:hover .gallery-card-overlay span {
    transform: translateY(0);
}

/* Video play icon */
.gallery-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(198,154,69,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(198,154,69,0.4);
}

.gallery-card-play::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.gallery-card:hover .gallery-card-play {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 30px rgba(198,154,69,0.6);
}

/* Pulse ring on video */
.gallery-card-play::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(198,154,69,0.4);
    animation: playPulse 2s infinite;
}

@keyframes playPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}


/* =========================================================
   4. LIGHTBOX
   ========================================================= */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10,30,24,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.gallery-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 85vh;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox.active .gallery-lightbox-content {
    transform: scale(1);
}

.gallery-lightbox-content img,
.gallery-lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.5);
}

.gallery-lightbox-caption {
    text-align: center;
    margin-top: 16px;
    color: rgba(255,255,255,0.8);
    font-family: "Playfair Display", serif;
    font-size: 1.1rem;
}

/* Navigation arrows */
.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
    backdrop-filter: blur(10px);
}

.gallery-lightbox-nav:hover {
    background: var(--gold, #c69a45);
    border-color: var(--gold, #c69a45);
    transform: translateY(-50%) scale(1.1);
}

.gallery-lightbox-prev {
    left: 30px;
}

.gallery-lightbox-next {
    right: 30px;
}

/* Close button */
.gallery-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
    backdrop-filter: blur(10px);
}

.gallery-lightbox-close:hover {
    background: rgba(231,76,60,0.8);
    border-color: rgba(231,76,60,0.8);
    transform: rotate(90deg);
}

/* Counter */
.gallery-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    z-index: 5;
}


/* =========================================================
   5. EMPTY STATE
   ========================================================= */

.gallery-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light, #646b66);
}

.gallery-empty i {
    font-size: 3rem;
    color: var(--border, #e5ddd0);
    margin-bottom: 16px;
}

.gallery-empty h3 {
    font-family: "Playfair Display", serif;
    font-size: 1.4rem;
    color: var(--text, #202522);
    margin-bottom: 8px;
}

.gallery-empty p {
    font-size: 0.95rem;
}


/* =========================================================
   6. SHUFFLE CONTROL BAR
   ========================================================= */

.gallery-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 0 20px 30px;
}

.gallery-shuffle-btn {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 24px;
    border: none;
    background: linear-gradient(135deg, var(--green, #173f35), var(--green-light, #245b4c));
    color: #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gallery-shuffle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23,63,53,0.3);
}

.gallery-shuffle-btn i {
    transition: transform 0.5s ease;
}

.gallery-shuffle-btn:hover i {
    transform: rotate(180deg);
}

/* Auto shuffle indicator */
.gallery-auto-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light, #646b66);
    font-weight: 500;
}

.gallery-auto-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold, #c69a45);
    animation: autoPulse 2s infinite;
}

@keyframes autoPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.gallery-auto-indicator.paused .gallery-auto-dot {
    animation: none;
    background: var(--border, #e5ddd0);
}


/* =========================================================
   7. RESPONSIVE
   ========================================================= */

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 180px;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        min-height: 280px;
        padding: 90px 20px 50px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 160px;
        gap: 10px;
    }

    .gallery-card.size-large {
        grid-column: span 2;
        grid-row: span 1;
    }

    .gallery-card.size-tall {
        grid-row: span 1;
    }

    .gallery-lightbox-prev { left: 10px; }
    .gallery-lightbox-next { right: 10px; }

    .gallery-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .gallery-filters {
        gap: 8px;
        padding: 30px 15px 20px;
    }

    .gallery-filter-btn {
        padding: 8px 18px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 140px;
    }

    .gallery-card.size-large,
    .gallery-card.size-wide {
        grid-column: span 2;
    }
}
