/* Nikhil Kale · Front Stage
   Warm neutrals, one metal. Fraunces for display (optical sizing does the work),
   Geist for everything else, Geist Mono for the instrument. Light and dark are peers. */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin-italic.woff2') format('woff2');
  font-weight: 300 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('../fonts/geist-latin.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/geist-mono-latin.woff2') format('woff2');
  font-weight: 400 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #0B0A08;
  --surface: #13120F;
  --ink: #F3EFE8;
  --ink-2: #BCB6AC;
  --ink-3: #8A847B;
  --line: rgba(243, 239, 232, 0.14);
  --line-strong: rgba(243, 239, 232, 0.32);
  --brass: #C29A62;
  --bronze-hi: #DDBE8C;
  --bronze-deep: #A07848;
  --brass-ink: #0B0A08;
  --scrim: rgba(11, 10, 8, 0.9);

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --accent: var(--serif);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gutter: clamp(20px, 4.4vw, 72px);
  --max: 1440px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark light;
}

:root[data-theme="light"] {
  --bg: #F4F2ED;
  --surface: #FFFEFB;
  --ink: #17150F;
  --ink-2: #46423A;
  --ink-3: #6A655C;
  --line: rgba(23, 21, 15, 0.14);
  --line-strong: rgba(23, 21, 15, 0.34);
  --brass: #84612E;
  --bronze-hi: #A07A43;
  --bronze-deep: #6E4F24;
  --brass-ink: #F4F2ED;
  --scrim: rgba(244, 242, 237, 0.92);
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F2ED;
    --surface: #FFFEFB;
    --ink: #17150F;
    --ink-2: #46423A;
    --ink-3: #6A655C;
    --line: rgba(23, 21, 15, 0.14);
    --line-strong: rgba(23, 21, 15, 0.34);
    --brass: #84612E;
    --bronze-hi: #A07A43;
    --bronze-deep: #6E4F24;
    --brass-ink: #F4F2ED;
    --scrim: rgba(244, 242, 237, 0.92);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--brass); color: var(--brass-ink); }
a { color: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

:focus-visible {
  outline: 1.5px solid var(--brass);
  outline-offset: 5px;
  border-radius: 2px;
}

.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 16px; top: 12px; z-index: 30;
  padding: 10px 14px; background: var(--ink); color: var(--bg);
  font: 500 13px/1 var(--sans); text-decoration: none;
  transform: translateY(-160%); transition: transform 0.3s var(--ease);
}
.skip:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------------------------------------------------------------- field */
.field {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0; pointer-events: none;
}
.field-fallback { display: none; }
.no-webgl .field { display: none; }
.no-webgl .field-fallback {
  display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 68% 46%, color-mix(in srgb, var(--ink) 7%, transparent), transparent 70%);
}
.no-webgl .field-fallback span {
  position: absolute; left: 68%; top: 46%; width: 34vmin; height: 34vmin;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 14px color-mix(in srgb, var(--ink) 3%, transparent);
}
.no-webgl .field-fallback span::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--brass);
}

main, .coda { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- chrome */
.chrome {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 22px var(--gutter);
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
.chrome::before {
  content: ''; position: absolute; inset: 0 0 -56px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 55%, transparent 100%);
}
.mark {
  justify-self: start;
  font: 400 23px/1 var(--serif);
  letter-spacing: -0.005em;
  text-decoration: none;
}
.act {
  display: flex; gap: 12px; align-items: baseline;
  font: 400 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
}
.act [data-act-num] { color: var(--brass); }
.act [data-act] { color: var(--ink-2); min-width: 12ch; }
.nav { justify-self: end; display: flex; gap: 28px; }
.nav a {
  font: 450 13.5px/1 var(--sans); letter-spacing: 0.01em; text-decoration: none;
  color: var(--ink-2); padding: 8px 0; position: relative;
  transition: color 0.4s var(--ease);
}
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav { align-items: center; }
.theme-toggle {
  display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -6px -4px 0;
  padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  color: var(--ink-2); transition: color 0.4s var(--ease);
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:focus-visible { outline: 1px solid var(--brass); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.25; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}
.progress {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 0; height: 1px;
  background: var(--line);
}
.progress span {
  position: absolute; inset: 0; background: var(--brass);
  transform: scaleX(0); transform-origin: left; will-change: transform;
}


/* ---------------------------------------------------------------- shared */
.label {
  display: flex; gap: 14px; align-items: center;
  font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: clamp(28px, 4vh, 44px);
}
.label span {
  color: var(--brass);
  display: inline-flex; align-items: center; gap: 14px;
}
.label span::after { content: ''; width: 28px; height: 1px; background: var(--line-strong); }

.section-title {
  font: 400 clamp(46px, 6.4vw, 104px)/0.96 var(--serif);
  letter-spacing: -0.018em;
  max-width: 14ch;
}
.prose {
  font-size: clamp(16.5px, 1.2vw, 18.5px);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 44ch;
}
.prose.narrow { max-width: 38ch; }

.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.wi { display: inline-block; will-change: transform; }

/* hide the arrival until its timeline takes over (fonts ready) */
.js:not(.ready):not(.reduced-motion) [data-in],
.js:not(.ready):not(.reduced-motion) .arrival .name { opacity: 0; }

/* ---------------------------------------------------------------- I. arrival */
.arrival {
  min-height: 100vh; min-height: 100dvh;
  display: grid; align-content: end; gap: clamp(40px, 7vh, 76px);
  padding: 18vh 0 clamp(36px, 6vh, 60px);
  position: relative;
}
.name {
  font: 360 clamp(54px, 7.2vw, 124px)/0.92 var(--serif);
  letter-spacing: -0.038em;
  max-width: 9.6em;
  margin-left: -0.03em;
}
.name .line { display: block; text-wrap: balance; }
.name .italic { font-style: italic; font-weight: 300; color: var(--brass); }
.truth {
  margin-top: clamp(26px, 4vh, 40px);
  font-size: clamp(16.5px, 1.2vw, 19px);
  line-height: 1.6;
  max-width: 44ch;
  color: var(--ink-2);
}
.ctas { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.cta {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 22px; border-radius: 999px;
  font: 500 14.5px/1 var(--sans); text-decoration: none;
  background: var(--ink); color: var(--bg);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.cta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform 0.5s var(--ease); }
.cta:hover svg { transform: translate(3px, -3px); }
.cta.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.cta.ghost:hover { box-shadow: inset 0 0 0 1px var(--ink-2); }
.cta:active { transform: translateY(1px); }
.proof {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1.25fr;
  margin: 0; padding: 0; list-style: none;
  border-top: 1px solid var(--line);
}
.proof li { display: grid; gap: 8px; align-content: start; padding: 20px 22px 0 0; }
.proof li + li { padding-left: 22px; border-left: 1px solid var(--line); }
.proof b { font: 380 clamp(30px, 2.7vw, 46px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.proof b i { font-style: italic; font-weight: 340; }
.proof span { font-size: 13.5px; line-height: 1.45; color: var(--ink-3); max-width: 26ch; }

/* ---------------------------------------------------------------- II. thesis */
.thesis {
  min-height: 120vh;
  padding: 22vh 0 18vh;
}
.statement {
  font: 400 clamp(44px, 5.5vw, 88px)/0.98 var(--serif);
  letter-spacing: -0.02em;
  max-width: 11.5ch;
}
.thesis-body {
  margin-top: clamp(44px, 7vh, 80px);
  display: grid; gap: 30px;
  max-width: 560px;
}
.couplet {
  font: 400 clamp(24px, 2.2vw, 34px)/1.18 var(--serif);
  letter-spacing: -0.01em;
}
.couplet em { color: var(--brass); }
.triad { margin-top: 8px; border-top: 1px solid var(--line); }
.triad li {
  --rule: 1;
  display: grid; grid-template-columns: 9.5em 1fr; gap: 20px; align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.triad .k { font: 400 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); }
.triad .v { font-size: 16.5px; color: var(--ink); }
/* the record of a life, in the Person section: same rhythm as the triad */
.history { margin-top: clamp(28px, 4vh, 40px); border-top: 1px solid var(--line); max-width: 560px; }
.history li { display: grid; grid-template-columns: 8.5em 1fr; gap: 20px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.history .k { font: 400 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); }
.history .v { font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
@media (max-width: 560px) { .history li { grid-template-columns: 1fr; gap: 4px; } }

/* ---------------------------------------------------------------- III. the person */
.person {
  position: relative; overflow: clip;
  min-height: 118vh;
  display: grid; align-items: center;
  padding: 18vh 0;
}
.person-photo { position: absolute; top: 0; right: 0; bottom: 0; width: 56%; margin: 0; overflow: hidden; }
.person-photo img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  filter: brightness(0.92) saturate(0.92);
  will-change: transform;
}
.person-photo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, var(--bg) 0%, transparent 18%, transparent 80%, var(--bg) 100%),
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 14%, color-mix(in srgb, var(--bg) 14%, transparent) 46%, transparent 64%);
}
.person-copy { position: relative; max-width: 640px; }
.person .section-title { max-width: 14ch; font-size: clamp(44px, 5.4vw, 92px); }
.person .section-title .l { display: block; }
.person .section-title em { font-style: italic; font-weight: 300; color: var(--brass); text-wrap: balance; }
.person .prose { margin-top: clamp(28px, 4vh, 44px); }
.person-aside {
  margin-top: 26px;
  font: 340 italic clamp(19px, 1.6vw, 24px)/1.3 var(--serif);
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- III. worlds */
.worlds-intro {
  min-height: 130vh;
  display: grid; align-items: center;
  padding: 16vh 0;
}
.world { position: relative; height: 175vh; }
.world-hold {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: grid; align-items: center;
}
.world-copy { max-width: 470px; }
.world:nth-of-type(even) .world-copy { margin-left: auto; }
.world-meta {
  display: flex; gap: 18px; align-items: center;
  font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 26px;
}
.world-meta .idx { color: var(--brass); font-variant-numeric: tabular-nums; }
.world-meta .kind { display: inline-flex; align-items: center; gap: 18px; color: var(--ink-2); }
.world-meta .kind::before { content: ''; width: 28px; height: 1px; background: var(--line-strong); }
.world-name {
  font: 400 clamp(60px, 7.4vw, 124px)/0.9 var(--serif);
  letter-spacing: -0.025em;
}
.world-sub {
  margin-top: 16px;
  font: italic 400 clamp(20px, 1.7vw, 26px)/1.2 var(--serif);
  color: var(--ink-2);
}
.world-line {
  margin-top: 26px;
  font-size: clamp(16.5px, 1.2vw, 18.5px); line-height: 1.6;
  color: var(--ink-2);
  max-width: 40ch;
}
/* a conviction: the claim set large, its second half in the bronze italic, then the proof and two doors */
.world-meta .proj { color: var(--ink-3); }
.world-meta .proj::before { content: ''; display: inline-block; width: 4px; height: 4px; margin-right: 18px; border-radius: 50%; background: var(--brass); vertical-align: middle; }
.world-thesis {
  font: 360 clamp(38px, 4.3vw, 70px)/1 var(--serif);
  letter-spacing: -0.03em;
  max-width: 13ch;
  text-wrap: balance;
}
.world-thesis em {
  font-style: italic; font-weight: 300;
  background-image: linear-gradient(180deg, var(--bronze-hi) 8%, var(--brass) 58%, var(--bronze-deep) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: 0.06em;
}
.world-copy:has(.world-thesis) { max-width: 560px; }
.world-links { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 10px 30px; align-items: center; }
.world-links .door { margin-top: 0; }
.door-quiet { font-size: 13.5px; color: var(--ink-2); border-bottom-color: var(--line); }
.door-essay:not(.is-closed) { color: var(--ink); }
.door {
  margin-top: 34px;
  display: inline-flex; align-items: center; gap: 14px;
  padding: 14px 0 12px;
  font: 500 15px/1 var(--sans); letter-spacing: 0.005em;
  text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
  transition: border-color 0.4s var(--ease);
}
.door::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--brass);
  transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease);
}
.door svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; transition: transform 0.5s var(--ease); }
.door:hover::after, .door:focus-visible::after { transform: scaleX(1); }
.door:hover svg, .door:focus-visible svg { transform: translate(3px, -3px); color: var(--brass); }
.door:active { transform: translateY(1px); }
.door.is-closed { color: var(--ink-3); border-bottom-style: dashed; cursor: default; }
.door.is-closed::after { display: none; }
.door.is-closed i { width: 6px; height: 6px; border-radius: 50%; background: var(--brass); opacity: 0.8; }

/* ---------------------------------------------------------------- IV b. writing */
.writing {
  position: relative; z-index: 2;
  padding: clamp(110px, 18vh, 200px) 0 clamp(80px, 14vh, 160px);
  background: linear-gradient(180deg, transparent, var(--bg) 14%, var(--bg) 88%, transparent);
}
.writing-head { max-width: 640px; margin-bottom: clamp(40px, 7vh, 72px); }
.writing-head .prose { margin-top: 24px; }
.essay-list { border-top: 1px solid var(--line-strong); }
.essay-list li { border-bottom: 1px solid var(--line); }
.essay-row {
  display: grid; grid-template-columns: 4.5em 1fr auto 18px; gap: 28px; align-items: center;
  padding: clamp(24px, 3.6vh, 34px) 0; text-decoration: none; color: var(--ink);
  position: relative;
}
.essay-row::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--brass);
  transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease);
}
.essay-row:hover::after, .essay-row:focus-visible::after { transform: scaleX(1); }
.essay-row:focus-visible { outline: none; }
.er-n { font: 400 11px/1 var(--mono); letter-spacing: 0.16em; color: var(--brass); align-self: start; padding-top: 0.9em; }
.er-main { display: grid; gap: 10px; }
.er-title { font: 360 clamp(26px, 2.7vw, 40px)/1.08 var(--serif); letter-spacing: -0.025em; text-wrap: balance; }
.er-title em {
  font-style: italic; font-weight: 300;
  background-image: linear-gradient(180deg, var(--bronze-hi) 8%, var(--brass) 58%, var(--bronze-deep) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.er-dek { font-size: 15.5px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.er-kind { font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.essay-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; color: var(--ink-3); transition: transform 0.5s var(--ease), color 0.4s; }
.essay-row:hover svg, .essay-row:focus-visible svg { transform: translate(3px, -3px); color: var(--brass); }
.essay-row:hover .er-title { color: var(--ink); }
@media (max-width: 760px) {
  .essay-row { grid-template-columns: 2.6em 1fr 16px; gap: 16px; }
  .er-kind { display: none; }
  .er-dek { font-size: 14.5px; }
}

/* ---------------------------------------------------------------- IV. codex */
.codex {
  min-height: 115vh;
  display: grid; align-items: center;
  padding: 20vh 0 16vh;
}
.codex-copy { max-width: 560px; }
.codex .section-title { max-width: 11ch; }
.codex .prose { margin-top: 28px; }
.codex-book { margin-top: 30px; }

/* the rail: an orb per section on the right; the current one lit in bronze and breathing at the sound's pace */
.rail { position: fixed; right: clamp(14px, 1.6vw, 28px); top: 50%; transform: translateY(-50%); z-index: 25; }
.rail ol { position: relative; display: grid; gap: 12px; justify-items: end; }
.rail ol::before { content: ''; position: absolute; right: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.rail a { position: relative; display: flex; align-items: center; gap: 12px; padding: 3px 0; text-decoration: none; color: var(--ink-3); }
.rail i { position: relative; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg); transition: border-color 0.5s var(--ease), background 0.5s var(--ease), box-shadow 0.5s var(--ease); }
.rail .sub i { width: 5px; height: 5px; margin-right: 2px; }
.rail span {
  font: 400 10.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; transform: translateX(6px); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: none; color: var(--ink-2); }
.rail a:focus-visible { outline: none; }
.rail a:focus-visible i { outline: 1px solid var(--brass); outline-offset: 3px; }
.rail a.past i { border-color: var(--brass); }
.rail a.on i {
  border-color: var(--bronze-hi);
  background: radial-gradient(circle at 35% 30%, var(--bronze-hi), var(--brass) 55%, var(--bronze-deep));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass) 14%, transparent), 0 0 14px color-mix(in srgb, var(--brass) 45%, transparent);
  animation: rail-breath 10s ease-in-out infinite;
}
@keyframes rail-breath {
  0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 10%, transparent), 0 0 8px color-mix(in srgb, var(--brass) 30%, transparent); }
  40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--brass) 16%, transparent), 0 0 18px color-mix(in srgb, var(--brass) 55%, transparent); }
  100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 10%, transparent), 0 0 8px color-mix(in srgb, var(--brass) 30%, transparent); }
}
.reduced-motion .rail a.on i { animation: none; }
@media (max-width: 860px) { .rail { display: none; } }

/* the sound switch: off by default, remembered, always in the same corner */
.snd {
  position: fixed; left: var(--gutter); bottom: 22px; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 8px 4px;
  border: 0; background: none; cursor: pointer;
  font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
  transition: color 0.3s var(--ease);
}
.snd:hover, .snd:focus-visible { color: var(--brass); }
.snd:focus-visible { outline: 1px solid var(--brass); outline-offset: 4px; }
.snd .bars { display: flex; align-items: flex-end; gap: 3px; height: 13px; }
.snd .bars i { width: 1.5px; height: 13px; background: currentColor; border-radius: 1px; transform: scaleY(0.23); transform-origin: bottom; transition: transform 0.4s var(--ease); }
.snd.on { color: var(--brass); }
/* the bars breathe at the bed's own pace: in 4 s, out 6 s */
.snd.on .bars i { animation: snd-breath 10s ease-in-out infinite; }
.snd.on .bars i:nth-child(2) { animation-delay: -0.5s; }
.snd.on .bars i:nth-child(3) { animation-delay: -1s; }
.snd.on .bars i:nth-child(4) { animation-delay: -1.5s; }
@keyframes snd-breath { 0% { transform: scaleY(0.25); } 40% { transform: scaleY(1); } 100% { transform: scaleY(0.25); } }
.no-webgl .snd, .reduced-motion .snd .bars i { animation: none; }
/* on a phone the switch is a small round button in the corner, clear of the copy; its words stay for screen readers */
@media (max-width: 860px) {
  .snd { left: auto; right: 14px; bottom: 14px; padding: 11px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 84%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .snd .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.thesis-prose { display: grid; gap: 14px; }
/* a foreign word or a single emphasis inside running text takes the accent face, never a faked italic */
.prose i, .prose em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.codex-form { margin-top: 44px; }
.field-row { display: grid; gap: 10px; }
.field-row label {
  font: 400 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2);
}
.input-line {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.4s var(--ease);
}
.input-line:focus-within { border-color: var(--ink); }
.codex-form[data-state="invalid"] .input-line,
.codex-form[data-state="error"] .input-line { border-color: #D2735A; }
.input-line input {
  appearance: none; border: 0; background: transparent; color: var(--ink);
  font: 400 clamp(20px, 1.8vw, 26px)/1.2 var(--sans); letter-spacing: -0.01em;
  padding: 16px 0; min-width: 0; width: 100%;
}
.input-line input::placeholder { color: var(--ink-3); opacity: 0.8; }
.input-line input:focus { outline: none; }
.input-line:has(input:focus-visible) { outline: 1.5px solid var(--brass); outline-offset: 6px; }
.input-line button {
  appearance: none; border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--bronze-hi), var(--brass)); color: var(--brass-ink);
  box-shadow: inset 0 1px 0 rgba(255, 246, 228, 0.28);
  font: 550 14px/1 var(--sans); letter-spacing: 0.01em;
  padding: 15px 20px; border-radius: 999px;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), filter 0.4s var(--ease), opacity 0.3s;
}
.input-line button:hover { filter: brightness(1.07); }
.input-line button:active { transform: scale(0.98); }
.input-line button:disabled { opacity: 0.7; cursor: progress; }
.b-busy { display: none; }
.codex-form[data-state="sending"] .b-idle { display: none; }
.codex-form[data-state="sending"] .b-busy { display: inline-flex; align-items: center; gap: 10px; }
.codex-form[data-state="sending"] .b-busy::after {
  content: ''; width: 18px; height: 1px; background: currentColor;
  animation: busy 1s var(--ease) infinite alternate; transform-origin: left;
}
@keyframes busy { from { transform: scaleX(0.2); } to { transform: scaleX(1); } }
.field-help { font: 400 12px/1.4 var(--mono); letter-spacing: 0.04em; color: var(--ink-3); }
.field-error { font-size: 14.5px; color: #E08C71; min-height: 1.4em; }
:root[data-theme="light"] .field-error { color: #A64F2A; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .field-error { color: #A64F2A; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.codex-status { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--brass); }
.codex-status:focus { outline: none; }
.status-title { font: 400 clamp(30px, 2.8vw, 42px)/1.05 var(--serif); margin-bottom: 10px; }

/* ---------------------------------------------------------------- V. coda */
.coda {
  padding: 18vh 0 72px;
}
.coda .wrap {
  display: grid; grid-template-columns: 1fr auto; gap: 28px 40px; align-items: end;
  border-top: 1px solid var(--line); padding-top: 32px;
}
.coda-line { font: italic 400 clamp(22px, 2vw, 30px)/1.2 var(--serif); color: var(--ink-2); }
.coda-nav { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: flex-end; }
.coda-nav a { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.coda-nav span { font-size: 14px; color: var(--ink-3); }
.coda-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.coda-meta {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between;
  font: 400 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}

.coda-meta a { color: var(--ink-2); text-decoration: none; transition: color 0.4s var(--ease); }
.coda-meta a:hover, .coda-meta a:focus-visible { color: var(--brass); }
.history + .door-about { margin-top: 26px; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .chrome { grid-template-columns: 1fr auto; padding-block: 16px; }
  .act { display: none; }
  .mark { font-size: 21px; }
  .nav { gap: 20px; }
  .nav a[href="#worlds"], .nav a[href$="/#worlds"], .nav a[href="#writing"] { display: none; } /* the worlds are one scroll away; the name keeps one line */

  /* the form sits in the upper half; copy reads over a quiet scrim below */
  main::before {
    content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: 64vh; z-index: -1;
    background: linear-gradient(to top, var(--scrim) 0%, var(--scrim) 42%, transparent 100%);
    pointer-events: none;
  }
  .arrival { padding: 46vh 0 40px; gap: 36px; }
  .name { font-size: clamp(44px, 12.4vw, 72px); }
  .proof { grid-template-columns: 1fr 1fr; }
  .proof li { padding: 16px 12px 16px 0; }
  .proof li + li { padding-left: 0; border-left: 0; }
  .proof li:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
  .proof li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .thesis { min-height: 0; padding: 38vh 0 16vh; }
  .person { min-height: 0; padding: 0 0 14vh; display: block; }
  .person-photo { position: relative; width: 100%; height: 72vh; }
  .person-photo::after { background: linear-gradient(180deg, var(--bg) 0%, transparent 16%, transparent 55%, var(--bg) 100%); }
  .person-copy { margin-top: -12vh; }
  .statement { font-size: clamp(42px, 12vw, 64px); }
  .worlds-intro { min-height: 110vh; align-items: end; padding-bottom: 12vh; }
  .world { height: 165vh; }
  .world-hold { align-items: end; padding-bottom: 9vh; }
  .world:nth-of-type(even) .world-copy { margin-left: 0; }
  .world-name { font-size: clamp(54px, 15vw, 84px); }
  .codex { min-height: 100vh; align-items: end; padding: 42vh 0 10vh; }
  .input-line { grid-template-columns: 1fr; border-bottom: 0; gap: 16px; }
  .input-line input { border-bottom: 1px solid var(--line-strong); }
  .input-line button { width: 100%; padding: 18px 20px; }
  .coda .wrap { grid-template-columns: 1fr; }
  .coda-nav { justify-content: flex-start; }
  .coda-meta { flex-direction: column; gap: 10px; }
  .triad li { grid-template-columns: 1fr; gap: 8px; }
  .chrome::before { inset: 0 0 -40px 0; }
}

/* ---------------------------------------------------------------- bronze
   One tone shared with the particle field (scene.js THEMES). Display italics
   carry a quiet top-lit sheen, light at the top edge and settling into the
   bronze; everything else is the solid tone. */
.name .italic, .name .italic .wi,
.couplet em,
.person .section-title em, .person .section-title em .wi {
  background-image: linear-gradient(180deg, var(--bronze-hi) 8%, var(--brass) 58%, var(--bronze-deep) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
/* nested words carry their own sheen; the parent's would only double it */
.name .italic:has(.wi), .person .section-title em:has(.wi) { background-image: none; }
.name .italic .sr, .person .section-title em .sr { -webkit-text-fill-color: initial; }
@media (forced-colors: active) {
  .name .italic, .name .italic .wi, .couplet em, .person .section-title em, .person .section-title em .wi {
    -webkit-text-fill-color: CanvasText; background: none;
  }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
