/* Rondo — the site. An engraved score on white paper; the AI writes on it in
   conductor's pencil. Refrains are white pages, episodes turn to ink. */

@font-face {
  font-family: "Bodoni Moda";
  src: url("../fonts/bodoni-moda-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("../fonts/bodoni-moda-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("../fonts/caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-2: #f6f6f8;
  --ink: #0e0e12;
  --ink-2: #3b3b45;
  --ink-3: #62626d;
  --staff: #0e0e12;
  --hair: #dcdce2;
  --night: #0e0e12;
  --night-2: #18181f;
  --night-3: #24242d;
  --on-night: #f4f4f7;
  --on-night-2: #b8b8c6;
  --on-night-3: #8d8d9c;
  --blue: #2383e2;
  --blue-strong: #1f6fc0;
  --blue-ink: #1a5fa6;
  --violet: #7b5cff;
  --violet-soft: #a894ff;
  --marker: #ffd24a;
  --marker-soft: rgba(255, 210, 74, 0.55);

  /* The app's own UI tokens, for the product moments drawn on the page. */
  --ui-page: #ffffff;
  --ui-wash: #f7f7f5;
  --ui-text: #1d1b16;
  --ui-text-2: #5f5e5b;
  --ui-text-3: #91918e;
  --ui-border: #e3e2e0;
  --ui-blue: #2383e2;

  --display: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* One tempo: 96 bpm. Every duration is a beat or a subdivision of it. */
  --beat: 625ms;
  --eighth: 312ms;
  --sixteenth: 156ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --nav-h: 68px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--blue-ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--marker); color: var(--ink); }
.night ::selection { background: var(--violet); color: #fff; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.night :focus-visible { outline-color: var(--violet-soft); }
html { scrollbar-color: #b9b9c4 var(--paper); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: #c7c7d0; border-radius: 8px; border: 3px solid var(--paper); }

.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- Type ---------- */

.display {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-wrap: balance;
  margin: 0;
}
h1.display { font-size: clamp(3.1rem, 7.4vw, 6rem); }
h2.display { font-size: clamp(2.35rem, 4.8vw, 4.1rem); line-height: 1.02; }
h3 { font-size: 1.3rem; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 0.35em; }
p { margin: 0 0 1em; }
.lede { font-size: clamp(1.12rem, 1.5vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 38ch; text-wrap: pretty; }
.night .lede { color: var(--on-night-2); }
.measure { max-width: 64ch; }
.tabular { font-variant-numeric: tabular-nums; }

/* Engraving marks */
.tempo {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0;
  color: var(--ink);
}
.tempo .mm { font-family: var(--sans); font-style: normal; font-weight: 500; font-size: 0.9rem; color: var(--ink-3); margin-left: 0.5em; }
.night .tempo { color: var(--on-night); }
.night .tempo .mm { color: var(--on-night-3); }
.dyn {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.rehearsal {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.3em;
  border: 2px solid currentColor;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0;
}
.rehearsal.big { font-size: 1.35rem; border-width: 2.5px; }

/* ---------- Buttons ---------- */

.btn {
  --h: 50px;
  display: inline-flex; align-items: center; gap: 0.6em;
  height: var(--h); padding: 0 1.35em;
  border-radius: 999px;
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color var(--sixteenth) var(--ease), color var(--sixteenth) var(--ease), transform var(--sixteenth) var(--ease), box-shadow var(--eighth) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--blue-strong); color: #fff; box-shadow: 0 6px 18px -8px rgba(31, 111, 192, 0.7); }
.btn-primary:hover { background: #1a62ab; text-decoration: none; box-shadow: 0 10px 24px -10px rgba(31, 111, 192, 0.8); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: #fff; text-decoration: none; }
.night .btn-quiet { color: var(--on-night); border-color: var(--on-night-2); }
.night .btn-quiet:hover { background: var(--on-night); color: var(--ink); }
.btn .ring { width: 20px; height: 20px; }
.btn-small { --h: 40px; padding: 0 1.05em; font-size: 0.95rem; }

/* ---------- Top bar ---------- */

.bar {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--eighth) var(--ease), background-color var(--eighth) var(--ease), color var(--eighth) var(--ease);
}
.bar.scrolled { border-bottom-color: var(--hair); }
.bar.on-night { background: rgba(14, 14, 18, 0.82); border-bottom-color: rgba(255, 255, 255, 0.08); color: var(--on-night); }
.bar .wrap { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; }
.brand .ring { width: 28px; height: 28px; }
.brand:hover { text-decoration: none; }
.score-nav { display: flex; gap: 6px; margin: 0 auto; list-style: none; padding: 0; }
.score-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 10px 0 6px;
  color: inherit; text-decoration: none; font-size: 0.92rem; font-weight: 550;
  border-radius: 8px;
  transition: background-color var(--sixteenth) var(--ease);
}
.score-nav a:hover { background: rgba(14, 14, 18, 0.06); }
.bar.on-night .score-nav a:hover { background: rgba(255, 255, 255, 0.08); }
.score-nav .rehearsal { font-size: 0.72rem; border-width: 1.5px; min-width: 1.8em; height: 1.8em; transition: background-color var(--eighth) var(--ease), color var(--eighth) var(--ease); }
.score-nav a[aria-current="true"] .rehearsal { background: currentColor; }
.score-nav a[aria-current="true"] .rehearsal span { color: var(--paper); }
.bar.on-night .score-nav a[aria-current="true"] .rehearsal span { color: var(--ink); }
.bar .btn { margin-left: auto; }
.score-nav + .btn { margin-left: 0; }
@media (max-width: 1080px) { .score-nav .label { display: none; } .score-nav a { padding: 0 6px; } }
@media (max-width: 720px) { .bar .btn { margin-left: auto; } }

/* ---------- Hero ---------- */

.hero { position: relative; padding: clamp(28px, 5vh, 64px) 0 0; overflow: clip; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  grid-template-rows: auto auto;
  column-gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.hero-copy { grid-column: 1; grid-row: 1; }
.hero-grid .score-band { grid-column: 1 / -1; grid-row: 2; }
.hero-phone { grid-column: 2; grid-row: 1 / span 2; align-self: start; }

.hero-copy { padding-top: clamp(8px, 3vh, 36px); position: relative; z-index: 2; }
.hero-copy .tempo { display: inline-flex; align-items: baseline; margin-bottom: 18px; }
.pencil-note { font-family: var(--display); font-style: italic; font-weight: 600; color: var(--blue); }
.hero h1 { margin-bottom: 26px; }
.hero h1 em { font-style: italic; font-weight: 500; }
.hero .lede { margin-bottom: 30px; max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-phone { position: relative; z-index: 3; justify-self: end; width: 100%; margin-top: 0; }
.phone {
  position: relative;
  outline: 1px solid rgba(255,255,255,0.08);
  border-radius: 46px;
  padding: 9px;
  background: var(--ink);
  box-shadow: 0 18px 32px -24px rgba(14, 14, 18, 0.5), 0 6px 14px -10px rgba(14, 14, 18, 0.3);
}
.phone img { border-radius: 38px; width: 100%; height: auto; background: #fff; }
.phone.crop { overflow: hidden; }
.phone.crop .screen { border-radius: 38px; overflow: hidden; aspect-ratio: 1206 / 1900; }
.phone.crop .screen img { border-radius: 0; }
.hero-phone .mark-circle { position: absolute; pointer-events: none; overflow: visible; }

.hero-phone .pencil-stroke { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .hero-phone .pencil-stroke { stroke-dashoffset: 1; transition: stroke-dashoffset var(--beat) var(--ease); }
.js .hero-phone .pencil-stroke.drawn { stroke-dashoffset: 0; }
.score-band { position: relative; margin-top: clamp(28px, 4vh, 48px); z-index: 1; }
.score { width: 100%; height: auto; color: var(--staff); overflow: visible; }
.score-caption {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 22px;
  padding: 14px 0 0; color: var(--ink-3); font-size: 0.9rem;
}
.score-caption .count { font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 2.6vw, 2.3rem); color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.score-caption .count .to { font-family: var(--sans); font-weight: 400; color: var(--ink-3); font-size: max(0.95rem, 0.5em); margin: 0 0.35em; }
.score-caption .count b { font-weight: 700; color: var(--ink); background: linear-gradient(transparent 58%, var(--marker-soft) 58%); padding: 0 0.08em; }
.score-caption .sample { font-size: 0.8rem; letter-spacing: 0.02em; }
.score-controls { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1.5px solid var(--hair); background: var(--paper); color: var(--ink); cursor: pointer;
  transition: border-color var(--sixteenth) var(--ease), background-color var(--sixteenth) var(--ease);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Score drawing */
.score .line { stroke: currentColor; stroke-width: 1; shape-rendering: crispEdges; }
.score .barline { stroke: currentColor; stroke-width: 1.4; }
.score .barline.thick { stroke-width: 4; }
.score .inst { font: 600 13px var(--sans); fill: var(--ink); }
.score .inst-sub { font: 500 11px var(--sans); fill: var(--ink-3); }
.score .note { cursor: pointer; }
.score .note .head { fill: currentColor; transition: opacity var(--eighth) var(--ease); }
.score .note .stem { stroke: currentColor; stroke-width: 1.3; transition: opacity var(--eighth) var(--ease); }
.score .note .hit { fill: transparent; }
.score .note.pp .head, .score .note.pp .stem { opacity: 0.85; }
.score.played .note.pp .head, .score.played .note.pp .stem { opacity: 0.32; }
.score .note.done-pp .head, .score .note.done-pp .stem { opacity: 0.32; }
.score .note:hover .head, .score .note:focus-visible .head { fill: var(--blue); opacity: 1; }
.score .note:focus-visible { outline: none; }
.score .note:focus-visible .hit { stroke: var(--blue); stroke-width: 1.5; }
.score .dynmark { font: italic 800 17px var(--display); fill: var(--ink); opacity: 0; transition: opacity var(--eighth) var(--ease); }
.score .dynmark.on { opacity: 1; }
.score .dynmark.ff { fill: var(--blue-ink); }
.score .pencil { fill: none; stroke: url(#pencil); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.score .marker { fill: var(--marker-soft); opacity: 0; transition: opacity var(--eighth) var(--ease); }
.score .marker.on { opacity: 1; }
.score .playhead line { stroke: url(#pencil-v); stroke-width: 2; }
.score .playhead { transition: opacity var(--eighth) var(--ease); }
.score .tip-bg { fill: var(--ink); }
.score .tip-text { font: 600 12px var(--sans); fill: #fff; }
.score .tip-sub { font: 500 11px var(--sans); fill: #c9c9d4; }

/* ---------- Sections ---------- */

section { position: relative; }
.movement { padding: clamp(84px, 12vw, 160px) 0; }
.movement-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px 22px; align-items: start; margin-bottom: clamp(40px, 6vw, 72px); }
.movement-head .rehearsal { margin-top: 0.55em; justify-self: start; }
.movement-head .tempo { display: block; margin-bottom: 14px; }
.movement-head h2 { margin-bottom: 20px; }
.night { background: var(--night); color: var(--on-night); }
.night a { color: #9cc8ff; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.split.flip > :first-child { order: 2; }

.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.points li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 16px; align-items: baseline; }
.points .dyn { font-size: 1.55rem; color: var(--blue-ink); line-height: 1; }
.night .points .dyn { color: var(--violet-soft); }
.points h3 { margin: 0; grid-column: 2; }
.points p { grid-column: 2; margin: 0; color: var(--ink-2); max-width: 52ch; }
.night .points p { color: var(--on-night-2); }

/* Today (A) */
.today-stage { position: relative; display: grid; place-items: center; }
.today-stage .phone { width: min(100%, 340px); }
.annot { position: absolute; font-family: var(--display); font-style: italic; font-weight: 600; color: var(--blue); font-size: 1.05rem; line-height: 1.2; pointer-events: none; }
.annot svg { overflow: visible; }

/* Jev (E): Lens on sample mail */
.jev {
  background: var(--ui-page); color: var(--ui-text);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--ui-border), 0 40px 80px -48px rgba(14, 14, 18, 0.45);
  overflow: hidden; font-size: 15px; line-height: 1.5;
}
.jev-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ui-border); }
.jev-mark { width: 26px; height: 26px; padding: 5px; border-radius: 7px; color: #fff; background: linear-gradient(#6a6ff0, #4f55e3); flex: none; box-sizing: border-box; }
.jev-title { font-weight: 600; flex: 1; }
.jev-kind { flex: none; font: 700 11px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: #c2413c; background: rgba(212, 76, 71, 0.1); padding: 2px 7px; border-radius: 4px; }
.jev-kind.choice { color: #1c69b5; background: rgba(35, 131, 226, 0.12); }
.jev-kind.score { color: #9a6a12; background: rgba(203, 145, 47, 0.14); }
.jev-question { margin: 14px 18px 6px; font-size: 15px; font-weight: 600; min-height: 1.5em; }
.jev-rows { list-style: none; margin: 0; padding: 4px 10px 12px; display: grid; }
.jev-rows li { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) 10.5em; gap: 12px; align-items: center; padding: 9px 8px; border-top: 1px solid var(--ui-border); font-size: 13.5px; }
.jev-rows li:first-child { border-top: 0; }
.jev-rows .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jev-rows .subj { color: var(--ui-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jev-rows .ans { display: flex; align-items: center; gap: 8px; justify-content: flex-end; opacity: 0; transform: translateX(6px); transition: opacity var(--eighth) var(--ease), transform var(--eighth) var(--ease); }
.jev-rows .ans.on { opacity: 1; transform: none; }
.jev-bar { flex: 1; max-width: 70px; height: 6px; border-radius: 3px; background: #ecebe8; overflow: hidden; }
.jev-bar i { display: block; height: 100%; border-radius: 3px; background: #c9c7c2; }
.jev-bar i.yes { background: #448361; }
.jev-pct { font: 12px var(--mono); color: var(--ui-text-3); min-width: 3ch; text-align: right; }
.jev-pct.yes { color: #448361; font-weight: 700; }
.jev-pct.warn, .jev-bar i.warn { color: #d44c47; }
.jev-bar i.warn { background: #d44c47; }
.jev-cat { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.jev-cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.jev-level { display: inline-flex; align-items: flex-end; gap: 2px; margin-right: 4px; }
.jev-level b { width: 5px; height: 7px; border-radius: 1px; background: #ecebe8; }
.jev-level b.on { background: #3b3b45; }
.jev-level b.now { height: 12px; }
.jev-fine { margin-top: 30px; color: var(--ink-3); font-size: 0.92rem; max-width: 70ch; }
@media (max-width: 640px) {
  .jev-rows li { grid-template-columns: minmax(0, 1fr) 9.5em; }
  .jev-rows .subj { display: none; }
}

/* Ask (B) */
.ask {
  background: var(--ui-page); color: var(--ui-text);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 40px 80px -40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  font-size: 15px; line-height: 1.5;
}
.ask-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ui-border); }
.ask-top .ring { width: 22px; height: 22px; flex: none; }
.ask-input { flex: 1; min-width: 0; font: inherit; font-size: 16px; border: 0; outline: 0; background: transparent; color: var(--ui-text); padding: 6px 0; }
.ask-input::placeholder { color: var(--ui-text-3); }
.ask-go { flex: none; height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--blue-strong); color: #fff; font: 600 14px var(--sans); cursor: pointer; }
.ask-go:hover { background: #1a62ab; }
.ask-go:disabled { opacity: 0.4; cursor: default; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ui-border); background: var(--ui-page); color: var(--ui-text-2); font: 500 13.5px var(--sans); cursor: pointer; transition: background-color var(--sixteenth) var(--ease), color var(--sixteenth) var(--ease); }
.chip:hover { background: rgba(0, 0, 0, 0.04); color: var(--ui-text); }
.chip[aria-pressed="true"] { background: rgba(35, 131, 226, 0.14); border-color: rgba(35, 131, 226, 0.4); color: #1c69b5; }
.ask-body { padding: 16px 18px 18px; min-height: 250px; }
.ask-status { display: flex; align-items: center; gap: 8px; color: var(--ui-text-3); font-size: 13px; margin-bottom: 10px; min-height: 20px; }
.ask-status .ring { width: 16px; height: 16px; }
.ask-answer { font-size: 16px; line-height: 1.55; margin: 0 0 14px; min-height: 3em; }
.cite { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; padding: 0 0.3em; margin: 0 0.1em; border-radius: 5px; background: rgba(35, 131, 226, 0.14); color: #1c69b5; font: 600 12px var(--sans); vertical-align: 0.12em; }
.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sources li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: 10px; font-size: 13.5px; opacity: 0; transform: translateY(6px); transition: opacity var(--eighth) var(--ease), transform var(--eighth) var(--ease); }
.sources li.on { opacity: 1; transform: none; }
.sources .who { font-weight: 600; }
.sources .subj { color: var(--ui-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources .when { color: var(--ui-text-3); font-variant-numeric: tabular-nums; }
.ui-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--ui-wash); color: var(--ui-text-2); font-size: 12.5px; border-top: 1px solid var(--ui-border); }
.place { display: inline-flex; align-items: center; gap: 6px; }
.place svg { width: 14px; height: 14px; }

/* Refrains */
.refrain { padding: clamp(48px, 7vw, 88px) 0; background: var(--paper); overflow: clip; }
.refrain-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px 28px; align-items: center; }
.refrain-row > .rehearsal { justify-self: start; }
.refrain-staff { grid-column: 1 / -1; }
.refrain .rehearsal { font-size: 1.1rem; }
.refrain-staff { position: relative; }

.refrain-words { display: flex; flex-direction: column; gap: 2px; }
.refrain-words .tempo { font-size: 1rem; }
.refrain-words p { margin: 0; color: var(--ink-2); max-width: 44ch; }
.refrain-count { font-family: var(--display); font-size: clamp(2.2rem, 4.2vw, 3.4rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.refrain-count small { display: block; font-family: var(--sans); font-size: 0.85rem; font-weight: 500; letter-spacing: 0; color: var(--ink-3); margin-top: 6px; text-align: right; }
.refrain-count .fine { font-style: italic; }

/* Voice (C) */
.voice-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.profile { border-top: 1.5px solid var(--on-night-3); padding-top: 18px; }
.profile h3 { font-size: 1rem; color: var(--on-night-2); font-weight: 600; margin-bottom: 14px; }
.profile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.profile li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; color: var(--on-night); }
.profile li::before { content: ""; width: 9px; height: 7px; margin-top: 0.62em; border-radius: 50%; background: var(--on-night); transform: rotate(-20deg); }
.profile .instr { margin-top: 22px; padding: 14px 16px; background: var(--night-2); border-radius: 12px; color: var(--on-night-2); font-size: 0.97rem; }
.profile .instr b { color: var(--on-night); font-weight: 600; }

.thread-ui { background: var(--ui-page); color: var(--ui-text); border-radius: 16px; overflow: hidden; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.85); font-size: 14.5px; line-height: 1.5; }
.thread-ui .head { padding: 18px 20px 10px; }
.thread-ui .subject { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 12.5px; font-weight: 500; }
.tag.purple { background: #efe6f5; color: #6b3f8f; }
.tag.blue { background: #e2eefa; color: #1f5e99; }
.tag.gray { background: #eceae7; color: #52504b; }
.tag.green { background: #e4f1e6; color: #2d6a3b; }
.tag.yellow { background: #faefd2; color: #7a5a12; }
.msg { margin: 8px 20px; padding: 14px 16px; border: 1px solid var(--ui-border); border-radius: 12px; }
.msg .from { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; margin-bottom: 6px; }
.msg .from b { font-weight: 600; }
.msg .from span { color: var(--ui-text-3); }
.msg p { margin: 0; color: var(--ui-text); }
.prepared { margin: 12px 20px 20px; border-radius: 12px; background: #f3f0ff; border: 1px solid #ddd3ff; padding: 14px 16px 16px; }
.prepared .label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #5a3fd1; margin-bottom: 10px; }
.prepared .label .ring { width: 16px; height: 16px; }
.prepared .draft { white-space: pre-line; color: var(--ui-text); margin: 0 0 14px; min-height: 7.5em; }
.prepared .draft .caret { display: inline-block; width: 1.5px; height: 1.05em; background: var(--ui-text); vertical-align: -0.15em; margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.prepared .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ui-btn { height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--ui-border); background: #fff; color: var(--ui-text); font: 500 13.5px var(--sans); cursor: pointer; }
.ui-btn.primary { background: var(--blue-strong); border-color: var(--blue-strong); color: #fff; }
.ui-btn:hover { filter: brightness(0.97); }
.voice-toggle { display: inline-flex; margin: 0 0 18px; padding: 4px; border-radius: 999px; background: var(--night-2); gap: 4px; }
.voice-toggle button { height: 34px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; color: var(--on-night-2); font: 600 14px var(--sans); cursor: pointer; }
.voice-toggle button[aria-pressed="true"] { background: var(--on-night); color: var(--ink); }
.shot-note { margin-top: 18px; color: var(--on-night-3); font-size: 0.88rem; }

/* Assistants (D) */
.clearance { display: grid; gap: 10px; }
.clear-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 14px 16px; background: var(--night-2); border-radius: 12px; }
.clear-row .acct b { display: block; font-weight: 600; }
.clear-row .acct span { color: var(--on-night-3); font-size: 0.9rem; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--night); border-radius: 9px; border: 1px solid var(--night-3); }
.seg button { height: 32px; min-width: 62px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--on-night-2); font: 600 13px var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--on-night); color: var(--ink); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--night-3); }
.can { margin-top: 14px; color: var(--on-night-2); font-size: 0.95rem; min-height: 3em; }
.approval {
  margin-top: 26px;
  background: var(--ui-page); color: var(--ui-text); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: 14.5px;
}
.approval .ring { width: 30px; height: 30px; grid-row: span 3; }
.approval b { font-weight: 650; }
.approval .what { color: var(--ui-text-2); }
.approval .actions { display: flex; gap: 8px; margin-top: 10px; }
.approval.answered { opacity: 0.9; }
.approval .result { color: var(--ui-text-2); margin-top: 8px; font-size: 13.5px; }

.guard { margin-top: clamp(56px, 8vw, 96px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.email-src { background: var(--night-2); border-radius: 14px; padding: 18px 20px; font-family: var(--mono); font-size: 0.86rem; line-height: 1.6; color: var(--on-night-2); overflow-wrap: anywhere; }
.email-src .hidden-text { color: #ff9a9a; background: rgba(255, 90, 90, 0.12); border-radius: 4px; transition: opacity var(--beat) var(--ease), filter var(--beat) var(--ease); }
.email-src.cleaned .hidden-text { opacity: 0.18; filter: blur(2px); text-decoration: line-through; }
.warn-banner { margin-top: 12px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #fff4e5; color: #6b4200; font: 500 14px/1.45 var(--sans); }
.warn-banner svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

.siri { margin-top: clamp(56px, 8vw, 96px); display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; }
.siri .say { font-family: var(--display); font-style: italic; font-size: clamp(1.25rem, 2vw, 1.6rem); color: var(--on-night); }

/* Everything (E) */
.index-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(24px, 3vw, 48px); }
.index-col { padding-top: 22px; border-top: 2px solid var(--ink); }
.index-col + .index-col { }
.index-col h3 { font-family: var(--display); font-weight: 600; font-size: 1.55rem; letter-spacing: -0.015em; margin-bottom: 14px; display: flex; align-items: baseline; gap: 12px; }
.index-col h3 .dyn { font-size: 1.05rem; color: var(--ink-3); }
.index-list { list-style: none; margin: 0 0 44px; padding: 0; }
.index-list li { display: grid; grid-template-columns: minmax(0, 1fr); padding: 11px 0; border-bottom: 1px solid var(--hair); }
.index-list b { font-weight: 620; }
.index-list span { color: var(--ink-2); font-size: 0.96rem; }
.providers { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 44px; padding: 0; list-style: none; }
.providers li { padding: 7px 12px; border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 600; font-size: 0.92rem; }
.shots-row { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); margin-top: clamp(24px, 4vw, 56px); align-items: end; }
.shots-row .phone { max-width: 320px; justify-self: center; }
.phone.crop.tail .screen { aspect-ratio: 1206 / 1500; }
.phone.crop.tail .screen img { object-fit: cover; object-position: 50% 78%; height: 100%; }
.tablet { border-radius: 28px; padding: 10px; background: var(--ink); outline: 1px solid rgba(255,255,255,0.08); box-shadow: 0 30px 60px -32px rgba(14, 14, 18, 0.5); }
.tablet img { border-radius: 19px; width: 100%; height: auto; background: #fff; }
.tablet.crop .screen { border-radius: 19px; overflow: hidden; aspect-ratio: 1668 / 1250; }
.tablet.crop .screen img { border-radius: 0; }
figure { margin: 0; }
figcaption { margin-top: 12px; color: var(--ink-3); font-size: 0.88rem; }
.night figcaption { color: var(--on-night-3); }
.keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid var(--hair); border-bottom-width: 2px; border-radius: 6px; font: 600 13px var(--mono); color: var(--ink); background: var(--paper); }

.routes { width: 100%; border-collapse: collapse; font-size: 1rem; }
.routes caption { text-align: left; color: var(--on-night-2); font-size: 0.9rem; padding-bottom: 12px; }
.routes th, .routes td { text-align: left; padding: 13px 12px 13px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.14); vertical-align: top; }
.routes thead th { font-size: 0.85rem; font-weight: 600; color: var(--on-night-2); border-bottom-color: rgba(255, 255, 255, 0.4); }
.routes td:first-child { font-weight: 600; }
.routes .where { white-space: nowrap; }
.routes .where span { display: inline-flex; align-items: center; gap: 7px; }
.routes .where svg { width: 15px; height: 15px; flex: none; }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.promises li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 12px; }
.promises .dyn { font-size: 1.3rem; color: var(--violet-soft); line-height: 1.2; }
.promises b { display: block; font-weight: 650; }
.promises span { color: var(--on-night-2); }

/* Coda */
.coda { padding: clamp(96px, 14vw, 180px) 0 clamp(72px, 10vw, 120px); text-align: center; overflow: clip; }
.coda .rehearsal { margin: 0 auto 26px; }
.coda h2 { margin: 0 auto 22px; max-width: 14ch; }
.coda .lede { margin: 0 auto 34px; max-width: 42ch; }
.coda .hero-actions { justify-content: center; }
.coda .fine-mark { margin-top: 56px; display: flex; justify-content: center; align-items: center; gap: 14px; color: var(--ink-3); }
.coda .fine-mark .tempo { font-size: 1.1rem; color: var(--ink); }
.coda .fine-mark svg { width: 64px; height: 44px; color: var(--ink); }

/* Footer */
.foot { border-top: 1px solid var(--hair); padding: 32px 0 48px; font-size: 0.92rem; color: var(--ink-3); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-left: auto; }
.foot a { color: var(--ink-2); }

/* ---------- Reading pages (privacy, support) ---------- */

.doc-hero { padding: clamp(56px, 8vw, 104px) 0 clamp(28px, 4vw, 48px); border-bottom: 1px solid var(--hair); }
.doc-hero .tempo { display: block; margin-bottom: 14px; }
.doc-hero p { color: var(--ink-3); margin: 18px 0 0; }
.doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); padding: clamp(40px, 6vw, 72px) 0 clamp(80px, 10vw, 120px); }
.toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; font-size: 0.93rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; display: grid; gap: 2px; }
.toc li { counter-increment: toc; }
.toc a { display: grid; grid-template-columns: 26px minmax(0, 1fr); padding: 6px 8px; margin-left: -8px; border-radius: 6px; color: var(--ink-2); text-decoration: none; }
.toc a::before { content: counter(toc, upper-alpha); font-weight: 800; font-size: 0.78rem; color: var(--ink-3); padding-top: 0.15em; }
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); background: var(--paper-2); }
.toc a[aria-current="true"]::before { color: var(--blue-ink); }
.prose { max-width: 70ch; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 2.6vw, 2.15rem); letter-spacing: -0.015em; line-height: 1.15; margin: 2.4em 0 0.6em; padding-top: 0.8em; border-top: 1px solid var(--hair); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin: 0.4em 0; padding-left: 0.2em; }
.prose li::marker { color: var(--ink-3); }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 4px; color: var(--ink); }
.prose .short { background: var(--paper-2); border-radius: 14px; padding: 22px 24px 8px; margin-bottom: 8px; }
.prose .short li { color: var(--ink); }

/* Section systems: every movement opens on a staff, its tempo marked above it. */
:root { --staff-line: rgba(14, 14, 18, 0.55); }
.night { --staff-line: rgba(244, 244, 247, 0.34); }
.movement-head .tempo, .doc-hero .tempo {
  display: block;
  padding-bottom: 46px;
  margin-bottom: 18px;
  background: repeating-linear-gradient(to bottom, transparent 0 8px, var(--staff-line) 8px 9px) left bottom / 100% 45px no-repeat;
  position: relative;
}
.movement-head .tempo::after, .doc-hero .tempo::after {
  /* The system's closing bar line, at the right end of the section staff. */
  content: ""; position: absolute; right: 0; bottom: 0; width: 1.5px; height: 37px; background: var(--staff-line);
}
.pencil-tempo { color: var(--blue-ink) !important; }
.metro { font-family: var(--sans); font-style: normal; font-weight: 600; font-size: 0.85rem; color: var(--ink-3); margin-left: 0.6em; font-variant-numeric: tabular-nums; }

/* Column rules in the ink episodes: the score's bar lines, in white. */
@media (min-width: 1001px) {
  .night .split > :last-child, .night .voice-grid > :last-child, .night .guard > :last-child {
    border-left: 1px solid rgba(244, 244, 247, 0.16);
    padding-left: clamp(28px, 3vw, 48px);
  }
}

/* The count sits under the phone, where the score's chord lands. */
.phone-count { margin: 18px 0 0; text-align: center; font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 2.4vw, 2.2rem); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.phone-count .to { font-family: var(--sans); font-weight: 400; color: var(--ink-3); font-size: max(0.95rem, 0.5em); margin: 0 0.35em; }
.phone-count b { font-weight: 700; background: linear-gradient(transparent 58%, var(--marker-soft) 58%); padding: 0 0.08em; }
.hero .phone.crop .screen { aspect-ratio: 1206 / 1640; }
.hero-phone .phone-count { text-align: left; margin-left: 4px; }

/* Refrains: the hero's system comes back, with what's been handled struck through. */
.refrain-staff svg { width: 100%; height: auto; color: var(--ink); }
.refrain-staff .strike { stroke: url(#pencil); stroke-width: 2.2; stroke-linecap: round; fill: none; }

/* Pencil: a hand, not a selection ring — two passes of different weight. */
.score .pencil.soft { stroke-width: 1.1; opacity: 0.55; }
.score .hairpin { fill: none; stroke: url(#pencil); stroke-width: 1.6; stroke-linecap: round; }
.score .margin-note { font: 600 21px "Caveat", "Bradley Hand", cursive; fill: url(#pencil); letter-spacing: 0.01em; }
.score .pencil-fill { fill: url(#pencil); }
.score .pencil-fill.soft { opacity: 0.5; }
.score.mini .pencil-fill.soft { opacity: 0.4; }
.score .lead { fill: none; stroke: url(#pencil); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Phones keep the letters: a second row under the bar. */
@media (max-width: 720px) {
  :root { --nav-h: 104px; }
  .bar { height: auto; }
  .bar .wrap { flex-wrap: wrap; row-gap: 6px; padding-top: 10px; padding-bottom: 10px; }
  .bar nav { order: 3; width: 100%; }
  .score-nav { display: flex !important; justify-content: space-between; margin: 0; }
  .score-nav a { padding: 0 2px; height: 34px; }
  .sources li { grid-template-columns: auto minmax(0, 1fr); }
  .sources .when { grid-column: 2; }
  .sources .subj { white-space: normal; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-copy, .hero-grid .score-band, .hero-phone { grid-column: 1; grid-row: auto; }
  .hero-phone { justify-self: center; width: min(78vw, 330px); margin-top: 32px; }
  .hero-grid .score-band { margin-top: 28px; }
  .split, .voice-grid, .guard { grid-template-columns: minmax(0, 1fr); }
  .split.flip > :first-child { order: 0; }
  .index-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .index-grid, .shots-row { grid-template-columns: minmax(0, 1fr); }
  .movement-head { grid-template-columns: minmax(0, 1fr); }
  .movement-head .rehearsal { margin-top: 0; }
  .refrain-row { grid-template-columns: auto minmax(0, 1fr); }
  .refrain-staff { grid-column: 1 / -1; order: 3; }
  .refrain-count { grid-column: 1 / -1; }
  .refrain-count small { text-align: left; }
  .score-controls { margin-left: 0; }
  .clear-row { grid-template-columns: minmax(0, 1fr); }
  .seg { width: 100%; }
  .seg button { flex: 1; min-width: 0; }
  .routes thead { display: none; }
  .routes tr { display: grid; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
  .routes th, .routes td { border: 0; padding: 2px 0; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .toc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}
@media print {
  .bar, .score-band, .coda .hero-actions, .foot nav { display: none; }
  .night { background: #fff; color: #000; }
}
