/* ═══════════════ Kaleidoscope — the voxel palace ═══════════════
   Ivory and gold over deep indigo. Display type is Fraunces; every
   small label is Outfit, tracked wide, so the UI reads as engraving
   on the building rather than chrome on top of it. */

:root {
  --ink: #f8f0dd;
  --ink-dim: rgba(248, 240, 221, 0.7);
  --ink-faint: rgba(248, 240, 221, 0.45);
  --gold: #ffcd6b;
  --gold-deep: #d9a03c;
  --night: #0b0d22;
  --glass: rgba(16, 14, 36, 0.5);
  --glass-solid: rgba(19, 16, 40, 0.92);
  --line: rgba(255, 226, 173, 0.22);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Outfit", system-ui, -apple-system, sans-serif;
  --shadow-soft: 0 2px 24px rgba(6, 5, 22, 0.85);
}

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

body {
  font-family: var(--sans);
  overscroll-behavior-y: none;
  color: var(--ink);
  background: var(--night);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0;
  touch-action: none;   /* the scroll is driven by hand, see palace.js */
}

/* Sized by palace.js. Zero by default so a browser without JS gets a plain
   document instead of eleven blank screens before it. */
.scroll-space { height: 0; pointer-events: none; }

::selection { background: var(--gold); color: #2a1f08; }

/* Let visitors orient themselves immediately; the scene still fades in, but
   no longer leaves a blank, ambiguous pause before the controls appear. */
body > *:not(.scroll-space) { transition: opacity 0.32s ease; }
body:not(.ready) #scene,
body:not(.ready) .hero,
body:not(.ready) .hud-top { opacity: 0; }

/* ───────────── progress ───────────── */
.progress-track {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 40; background: rgba(255, 226, 173, 0.08);
}
#progress-bar {
  height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}

/* ───────────── hero ───────────── */
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 78% 62% at 50% 38%, rgba(8, 6, 26, 0.3), rgba(8, 6, 26, 0.1) 58%, transparent 82%);
  pointer-events: none;
}
.hero {
  position: fixed; inset: 0; z-index: 12;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 1.5rem;
  pointer-events: none;
}
.hero-inner {
  pointer-events: auto;
  margin-bottom: clamp(4rem, 13vh, 9rem);
  display: flex; flex-direction: column; align-items: center;
}
.hero-kicker {
  font-size: 0.7rem; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 1.1rem; padding-left: 0.42em;
  text-shadow: var(--shadow-soft);
}
.hero-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 1;
  font-weight: 400;
  font-size: clamp(3.2rem, 11vw, 8.5rem);
  line-height: 0.9; letter-spacing: -0.028em;
  text-shadow: 0 6px 60px rgba(6, 4, 24, 0.9), 0 1px 3px rgba(6, 4, 24, 0.7);
}
.hero-rule {
  width: 5.5rem; height: 1px; margin: 1.25rem 0 1rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.start-guide {
  width: min(42rem, calc(100vw - 2rem));
  padding: clamp(1rem, 2vw, 1.35rem) clamp(1rem, 2.5vw, 1.65rem) 1.1rem;
  border: 1px solid rgba(255, 226, 173, 0.28); border-radius: 18px;
  background: linear-gradient(135deg, rgba(20, 17, 48, 0.83), rgba(11, 10, 30, 0.72));
  box-shadow: 0 18px 58px rgba(5, 4, 18, 0.42); backdrop-filter: blur(16px);
}
.start-guide-label {
  color: var(--gold); font-size: 0.61rem; font-weight: 500; letter-spacing: 0.26em;
  text-transform: uppercase; margin-bottom: 0.38rem;
}
.start-guide h2 {
  font-family: var(--serif); font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 400; line-height: 1.1; letter-spacing: -0.015em;
}
.start-guide-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 1rem; text-align: left; }
.start-guide-option {
  display: grid; grid-template-columns: 1.7rem 1fr; gap: 0.45rem; align-items: start;
  padding: 0.7rem; border-radius: 11px; background: rgba(255, 255, 255, 0.045);
}
.start-guide-icon { color: var(--gold); font-size: 1.25rem; line-height: 1.2; text-align: center; }
.start-guide-option p { color: var(--ink-dim); font-size: 0.79rem; font-weight: 300; line-height: 1.48; }
.start-guide-option strong { color: var(--ink); font-weight: 500; }
.start-guide-keyboard { color: var(--ink-faint); font-size: 0.68rem; margin-top: 0.8rem; }
.start-guide-keyboard kbd {
  display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; margin-right: 0.2rem;
  border: 1px solid var(--line); border-bottom-color: rgba(255, 226, 173, 0.42); border-radius: 4px;
  color: var(--ink-dim); font-family: var(--sans); font-size: 0.62rem;
}
.hero-actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; flex-wrap: wrap; justify-content: center; }
.hero-cta {
  display: inline-block; padding: 0.78rem 1.7rem; border-radius: 999px;
  background: var(--gold); color: #2b2008;
  font-weight: 600; font-size: 0.9rem; letter-spacing: 0.01em; text-decoration: none;
  box-shadow: 0 10px 34px rgba(255, 205, 107, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 42px rgba(255, 205, 107, 0.45); }
.hero-ghost {
  padding: 0.78rem 1.5rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(14, 11, 34, 0.62);
  backdrop-filter: blur(12px);
  color: var(--ink); font-family: var(--sans); font-size: 0.9rem;
  transition: background 0.18s ease, transform 0.18s ease;
}
.hero-ghost:hover { background: rgba(60, 52, 96, 0.5); transform: translateY(-2px); }
.hero-scroll-hint {
  position: absolute; bottom: 1.9rem; left: 50%;
  text-shadow: 0 1px 14px rgba(6, 5, 22, 0.95); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  font-size: 0.63rem; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--ink-faint); animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.75; }
  50% { transform: translate(-50%, 9px); opacity: 1; }
}

/* ───────────── top hud ───────────── */
.hud-top {
  position: fixed; top: 1.15rem; left: 1.4rem; right: 1.4rem; z-index: 30;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--ink); }
.brand img {
  width: 40px; height: 40px; border-radius: 11px; object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}
.brand span {
  display: flex; flex-direction: column; line-height: 1.15;
  font-family: var(--serif); font-weight: 400; font-size: 1.02rem;
  text-shadow: var(--shadow-soft);
}
.brand b {
  font-family: var(--sans); font-weight: 400; font-size: 0.58rem;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-faint);
}
.hud-actions { display: flex; gap: 0.5rem; }
.chip {
  padding: 0.55rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(12px);
  color: var(--ink); font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.04em; text-decoration: none;
  transition: background 0.16s ease, transform 0.16s ease;
}
.chip:hover { background: rgba(64, 56, 104, 0.6); transform: translateY(-1px); }
.chip-gold { background: var(--gold); color: #2b2008; border-color: transparent; font-weight: 600; }
.chip-gold:hover { background: #ffd98e; }

/* ───────────── chapter title ───────────── */
.chapter {
  position: fixed; left: 1.6rem; bottom: 1.6rem; z-index: 25;
  display: flex; align-items: baseline; gap: 0.7rem;
  pointer-events: none; transition: opacity 0.5s ease;
}
.chapter-no {
  font-family: var(--serif); font-size: 0.82rem; color: var(--gold);
  letter-spacing: 0.16em;
}
.chapter-name {
  font-family: var(--serif); font-weight: 300; font-size: clamp(1rem, 2.2vw, 1.5rem);
  letter-spacing: 0.01em; text-shadow: var(--shadow-soft);
}
.chapter .chapter-no, .chapter .chapter-name {
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.7, 0.25, 1);
}
.chapter.in .chapter-no, .chapter.in .chapter-name { opacity: 1; transform: none; }
.chapter.in .chapter-name { transition-delay: 0.06s; }

/* ───────────── window markers ───────────── */
.markers { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.marker {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink); font-family: var(--sans);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
  will-change: transform, opacity;
}
.marker-dot {
  position: relative; flex: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(10, 8, 26, 0.55);
  border: 2px solid var(--gold);
  box-shadow: 0 0 12px rgba(255, 205, 107, 0.9), inset 0 0 0 2px rgba(10, 8, 26, 0.5);
  transform: translate(-50%, -50%);
}
.marker-dot::before {
  content: ""; position: absolute; inset: 2.5px; border-radius: 50%;
  background: #fff6e0;
}
.marker-dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.5px solid rgba(255, 205, 107, 0.75);
  animation: ping 2.8s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}
@keyframes ping {
  0% { transform: scale(0.7); opacity: 0.9; }
  70%, 100% { transform: scale(2.4); opacity: 0; }
}
.marker-label {
  transform: translateY(-50%);
  white-space: nowrap; font-size: 0.72rem; letter-spacing: 0.05em;
  padding: 0.28rem 0.65rem; border-radius: 999px;
  background: rgba(12, 10, 30, 0.72); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  opacity: 0; transform-origin: left center;
  transition: opacity 0.25s ease;
}
.marker:hover .marker-label, .marker:focus-visible .marker-label { opacity: 1; }
.marker:hover .marker-dot { background: var(--gold); transform: translate(-50%, -50%) scale(1.15); }
.marker.guided .marker-dot {
  background: var(--gold); transform: translate(-50%, -50%) scale(1.48);
  box-shadow: 0 0 24px 7px rgba(255, 205, 107, 0.65), inset 0 0 0 2px rgba(10, 8, 26, 0.5);
}
.marker.guided .marker-label { opacity: 1; }

/* A single, timely cue turns the opening camera move into a clear first
   interaction, especially on touch screens where window labels are hidden. */
.first-window-guide {
  position: fixed; z-index: 34; left: 50%; bottom: 1.6rem;
  display: flex; align-items: center; gap: 0.65rem;
  width: min(31rem, calc(100vw - 2rem)); padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 205, 107, 0.48); border-radius: 14px;
  background: rgba(13, 11, 34, 0.9); box-shadow: 0 14px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px); color: var(--ink-dim);
  transform: translate(-50%, 0.8rem); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}
.first-window-guide.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.first-window-guide-spark { color: var(--gold); font-size: 1.1rem; }
.first-window-guide p { font-size: 0.8rem; font-weight: 300; line-height: 1.45; }
.first-window-guide strong { color: var(--ink); font-weight: 500; }
.first-window-guide em { color: var(--gold); font-style: normal; }

/* ───────────── tooltip ───────────── */
.tooltip {
  position: fixed; z-index: 35; pointer-events: none;
  padding: 0.45rem 0.8rem; border-radius: 10px;
  background: rgba(10, 8, 26, 0.88); border: 1px solid var(--line);
  color: var(--ink); white-space: nowrap;
  transform: translate(16px, -50%);
  display: flex; flex-direction: column; gap: 0.1rem;
}
/* `.tooltip { display: flex }` outranks the UA's `[hidden] { display: none }`,
   so the hidden attribute was doing nothing and the popup never went away. */
.tooltip[hidden] { display: none; }
.tooltip b { font-family: var(--serif); font-weight: 400; font-size: 0.9rem; }
.tooltip span {
  font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold);
}

/* ───────────── room panel ───────────── */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(820px, 48vw);
  transform: translateX(103%);
  transition: transform 0.55s cubic-bezier(0.3, 0.86, 0.2, 1);
}
.panel.open { transform: translateX(0); }
.panel-inner {
  height: 100%; overflow-y: auto; position: relative;
  padding: 0 0 2rem;
  background: linear-gradient(168deg, rgba(30, 24, 58, 0.95), rgba(12, 10, 30, 0.97));
  border-left: 1px solid var(--line);
  backdrop-filter: blur(20px);
  box-shadow: -40px 0 100px rgba(0, 0, 0, 0.55);
}
.panel-inner > *:not(.panel-figure):not(.panel-close) { margin-left: clamp(2rem, 4vw, 3.5rem); margin-right: clamp(2rem, 4vw, 3.5rem); }
.panel-close {
  position: absolute; top: 1rem; right: 1.1rem; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(10, 8, 26, 0.6);
  backdrop-filter: blur(8px);
  color: var(--ink); font-size: 1.35rem; cursor: pointer; line-height: 1;
}
.panel-close:hover { background: rgba(255, 240, 200, 0.16); }
.panel-figure { display: block; margin: 0 0 1.6rem; }
.panel-figure img {
  display: block; width: 100%; height: clamp(220px, 32vh, 360px);
  object-fit: cover; filter: saturate(0.92);
}
.panel-figure:not(:empty) { position: relative; }
.panel-figure:not(:empty)::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(12, 10, 30, 0.85));
}
.panel-kicker {
  font-size: 0.62rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.7rem;
}
.panel-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2rem, 3vw, 3rem); line-height: 1.08;
  letter-spacing: -0.015em; margin-bottom: 1.2rem;
}
.panel-body { font-weight: 300; font-size: clamp(1rem, 1.2vw, 1.12rem); line-height: 1.75; color: var(--ink-dim); }
.panel-body p + p { margin-top: 0.85em; }
.panel-body strong { color: var(--ink); font-weight: 500; }
.panel-body ul { list-style: none; margin-top: 0.4em; }
.panel-body li { padding: 0.65em 0; border-bottom: 1px solid rgba(255, 226, 173, 0.12); }
.panel-body li:last-child { border-bottom: none; }
.panel-body a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(255, 205, 107, 0.35); }
.panel-body a:hover { border-bottom-color: var(--gold); }
.panel-body .panel-btn {
  display: inline-block; margin-top: 1.4em; border: none;
  background: var(--gold); color: #2b2008; font-weight: 600;
  padding: 0.62rem 1.35rem; border-radius: 999px;
}
.panel-nav {
  margin-top: 2.2rem; padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
}
.panel-nav button {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); padding: 0.48rem 0.95rem; cursor: pointer;
  font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.02em;
}
.panel-nav button:hover { background: rgba(255, 240, 200, 0.12); }

/* ───────────── directory ───────────── */
.directory {
  position: fixed; z-index: 45; top: 4.9rem; right: 1.4rem;
  width: min(330px, 90vw); max-height: min(72vh, 600px); overflow-y: auto;
  background: var(--glass-solid); border: 1px solid var(--line);
  border-radius: 20px; backdrop-filter: blur(16px);
  padding: 1.1rem; box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
}
.directory-title {
  font-family: var(--serif); font-size: 0.7rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gold);
  margin: 0 0 0.75rem 0.6rem;
}
.directory ul { list-style: none; }
.directory li button {
  width: 100%; text-align: left; background: transparent; border: none;
  color: var(--ink); font-family: var(--sans);
  padding: 0.55rem 0.65rem; border-radius: 11px; cursor: pointer;
  display: flex; gap: 0.75rem; align-items: baseline;
}
.directory li button:hover { background: rgba(255, 240, 200, 0.1); }
.directory li .num {
  color: var(--gold); font-size: 0.66rem; font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}
.directory li b { display: block; font-weight: 400; font-size: 0.88rem; }
.directory li i {
  display: block; font-style: normal; font-size: 0.62rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
  margin-top: 0.15rem;
}

/* ───────────── noscript ───────────── */
.noscript {
  position: fixed; inset: 0; background: var(--night); color: var(--ink);
  padding: 3rem 2rem; z-index: 99; font-family: var(--sans);
}
.noscript h1 { font-family: var(--serif); font-weight: 400; margin-bottom: 1rem; }
.noscript ul { list-style: none; margin-top: 1rem; line-height: 2; }
.noscript a { color: var(--gold); }

/* ───────────── small screens ───────────── */
@media (max-width: 640px) {
  /* Keep the complete wide capture visible on a portrait phone. A softened
     duplicate fills the surrounding space, so there is no tight crop or
     stretched image during the loading handoff. */
  .hud-top { top: 0.85rem; left: 0.9rem; right: 0.9rem; }
  .brand span { font-size: 0.9rem; }
  .chapter { left: 1rem; bottom: 1.2rem; }
  .marker-label { display: none; }
  .marker.guided .marker-label { display: block; font-size: 0.64rem; }
  .first-window-guide { bottom: max(0.9rem, env(safe-area-inset-bottom)); width: calc(100vw - 1.5rem); padding: 0.68rem 0.8rem; border-radius: 12px; }
  .first-window-guide p { font-size: 0.73rem; line-height: 1.38; }
  .hero-inner { margin-bottom: 3.25rem; }
  .hero-kicker { margin-bottom: 0.7rem; font-size: 0.58rem; }
  .hero-title { font-size: clamp(3rem, 17vw, 4.4rem); }
  .hero-rule { margin: 0.9rem 0 0.75rem; }
  .start-guide { width: min(31rem, calc(100vw - 1.5rem)); padding: 0.9rem; border-radius: 15px; }
  .start-guide h2 { font-size: 1.35rem; }
  .start-guide-options { grid-template-columns: 1fr; gap: 0.55rem; margin-top: 0.75rem; }
  .start-guide-option { padding: 0.55rem 0.6rem; grid-template-columns: 1.5rem 1fr; }
  .start-guide-option p { font-size: 0.72rem; line-height: 1.4; }
  .start-guide-keyboard { display: none; }
  .hero-actions { margin-top: 0.85rem; }
  .hero-cta, .hero-ghost { padding: 0.68rem 1.05rem; font-size: 0.78rem; }
  .hero-scroll-hint { bottom: 1rem; font-size: 0.54rem; }
  .panel { top: auto; width: 100%; height: min(78dvh, 720px); transform: translateY(104%); }
  .panel.open { transform: translateY(0); }
  .panel-inner { border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -25px 80px rgba(0, 0, 0, 0.52); }
  .panel-inner > *:not(.panel-figure):not(.panel-close) { margin-left: 1.25rem; margin-right: 1.25rem; }
  .panel-figure img { height: clamp(150px, 25dvh, 220px); }
  .panel-title { font-size: clamp(1.8rem, 8vw, 2.35rem); }
  .panel-body { font-size: 0.96rem; line-height: 1.65; }
  .panel-nav { margin-top: 1.5rem; padding-bottom: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-hint { animation: none; }
  .marker-dot::after { animation: none; }
  .panel { transition: none; }
  body > *:not(.scroll-space) { transition: none; }
}


/* ═════════════════ the reading document ═════════════════
   Scrolls up over the fixed scene once the camera move is done. Also the
   whole site when there is no WebGL, and the only thing a crawler sees. */

.ledger {
  position: relative; z-index: 15;
  padding: 0 0 4rem;
  background:
    linear-gradient(180deg, transparent, rgba(9, 8, 26, 0.86) 14vh, var(--night) 34vh);
}
.ledger > * { width: min(660px, calc(100% - 2.6rem)); margin-inline: auto; }

.ledger-head { padding-top: 40vh; }
.ledger-eyebrow {
  font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1rem;
}
.ledger-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.9rem, 5.5vw, 2.9rem); line-height: 1.05;
  letter-spacing: -0.02em; margin-bottom: 1.2rem;
}
.ledger-lead {
  color: var(--ink-dim); font-weight: 300;
  font-size: clamp(1rem, 2.2vw, 1.12rem); line-height: 1.7;
}
.ledger-lead + .ledger-lead { margin-top: 1.6rem; }
.ledger-cta {
  display: inline-block; margin: 0 0.5rem 0.5rem 0;
  padding: 0.72rem 1.5rem; border-radius: 999px;
  background: var(--gold); color: #2b2008;
  font-weight: 600; font-size: 0.9rem; text-decoration: none; border: none;
}
.ledger-cta:hover { background: #ffd98e; }
.ledger-cta-quiet {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); font-weight: 400;
}
.ledger-cta-quiet:hover { background: rgba(255, 240, 200, 0.12); }

.room { padding-top: clamp(3rem, 9vh, 5rem); scroll-margin-top: 5rem; }
.room::before {
  content: attr(data-plate) " · " attr(data-kicker);
  display: block; margin-bottom: 0.7rem;
  font-size: 0.62rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold);
}
.room-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.1;
  letter-spacing: -0.015em; margin-bottom: 1.3rem;
}
.room-img {
  display: block; width: 100%; height: clamp(180px, 34vh, 320px);
  object-fit: cover; border-radius: 4px;
  margin-bottom: 1.4rem; filter: saturate(0.94);
}
.room-body { color: var(--ink-dim); font-weight: 300; font-size: 1rem; line-height: 1.72; }
.room-body p + p { margin-top: 0.85em; }
.room-body strong { color: var(--ink); font-weight: 500; }
.room-body ul { list-style: none; margin-top: 0.4em; }
.room-body li { padding: 0.7em 0; border-bottom: 1px solid rgba(255, 226, 173, 0.12); }
.room-body li:last-child { border-bottom: none; }
.room-body a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(255, 205, 107, 0.35); }
.room-body a:hover { border-bottom-color: var(--gold); }
.room-body .panel-btn {
  display: inline-block; margin-top: 1.4em; border: none;
  background: var(--gold); color: #2b2008; font-weight: 600;
  padding: 0.62rem 1.35rem; border-radius: 999px; text-decoration: none;
}

/* ── contact ── */
.ledger-contact { padding-top: clamp(3.5rem, 10vh, 6rem); }
.contact-grid {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.5rem;
}
.contact-grid h4 {
  font-size: 0.62rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold); font-weight: 500; margin-bottom: 0.8rem;
}
.contact-grid p { color: var(--ink-dim); font-weight: 300; line-height: 1.8; }
.contact-grid p + p { margin-top: 0.9rem; }
.contact-grid a { color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(255, 205, 107, 0.3); }
.contact-grid a:hover { color: var(--gold); border-bottom-color: var(--gold); }
.social-list { list-style: none; display: grid; gap: 0.15rem; }
.social-list a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.45rem 0; border-bottom: none;
  color: var(--ink-dim); font-weight: 300;
}
.social-list a:hover { color: var(--gold); }
.social-list img {
  width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none;
}
.video-frame {
  margin-top: 2.5rem; position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ledger-footer {
  margin-top: clamp(3rem, 9vh, 5rem); padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 0.82rem; font-weight: 300;
}
.ledger-footer p + p { margin-top: 0.35rem; }

/* ── when the document is up, the scene controls stand down ── */
body.reading .markers,
body.reading .chapter,
body.reading .progress-track { opacity: 0; pointer-events: none; }
.markers, .chapter, .progress-track { transition: opacity 0.45s ease; }

/* ── no WebGL: the document is the site ── */
body.no-webgl #scene,
body.no-webgl .hero,
body.no-webgl .chapter,
body.no-webgl .markers,
body.no-webgl .progress-track { display: none; }
body.no-webgl .ledger { background: var(--night); }
body.no-webgl .ledger-head { padding-top: 7rem; }

@media (max-width: 640px) {
  .ledger-head { padding-top: 30vh; }
  .room-img { height: clamp(160px, 26vh, 230px); }
}

/* Two entrances, with all information available without a camera journey. */
body:not(.ready) .hero, body:not(.ready) .hud-top { opacity: 1; }
body { background-image: radial-gradient(ellipse at 50% 20%, #342548, #0b0d22 80%); }
body.navigation-ready .ledger { display: none; }
.brand-symbol { color: var(--gold); font-size: 2.2rem !important; }
.hero-inner { margin: 4rem 0 5rem; width: min(760px, 100%); max-height: calc(100dvh - 170px); overflow-y: auto; scrollbar-width: thin; }
.hero-title { font-size: clamp(2.6rem, 8vw, 6.2rem); }
.hero-subtitle { color: var(--ink-dim); margin: 1rem 0 1.7rem; font-size: clamp(1rem, 2vw, 1.2rem); }
.start-guide-label { margin-bottom: 0.8rem; }
.path-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.path-card { display: flex; flex-direction: column; align-items: center; padding: 1.5rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(16,14,36,.86); backdrop-filter: blur(14px); color: var(--ink); text-decoration: none; transition: background .2s, border-color .2s; }
.path-card:hover { border-color: var(--gold); background: rgba(51,39,70,.95); }
.window-icon { color: var(--gold); font-size: 2.2rem; line-height: 1; margin-bottom: 1rem; }
.path-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.15rem, 2.5vw, 1.7rem); }
.path-card p { font-size: .9rem; color: var(--ink-dim); margin: .65rem 0 1.1rem; }
.path-link { color: var(--gold); font-size: .75rem; margin-top: auto; }
.hero-cta { text-decoration: none; }
.quick-nav { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: .2rem; padding: .4rem; max-width: calc(100% - 1rem); border: 1px solid var(--line); border-radius: 100px; background: rgba(16,14,36,.95); backdrop-filter: blur(16px); box-shadow: 0 8px 30px #0006; }
.quick-nav a { padding: .7rem 1rem; white-space: nowrap; border-radius: 30px; color: var(--ink-dim); font-size: .85rem; text-decoration: none; }
.quick-nav a:hover, .quick-nav a[aria-current] { color: var(--night); background: var(--gold); }
.hud-top { z-index: 65; }
body.panel-open .brand { visibility: hidden; }
.panel { top: 76px; bottom: 86px; width: min(800px, 62vw); }
.panel-inner { border: 1px solid var(--line); border-radius: 20px 0 0 20px; padding-bottom: 1.5rem; overscroll-behavior: contain; }
.panel-inner > .panel-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0; padding: .75rem 1.25rem; background: #15112b; border-bottom: 1px solid var(--line); }
.panel-toolbar a { color: var(--gold); font-size: .85rem; text-decoration: none; }
.panel-toolbar .panel-close { position: static; flex-shrink: 0; }
.panel-figure img { height: clamp(150px, 23vh, 240px); }
.panel-figure:empty { margin-bottom: 1rem; }
.panel-title { font-size: clamp(1.7rem, 3vw, 2.5rem); }
.path-tag { color: var(--gold); font-size: .8rem; }
.nested-windows { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; margin-top: 1.4rem; }
.nested-windows a { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-size: .9rem; background: #ffffff05; }
.nested-windows a::after { content: '→'; color: var(--gold); margin-left: auto; flex-shrink: 0; }
.nested-windows a:hover { background: #ffffff10; border-color: var(--gold); }
.directory { z-index: 64; top: 76px; max-height: calc(100dvh - 165px); overflow-y: auto; overscroll-behavior: contain; }
.directory li a { display: block; color: var(--gold); text-decoration: none; padding: .65rem; font-size: 1rem; }
.directory li ul { padding: 0 0 .8rem .8rem; }
.directory li li a { font-size: .85rem; color: var(--ink-dim); padding: .4rem .6rem; }
.directory a:hover { background: #ffffff0a; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.2rem; }
.photo-grid a { border: 0; }
.photo-grid img { display: block; width: 100%; height: 180px; object-fit: cover; border-radius: 10px; }
.photo-grid figcaption { font-size: .8rem; margin-top: .4rem; line-height: 1.4; }
.chapter { bottom: 6.5rem; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
[hidden] { display: none !important; }
body.no-webgl.navigation-ready .hero { display: flex; }
body.no-webgl .scroll-space { height: 0 !important; }
@media (max-width: 640px) {
  .hud-top { gap: .5rem; }
  .brand span { font-size: .9rem; }
  .brand b { font-size: .48rem; letter-spacing: .12em; }
  .brand-symbol { display: none !important; }
  .hud-actions { gap: .3rem; }
  .chip { padding: .5rem .7rem; font-size: .73rem; }
  .hero { padding: 0 1rem; }
  .hero-inner { max-height: calc(100dvh - 150px); margin: 4rem 0 4.5rem; }
  .hero-title { font-size: clamp(2.6rem, 11vw, 4.4rem); }
  .hero-subtitle { margin: .7rem 0 1rem; font-size: .9rem; }
  .path-choices { gap: .65rem; }
  .path-card { padding: 1.1rem .7rem; border-radius: 16px; }
  .path-card h2 { font-size: 1.16rem; }
  .path-card p { font-size: .78rem; margin: .6rem 0; }
  .path-link { font-size: .66rem; }
  .window-icon { margin-bottom: .65rem; font-size: 1.8rem; }
  .quick-nav { border-radius: 20px; gap: 0; width: max-content; padding: .3rem; }
  .quick-nav a { white-space: normal; text-align: center; font-size: .67rem; padding: .6rem .5rem; line-height: 1.25; }
  .panel { top: 66px; bottom: 85px; height: auto; width: 100%; }
  .panel-inner { border-radius: 18px; }
  .nested-windows a { padding: .8rem; font-size: .82rem; }
  .photo-grid { gap: .7rem; }
  .photo-grid img { height: 145px; }
  .directory { top: 66px; max-width: calc(100vw - 2rem); }
}
/* The entrance is a project chooser; put its child windows before the overview. */
.panel-kicker { margin-top: 1.5rem; }
.panel-summary { color: var(--ink-dim); font-size: .85rem; line-height: 1.55; margin-bottom: 1.5rem; }
.panel-summary strong { color: var(--ink); font-weight: 500; }
.panel-summary a { color: var(--gold); }
.panel-sections h3 { font-size: 1rem; font-weight: 500; color: var(--ink); }
.panel-sections p { color: var(--ink-dim); font-size: .85rem; line-height: 1.5; margin-top: .35rem; }
.panel-sections .nested-windows { margin-top: .9rem; }
.panel-sections:not([hidden]) + .panel-body { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.nested-windows a { justify-content: flex-start; gap: .75rem; min-height: 78px; padding: .7rem; background: rgba(255,255,255,.035); }
.window-thumbnail { width: 48px; height: 48px; flex-shrink: 0; object-fit: cover; border-radius: 8px; }
.window-card-title { flex: 1; line-height: 1.35; overflow-wrap: anywhere; }
.project-badge { display: block; margin-top: .3rem; color: var(--gold); font-size: .7rem; }
/* Child content stays inside its organization's panel, with its own controls. */
.project-window { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(8, 7, 23, .5); padding-bottom: 1.2rem; }
.project-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 1.2rem; border-bottom: 1px solid var(--line); background: #1d1833; }
.project-toolbar a { color: var(--gold); text-decoration: none; font-size: .8rem; line-height: 1.4; }
.project-close { width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); font-size: 1.3rem; cursor: pointer; }
.project-close:hover { background: rgba(255, 240, 200, .12); }
.project-window .panel-figure { margin-bottom: 0; }
.project-window .panel-figure img { height: 170px; }
.project-title { font-family: var(--serif); font-size: 1.8rem; font-weight: 400; line-height: 1.15; margin: 1.2rem; }
.project-window > .panel-body, .project-window > .panel-nav { margin-left: 1.2rem; margin-right: 1.2rem; }
.project-window > .panel-body { font-size: 1rem; }
@media (max-width: 640px) {
  .nested-windows a { gap: .5rem; padding: .6rem; min-height: 76px; }
  .window-thumbnail { width: 36px; height: 42px; border-radius: 6px; }
  .nested-windows a::after { display: none; }
  .project-toolbar { padding: .6rem .85rem; }
  .project-title { font-size: 1.5rem; margin: 1rem .85rem; }
  .project-window > .panel-body, .project-window > .panel-nav { margin-left: .85rem; margin-right: .85rem; }
  .project-window > .panel-body { font-size: .92rem; }
  .project-window .panel-figure img { height: 130px; }
}
.panel-inner > .panel-toolbar { margin-left: 0; margin-right: 0; }
.video-frame iframe { border: 0; }
.path-card { min-width: 0; }
.path-card h2 { overflow-wrap: anywhere; }
.room:not([data-plate])::before { display: none; }

/* Performance poster: real dancers lead; the palace remains behind the tour. */
.hero { text-align: left; padding: 0 2rem; }
.hero::before { background: linear-gradient(105deg, #171325f5 20%, #171325d9 65%, #17132599); }
.hero-inner { position: relative; display: block; width: min(1160px, 100%); margin: 72px 0 82px; max-height: calc(100dvh - 170px); padding: .5rem; }
.hero-stage { display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: clamp(1.5rem, 4vw, 4rem); }
.hero-kicker { font-size: .8rem; letter-spacing: .035em; text-transform: none; color: var(--ink-dim); margin-bottom: 1rem; }
.hero-title { font-size: clamp(3rem, 5.8vw, 5.8rem); font-weight: 500; line-height: .98; letter-spacing: -.035em; text-shadow: none; }
.hero-subtitle { font-size: clamp(.95rem, 1.25vw, 1.1rem); line-height: 1.55; margin: 1.1rem 0 0; max-width: 34rem; }
.hero-actions { justify-content: flex-start; margin-top: 1.35rem; gap: .6rem; }
.hero-cta, .hero-ghost { border-radius: 10px; padding: .8rem 1.1rem; font-size: .85rem; box-shadow: none; }
.hero-cta { background: #f8cf80; }
.hero-cta:hover { box-shadow: none; }
.hero-performance { position: relative; display: block; min-width: 0; border-radius: 16px; overflow: hidden; color: white; text-decoration: none; background: #292434; }
.hero-performance > img { display: block; width: 100%; height: auto; }
.performance-caption { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.1rem; background: #ae3548; font-size: .78rem; }
.performance-caption > :first-child { font-size: 1rem; font-weight: 500; }
.path-heading { margin: 1.6rem 0 .7rem; }
.path-heading .start-guide-label { font-size: .85rem; font-weight: 400; letter-spacing: 0; text-transform: none; margin: 0; color: var(--ink-dim); }
.path-card { position: relative; isolation: isolate; overflow: hidden; min-height: 152px; align-items: flex-start; justify-content: flex-end; padding: 1.25rem 1.4rem; border: 1px solid #ffffff24; border-radius: 14px; backdrop-filter: none; background: #221b30; }
.path-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; z-index: -2; }
.path-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #131020ee, #1310209c 65%, #13102030); }
.path-copy { max-width: calc(100% - 2rem); }
.path-card h2 { font-size: clamp(1.35rem, 2.25vw, 2rem); line-height: 1.1; }
.path-card p { margin: .4rem 0 .75rem; font-size: .86rem; color: #f8f0ddd9; }
.path-link { font-size: .76rem; }
.path-arrow { position: absolute; right: 1.2rem; bottom: 1.1rem; font-size: 1.8rem; color: var(--gold); }
.path-card:hover { border-color: var(--gold); }
.panel-inner { background: #191529f5; }
.panel-open .hero-inner { opacity: .2; }
.panel-title { letter-spacing: -.035em; }
.panel-title:focus, .project-title:focus { outline: none; }
.nested-windows { gap: .85rem; }
.nested-windows a { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: 0 0 .85rem; overflow: hidden; align-content: start; background: #ffffff06; }
.window-thumbnail { grid-column: 1 / -1; width: 100%; height: 112px; border-radius: 0; margin-bottom: .8rem; }
.window-card-title { padding-left: .9rem; }
.nested-windows a::after { margin: 0 .9rem 0 0; align-self: center; }
.project-window .panel-figure img { height: auto; max-height: 330px; object-fit: contain; background: #100e1a; }
.project-window .panel-figure::after { display: none; }
.gallery-intro { margin-bottom: 1.5rem; }
.gallery-album { border-top: 1px solid var(--line); }
.gallery-album:last-of-type { border-bottom: 1px solid var(--line); }
.gallery-album summary { padding: 1rem 0; cursor: pointer; color: var(--ink); font-weight: 500; font-size: 1.05rem; }
.gallery-album summary::marker { color: var(--gold); }
.gallery-album summary span { float: right; color: var(--ink-dim); font-size: .75rem; font-weight: 400; padding-top: .2rem; }
.gallery-album .photo-grid { margin: 0 0 1.5rem; align-items: start; }
.gallery-album .photo-grid a { display: block; border: 0; }
.gallery-album .photo-grid a:first-child { grid-column: 1 / -1; }
.gallery-album .photo-grid img { height: auto; border-radius: 8px; }
.gallery-album figcaption { color: var(--ink-dim); font-size: .78rem; }
@media (min-width: 900px) and (max-height: 760px) {
  .hero-title { font-size: clamp(3rem, 5vw, 4.5rem); }
  .hero-stage { grid-template-columns: 1fr 1fr; }
  .hero-performance { max-width: 450px; justify-self: end; }
  .path-card { min-height: 130px; }
  .path-heading { margin-top: 1rem; }
}
@media (max-width: 760px) {
  .hero { padding: 0 .9rem; }
  .hero-inner { max-height: calc(100dvh - 158px); margin: 66px 0 84px; padding: .3rem; }
  .hero-stage { grid-template-columns: 1fr; gap: 1.1rem; }
  .hero-kicker { font-size: .72rem; margin-bottom: .6rem; }
  .hero-title { font-size: clamp(2.7rem, 9vw, 4rem); }
  .hero-title br { display: none; }
  .hero-subtitle { font-size: .9rem; margin-top: .75rem; }
  .hero-subtitle br { display: none; }
  .hero-actions { margin-top: .85rem; }
  .hero-cta, .hero-ghost { font-size: .78rem; padding: .65rem .85rem; }
  .hero-performance > img { max-height: 250px; object-fit: cover; object-position: center top; }
  .performance-caption { padding: .6rem .8rem; font-size: .7rem; }
  .performance-caption > :first-child { font-size: .85rem; }
  .path-heading { margin-top: 1.1rem; }
  .path-choices { gap: .6rem; }
  .path-card { min-height: 165px; padding: 1rem .8rem; }
  .path-card::before { background: linear-gradient(0deg, #131020f5, #13102099); }
  .path-copy { max-width: 100%; }
  .path-card h2 { font-size: 1.25rem; }
  .path-card p { font-size: .77rem; line-height: 1.35; }
  .path-link { font-size: .7rem; }
  .path-arrow { display: none; }
  .nested-windows a { padding: 0 0 .75rem; gap: 0; }
  .window-thumbnail { width: 100%; height: 90px; border-radius: 0; margin-bottom: .6rem; }
  .window-card-title { padding: 0 .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-cta, .hero-ghost, .path-card { transition: none; }
  .hero-cta:hover, .hero-ghost:hover { transform: none; }
}
