@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;800&family=DM+Mono:wght@300;400;500&display=swap');

/* Fellowship scene kit v2 — chrome
 *
 * Two rules decide everything in this file.
 *
 * 1. Legibility has two answers and you pick by whether you control the framing.
 *    In FREE WALK you do not — the camera can end up facing a white wall — so chrome
 *    carries a scrim (body.walk). On an AUTHORED TOUR STOP you do: the shot is composed
 *    to leave quiet wall for the type, so the caption sits directly on the image with no
 *    card at all (body.tour). The second looks far less like a HUD, and it is the single
 *    most visible difference between a page that reads as a film and one that reads as
 *    a viewer with buttons on it.
 *
 * 2. Nothing is anchored to a screen edge without env(safe-area-inset-*). Declaring
 *    viewport-fit=cover and then putting a control under the iOS home indicator is a
 *    bug we have seen shipped in a build we otherwise admire.
 *
 * Minimum 10px body text, 9px labels. Every colour below clears 4.5:1 on the surface
 * it sits on.
 */

:root{
  --ui-display:'Poppins','Futura','Avenir Next',system-ui,-apple-system,sans-serif;
  --ui-mono:'DM Mono',ui-monospace,SFMono-Regular,Menlo,monospace;

  --ui-bg:#070505;
  --ui-fg:#f0ece6;        /* primary   */
  --ui-fg2:#cdc4b8;       /* secondary */
  --ui-fg3:#8d847a;       /* labels    */
  --ui-dim:#58524a;       /* furthest back */
  --ui-accent:#e6d3a3;    /* warm cream — highlights, the active tick */
  --ui-line:rgba(240,236,230,.18);
  --ui-line-hi:rgba(240,236,230,.45);
  --ui-scrim:rgba(7,5,5,.72);

  --gut:16px;
  --safe-l:max(var(--gut),env(safe-area-inset-left));
  --safe-r:max(var(--gut),env(safe-area-inset-right));
  --safe-t:max(var(--gut),env(safe-area-inset-top));
  --safe-b:max(var(--gut),env(safe-area-inset-bottom));
}

*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{background:var(--ui-bg);overflow:hidden;color:var(--ui-fg);
  font-family:var(--ui-display);-webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility}
canvas.gl{display:block;position:fixed;inset:0;touch-action:none}
[hidden]{display:none !important}
button{font-family:inherit;color:inherit;background:none;border:none;cursor:pointer}
:focus-visible{outline:2px solid var(--ui-accent);outline-offset:3px}

/* Edge vignettes. One gradient per edge, drawn behind the chrome, instead of a blur
 * card behind each widget. Costs nothing, never looks like a panel, and gives every
 * corner enough contrast to hold small type on a bright render. */
#vig{position:fixed;inset:0;z-index:4;pointer-events:none;opacity:0;transition:opacity .5s}
body.ready #vig{opacity:1}
#vig::before,#vig::after{content:'';position:absolute;left:0;right:0;height:26vh}
#vig::before{top:0;background:linear-gradient(to bottom,rgba(7,5,5,.62),rgba(7,5,5,.14) 62%,transparent)}
/* The bottom gradient is doing real work: on a Tier B render the wall behind a caption
 * can be mid-grey, and cream text on mid-grey fails. Deeper and taller than the top. */
#vig::after{bottom:0;height:40vh;
  background:linear-gradient(to top,rgba(7,5,5,.9),rgba(7,5,5,.5) 38%,rgba(7,5,5,.16) 70%,transparent)}
body.walk #vig::before{background:linear-gradient(to bottom,rgba(7,5,5,.72),transparent)}
body.walk #vig::after{background:linear-gradient(to top,rgba(7,5,5,.8),transparent)}

/* ---------------------------------------------------------------- start screen */
#start{position:fixed;inset:0;z-index:100;background:var(--ui-bg);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  transition:opacity .9s ease}
#start.gone{opacity:0;pointer-events:none}
.start-inner{width:min(560px,100%)}
#start h1{font-weight:800;font-size:clamp(2.1rem,5.4vw,3.2rem);line-height:1.04;
  letter-spacing:-.015em;color:var(--ui-fg)}
#start h1 .b{display:block;color:var(--ui-accent)}
#start .sub{margin-top:.55rem;font-weight:500;font-size:clamp(.82rem,1.6vw,1rem);
  color:var(--ui-fg2);letter-spacing:.01em}

#progress{margin:2.1rem 0 1.5rem;display:grid;grid-template-columns:1fr auto auto;
  align-items:center;gap:.9rem}
#progress .track{grid-column:1/-1;height:2px;background:rgba(240,236,230,.12);overflow:hidden}
#progress .fill{height:100%;width:0;background:var(--ui-accent);
  transition:width .45s cubic-bezier(.22,.61,.36,1)}
#progress .pct,#progress .state{font-family:var(--ui-mono);font-size:.68rem;
  letter-spacing:.14em;text-transform:uppercase;color:var(--ui-dim);margin-top:.7rem}
#progress .pct{grid-column:1;justify-self:start;color:var(--ui-fg3)}
#progress .state{grid-column:2/-1;justify-self:end}

.choices{display:flex;flex-direction:column;gap:.55rem}
.choices button{display:flex;align-items:center;justify-content:space-between;
  padding:.95rem 1.2rem;border:1px solid var(--ui-line);color:var(--ui-fg);
  font-size:.95rem;font-weight:500;letter-spacing:.01em;transition:all .22s;text-align:left}
.choices button:hover:not(:disabled){border-color:var(--ui-accent);background:rgba(230,211,163,.07)}
.choices button:disabled{color:var(--ui-dim);border-color:rgba(240,236,230,.08);cursor:default}
.choices .arr{opacity:.5;font-size:1rem}
#start .note{margin-top:1.4rem;font-size:.78rem;line-height:1.6;color:var(--ui-fg3);max-width:46ch}

/* ---------------------------------------------------------------- top bar */
#topbar{position:fixed;top:0;left:0;right:0;z-index:12;display:flex;
  justify-content:space-between;align-items:center;gap:14px;
  padding:var(--safe-t) var(--safe-r) 10px var(--safe-l);pointer-events:none}
#topbar .brand{font-weight:600;font-size:.78rem;letter-spacing:.01em;color:var(--ui-fg)}
#topbar nav{display:flex;align-items:center;gap:2px;pointer-events:auto}
#topbar nav button{padding:6px 11px;font-size:.76rem;font-weight:500;color:var(--ui-fg2);
  letter-spacing:.01em;border-radius:3px;transition:color .2s,background .2s}
#topbar nav button:hover{color:var(--ui-fg);background:rgba(240,236,230,.08)}
#topbar nav button.on{color:var(--ui-fg)}
#topbar nav .dot{display:inline-block;width:5px;height:5px;border-radius:50%;
  background:transparent;margin-right:7px;vertical-align:1px;transition:background .2s}
#topbar nav button.on .dot{background:var(--ui-accent)}

/* ---------------------------------------------------------------- caption */
/* Anchored per stop. The default is bottom-left; a stop whose art is on the left sets
 * anchor 'tr' and the text moves out of its way. This is the whole trick behind the
 * reference build's typography: the shot is framed with somewhere for the words to go. */
#caption{position:fixed;z-index:11;max-width:min(52ch,46vw);pointer-events:none;
  opacity:0;transition:opacity .5s ease;
  /* insurance for the frame where the composition did not leave quite enough quiet
   * wall. Cheap, invisible against dark, and it never reads as a box. */
  text-shadow:0 1px 14px rgba(7,5,5,.85),0 1px 3px rgba(7,5,5,.6)}
#caption.show{opacity:1}
#caption.bl{left:var(--safe-l);bottom:calc(var(--safe-b) + 68px)}
#caption.tl{left:var(--safe-l);top:calc(var(--safe-t) + 44px)}
body.cap-top #vig::before{height:46vh;
  background:linear-gradient(to bottom,rgba(7,5,5,.88),rgba(7,5,5,.42) 44%,transparent)}
#caption.br{right:var(--safe-r);bottom:calc(var(--safe-b) + 68px);text-align:left}
#caption.tr{right:var(--safe-r);top:calc(var(--safe-t) + 44px);text-align:left}
#caption .num{font-family:var(--ui-mono);font-size:.66rem;letter-spacing:.2em;
  color:var(--ui-fg3);display:block;margin-bottom:.45rem}
#caption h2{font-size:clamp(1.15rem,2.1vw,1.5rem);font-weight:600;line-height:1.18;
  letter-spacing:-.008em;color:var(--ui-fg)}
#caption .sub{font-size:.86rem;font-weight:400;color:var(--ui-fg3);margin-top:.12rem}
#caption p{margin-top:.6rem;font-size:.93rem;line-height:1.52;color:var(--ui-fg2);
  font-weight:400;text-wrap:pretty}
/* In free walk the framing is nobody's decision, so the scrim comes back. */
body.walk #caption{background:var(--ui-scrim);backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);padding:12px 15px;border-radius:3px;max-width:44ch}

.readbtn{pointer-events:auto;margin-top:.95rem;display:inline-flex;align-items:center;
  gap:.5rem;padding:.5rem .85rem;border:1px solid var(--ui-line);font-size:.74rem;
  font-weight:500;color:var(--ui-fg);border-radius:3px;transition:all .2s}
.readbtn:hover{border-color:var(--ui-line-hi);background:rgba(240,236,230,.07)}
.readbtn i{width:9px;height:10px;display:inline-block;position:relative}
.readbtn i::before,.readbtn i::after{content:'';position:absolute;top:0;bottom:0;width:3px;
  background:currentColor}
.readbtn i::before{left:0}.readbtn i::after{right:0}
.readbtn.paused i::before,.readbtn.paused i::after{display:none}
.readbtn.paused i{border-left:8px solid currentColor;border-top:5px solid transparent;
  border-bottom:5px solid transparent;width:0;height:0}
/* Pulses on the first captioned stop only, and never again once anyone has paused. */
.readbtn.nudge{animation:nudge 1.3s ease-in-out infinite}
@keyframes nudge{0%,100%{border-color:var(--ui-line)}50%{border-color:var(--ui-accent)}}

/* ---------------------------------------------------------------- transport */
#tourbar{position:fixed;left:0;right:0;bottom:0;z-index:12;display:flex;align-items:center;
  gap:14px;padding:12px var(--safe-r) var(--safe-b) var(--safe-l);
  opacity:0;transition:opacity .4s;pointer-events:none}
body.tour #tourbar{opacity:1;pointer-events:auto}
#tourbar button{font-size:.8rem;color:var(--ui-fg2);transition:color .2s;padding:4px 2px}
#tourbar button:hover{color:var(--ui-fg)}
#t-play{min-width:62px;text-align:left;font-weight:500;color:var(--ui-fg)}
#t-time{font-family:var(--ui-mono);font-size:.7rem;color:var(--ui-fg3);
  letter-spacing:.06em;white-space:nowrap}
#t-speed{font-family:var(--ui-mono);font-size:.7rem;min-width:30px;text-align:right}

#t-scrub{position:relative;flex:1;height:34px;cursor:pointer;touch-action:none}
#t-scrub .rail{position:absolute;left:0;right:0;top:24px;height:1px;background:rgba(240,236,230,.2)}
#t-scrub .done{position:absolute;left:0;top:24px;height:1px;width:0;background:var(--ui-accent)}
#t-scrub .ticks,#t-acts{position:absolute;left:0;right:0}
#t-scrub .ticks{top:21px;height:7px}
#t-scrub .ticks i{position:absolute;top:3px;width:1px;height:4px;background:rgba(240,236,230,.3)}
#t-acts{top:0;height:20px}
#t-acts i{position:absolute;top:0;font-style:normal;font-size:.62rem;letter-spacing:.04em;
  color:var(--ui-fg3);white-space:nowrap;padding-left:5px;border-left:1px solid rgba(240,236,230,.22);
  overflow:hidden;text-overflow:ellipsis}
#t-acts i.on{color:var(--ui-accent);border-left-color:var(--ui-accent)}
#t-scrub .knob{position:absolute;top:20px;width:9px;height:9px;border-radius:50%;
  background:var(--ui-accent);margin-left:-4.5px;pointer-events:none;
  transition:transform .15s}
#t-scrub:hover .knob{transform:scale(1.25)}

/* ---------------------------------------------------------------- place / minimap */
#place{position:fixed;right:var(--safe-r);z-index:11;bottom:calc(var(--safe-b) + 62px);
  text-align:right;pointer-events:none;opacity:0;transition:opacity .4s}
body.ready #place{opacity:1}
#place canvas{display:block;margin-left:auto;width:150px;height:110px}
#place span{display:block;margin-top:7px;font-size:.7rem;font-weight:500;
  color:var(--ui-fg2);letter-spacing:.01em}
@media (max-width:860px){#place{display:none}}

/* ---------------------------------------------------------------- walk furniture */
#reticle{position:fixed;left:50%;top:50%;width:5px;height:5px;margin:-2.5px 0 0 -2.5px;
  border-radius:50%;background:rgba(240,236,230,.55);z-index:10;pointer-events:none;
  opacity:0;transition:opacity .25s,transform .18s}
body.walk.locked #reticle{opacity:1}
#reticle.hot{transform:scale(2.1);background:var(--ui-accent)}

#cue{position:fixed;left:50%;top:calc(50% + 26px);transform:translateX(-50%);z-index:11;
  pointer-events:none;opacity:0;transition:opacity .25s}
#cue.show{opacity:1}
#cue span{display:inline-block;padding:5px 11px;background:var(--ui-scrim);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border:1px solid var(--ui-line);border-radius:3px;font-size:.72rem;color:var(--ui-fg)}

#toast{position:fixed;left:50%;bottom:calc(var(--safe-b) + 84px);transform:translateX(-50%);
  z-index:14;pointer-events:none;opacity:0;transition:opacity .35s;max-width:min(42ch,88vw)}
#toast.show{opacity:1}
#toast span{display:block;padding:9px 14px;background:var(--ui-scrim);
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  border:1px solid var(--ui-line);border-radius:3px;font-size:.78rem;line-height:1.45;
  color:var(--ui-fg);text-align:center}

/* touch thumbstick — only on touch-only devices, and never under the home indicator. The ring is the control:
   walker.js listens on this element, moves the knob through --kx / --ky, sets data-active while a thumb is on it
   and data-used once it has been walked with. Nothing on it can be selected or called up by a long press: a held
   thumb is a walk, not a text selection. */
#stick{position:fixed;left:calc(var(--safe-l) + 12px);bottom:calc(var(--safe-b) + 58px);
  width:108px;height:108px;border-radius:50%;z-index:13;display:none;touch-action:none;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;
  border:1px solid rgba(240,236,230,.38);background:rgba(7,5,5,.42);transition:border-color .2s,background .2s}
body.touch.walk #stick{display:block}
#stick[data-active]{border-color:rgba(240,236,230,.7);background:rgba(7,5,5,.55)}
/* which way is forward: a mark at the top of the ring */
#stick::before{content:"";position:absolute;left:50%;top:9px;width:9px;height:9px;margin-left:-5px;
  border-left:1.5px solid rgba(240,236,230,.6);border-top:1.5px solid rgba(240,236,230,.6);transform:rotate(45deg);pointer-events:none}
#stick b{position:absolute;left:50%;top:50%;width:40px;height:40px;margin:-20px 0 0 -20px;pointer-events:none;
  border-radius:50%;background:rgba(240,236,230,.55);transform:translate(var(--kx,0px),var(--ky,0px));transition:background .2s}
#stick[data-active] b{background:rgba(240,236,230,.92)}
/* the ring says what it is until someone has walked with it (walker.js sets data-used). A page that wants other
   words, or none, overrides this rule. */
#stick:not([data-used])::after{content:"Hold and drag to walk";position:absolute;left:0;bottom:calc(100% + 10px);
  white-space:nowrap;padding:5px 9px;background:var(--ui-scrim);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border:1px solid var(--ui-line);border-radius:3px;font-size:.72rem;line-height:1.3;color:var(--ui-fg);pointer-events:none}
/* until then it also breathes when no thumb is on it, so the eye finds where the thumb goes */
@keyframes kit-stick-hint{0%,100%{box-shadow:0 0 0 0 rgba(240,236,230,0)}50%{box-shadow:0 0 0 9px rgba(240,236,230,.16)}}
body.touch.walk #stick:not([data-used]):not([data-active]){animation:kit-stick-hint 1.6s ease-in-out 4}
/* and a message does not sit on the ring: on a phone in walk mode it goes above the ring and its instruction */
body.touch.walk #toast{bottom:calc(var(--safe-b) + 58px + 108px + 50px)}
/* on a touch screen the chrome over the view is not text to select: a long press there is a look held still */
body.touch #topbar,body.touch #tourbar,body.touch #caption,body.touch #place,body.touch #reticle,body.touch #cue,
body.touch #toast,body.touch canvas.gl{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}

/* ---------------------------------------------------------------- drawer */
#drawer{position:fixed;top:0;right:0;bottom:0;width:100%;max-width:430px;z-index:60;
  background:rgba(7,5,5,.97);backdrop-filter:blur(22px);-webkit-backdrop-filter:blur(22px);
  border-left:1px solid var(--ui-line);transform:translateX(101%);
  transition:transform .42s cubic-bezier(.22,.61,.36,1);pointer-events:none;overflow:hidden}
#drawer.open{transform:translateX(0);pointer-events:auto}
#din{height:100%;overflow-y:auto;padding:52px 26px calc(var(--safe-b) + 40px);
  scrollbar-width:thin;scrollbar-color:rgba(240,236,230,.28) transparent}
#din::-webkit-scrollbar{width:5px}
#din::-webkit-scrollbar-thumb{background:rgba(240,236,230,.26)}
#dx{position:absolute;top:14px;right:16px;z-index:2;width:28px;height:28px;
  border:1px solid var(--ui-line);border-radius:3px;font-size:15px;line-height:1;
  display:flex;align-items:center;justify-content:center;color:var(--ui-fg)}
#dx:hover{border-color:var(--ui-line-hi);background:rgba(240,236,230,.08)}
#drawer .kicker{font-family:var(--ui-mono);font-size:.64rem;letter-spacing:.22em;
  text-transform:uppercase;color:var(--ui-fg3);margin-bottom:.7rem}
#drawer h2{font-size:1.22rem;font-weight:600;line-height:1.22;color:var(--ui-fg)}
#drawer .meta{margin-top:.3rem;font-size:.84rem;color:var(--ui-fg3)}
#drawer figure{margin:1.2rem 0}
#drawer figure img{display:block;width:100%;height:auto;cursor:zoom-in;background:#120f0e}
#drawer figure figcaption{margin-top:.5rem;font-size:.72rem;color:var(--ui-dim);line-height:1.5}
#drawer dl{display:grid;grid-template-columns:86px 1fr;gap:.42rem .9rem;margin:1.1rem 0;
  font-size:.79rem;line-height:1.55}
#drawer dt{color:var(--ui-fg3)}
#drawer dd{color:var(--ui-fg2);overflow-wrap:break-word}
#drawer p{font-size:.9rem;line-height:1.66;color:var(--ui-fg2);margin-bottom:.8rem;text-wrap:pretty}

#lightbox{position:fixed;inset:0;z-index:80;background:rgba(7,5,5,.95);display:none;
  align-items:center;justify-content:center;padding:var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  cursor:zoom-out}
#lightbox.open{display:flex}
#lightbox img{max-width:100%;max-height:100%;object-fit:contain}

/* ---------------------------------------------------------------- modes */
body.p #topbar,body.p #tourbar,body.p #place,body.p #caption,body.p #vig{opacity:0}
body.p #topbar,body.p #tourbar{pointer-events:none}

@media (max-width:760px){
  #drawer{max-width:none;border-left:none}
  #caption{max-width:min(40ch,88vw)}
  #caption.br,#caption.tr{right:auto;left:var(--safe-l)}
  #topbar nav button{padding:6px 8px;font-size:.72rem}
  #t-acts{display:none}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
}
