/* ---------- Shared ---------- */
:root {
    --bg: #0a0a0a;
    --bg-soft: #161616;
    --fg: #f4f4f4;
    --fg-dim: #9a9a9a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #d4af37;
    --panel-width: min(360px, 90vw);
    --carousel-height: 160px;
    --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.hidden { display: none !important; }

/* ---------- Gallery page ---------- */
.gallery-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    --bg: #ffffff;
    --fg: #111111;
    --fg-dim: #999999;
    --border: rgba(0, 0, 0, 0.1);
    background: #ffffff;
    color: #111111;
}

.gallery-header {
    position: relative;
    padding: 4rem 3rem 3.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.gallery-logo {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    max-width: 160px;
    max-height: 75px;
}

.gallery-logo img {
    max-width: 160px;
    max-height: 75px;
    object-fit: contain;
}

.gallery-header h1 {
    font-family: var(--font-sans);
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 0.75rem;
    color: #111;
}

.gallery-header p {
    color: #999;
    margin: 0;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.gallery-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
    padding: 3rem;
}

.look-card {
    display: block;
    text-decoration: none;
    overflow: hidden;
    background: transparent;
}

.look-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    background-size: cover;
    background-position: center top;
    background-color: #ebebeb;
    transition: transform 0.55s cubic-bezier(0.25, 0, 0.05, 1);
    will-change: transform;
}

.look-card:hover .look-thumb {
    transform: scale(1.03);
}

.look-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.look-meta {
    padding: 1rem 0 0;
}

.look-title {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin: 0 0 0.2rem;
    color: #111;
    line-height: 1.3;
}

.look-designer {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
    font-weight: 400;
}

.look-course {
    margin: 0.15rem 0 0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #bbb;
}

.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.gallery-footer {
    padding: 2rem 3rem;
    color: #bbb;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ---------- Viewer page ---------- */
.viewer-page {
    height: 100vh;
    overflow: hidden;
    background: #ffffff; /* white loading background before splat renders */
}

.back-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 20;
    padding: 0.5rem 0.85rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    color: var(--fg);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.back-link:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent);
}

#viewer-shell {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--panel-width);
    bottom: 0;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.viewer-page.has-carousel #viewer-shell {
    bottom: var(--carousel-height);
}

.viewer-page.ui-collapsed #viewer-shell {
    right: 0;
    bottom: 0;
}

#splat-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.info-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100vh;
    z-index: 10;
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(0);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    /* local variable overrides so all child elements flip to light theme */
    --fg: #111111;
    --fg-dim: #666666;
    --border: rgba(0, 0, 0, 0.1);
    color: #111111;
}

.viewer-page.ui-collapsed .info-panel {
    transform: translateX(100%);
}

.photo-carousel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--carousel-height);
    z-index: 10;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    display: none;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.5rem;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-carousel.has-photos {
    display: flex;
}

.viewer-page.ui-collapsed .photo-carousel {
    transform: translateY(100%);
}

.carousel-track-wrap {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    display: flex;
    align-items: center;
    height: 100%;
}

.carousel-track-wrap::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.25rem;
    height: 100%;
    min-width: 100%;
    justify-content: center;
}

.carousel-slide {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    scroll-snap-align: start;
    cursor: pointer;
}

.carousel-slide img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 3px;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
    display: block;
}

.carousel-slide:hover img {
    border-color: var(--accent);
}

.carousel-caption {
    font-size: 0.65rem;
    color: var(--fg-dim);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.carousel-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
}

.info-panel-inner {
    padding: 4rem 1.75rem 2rem;
}

.info-panel h1 {
    font-family: var(--font-sans);
    font-size: 1.75rem;
    font-weight: 400;
    margin: 0 0 0.25rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.info-designer {
    margin: 0;
    font-size: 1rem;
    color: var(--fg);
}

.info-course {
    margin: 0.25rem 0 1.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.info-section {
    margin-bottom: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.info-section h2 {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-dim);
    margin: 0 0 0.5rem;
    font-weight: 500;
}

.info-section p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--fg);
    line-height: 1.55;
    white-space: pre-wrap;
}


.look-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.look-nav-btn {
    text-decoration: none;
    color: var(--fg-dim);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.look-nav-btn:hover {
    color: var(--fg);
    border-color: var(--accent);
}

.panel-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.panel-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent);
}

.viewer-error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 2rem;
    background: var(--bg-soft);
    border: 1px solid #aa3333;
    border-radius: 4px;
    max-width: 500px;
    text-align: center;
    z-index: 30;
}

/* ---------- Photo lightbox ---------- */
.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.photo-lightbox.open {
    opacity: 1;
    pointer-events: all;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 900px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 4px;
    overflow: hidden;
}

.lightbox-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    background: #000;
}

.lightbox-info {
    padding: 1rem 1.25rem;
}

.lightbox-caption {
    margin: 0 0 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--fg);
}

.lightbox-caption:empty { display: none; }

.lightbox-text {
    margin: 0;
    font-size: 0.9rem;
    color: var(--fg-dim);
    line-height: 1.55;
    white-space: pre-wrap;
}

.lightbox-text:empty { display: none; }

.lightbox-info:empty { display: none; }

.lightbox-nav {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: var(--accent);
}

.lightbox-nav:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.lightbox-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--accent);
}

/* ---------- Responsive ---------- */

/* Tablets / narrow desktops: shrink the side panel a touch. */
@media (max-width: 1100px) and (min-width: 901px) {
    :root { --panel-width: 320px; }
}

/* Phones and small tablets: stack the splat (top band) above the info
   panel (bottom band). The desktop layout uses position:fixed on
   #viewer-shell and .info-panel; we override their anchors here so they
   form horizontal bands instead of side-by-side columns. */
@media (max-width: 900px) {
    .viewer-page {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    /* Splat band: top 60% of the screen, full width. */
    #viewer-shell {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        width: 100%;
        height: 60vh;
        height: 60dvh;
        transition: none;
    }

    /* If a carousel is shown, shrink the splat band by the carousel height
       so the info panel still fits between them. */
    .viewer-page.has-carousel #viewer-shell {
        height: calc(60dvh - var(--carousel-height) / 2);
        bottom: auto !important;
    }

    /* The splat-frame iframe is position:absolute; inset:0 inside the shell,
       so it'll just fill whatever band we give the shell. No changes needed. */

    /* Info panel: bottom 40% of the screen, full width, scrollable. */
    .info-panel {
        position: fixed !important;
        top: 60vh !important;
        top: 60dvh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: auto !important;
        border-left: 0 !important;
        border-top: 3px solid var(--accent);
        transform: none !important;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* The desktop "ui-collapsed" mode hides the panel by sliding right; on
       mobile we just leave both bands in place. */
    .viewer-page.ui-collapsed .info-panel {
        transform: none !important;
    }
    .viewer-page.ui-collapsed #viewer-shell {
        right: 0 !important;
        bottom: auto !important;
    }

    .info-panel-inner {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    /* The desktop side-panel toggle doesn't make sense in a stacked layout. */
    .panel-toggle { display: none; }

    .back-link {
        top: 0.6rem;
        left: 0.6rem;
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }

    /* Gallery page tweaks (separate from viewer page). */
    .gallery-header {
        padding: 1.5rem 1rem 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .gallery-logo {
        position: static;
        max-width: 160px;
        max-height: 75px;
    }

    .gallery-logo img {
        max-width: 160px;
        max-height: 75px;
    }

    .gallery-header h1 {
        margin: 0;
    }

    .gallery-grid {
        gap: 1rem;
        padding: 1rem;
    }

    /* Lightbox: shrink on phones so close/nav buttons remain reachable. */
    .lightbox-content { max-width: 95vw; }
    .lightbox-img { max-height: 60vh; }
    .lightbox-nav { width: 38px; height: 38px; }
}
