/* Gallery page — Dhivya Arts and Crafts */

.gallery-page {
    --gallery-gap: 1.25rem;
    --gallery-radius: 1rem;
    --gallery-ink: #0f172a;
    --gallery-muted: #64748b;
    --gallery-line: #e2e8f0;
    --gallery-surface: #ffffff;
    --gallery-bg: #f8fafc;
    --gallery-accent: #ff8c00;
    --gallery-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --gallery-shadow-hover: 0 16px 36px rgba(15, 23, 42, 0.14);
    background:
        radial-gradient(ellipse 80% 40% at 10% -10%, rgba(255, 140, 0, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 35% at 90% 0%, rgba(15, 23, 42, 0.04), transparent 50%),
        var(--gallery-bg);
}

html.dark .gallery-page,
.dark .gallery-page {
    --gallery-bg: #000;
    --gallery-surface: #1a1a1a;
    --gallery-line: #334155;
    --gallery-ink: #f8fafc;
    --gallery-muted: #94a3b8;
}

.gallery-page.page-section {
    background:
        radial-gradient(ellipse 80% 40% at 10% -10%, rgba(255, 140, 0, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 35% at 90% 0%, rgba(15, 23, 42, 0.04), transparent 50%),
        var(--gallery-bg);
}

.gallery-page__inner {
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
}

.gallery-page__header {
    margin-bottom: 0.5rem;
}

.gallery-page__meta {
    cursor: default;
    pointer-events: none;
}

.gallery-page__meta .material-symbols-outlined {
    color: var(--gallery-accent);
}

.gallery-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 1rem 0 1.75rem;
    padding: 0 0 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.gallery-filter {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.6rem 1.15rem;
    border: 1px solid var(--gallery-line);
    border-radius: 999px;
    background: var(--gallery-surface);
    color: #475569;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.gallery-filter:hover {
    border-color: #cbd5e1;
    color: var(--gallery-ink);
    transform: translateY(-1px);
}

.gallery-filter.is-active {
    border-color: var(--gallery-ink);
    background: var(--gallery-ink);
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.gallery-empty {
    padding: 3.5rem 1.5rem;
    border: 1px solid var(--gallery-line);
    border-radius: 1.5rem;
    background: var(--gallery-surface);
    text-align: center;
    box-shadow: var(--gallery-shadow);
}

.gallery-empty .material-symbols-outlined {
    display: block;
    margin: 0 auto 0.75rem;
    color: #cbd5e1;
    font-size: 3rem;
}

.gallery-empty p {
    margin: 0;
    color: var(--gallery-muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: stretch;
}

@media (min-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        --gallery-gap: 1.35rem;
        gap: var(--gallery-gap);
    }
}

@media (min-width: 1100px) {
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.gallery-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--gallery-radius);
    background: var(--gallery-surface);
    box-shadow: var(--gallery-shadow);
    overflow: hidden;
    cursor: zoom-in;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    animation: gallery-card-in 0.55s ease both;
}

.gallery-card:nth-child(1) { animation-delay: 0.02s; }
.gallery-card:nth-child(2) { animation-delay: 0.06s; }
.gallery-card:nth-child(3) { animation-delay: 0.1s; }
.gallery-card:nth-child(4) { animation-delay: 0.14s; }
.gallery-card:nth-child(5) { animation-delay: 0.18s; }
.gallery-card:nth-child(6) { animation-delay: 0.22s; }
.gallery-card:nth-child(7) { animation-delay: 0.26s; }
.gallery-card:nth-child(8) { animation-delay: 0.3s; }
.gallery-card:nth-child(9) { animation-delay: 0.34s; }
.gallery-card:nth-child(10) { animation-delay: 0.38s; }

@keyframes gallery-card-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card {
        animation: none;
    }

    .gallery-card,
    .gallery-card__media img,
    .gallery-filter {
        transition: none;
    }
}

.gallery-card:hover,
.gallery-card:focus-visible {
    border-color: rgba(255, 140, 0, 0.35);
    box-shadow: var(--gallery-shadow-hover);
    transform: translateY(-4px);
    outline: none;
}

.gallery-card__media {
    position: relative;
    aspect-ratio: 4 / 5;
    background: linear-gradient(145deg, #eef2f7, #e2e8f0);
    overflow: hidden;
}

.gallery-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.45s ease;
}

.gallery-card.is-video .gallery-card__media img {
    object-position: center center;
}

.gallery-card:hover .gallery-card__media img,
.gallery-card:focus-visible .gallery-card__media img {
    transform: scale(1.04);
}

.gallery-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #94a3b8;
}

.gallery-card__placeholder .material-symbols-outlined {
    font-size: 2.75rem;
}

.gallery-card__badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
}

.gallery-card__badge .material-symbols-outlined {
    font-size: 0.95rem;
}

.gallery-card__play {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0.92;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-card__play-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    background: rgba(255, 140, 0, 0.95);
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 140, 0, 0.35);
}

.gallery-card__play-icon .material-symbols-outlined {
    font-size: 1.7rem;
    margin-left: 2px;
}

.gallery-card:hover .gallery-card__play,
.gallery-card:focus-visible .gallery-card__play {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 1rem 1.05rem;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.gallery-card__title {
    margin: 0;
    color: var(--gallery-ink);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card__desc {
    margin: 0;
    color: var(--gallery-muted);
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(8, 12, 20, 0.94);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.gallery-lightbox__close {
    top: 1rem;
    right: 1rem;
}

.gallery-lightbox__nav--prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox__nav--next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(96vw, 1080px);
    max-height: 92vh;
}

.gallery-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: min(74vh, 860px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 0.85rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    background: #111;
}

.gallery-lightbox__video {
    width: min(96vw, 960px);
    aspect-ratio: 16 / 9;
    border-radius: 0.85rem;
    overflow: hidden;
    background: #000;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__video iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.gallery-lightbox__caption {
    margin-top: 1rem;
    max-width: 40rem;
    text-align: center;
    color: #fff;
}

.gallery-lightbox__title {
    font-size: 1.05rem;
    font-weight: 700;
}

.gallery-lightbox__desc {
    margin-top: 0.35rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.gallery-lightbox__video-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.8rem;
    color: var(--gallery-accent);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.gallery-lightbox__video-link:hover {
    text-decoration: underline;
}

.gallery-lightbox__counter {
    margin-top: 0.65rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

@media (max-width: 700px) {
    .gallery-page {
        padding: 1.5rem 0 3.5rem;
    }

    .gallery-page__inner {
        width: min(1200px, calc(100% - 1.5rem));
    }

    .gallery-lightbox__nav {
        display: none;
    }

    .gallery-card__body {
        padding: 0.75rem 0.85rem 0.9rem;
    }

    .gallery-card__title {
        font-size: 0.85rem;
    }
}

/* Dark mode support when site theme switches */
.dark .gallery-page {
    --gallery-ink: #f8fafc;
    --gallery-muted: #94a3b8;
    --gallery-line: #334155;
    --gallery-surface: #171717;
    --gallery-bg: #0a0a0a;
    --gallery-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --gallery-shadow-hover: 0 16px 36px rgba(0, 0, 0, 0.5);
    background:
        radial-gradient(ellipse 80% 40% at 10% -10%, rgba(255, 140, 0, 0.1), transparent 55%),
        var(--gallery-bg);
}

.dark .gallery-filter {
    background: #171717;
    color: #94a3b8;
}

.dark .gallery-filter.is-active {
    background: #fff;
    border-color: #fff;
    color: #0a0a0a;
}

.dark .gallery-card__body {
    background: #171717;
    border-top-color: #262626;
}
