/* ================================================================
   TOUR - 3D PHOTOGRAPHY GALLERY  (styles for tour.html)
   ----------------------------------------------------------------
   Photographs come from ./images/gallery/manifest.json (tag `tour`).
   Sections below mirror the sections of js/tour.js.
   ================================================================ */

:root {
    --ink: #e9e6df;            /* off-white UI text                */
    --ink-dim: #9a978f;        /* secondary metadata               */
    --line: rgba(233, 230, 223, .16);
    --glass: rgba(10, 10, 12, .55);
    --accent: #cbb98a;         /* warm brass, used sparingly       */
    --serif: Georgia, "Times New Roman", serif;
    --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
    background: #050508;
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; }

/* ---------- cheap film-look overlays (mobile fallback path) ---- */
.fx-vignette {
    position: fixed; inset: 0; pointer-events: none; z-index: 2;
    background: radial-gradient(ellipse at center,
                transparent 52%, rgba(0,0,0,.34) 100%);
}
.fx-grain {
    position: fixed; inset: -50%; pointer-events: none; z-index: 2;
    opacity: .05; animation: grain 0.9s steps(4) infinite;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='240' height='240' filter='url(%23n)' opacity='0.6'/></svg>");
}
@keyframes grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2%, 3%); }
    50% { transform: translate(3%, -2%); }
    75% { transform: translate(-3%, -3%); }
    100% { transform: translate(2%, 2%); }
}
body.quality-full .fx-vignette, body.quality-full .fx-grain { display: none; }

/* ================= 11. UI - intro screen ======================= */
#intro {
    position: fixed; inset: 0; z-index: 40;
    background: #030304;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 1.6s ease;
    overflow: hidden;
}
#intro.hidden { opacity: 0; pointer-events: none; }

/* hero: a real photograph from the exhibition, behind the title */
.intro-hero {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 42%, #15151a 0%, #050508 78%);
}
#introHero {
    position: absolute; inset: -6%;
    background-size: cover; background-position: center;
    opacity: 0; transition: opacity 1.8s ease;
    animation: heroDrift 28s ease-in-out infinite alternate;
    /* Soft, dimmed backdrop: the photo sets the mood, the text
       carries the message. inset -6% keeps the blur's soft edges
       outside the viewport. */
    filter: blur(14px) brightness(.68) saturate(.78);
    will-change: transform;
}
#introHero.on { opacity: 1; }
@keyframes heroDrift { from { transform: scale(1.03); } to { transform: scale(1.09); } }
.intro-scrim {
    position: absolute; inset: 0; z-index: 1;
    background:
        radial-gradient(ellipse at center, transparent 24%, rgba(3,3,4,.7) 100%),
        linear-gradient(180deg, rgba(3,3,4,.8) 0%, rgba(3,3,4,.62) 46%, rgba(3,3,4,.95) 100%);
}
@media (prefers-reduced-motion: reduce) { #introHero { animation: none; } }

#introLang {
    position: absolute; top: 26px; right: 30px; z-index: 3;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--ink); font-family: var(--sans); font-size: 10px;
    letter-spacing: .28em; text-indent: .28em; text-transform: uppercase;
    padding: 12px 14px 11px 17px; cursor: pointer;
    transition: color .3s, border-color .3s;
}
#introLang:hover { color: #fff; border-color: var(--accent); }

.intro-inner { position: relative; z-index: 2; text-align: center; padding: 0 24px; max-width: 780px; }

.intro-kicker {
    font-size: 10px; letter-spacing: .55em; text-indent: .55em;
    color: var(--ink-dim); text-transform: uppercase; margin-bottom: 26px;
    animation: rise 2.2s cubic-bezier(.2,.7,.3,1) both;
}
.intro-title {
    font-family: var(--serif);
    font-size: clamp(40px, 9vw, 96px);
    font-weight: 400; letter-spacing: .18em; text-indent: .18em;
    text-transform: uppercase; color: var(--ink); line-height: 1.05;
    text-shadow: 0 2px 30px rgba(0,0,0,.65);
    animation: rise 2.2s cubic-bezier(.2,.7,.3,1) both;
}
.intro-by {
    margin-top: 16px;
    font-size: 11px; letter-spacing: .5em; text-indent: .5em;
    text-transform: uppercase; color: var(--ink-dim);
    animation: rise 2.2s .25s cubic-bezier(.2,.7,.3,1) both;
}
.intro-desc {
    margin: 26px auto 0; max-width: 32em;
    font-size: 14.5px; line-height: 1.75; letter-spacing: .02em;
    color: #ddd9d0;
    text-shadow: 0 1px 14px rgba(0,0,0,.7);
    animation: rise 2.2s .4s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* primary CTA - the one loud element on the screen */
#enterBtn {
    box-shadow: 0 10px 34px rgba(0,0,0,.5);
    margin-top: 38px;
    background: var(--accent); color: #141109;
    border: 1px solid var(--accent);
    padding: 17px 52px 16px 56px;
    font-family: var(--sans); font-size: 12px;
    letter-spacing: .5em; text-indent: .5em; text-transform: uppercase;
    cursor: pointer;
    transition: background .4s, color .4s, border-color .4s;
}
#enterBtn:hover:not(:disabled) { background: #ddca9c; border-color: #ddca9c; color: #0c0b07; }
#enterBtn:disabled { background: none; border-color: var(--line); color: var(--ink-dim); cursor: default; }
#enterBtn:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
#intro.ready #enterBtn { animation: rise 1.2s both; }

.intro-load { margin-top: 30px; min-height: 66px; }
.load-label {
    font-size: 10px; letter-spacing: .4em; text-indent: .4em;
    text-transform: uppercase; color: var(--ink-dim);
}
.load-pct {
    font-family: var(--serif); font-size: 26px; margin-top: 10px;
    color: var(--ink); font-variant-numeric: tabular-nums;
}
.load-bar {
    width: 180px; height: 1px; margin: 14px auto 0;
    background: rgba(233,230,223,.12); overflow: hidden;
}
.load-bar i {
    display: block; height: 100%; width: 0%;
    background: var(--ink); transition: width .3s ease;
}
.load-note { font-size: 10px; color: #6c6a64; margin-top: 12px; letter-spacing: .08em; }
.load-note a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
#intro.ready .intro-load { display: none; }

/* controls hint - deliberately secondary, below the CTA once ready */
.intro-controls { display: none; margin-top: 28px; min-height: 66px; }
#intro.ready .intro-controls { display: block; animation: rise 1.2s both; }
.intro-controls span {
    font-size: 9px; letter-spacing: .26em; text-indent: .26em;
    text-transform: uppercase; color: #75726a; line-height: 2.1;
    display: inline-block; max-width: 52em;
}

/* ---------- install notice (intro only) ------------------------- */
.install-note {
    display: none;                        /* .on shows it */
    margin: 26px auto 0;
    max-width: 420px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    text-align: left;
    align-items: center; gap: 12px;
}
.install-note.on { display: flex; }
.install-note [hidden] { display: none !important; }   /* author display: rules beat [hidden] */
.install-note svg { flex: none; color: var(--accent); }
.install-note .in-t b {
    display: block; font-family: var(--serif); font-weight: 400;
    font-size: 14px; letter-spacing: .04em; color: var(--ink);
}
.install-note .in-t span {
    display: block; font-size: 11px; line-height: 1.5; color: var(--ink-dim);
}
.install-note .ctl { flex: none; }   /* .ctl has no flex: none; the card is a narrow flex row */

/* ================= 11. UI - persistent chrome ================== */
.ui { position: fixed; z-index: 10; transition: opacity .8s ease; }
body.pre-enter .ui { opacity: 0; pointer-events: none; }

#brand { top: 26px; left: 30px; line-height: 1.5; }
#brand b {
    font-size: 12px; font-weight: 600;
    letter-spacing: .42em; text-transform: uppercase;
}
#brand span {
    display: block; font-size: 9px;
    letter-spacing: .3em; text-transform: uppercase; color: var(--ink-dim);
}

/* ---------- top-right controls + bottom navigation dock -------- */
#topbar { top: 24px; right: 28px; display: flex; gap: 10px; }
body.fill #brand, body.fill #topbar, body.fill #dock, body.fill #joy, body.fill #chip,
body.fill #toast { display: none; }
#fillClose {
    position: fixed; top: 24px; right: 28px; z-index: 10; display: none;
    font-size: 18px; letter-spacing: 0; text-indent: 0;   /* a lone glyph, centred */
}
body.fill #fillClose { display: inline-flex; }
.ctl {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 9px; height: 40px; min-width: 40px; padding: 0 14px;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--ink); font-family: var(--sans); font-size: 9px;
    letter-spacing: .28em; text-indent: .28em; text-transform: uppercase;
    cursor: pointer; text-decoration: none;
    transition: color .3s, border-color .3s, background .3s;
}
.ctl:hover { color: #fff; border-color: var(--accent); background: rgba(203,185,138,.08); }
.ctl:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.ctl.active { color: var(--accent); border-color: var(--accent); }
.ctl svg { width: 15px; height: 15px; flex: none; }
.ctl .q { font-family: var(--serif); font-size: 16px; letter-spacing: 0; text-indent: 0; }

#dock {
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 2px;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 5px;
    touch-action: none;                 /* a stray pinch on the bar must never zoom the UI */
}
@media (min-width: 821px) {
    #dock { transition: left .8s cubic-bezier(.4,0,.2,1); }
    body:has(#panel.open) #dock { left: calc(50% - min(200px, 46vw)); }
}
@media (min-width: 821px) and (max-width: 1180px) {
    body:has(#panel.open) #dock .dl { display: none; }
}
#dock .ctl { height: 38px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
#guideBtn .g-pause { display: none; }
#guideBtn.active .g-pause { display: block; }
#guideBtn.active .g-play { display: none; }
#dock .ctl:hover { background: rgba(233,230,223,.07); }
.dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
#navCount {
    min-width: 92px; text-align: center;
    font-size: 10px; letter-spacing: .3em; text-indent: .3em;
    color: var(--ink-dim); font-variant-numeric: tabular-nums;
    padding: 0 8px; white-space: nowrap;
}

/* ---------- cursor chip (hover label) -------------------------- */
#chip {
    position: fixed; z-index: 12; pointer-events: none;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 7px 13px 6px 15px;
    font-size: 9px; letter-spacing: .3em; text-indent: .3em;
    text-transform: uppercase; color: var(--ink);
    opacity: 0; transform: translate(14px, 18px) scale(.96);
    transition: opacity .25s ease;
    white-space: nowrap;
}
#chip.on { opacity: 1; }

/* ---------- virtual joystick (touch devices only) --------------- */
#joy {
    position: fixed;
    left: calc(20px + env(safe-area-inset-left, 0px));
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    width: 118px; height: 118px; border-radius: 50%;
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 11; display: none;
    touch-action: none;                 /* the stick must never scroll */
    opacity: .9;
    transition: opacity .45s ease;
}
#joy.on { display: block; }
#joy.dim { opacity: .25; }                     /* idle: quiet, still grabbable */
#joy.focus { opacity: 0; pointer-events: none; } /* a print is in view: gone */
#joyKnob {
    position: absolute; left: 50%; top: 50%;
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(233,230,223,.16); border: 1px solid var(--line);
    transform: translate(-50%, -50%);
    transition: transform .18s ease;    /* springs back on release */
    pointer-events: none;               /* the base owns the gestures */
}
#joy.live #joyKnob { transition: none; }   /* no lag while dragging */

/* ================= 11. UI - exhibition label panel ============= */
#panel {
    position: fixed;                   /* not a .ui element - must be explicit */
    top: 0; right: 0; bottom: 0;
    width: min(400px, 92vw);
    background: linear-gradient(to left, rgba(8,8,10,.92), rgba(8,8,10,.78));
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-left: 1px solid var(--line);
    z-index: 20;                       /* above the other fixed UI  */
    padding: 96px 44px 40px 46px;
    transform: translateX(102%);
    transition: transform .7s cubic-bezier(.25,.8,.25,1);
    overflow-y: auto;
}
#panel.open { transform: none; }

#panel .p-no {
    font-size: 9px; letter-spacing: .45em; text-indent: .45em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 18px;
}
#panel h2 {
    font-family: var(--serif); font-weight: 400;
    font-size: 27px; line-height: 1.25; letter-spacing: .02em;
    margin-bottom: 30px;
}
#panel dl { border-top: 1px solid var(--line); }
#panel .row {
    display: grid; grid-template-columns: minmax(0, max-content) 1fr;
    gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
#panel dt {
    font-size: 9px; letter-spacing: .28em; text-transform: uppercase;
    color: var(--ink-dim); padding-top: 3px;
}
#panel dd { font-size: 13px; line-height: 1.55; }
#panel dd.em { color: #6f6d66; }           /* "-" unknown fields   */
#panel .p-desc {
    margin-top: 26px; font-size: 13px; line-height: 1.75;
    color: #c9c6be;
}
#panelClose {
    position: absolute; top: 28px; right: 26px;
    background: none; border: 1px solid var(--line); color: var(--ink-dim);
    width: 38px; height: 38px; font-size: 15px; line-height: 1;
    cursor: pointer; transition: color .3s, border-color .3s;
}
#panelClose:hover { color: #fff; border-color: var(--accent); }

/* ---------- toast ------------------------------------------------ */
#toast {
    left: 50%; bottom: 92px; transform: translate(-50%, 8px);
    background: var(--glass); border: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 11px 20px 10px 23px; font-size: 10px;
    letter-spacing: .22em; text-indent: .22em; text-transform: uppercase;
    color: var(--ink); opacity: 0; pointer-events: none;
    transition: opacity .5s, transform .5s; max-width: calc(100vw - 30px);
    text-align: center;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#ctxLost {
    position: fixed; inset: 0; z-index: 40;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 22px; padding: 24px; text-align: center;
    background: rgba(3,3,4,.82); color: var(--ink);
    font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
}
#ctxLost[hidden] { display: none; }

/* ---------- overlays: help + exhibition index ------------------ */
.overlay {
    position: fixed; inset: 0; z-index: 30;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(3,3,4,.64);
    backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
    opacity: 0; pointer-events: none; transition: opacity .45s ease;
}
.overlay.on { opacity: 1; pointer-events: auto; }
.sheet {
    background: rgba(9,9,12,.94); border: 1px solid var(--line);
    width: min(560px, 100%); max-height: min(660px, 86vh);
    overflow-y: auto; padding: 36px 40px 32px;
    transform: translateY(12px);
    transition: transform .45s cubic-bezier(.2,.7,.3,1);
}
.overlay.on .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: .04em; }
.sheetClose {
    background: none; border: 1px solid var(--line); color: var(--ink-dim);
    width: 34px; height: 34px; font-size: 15px; line-height: 1;
    cursor: pointer; transition: color .3s, border-color .3s; flex: none;
}
.sheetClose:hover { color: #fff; border-color: var(--accent); }
.sheet-sub {
    font-size: 9px; letter-spacing: .3em; text-indent: .3em;
    text-transform: uppercase; color: var(--ink-dim); margin-bottom: 20px;
}

.h-row {
    display: grid; grid-template-columns: 148px 1fr; gap: 14px;
    align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line);
}
.h-row > span {
    font-size: 9px; letter-spacing: .28em; text-transform: uppercase;
    color: var(--ink-dim);
}
.h-row > div { font-size: 12.5px; line-height: 1.7; color: var(--ink); }
.kbd {
    display: inline-block; border: 1px solid var(--line);
    padding: 2px 7px 1px 8px; margin: 0 2px;
    font-size: 10px; letter-spacing: .1em; font-style: normal;
    background: rgba(233,230,223,.06); color: var(--ink);
}
.h-foot { margin-top: 26px; }
.h-foot a {
    color: var(--ink-dim); font-size: 10px; letter-spacing: .3em;
    text-transform: uppercase; text-decoration: none;
    border-bottom: 1px solid var(--line); padding-bottom: 4px;
    transition: color .3s, border-color .3s;
}
.h-foot a:hover { color: var(--accent); border-color: var(--accent); }
body.touch .only-desk { display: none; }
body:not(.touch) .only-touch { display: none; }

#ixList { list-style: none; }
.ix-row {
    display: grid; grid-template-columns: 30px 58px 1fr; gap: 14px;
    align-items: center; width: 100%; padding: 9px 6px;
    background: none; border: 0; border-bottom: 1px solid var(--line);
    color: var(--ink); font-family: var(--sans); text-align: left;
    cursor: pointer; transition: background .25s;
}
.ix-row:hover { background: rgba(203,185,138,.07); }
.ix-row.cur { background: rgba(203,185,138,.1); }
.ix-no { font-size: 10px; letter-spacing: .18em; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.ix-row.cur .ix-no { color: var(--accent); }
.ix-thumb {
    width: 58px; height: 44px; border: 1px solid var(--line);
    background-color: #141419; background-size: cover; background-position: center;
}
.ix-t b { display: block; font-family: var(--serif); font-weight: 400; font-size: 15px; line-height: 1.35; }
.ix-t i { font-style: normal; font-size: 9px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-dim); }

/* ================= responsive - small screens =================== */
@media (max-width: 820px) {
    #brand { top: 18px; left: 18px; max-width: calc(100vw - 224px); }
    #chip { display: none; }
    #topbar { top: 16px; right: 16px; gap: 8px; }
    #fillClose { top: 16px; right: 16px; }
    #topbar .el { display: none; }   /* icon-only exit, like the dock labels */
    .ctl { height: 38px; min-width: 38px; padding: 0 12px; }
    #dock { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 20px); }
    #dock .dl { display: none; }
    #navCount { min-width: 64px; }
    #joy { width: 104px; height: 104px; }
    #joyKnob { width: 42px; height: 42px; }
    .sheet { padding: 26px 22px 22px; }
    .h-row { grid-template-columns: 108px 1fr; gap: 10px; }
    .ix-row { grid-template-columns: 24px 52px 1fr; gap: 10px; }
    #panel {
        top: auto; left: 0; right: 0; bottom: 0; width: 100%;
        max-height: 62vh;
        border-left: 0; border-top: 1px solid var(--line);
        background: linear-gradient(to top, rgba(8,8,10,.95), rgba(8,8,10,.86));
        padding: 40px 26px 34px 30px;
        transform: translateY(103%);
    }
    #panel.open { transform: none; }
    #panel .row { grid-template-columns: minmax(0, max-content) 1fr; }
    #panelClose { top: 16px; right: 16px; }
    #toast { bottom: 96px; }
    #introHero { filter: blur(10px) brightness(.68) saturate(.78); }
}
