/* ============================================================
   Gallery Page Styles
   ============================================================ */
.gallery-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--temple-white), var(--sandal-cream));
    padding: 120px 20px 80px;
    text-align: center;
    color: var(--text-main);
}

.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M20 0l2 18h18l-15 11 6 18-11-13-11 13 6-18-15-11h18z" fill="%23E6A817" fill-opacity="0.05" fill-rule="evenodd"/></svg>');
    opacity: 0.2;
}

.gallery-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.gallery-hero h1 {
    font-size: 52px;
    font-weight: 900;
    margin-bottom: 20px;
    background: var(--sacred-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gallery-hero p {
    font-size: 18px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Gallery Controls & Filters */
.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 40px auto 30px;
    max-width: 600px;
    flex-wrap: wrap;
    position: relative;
    z-index: 5;
}

.filter-chip {
    padding: 10px 24px;
    border-radius: 50px;
    border: 2px solid var(--sandal-cream);
    background: white;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(.22, .61, .36, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-soft);
}

.filter-chip:hover {
    border-color: var(--saffron);
    color: var(--saffron);
    transform: translateY(-2px);
}

.filter-chip.active {
    background: var(--saffron);
    border-color: var(--saffron);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 153, 51, 0.3);
}

/* Gallery Section & Grid */
.gallery-section {
    padding: 0 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 220px;
    grid-auto-flow: dense;
    gap: 24px;
    transition: all 0.4s ease;
}

/* Gallery Card */
.gallery-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    position: relative;
    transition: all 0.4s cubic-bezier(.22, .61, .36, 1);
    grid-column: span 1;
    grid-row: span 1;
}

/* Asymmetric Collage Grid for Tablet/Desktop */
@media (min-width: 769px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr); /* Force 3 columns on desktop for perfect collage alignment */
    }

    /* Card 1: Large featured (spans 2 columns, 2 rows) */
    .gallery-card:nth-child(5n + 1) {
        grid-column: span 2;
        grid-row: span 2;
    }

    /* Card 3: Tall vertical card (spans 1 column, 2 rows) */
    .gallery-card:nth-child(5n + 3) {
        grid-row: span 2;
    }

    /* Card 4: Wide horizontal card (spans 2 columns, 1 row) */
    .gallery-card:nth-child(5n + 4) {
        grid-column: span 2;
    }
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
    border-color: rgba(230, 168, 23, 0.4);
}

.gallery-media-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #111;
}

.gallery-media-container img, 
.gallery-media-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(.22, .61, .36, 1);
}

.gallery-card:hover .gallery-media-container img,
.gallery-card:hover .gallery-media-container video {
    transform: scale(1.08);
}

/* Video Play Overlay */
.gallery-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 153, 51, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(.22, .61, .36, 1);
    opacity: 0.85;
    z-index: 1;
}

.gallery-video-play span {
    font-size: 28px;
    margin-left: 2px;
}

.gallery-card:hover .gallery-video-play {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
    background: var(--kumkum-red);
}

/* Card Overlay Info */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(62, 39, 35, 0.92) 0%, rgba(62, 39, 35, 0.4) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

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

.gallery-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 153, 51, 0.95);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    margin-bottom: 6px;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gallery-type-badge span {
    font-size: 13px;
}

.gallery-card-title {
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Loading state */
.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.gallery-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid var(--sandal-cream);
    border-top-color: var(--saffron);
    border-radius: 50%;
    animation: gallery-spin 1s linear infinite;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

.gallery-loading p {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
}

/* No Media State */
.gallery-no-media {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.gallery-no-media span {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--accent);
}

/* ============================================================
   Mobile Responsive — Gallery Page
   ============================================================ */
@media (max-width: 768px) {
    .gallery-hero {
        padding: 90px 16px 50px;
    }

    .gallery-hero h1 {
        font-size: 34px;
        margin-bottom: 12px;
    }

    .gallery-hero p {
        font-size: 15px;
    }

    .gallery-filters {
        margin: 30px auto 20px;
        gap: 8px;
    }

    .filter-chip {
        padding: 8px 16px;
        font-size: 12px;
    }

    .gallery-section {
        padding: 0 12px 60px;
    }

    .gallery-grid {
        gap: 16px;
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .gallery-card {
        border-radius: 16px;
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        aspect-ratio: 4/3;
    }

    .gallery-overlay {
        padding: 15px;
        opacity: 1; /* Always visible on mobile devices */
        background: linear-gradient(to top, rgba(62, 39, 35, 0.85) 0%, rgba(62, 39, 35, 0.25) 75%, transparent 100%);
    }

    .gallery-type-badge {
        padding: 3px 8px;
        font-size: 9px;
        margin-bottom: 4px;
    }

    .gallery-type-badge span {
        font-size: 11px;
    }

    .gallery-card-title {
        font-size: 13.5px;
    }

    .gallery-video-play {
        width: 44px;
        height: 44px;
    }

    .gallery-video-play span {
        font-size: 22px;
    }
}
