/* Layout: one left edge for brand, copy and title blocks; the scene owns the rest of the frame.
   Kelvin palette: colours named after light temperature. */
:root {
  --paper: #f1eadb;
  --ink: #2b2520;
  --night: 0;
  --k2200: #ffad5a;
  --k2700: #ffc58a;
  --k3000: #ffd6a8;
  --k4000: #fff1df;
  --indigo: #0b1230;
  --fg: var(--ink);
  --fg-soft: rgba(43, 37, 32, 0.8);
  --fg-faint: rgba(43, 37, 32, 0.5);
  --rule: rgba(43, 37, 32, 0.24);
  --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --sans: 'Instrument Sans', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
  --f: 10px;           /* frame inset */
  --bar: 48px;         /* top bar height */
  --cell: 48px;        /* menu cell / rail width */
  --cell-rail: 0px;    /* rail width that content must clear */
  --gutter-in: 20px;
  --edge: calc(var(--f) + var(--gutter-in));
  --inverse: var(--paper);
  --surface: rgba(241, 234, 219, 0.97);
  --fill: rgba(43, 37, 32, 0.06);
  --line: rgba(43, 37, 32, 0.1);         /* frame hairlines */       /* scroll progress tint in the top bar */
  --track: 0.22em;
  color-scheme: light;
}
:root.is-dark {
  --fg: var(--k4000);
  --fg-soft: rgba(255, 241, 223, 0.82);
  --fg-faint: rgba(255, 241, 223, 0.5);
  --rule: rgba(255, 241, 223, 0.26);
  --inverse: var(--indigo);
  --surface: rgba(11, 18, 48, 0.96);
  --fill: rgba(255, 241, 223, 0.1);
  --line: rgba(255, 241, 223, 0.2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--fg);
  font: 400 0.9375rem/1.6 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root.is-dark body { background: var(--indigo); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.spacer { height: 2000vh; }

/* ── frame: hairline border inset from the screen edge, a top bar and a left rail */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.frame {
  position: fixed;
  inset: var(--f);
  z-index: 9;
  border: 1px solid var(--line);
  pointer-events: none;
  transition: border-color 0.8s ease;
}
.bar {
  position: fixed;
  inset-block-start: var(--f);
  inset-inline: var(--f);
  z-index: 10;
  display: flex;
  align-items: stretch;
  height: var(--bar);
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  transition: color 0.8s ease, border-color 0.8s ease;
}
.bar__menu {
  flex: none;
  display: grid;
  place-content: center;
  gap: 6px;
  width: var(--cell);
  border: 0;
  border-inline-end: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.bar__menu i { display: block; width: 20px; height: 1px; background: currentColor; transition: transform 0.4s ease; }
.bar__menu[aria-expanded="true"] i:first-child { transform: translateY(3.5px) rotate(45deg); }
.bar__menu[aria-expanded="true"] i:last-child { transform: translateY(-3.5px) rotate(-45deg); }
.bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 14px;
  color: inherit;
  text-decoration: none;
  font: 400 0.75rem/1 var(--serif);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.bar__mark { flex: none; width: 20px; height: 20px; }
.bar__word { flex: none; width: 140px; height: 9px; }   /* wordmark aspect ≈ 15.4 : 1 */
.bar__nav {
  position: absolute;
  inset-block: 0;
  left: 50%;
  display: none;
  align-items: center;
  gap: 34px;
  transform: translateX(-50%);
}
/* labels scramble through random characters, then settle into the word (main.js) */
.bar__nav button {
  height: 13px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 500 0.6875rem/13px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: pre;
  cursor: pointer;
  transition: color 0.3s ease;
}
.bar__nav button:hover, .bar__nav button:focus-visible { color: var(--k2200); }
.bar__cta {
  display: grid;
  place-items: center;
  margin: 0;
  margin-inline-start: auto;   /* pushes the quote button to the far right, flush with the frame lines */
  padding-inline: 14px 12px;
  white-space: nowrap;
  background: var(--fg);
  color: var(--inverse);
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: background 0.8s ease, color 0.8s ease;
}
.bar__cta:hover, .bar__cta:focus-visible { background: var(--k2200); color: var(--ink); }
/* scroll progress fills the bar itself, after the menu cell, with a hairline at its leading edge */
.progress {
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(var(--cell) - 1px);   /* its leading edge sits on the menu cell's line at 0%, not beside it */
  z-index: -1;
  width: calc((100% - var(--cell)) * var(--p, 0) + 1px);
  background: var(--fill);
  border-inline-end: 1px solid var(--line);
  pointer-events: none;
  transition: background 0.8s ease;
}

.rail {
  position: fixed;
  inset-block: calc(var(--f) + var(--bar)) var(--f);
  inset-inline-start: var(--f);
  z-index: 10;
  display: none;
  width: var(--cell);
  border-inline-end: 1px solid var(--line);
  color: var(--fg);
  transition: color 0.8s ease, border-color 0.8s ease;
}
.rail__logo {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: grid;
  justify-items: center;
  gap: 18px;
  color: inherit;
  text-decoration: none;
  transform: translateY(-50%);
}
.rail__mark { width: 30px; height: 30px; }
/* lantern in the middle of the rail: drawn by day, lit when the site goes dark */
.rail__lamp {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: grid;
  place-items: center;
  height: 120px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  transform: translateY(-50%);
}
.rail__lamp svg { width: 26px; height: 58px; overflow: visible; }
.rail__lamp-beam, .rail__lamp-glow, .rail__lamp-glass { opacity: 0; transition: opacity 0.9s ease; }
.rail__lamp-bulb { transition: stroke 0.6s ease, fill 0.6s ease; }
.rail__lamp:hover .rail__lamp-glow, .rail__lamp:focus-visible .rail__lamp-glow { opacity: 0.45; }
:root.is-dark .rail__lamp-beam { opacity: 1; animation: lamp-on 0.7s steps(1, end); }
:root.is-dark .rail__lamp-glow { opacity: 1; animation: lamp-on 0.7s steps(1, end); }
:root.is-dark .rail__lamp-glass { opacity: 0.32; animation: lamp-on 0.7s steps(1, end); }
:root.is-dark .rail__lamp-bulb { stroke: var(--k2700); fill: #fff1df; }
/* a short flicker as it switches on, like a real lamp warming up */
@keyframes lamp-on {
  0% { opacity: 0; } 12% { opacity: 0.8; } 22% { opacity: 0.1; } 34% { opacity: 0.9; } 46% { opacity: 0.35; } 60%, 100% { opacity: 1; }
}
.rail__clock {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  height: var(--cell);
  border-top: 1px solid var(--line);
  font: 400 0.625rem/1 var(--mono);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.clock__dial {
  position: relative;
  width: 26px;
  height: 13px;
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
}
.clock__sun {
  --a: -80deg;
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--k2200);
  box-shadow: 0 0 calc(4px + var(--night) * 10px) var(--k2200);
  transform: rotate(var(--a)) translateY(-12px);
  transform-origin: 50% 2.5px;
}

/* ── menu: a night drawer from the left (after kprverse), in brand colours and type */
.menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  padding: var(--f);
  background: rgba(43, 37, 32, 0.3);
}
.menu[hidden] { display: none; }
.menu__panel {
  --m-rule: rgba(241, 234, 219, 0.14);
  display: grid;
  grid-template-columns: 1fr var(--cell);
  width: min(860px, 100%);
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: var(--ink);           /* brand ink, the colour of the logo */
  color: var(--paper);
  animation: menu-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes menu-in { from { opacity: 0; transform: translateX(-24px); } }
.menu__body { display: grid; grid-template-rows: 1fr auto auto auto; min-width: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.menu__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 22px 26px;
  border-top: 1px solid var(--m-rule);
}
.menu__row--main { align-content: start; padding-block: 28px 32px; border-top: 0; }
.menu__label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 500 0.625rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu__label i { width: 6px; height: 6px; background: var(--k2200); }
.menu__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.menu__list li { display: flex; align-items: flex-start; gap: 12px; }
.menu__list button {
  padding: 0.04em 0.12em 0.02em;
  margin-inline-start: -0.12em;
  border: 0;
  background: none;
  color: inherit;
  font: 600 clamp(1.7rem, min(6.2vw, 7.2vh), 4.25rem)/0.98 var(--sans);   /* fits seven lines in short windows */
  letter-spacing: -0.035em;
  text-transform: uppercase;
  text-align: start;
  white-space: pre;
  cursor: pointer;
  animation: menu-item 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.menu__list li:nth-child(1) button { animation-delay: 0.04s; }
.menu__list li:nth-child(2) button { animation-delay: 0.08s; }
.menu__list li:nth-child(3) button { animation-delay: 0.12s; }
.menu__list li:nth-child(4) button { animation-delay: 0.16s; }
.menu__list li:nth-child(5) button { animation-delay: 0.2s; }
.menu__list li:nth-child(6) button { animation-delay: 0.24s; }
.menu__list li:nth-child(7) button { animation-delay: 0.28s; }
@keyframes menu-item { from { opacity: 0; transform: translateY(14px); } }
.menu__list button:hover, .menu__list button:focus-visible { color: var(--k2200); }
/* the chapter you are on: an amber block with a notched corner */
.menu__list .is-current button {
  background: var(--k2200);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 0.28em), calc(100% - 0.28em) 100%, 0 100%);
}
.menu__tag {
  display: none;
  margin-top: 0.5em;
  font: 500 0.625rem/1.3 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--k2200);
  white-space: nowrap;
}
.menu__list .is-current .menu__tag { display: block; }
.menu__links { display: grid; gap: 8px; font: 500 0.75rem/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.menu__links a { color: inherit; text-decoration: none; }
.menu__links a:hover, .menu__links a:focus-visible { color: var(--k2200); }
.menu__links span { color: rgba(241, 234, 219, 0.7); }
.menu__row--foot {
  display: flex;
  justify-content: space-between;
  font: 500 0.625rem/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(241, 234, 219, 0.6);
}
.menu__side { position: relative; border-inline-start: 1px solid var(--m-rule); }
.menu__close {
  display: grid;
  place-content: center;
  width: 100%;
  height: var(--bar);
  border: 0;
  border-bottom: 1px solid var(--m-rule);
  background: none;
  color: inherit;
  cursor: pointer;
}
.menu__close i { display: block; width: 20px; height: 1px; background: currentColor; transform: translateY(0.5px) rotate(45deg); }
.menu__close i + i { transform: translateY(-0.5px) rotate(-45deg); }
.menu__close:hover i, .menu__close:focus-visible i { background: var(--k2200); }
.menu__mark { position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); }
.menu__dots {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 14px;
  height: 3px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px);
  opacity: 0.7;
}
@media (min-width: 768px) {
  .menu__row { grid-template-columns: 200px 1fr; padding-inline: 30px; }
  .menu__row--main { align-content: center; padding-block: 30px; }
  .menu__row--main .menu__label { align-self: start; margin-top: 0.9em; }
}

/* ── scroll cue, bottom right inside the frame */
.scroll-cue {
  position: fixed;
  inset-inline-end: calc(var(--f) + 22px);
  inset-block-end: calc(var(--f) + 18px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--fg);
  font: 500 0.5625rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.6s ease, color 0.8s ease;
}
.scroll-cue i {
  width: 7px;
  height: 7px;
  border-inline-end: 1px solid currentColor;
  border-block-end: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  animation: cue-bob 1.8s ease-in-out infinite;
}
@keyframes cue-bob { 50% { transform: translateY(1px) rotate(45deg); } }
:root.is-scrolled .scroll-cue { opacity: 0; }

/* ── chapters */
.chapters { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.chapter {
  --o: 0;
  position: absolute;
  inset-inline: var(--edge);
  inset-block-end: 112px;
  max-width: 34rem;
  opacity: var(--o);
  transform: translateY(calc((1 - var(--o)) * 16px));
  color: var(--fg);
  transition: color 0.8s ease;
}
.chapter.is-active { pointer-events: auto; }
.chapter::before {
  content: '';
  position: absolute;
  inset: -48px -72px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(241, 234, 219, 0.82), rgba(241, 234, 219, 0));
  transition: background 0.8s ease;
}
:root.is-dark .chapter::before { background: radial-gradient(closest-side, rgba(7, 10, 26, 0.62), rgba(7, 10, 26, 0)); }

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
  font: 500 0.6875rem/1.4 var(--sans);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--fg-soft);
}
.eyebrow::before { content: ''; width: 28px; height: 1px; background: currentColor; opacity: 0.55; }
.eyebrow b {
  font: 400 0.6875rem/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--fg);
}
h1, h2 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
h1 { font-size: clamp(3rem, 7.4vw, 7.75rem); line-height: 0.94; }
h2 { font-size: clamp(2.3rem, 5vw, 4.4rem); line-height: 1; }
h1 em, h2 em { font-style: italic; font-weight: 400; }
h1 span, h1 em { display: block; }
h1 em { color: var(--fg-soft); }
:root.is-dark h2 em { color: var(--k2700); text-shadow: 0 0 30px rgba(255, 173, 90, 0.4); }
.chapter p:not(.eyebrow) {
  margin: 0;
  max-width: 26rem;
  color: var(--fg-soft);
  font-size: 0.9375rem;
  line-height: 1.65;
  letter-spacing: 0;
}

.chapter--hero { inset-block-start: calc(var(--f) + var(--bar) + 40px); inset-block-end: auto; max-width: 46rem; }
.chapter--hero h1 { margin-bottom: 24px; }
.lede { font-size: 1rem; }
.chapter--hero .lede { max-width: 25rem; }

.sheet {
  --o: 0;
  position: absolute;
  inset-inline: var(--edge);
  inset-block-end: 72px;
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  font: 400 0.5625rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-soft);
  opacity: var(--o);
}
.sheet span { padding: 8px 10px; border-inline-end: 1px solid var(--rule); }
.sheet span:last-child { border-inline-end: 0; }
.sheet__wide { flex: 1; }

/* two fixed lines: each half of the headline stays on its own line at every width */
.h2-pair { font-size: clamp(1.75rem, 4.6vw, 3.6rem); }
.h2-pair span, .h2-pair em { display: block; white-space: nowrap; }

/* ── closing chapter: legend + actions */
.chapter--end { inset-block-end: 104px; }
.legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 28px;
  margin: 24px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--rule);
  list-style: none;
  font: 500 0.6875rem/1.3 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-soft);
}
.legend li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.legend em { margin-inline-start: auto; font: 400 0.6875rem/1 var(--mono); font-style: normal; letter-spacing: 0.06em; color: var(--k2700); }
.sym { flex: none; width: 16px; height: 16px; }
.sym--down { border: 1px solid var(--k2700); border-radius: 50%; box-shadow: 0 0 8px rgba(255, 173, 90, 0.5); }
.sym--line { height: 5px; border: 1px solid var(--k2700); box-shadow: 0 0 8px rgba(255, 173, 90, 0.5); }
.sym--pend { background: var(--k2200); clip-path: polygon(50% 8%, 96% 92%, 4% 92%); }
.sym--wash { height: 8px; border: 1px solid var(--k2700); border-bottom: 0; border-radius: 16px 16px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 2px;
  font: 600 0.6875rem/1 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}
.btn--light { background: var(--k4000); color: var(--indigo); }
.btn--light:hover, .btn--light:focus-visible { box-shadow: 0 0 40px 2px rgba(255, 173, 90, 0.5); }
.btn--ghost { color: var(--fg); border: 1px solid var(--rule); }
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--k2700); }
.btn:focus-visible, .switches button:focus-visible, .bar a:focus-visible, .bar button:focus-visible, .rail a:focus-visible, .menu button:focus-visible { outline: 1px solid var(--k2700); outline-offset: 3px; }

/* ── layer / room switches (Najdi triangle markers glow when on) */
.switches {
  position: fixed;
  z-index: 10;
  inset-inline: var(--edge);
  inset-block-end: calc(var(--f) + 10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 6px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s;
}
:root.show-switches:not(.act-int) .switches--ext,
:root.show-switches.act-int .switches--int { opacity: 1; visibility: visible; }
.switches button {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--fg-soft);
  font: 500 0.5625rem/1.2 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: start;
  cursor: pointer;
  transition: color 0.5s ease, border-color 0.5s ease, background 0.5s ease;
}
.switches span { overflow: hidden; text-overflow: ellipsis; }
.switches em { display: none; font: 400 0.625rem/1 var(--mono); font-style: normal; letter-spacing: 0.04em; margin-inline-start: auto; opacity: 0.7; }
.switches .tri {
  flex: none;
  width: 8px;
  height: 7px;
  background: var(--rule);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transition: background 0.5s ease, filter 0.5s ease;
}
.switches button.is-on { color: var(--fg); border-color: rgba(255, 197, 138, 0.5); background: rgba(255, 173, 90, 0.07); }
.switches button.is-on .tri { background: var(--k2200); filter: drop-shadow(0 0 5px var(--k2200)); }
.switches button:hover .tri { background: var(--k2700); }

/* ── spec callouts */
.callout-svg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; overflow: visible; }
.callout-svg g { opacity: 0; }
.c-ring { fill: none; stroke: var(--k2700); stroke-width: 1; opacity: 0.9; }
.c-ring--far { opacity: 0.35; stroke-dasharray: 2 4; animation: falloff 6s linear infinite; transform-origin: 0 0; }
.c-dot { fill: var(--k4000); }
.c-lead { fill: none; stroke: var(--k4000); stroke-width: 1; opacity: 0.7; }
@keyframes falloff { to { transform: rotate(360deg); } }
.callout {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 7;
  display: grid;
  gap: 5px;
  padding: 9px 13px;
  border-inline-start: 1px solid var(--k2700);
  /* a solid tint, no backdrop-filter: blurring the live WebGL canvas made Chrome flash black boxes */
  background: rgba(7, 10, 26, 0.8);
  color: var(--k4000);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.callout b { font: 600 0.625rem/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--k2700); }
.callout span { font: 400 0.625rem/1 var(--mono); letter-spacing: 0.04em; }

/* ── plan labels on the villa drawing */
.plan-label {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.plan-label b { font: 600 0.625rem/1 var(--sans); letter-spacing: 0.22em; text-transform: uppercase; }
.plan-label span { font: italic 400 0.8125rem/1 var(--serif); color: var(--fg-soft); }
.plan-label--dim span { font: 400 0.5625rem/1 var(--mono); font-style: normal; letter-spacing: 0.08em; color: var(--ink); }
.plan-label--v span { display: block; transform: rotate(-90deg); }

/* ── intro: icon blocks ascend into place, light shows through the gaps, the wordmark draws,
      then the paper lifts away (main.js adds .is-ready once the scene is loaded) */
.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  /* the paper lifts on the compositor (transform, not clip-path), so it stays smooth even when
     a large screen keeps the WebGL scene busy */
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1), visibility 0s linear 1s;
  cursor: pointer;
}
:root.is-ready .intro { transform: translate3d(0, -100%, 0); visibility: hidden; }
.intro__lockup {
  display: grid;
  justify-items: center;
  gap: 26px;
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.6s ease;
}
:root.is-ready .intro__lockup { transform: translateY(-40px); opacity: 0; }
.intro__icon { width: 68px; height: 68px; overflow: visible; }
.intro__block {
  opacity: 0;
  transform: translate(-10px, 14px);
  animation: block-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(0.15s + var(--i) * 0.13s);
}
@keyframes block-rise { to { opacity: 1; transform: none; } }
.intro__word { width: min(330px, 74vw); height: auto; overflow: visible; }
.intro__glyph {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: glyph-draw 0.45s cubic-bezier(0.5, 0, 0.3, 1) forwards;
  animation-delay: calc(1.05s + var(--i) * 0.055s);
}
@keyframes glyph-draw { to { stroke-dashoffset: 0; } }
.intro__tag {
  margin: 0;
  font: 500 0.5625rem/1 var(--sans);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--fg-soft);
  opacity: 0;
  animation: tag-in 0.8s ease forwards 2.15s;
}
@keyframes tag-in { from { opacity: 0; letter-spacing: 0.8em; } to { opacity: 1; letter-spacing: 0.5em; } }
@media (min-width: 768px) {
  .intro__icon { width: 84px; height: 84px; }
  .intro__word { width: 400px; }
  .intro__tag { font-size: 0.625rem; }
}

.no-webgl-msg { display: none; }
:root.no-webgl .no-webgl-msg {
  display: block;
  position: fixed;
  inset-inline: var(--edge);
  inset-block-start: 45%;
  z-index: 30;
  text-align: center;
}
:root.no-webgl .intro { display: none; }

/* ── larger screens */
@media (min-width: 480px) {
  :root { --gutter-in: 24px; }
  .switches em { display: inline; }
  .legend { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  /* the frame opens up: wider inset, a taller bar, and the left rail carrying the logo */
  :root {
    --f: 20px;
    --bar: 52px;
    --cell: 64px;
    --cell-rail: 64px;
    --gutter-in: clamp(28px, 3.5vw, 56px);
    --edge: calc(var(--f) + var(--cell) + var(--gutter-in));
  }
  .rail { display: block; }
  /* icon and wordmark side by side, top-left in the bar */
  .bar__brand { gap: 14px; padding-inline: 24px; }
  .bar__mark { width: 24px; height: 24px; }
  .bar__word { width: 176px; height: 11.4px; }
  .bar__nav { display: flex; }
  .bar__cta { padding-inline: 28px; }
  .chapter { inset-inline-end: auto; inset-block-end: 14vh; width: min(36rem, 46vw); }
  .chapter--end { inset-block-end: 10vh; width: min(44rem, 52vw); }
  /* the hero alone sits centred on the left edge; the elevation owns the right half */
  .chapter--hero {
    inset-block-start: 50%;
    inset-block-end: auto;
    width: min(46rem, 48vw);
    transform: translateY(calc(-50% + (1 - var(--o)) * 16px));
  }
  .chapter--hero h1 { font-size: clamp(3rem, 5.1vw, 6.25rem); }
  h1 span { white-space: nowrap; }
  .sheet { inset-inline-end: auto; inset-block-end: calc(var(--f) + 22px); width: min(34rem, 46vw); font-size: 0.625rem; }
  .switches {
    inset-inline-start: auto;
    inset-inline-end: calc(var(--f) + 24px);
    inset-block-end: auto;
    inset-block-start: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    width: 14rem;
  }
  .switches button { font-size: 0.625rem; padding: 0 14px; }
  .callout b, .callout span { font-size: 0.6875rem; }
}

@media (min-width: 1280px) {
  .chapter p:not(.eyebrow) { font-size: 1rem; }
}

/* short landscape windows: drop the title block, it would collide with the copy */
@media (max-height: 620px) {
  .sheet { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .c-ring--far, .scroll-cue i { animation: none; }
  :root.is-dark .rail__lamp-beam, :root.is-dark .rail__lamp-glow, :root.is-dark .rail__lamp-glass { animation: none; }
  /* intro shows the finished lockup straight away and simply fades */
  .intro__block, .intro__glyph, .intro__tag { animation: none; opacity: 1; transform: none; stroke-dashoffset: 0; }
  .intro { transition: opacity 0.5s ease, visibility 0s linear 0.5s; transform: none; }
  :root.is-ready .intro { opacity: 0; transform: none; }
}
