/* ── Gallery page — branded editorial layout ── */

body.gallery-page {
    background: #f8fafc;
}

/* Hero */
.gallery-page-hero {
    position: relative;
    min-height: clamp(420px, 62vh, 560px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

.gallery-page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(105deg, rgba(30, 58, 138, 0.92) 0%, rgba(30, 64, 175, 0.82) 40%, rgba(37, 99, 235, 0.65) 100%),
        url('../images/hero-display.jpg') center / cover no-repeat;
    z-index: 0;
}

.gallery-page-hero::after {
    display: none;
}

.gallery-hero-inner {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 130px 1.5rem 3rem;
    text-align: center;
}

.gallery-hero-copy {
    text-align: center;
}

.gallery-hero-copy .eyebrow-light {
    display: inline-block;
    margin-bottom: 1rem;
    color: #dbeafe;
    background: rgba(15, 23, 42, 0.32);
    border-color: rgba(255, 255, 255, 0.18);
}

.gallery-hero-copy h1 {
    font-size: clamp(2.35rem, 5vw, 3.65rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.08;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.gallery-hero-accent {
    display: block;
    background: linear-gradient(90deg, #bfdbfe 0%, #60a5fa 52%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gallery-hero-lead {
    font-size: clamp(1rem, 1.8vw, 1.12rem);
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.75;
    max-width: 34rem;
    margin: 0 auto 1.75rem;
}

.gallery-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.gallery-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 1rem;
    background: rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    min-width: 5.5rem;
}

.gallery-hero-stat strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.gallery-hero-stat span {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(219, 234, 254, 0.95);
}

.gallery-hero-scroll-hint {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    pointer-events: none;
}

.gallery-hero-scroll-hint svg {
    animation: galleryBounce 2s ease-in-out infinite;
}

@keyframes galleryBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* Bridge — filters & intro */
.gallery-bridge {
    position: relative;
    z-index: 5;
    background: #f8fafc;
    padding: 1.75rem 0 1.4rem;
    border-bottom: 1px solid #e2e8f0;
}

.gallery-bridge-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding-top: 1.15rem;
    padding-bottom: 1.15rem;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.gallery-bridge-copy {
    flex: 1 1 220px;
}

.gallery-bridge-copy h2 {
    font-size: 1.08rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 0.2rem;
    letter-spacing: -0.02em;
}

.gallery-bridge-copy p {
    margin: 0;
    font-size: 0.92rem;
    color: #475569;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.gallery-filter-btn {
    border: 1px solid rgba(59, 130, 246, 0.22);
    background: #ffffff;
    color: #334155;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.58rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.gallery-filter-btn:hover {
    background: #eff6ff;
    border-color: rgba(59, 130, 246, 0.35);
    color: #1d4ed8;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.gallery-filter-btn.is-active {
    background: #2563eb;
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

/* Grid section */
.work-gallery-section {
    padding: 1.6rem 0 0;
    margin: 0;
    background: #f8fafc;
}

.gallery-loading {
    text-align: center;
    padding: 3rem 1.25rem;
    color: #475569;
    font-size: 0.95rem;
}

.gallery-paging {
    text-align: center;
    padding: 2.2rem 1.25rem 3.2rem;
}

.gallery-paging-loader,
.gallery-paging-end,
.gallery-load-more-btn {
    display: none;
}

.gallery-paging.is-idle .gallery-load-more-btn,
.gallery-paging.is-loading .gallery-load-more-btn {
    display: inline-flex;
}

.gallery-paging.is-end .gallery-paging-end {
    display: block;
    margin: 0;
    color: #475569;
    font-size: 0.82rem;
}

.gallery-paging-loader {
    margin: 0;
    color: #94a3b8;
    font-size: 0.88rem;
}

.gallery-load-more-btn {
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 12rem;
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-load-more-btn:hover,
.gallery-load-more-btn:focus-visible {
    border-color: #93c5fd;
    color: #1e3a8a;
    background: #eff6ff;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
    outline: none;
}

.gallery-load-more-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.gallery-scroll-sentinel {
    width: 100%;
    height: 4px;
    pointer-events: none;
    visibility: hidden;
}

.gallery-empty {
    display: none;
}

.gallery-empty.is-visible,
.gallery-empty:not([hidden]) {
    display: block;
}

.gallery-empty-panel {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    padding: clamp(3rem, 8vw, 4.5rem) 1.75rem;
    text-align: center;
}

.gallery-empty-glow {
    position: absolute;
    inset: -20% 10% auto;
    height: 220px;
    background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

.gallery-empty-icon {
    position: relative;
    z-index: 1;
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.35), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(147, 197, 253, 0.25);
    color: #93c5fd;
}

.gallery-empty-icon svg {
    width: 34px;
    height: 34px;
}

.gallery-empty-icon--small {
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
}

.gallery-empty-icon--small svg {
    width: 26px;
    height: 26px;
}

.gallery-empty-eyebrow {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(147, 197, 253, 0.9);
    margin-bottom: 0.65rem;
}

.gallery-empty-panel h3 {
    position: relative;
    z-index: 1;
    margin: 0 0 0.75rem;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.gallery-empty-panel p {
    position: relative;
    z-index: 1;
    margin: 0 auto 1.5rem;
    max-width: 28rem;
    font-size: 0.98rem;
    line-height: 1.65;
    color: rgba(148, 163, 184, 0.95);
}

.gallery-empty-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.gallery-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    background: #2563eb;
    color: #fff !important;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-empty-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5);
}

.gallery-empty-btn--ghost {
    background: transparent;
    color: #e2e8f0 !important;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: none;
}

.gallery-empty-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(147, 197, 253, 0.45);
    color: #fff !important;
}

.gallery-empty-panel--filter {
    padding: 2.5rem 1.5rem 3rem;
}

.gallery-empty-panel--filter h3 {
    font-size: 1.2rem;
}

.gallery-empty-panel--error .gallery-empty-icon {
    background: linear-gradient(145deg, rgba(220, 38, 38, 0.2), rgba(239, 68, 68, 0.08));
    border-color: rgba(252, 165, 165, 0.3);
    color: #fca5a5;
}

.work-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: clamp(180px, 19vw, 260px);
    grid-auto-flow: dense;
    gap: 0.8rem;
    width: min(1240px, calc(100% - 3rem));
    margin: 0 auto;
    line-height: 0;
}

.work-gallery-item {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: #e2e8f0;
    cursor: zoom-in;
    min-height: 100%;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.work-gallery-item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    z-index: 2;
}

.work-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;
}

.work-gallery-item-zoom {
    position: absolute;
    right: 0.8rem;
    bottom: 0.8rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.work-gallery-item-zoom svg {
    width: 16px;
    height: 16px;
    stroke: #1e3a8a;
}

.work-gallery-item:hover img,
.work-gallery-item:focus-visible img {
    transform: scale(1.04);
}

.work-gallery-item:hover .work-gallery-item-zoom,
.work-gallery-item:focus-visible .work-gallery-item-zoom {
    opacity: 1;
    transform: scale(1);
}

.work-gallery-item:hover,
.work-gallery-item:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.work-gallery-item--wide { grid-column: span 2; }
.work-gallery-item--tall { grid-row: span 2; }
.work-gallery-item--hero { grid-column: span 2; grid-row: span 2; }

.work-gallery-item.is-hidden {
    display: none;
}

/* Gallery CTA — same banner as site-wide, with subtitle visible */
.gallery-page .cta-section .cta-copy p {
    display: block;
    margin: 0.65rem 0 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    max-width: 36rem;
    line-height: 1.5;
}

/* Lightbox — branded */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(3, 7, 18, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 3.5rem 4rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-stage {
    max-width: min(1200px, 100%);
    max-height: calc(100vh - 7rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25), 0 32px 80px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox-stage img {
    max-width: 100%;
    max-height: calc(100vh - 7rem);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: 2px;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
    position: absolute;
    border: 0;
    background: rgba(30, 64, 175, 0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(147, 197, 253, 0.25);
    -webkit-tap-highlight-color: transparent;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
    background: rgba(59, 130, 246, 0.55);
}

.gallery-lightbox-close:focus-visible,
.gallery-lightbox-nav:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.gallery-lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
}

.gallery-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
}

.gallery-lightbox-nav:hover {
    transform: translateY(-50%) scale(1.05);
}

.gallery-lightbox-prev { left: 1rem; }
.gallery-lightbox-next { right: 1rem; }

.gallery-lightbox-meta {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    max-width: 90%;
}

.gallery-lightbox-counter {
    margin: 0 0 0.25rem;
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body.gallery-lightbox-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 992px) {
    .gallery-hero-inner {
        padding-top: 120px;
    }

    .gallery-hero-scroll-hint {
        display: none;
    }

    .work-gallery {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: clamp(160px, 23vw, 230px);
        width: min(1240px, calc(100% - 2.2rem));
    }

    .gallery-bridge-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .gallery-page-hero {
        min-height: auto;
    }

    .gallery-hero-inner {
        padding: 110px 1.15rem 2rem;
    }

    .gallery-hero-stats {
        gap: 0.5rem;
    }

    .gallery-hero-stat {
        min-width: calc(50% - 0.25rem);
        flex: 1 1 calc(50% - 0.25rem);
    }

    .gallery-filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .gallery-filters::-webkit-scrollbar {
        display: none;
    }

    .gallery-filter-btn {
        flex-shrink: 0;
    }

    .work-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: clamp(145px, 32vw, 210px);
        width: calc(100% - 1.4rem);
        gap: 0.6rem;
    }

    .work-gallery-item--wide,
    .work-gallery-item--hero {
        grid-column: span 2;
    }

    .gallery-lightbox {
        padding: 0.75rem 2.75rem 3.5rem;
    }

    .gallery-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .gallery-lightbox-prev { left: 0.5rem; }
    .gallery-lightbox-next { right: 0.5rem; }
    .gallery-lightbox-close { top: 0.65rem; right: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-hero-scroll-hint svg {
        animation: none;
    }
}
