:root {
  --bg: #0b0d11;
  --ink: #e9e7e1;
  --muted: #aaa8a1;
  --dim: #6f6e69;
  --card: rgba(11, 13, 17, 0.74);
  --line: rgba(233, 231, 225, 0.14);
  --request: #5ad7ff;
  --power: #ffb640;
  --heat: #ff6a52;
  --accent: #9fb4c8;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.walk { overflow: hidden; }
a { color: var(--accent); text-underline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #000; padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; top: 1rem; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#veil { position: fixed; inset: 0; z-index: 2; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .12s linear; }
body.walk #scene { touch-action: none; }

/* labels projected from the scene */
#labels { position: fixed; inset: 0; z-index: 3; pointer-events: none; font-family: var(--sans); }
.label { position: absolute; left: 0; top: 0; transform: translate(-100vw, -100vh); transition: opacity .3s; white-space: nowrap; }
.label .dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgba(11,13,17,.6); }
.label .txt { position: absolute; left: 12px; top: -0.85em; font-size: .78rem; letter-spacing: .02em; padding: .2em .55em; background: rgba(11,13,17,.78); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); }
body[data-journey="request"] .label .dot { background: var(--request); }
body[data-journey="power"] .label .dot { background: var(--power); }
body[data-journey="heat"] .label .dot { background: var(--heat); }

/* loader */
#loader { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; transition: opacity .8s ease; }
#loader.done { opacity: 0; pointer-events: none; }
#loader .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.loader-card { position: relative; text-align: center; padding: 2rem; max-width: 26rem; }
.loader-title { font-size: 2rem; margin: 0 0 .25rem; letter-spacing: .01em; }
.loader-sub, .loader-msg { margin: 0; color: var(--muted); font-family: var(--sans); font-size: .85rem; }
.loader-msg { margin-top: .75rem; min-height: 1.2em; }
.bar { height: 2px; background: var(--line); margin: 1rem auto 0; width: 14rem; }
#bar-fill { height: 100%; width: 0; background: var(--ink); transition: width .2s; }

/* top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem max(1rem, env(safe-area-inset-right)) .7rem max(1rem, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(11,13,17,.85), rgba(11,13,17,0));
  font-family: var(--sans); font-size: .85rem;
}
.brand { color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .01em; }
.tools { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
button {
  font: inherit; font-family: var(--sans); font-size: .82rem; cursor: pointer;
  color: var(--ink); background: rgba(11,13,17,.6); border: 1px solid var(--line); border-radius: 999px;
  padding: .45rem .9rem; min-height: 40px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
button:hover { border-color: rgba(233,231,225,.4); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button[aria-pressed="true"] { background: var(--ink); color: #111; border-color: var(--ink); }
button.primary { background: var(--ink); color: #111; border-color: var(--ink); font-weight: 600; }
button.primary:hover { background: #fff; }
button.big { font-size: 1rem; padding: .7rem 1.3rem; }

/* story */
.story { position: relative; z-index: 5; }
.chapter { min-height: 100svh; display: flex; align-items: center; padding: 6rem 1.25rem 3rem; }
.chapter:nth-child(odd) { justify-content: flex-start; }
.chapter:nth-child(even) { justify-content: flex-end; }
.card {
  max-width: 33rem; padding: 1.4rem 1.6rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card h2, .card h1 { font-weight: 500; letter-spacing: -.005em; margin: 0 0 .6rem; line-height: 1.15; }
.card h2 { font-size: 1.6rem; }
.card h1 { font-size: 2.8rem; }
.card p { margin: 0 0 .8rem; }
.card p:last-child { margin-bottom: 0; }
.kicker { font-family: var(--sans); font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 .6rem; }
.kicker.request { color: var(--request); }
.kicker.power { color: var(--power); }
.kicker.heat { color: var(--heat); }
.lede { font-size: 1.15rem; }
.hint { font-family: var(--sans); color: var(--dim); font-size: .85rem; }
.small { font-family: var(--sans); font-size: .8rem; color: var(--muted); }
.title-card { max-width: 38rem; }
sup { font-family: var(--sans); font-size: .68em; line-height: 0; vertical-align: baseline; position: relative; top: -.5em; margin-left: .08em; }
sup a { text-decoration: none; color: var(--accent); }
sup a:hover { text-decoration: underline; }
body.walk .story, body.walk .panel, body.walk .topbar .brand { display: none; }

/* panels below the story */
.panel { position: relative; z-index: 5; background: var(--bg); border-top: 1px solid var(--line); padding: 4rem 1.25rem; }
.panel-inner { max-width: 62rem; margin: 0 auto; }
.panel h2 { font-weight: 500; font-size: 2rem; margin: 0 0 .75rem; }
.panel h3 { font-weight: 500; font-size: 1.25rem; margin: 1.8rem 0 .5rem; }
.intro { max-width: 40rem; color: var(--muted); margin-top: 0; }
.prose { max-width: 40rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .5rem; }
.prose table { border-collapse: collapse; font-family: var(--sans); font-size: .88rem; margin: 1rem 0 1.5rem; width: 100%; }
.prose th, .prose td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--muted); font-weight: 500; }
.prose td:last-child, .prose th:last-child { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.notes { font-family: var(--sans); font-size: .86rem; color: var(--muted); }
.notes ol { padding-left: 1.6rem; }
.notes li { margin-bottom: .55rem; }
.notes li:target { color: var(--ink); }
.notes a { word-break: break-word; }
.notes .back { margin-left: .3em; text-decoration: none; }
.diary { margin: 1rem 0 0; }
.diary dt { margin-top: 1.4rem; font-weight: 500; }
.diary dt time { display: block; font-family: var(--sans); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .2rem; }
.diary dt.milestone { font-size: 1.3rem; }
.diary dd { margin: .3rem 0 0; color: var(--muted); }
#nowebgl { position: relative; z-index: 6; margin: 6rem auto 0; max-width: 34rem; padding: 1rem 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.stills { display: grid; gap: 1.5rem; margin-top: 2rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.stills figure { margin: 0; }
.stills img { width: 100%; height: auto; display: block; border-radius: 4px; background: #000; }
.stills figcaption { margin-top: .5rem; color: var(--muted); font-size: .95rem; }

/* walk HUD */
#walk-hud { position: fixed; left: 0; right: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 20; text-align: center; font-family: var(--sans); pointer-events: none; }
#walk-hud .hud-row { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; pointer-events: auto; padding: 0 1rem; }
#walk-hud .hud-row button { font-size: .78rem; padding: .4rem .7rem; }
.hud-help { color: var(--muted); font-size: .8rem; margin: .6rem 0 0; }
#walk-exit { pointer-events: auto; margin-top: .6rem; }
.joy { position: fixed; bottom: calc(6.5rem + env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%;
  background: rgba(233,231,225,.08); border: 1px solid var(--line); z-index: 21; touch-action: none; }
#joy-left { left: 1.25rem; } #joy-right { right: 1.25rem; }
.joy .knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(233,231,225,.35); }
.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: inline-block; }
  .desktop-only { display: none; }
  body.walk #joy-left, body.walk #joy-right { display: block; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar { padding-top: .5rem; padding-bottom: .5rem; }
  .tools { gap: .3rem; }
  .tools button { font-size: .74rem; padding: .35rem .55rem; }
  .chapter { align-items: flex-end; padding: 5rem .9rem 2.5rem; }
  .chapter:nth-child(odd), .chapter:nth-child(even) { justify-content: center; }
  .card { padding: 1.1rem 1.2rem; }
  .card h1 { font-size: 2.2rem; }
  .card h2 { font-size: 1.4rem; }
  .brand { font-size: .95rem; }
  .label .txt { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  #loader { transition: none; }
  .label { transition: none; }
}
