/* ============================================================
   GALLERY — immersive WebGL photography room + canvas lightbox
   ============================================================ */

body:has(.gallery-stage) {
    overflow: hidden;
    background: #0a0a0a;
}

.gallery-stage {
    position: fixed;
    inset: 0;
}

#gallery-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#gallery-canvas.grabbing { cursor: grabbing; }
#gallery-canvas.pointing { cursor: pointer; }

/* Vignette to frame the room */
.gallery-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* Page heading, gallery-label style */
.gallery-heading {
    position: fixed;
    left: 2rem;
    bottom: 2.4rem;
    z-index: 10;
    pointer-events: none;
}

.gallery-heading h1 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 500;
    color: #fff;
    letter-spacing: 0.01em;
}

.gallery-heading p {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.3rem;
}

/* Drag hint */
.gallery-hint {
    position: fixed;
    left: 50%;
    bottom: 2.6rem;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    animation: hint-pulse 2.4s ease-in-out infinite;
    transition: opacity 0.6s ease;
}

.gallery-hint.hidden { opacity: 0; }

@keyframes hint-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.8; }
}

/* Project filter chips */
.gallery-chips {
    position: fixed;
    right: 2rem;
    bottom: 2.4rem;
    z-index: 10;
    display: flex;
    gap: 0.5rem;
}

.gallery-chips button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-primary);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-chips button:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.gallery-chips button.active {
    background: #fff;
    border-color: #fff;
    color: #0a0a0a;
}

/* Hover caption — floats above the heading */
.gallery-caption {
    position: fixed;
    left: 2rem;
    bottom: 10rem;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.gallery-caption.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-caption .cap-title {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #fff;
}

.gallery-caption .cap-meta {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.15rem;
}

/* DOM fallback grid (no WebGL) */
.gallery-fallback {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 7rem 2rem 8rem;
}

.gallery-fallback canvas {
    width: 100%;
    height: auto;
    cursor: pointer;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 5, 5, 0.96);
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.lightbox.open {
    display: block;
    opacity: 1;
}

body.lightbox-open { overflow: hidden; }

.lightbox-stage {
    position: absolute;
    inset: 4rem 20rem 4rem 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-stage canvas {
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
    user-select: none;
    -webkit-user-select: none;
}

/* Museum placard */
.lightbox-placard {
    position: absolute;
    right: 4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 13rem;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    padding-left: 1.5rem;
}

.placard-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.6rem;
}

.placard-series {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.3rem;
}

.placard-counter {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 1.2rem;
}

.placard-description {
    font-size: 0.8rem;
    font-weight: 300;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.65);
}

/* Lightbox controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    z-index: 2;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0.8rem;
    transition: color 0.25s ease;
    font-family: var(--font-primary);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { color: #fff; }

.lightbox-close { top: 1.2rem; right: 1.6rem; font-size: 2rem; }
.lightbox-prev  { left: 1rem;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1rem; top: 50%; transform: translateY(-50%); }

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .gallery-heading { left: 1.2rem; bottom: 4.4rem; }
    .gallery-heading h1 { font-size: 1.25rem; }
    .gallery-heading p { display: none; }

    /* Single swipeable row of chips along the bottom edge */
    .gallery-chips {
        left: 0;
        right: 0;
        bottom: 1rem;
        transform: none;
        flex-wrap: nowrap;
        justify-content: flex-start;
        width: auto;
        max-width: none;
        overflow-x: auto;
        padding: 0.2rem 1.2rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .gallery-chips::-webkit-scrollbar { display: none; }
    .gallery-chips button {
        flex: 0 0 auto;
        font-size: 0.66rem;
        padding: 0.4rem 0.85rem;
    }

    .gallery-caption { left: 1.2rem; bottom: 7.5rem; }
    .gallery-caption .cap-title { font-size: 0.95rem; }
    .gallery-hint { display: none; }

    /* Lightbox: image gets nearly the whole screen, title/description
       below it as a compact centered strip */
    .lightbox-stage { inset: 2.8rem 0.4rem 6.4rem 0.4rem; }
    .lightbox-placard {
        right: auto;
        left: 50%;
        top: auto;
        bottom: 0.9rem;
        transform: translateX(-50%);
        width: auto;
        max-width: 92vw;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding: 0.6rem 0 0;
        text-align: center;
    }
    .placard-title { font-size: 1rem; margin-bottom: 0.15rem; }
    .placard-series { font-size: 0.62rem; margin-bottom: 0.1rem; }
    .placard-counter { margin-bottom: 0.25rem; font-size: 0.62rem; }
    .placard-description { font-size: 0.7rem; max-height: 3.6em; overflow-y: auto; }
    .lightbox-prev, .lightbox-next { display: none; } /* swipe instead */
}

/* Short screens (landscape phones): overlays tuck into corners,
   lightbox placard becomes a right sidebar */
@media (max-height: 500px) {
    .gallery-heading { left: 1rem; bottom: 0.9rem; }
    .gallery-heading h1 { font-size: 1.05rem; }
    .gallery-heading p { display: none; }
    .gallery-hint { display: none; }

    .gallery-chips {
        left: auto;
        right: 1rem;
        bottom: 0.9rem;
        transform: none;
        flex-wrap: nowrap;
        max-width: 62vw;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .gallery-chips::-webkit-scrollbar { display: none; }
    .gallery-chips button {
        flex: 0 0 auto;
        font-size: 0.62rem;
        padding: 0.35rem 0.8rem;
    }

    .gallery-caption { left: 1rem; bottom: 3.2rem; }
    .gallery-caption .cap-title { font-size: 0.9rem; }

    .lightbox-stage { inset: 1rem 11.5rem 1rem 2.8rem; }
    .lightbox-placard {
        left: auto;
        right: 1rem;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        width: 9.5rem;
        max-width: none;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.15);
        padding: 0 0 0 1rem;
        text-align: left;
    }
    .placard-title { font-size: 1rem; }
    .placard-description { font-size: 0.68rem; max-height: 6em; overflow-y: auto; }
    .lightbox-prev, .lightbox-next { display: none; }
    .lightbox-close { top: 0.6rem; right: 0.8rem; }
}
