/*
  ANNEALER
  An app in four rooms. Each room is one stretch of a single annealing run:
  the Foyer is hot, Correspondence is nearly ambient. JS slides --temper
  through the temper colours as you move between rooms and scroll in them.

  Look: a paper theatre. Cut cardstock pieces float a little above a mottled
  plaster wall, hang from strings, and get moved between rooms by someone you
  never see. Storybook ink and narrator's warnings; a crooked tree; a spiral
  hill; paper waves; a sacred-geometry seal and an eye in most things;
  catalogue numbers and crop marks in the corners, like liner notes.

  Two lamps. Dusk is the default: plaster teal, lifted, easy on the eyes.
  Parchment is the lit lamp: aged cardstock. The lamp button switches them.
*/
:root {
  /* the temper run, hot to cool: ochre, rust, oxblood-plum, deep teal, verdigris */
  --ochre: #d6aa54;
  --rust: #a8532c;
  --plum: #80284a;
  --teal: #1f5560;
  --verdigris: #6e9696;
  --oxblood: #6e1f2c;
  --brass: #b8893a;
  --iridescent: linear-gradient(100deg, var(--ochre), var(--rust) 30%, var(--plum) 60%, var(--teal) 85%, var(--verdigris));

  /* cream cardstock cards (same in both lamps) */
  --card: #ebe1cc;
  --card-2: #ddd1b5;
  --card-ink: #2a2a27;
  --card-dim: #57524a;
  --card-rule: rgba(42, 42, 39, 0.22);

  /* dark cut-paper silhouettes */
  --sil-ink: #ede4d0;
  --sil-dim: #c4c0b1;

  /* paper things: tags, the ledger, the dossier */
  --manila: #d8c49b;
  --manila-deep: #c6ae80;
  --tag-ink: #2a1f17;
  --tag-ink-dim: #5d4a39;

  /* textures */
  --fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .27 0 0 0 0 .22 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23f)'/%3E%3C/svg%3E");
  --speck: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .2 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23p)'/%3E%3C/svg%3E");
  /* a hand-cut edge: never quite a rectangle */
  --cut: polygon(0.4% 1.1%, 22% 0, 51% 0.7%, 78% 0, 99.5% 0.6%, 100% 34%, 99.4% 67%, 99.8% 99%, 74% 100%, 46% 99.3%, 19% 100%, 0.3% 99.4%, 0 63%, 0.6% 31%);

  /* type */
  --font-ind: "Big Shoulders Display", "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-narr: "IM Fell English", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--2: 0.72rem;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.3rem, 7vw, 3.6rem);

  --measure: 34rem;
  --rail-w: 15.5rem;
  --tabbar-h: 4.2rem;
  --dock-h: 3.6rem;
  --sea-h: 7.5rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Dusk: the default lamp. Teal plaster, lifted, with a warm stain here and there. */
:root,
:root[data-theme="dusk"] {
  color-scheme: dark;
  --bg: #3c4b50;
  --bg-2: #34434a;
  --bg-3: #465a5f;
  --well: #29363b;
  --art-fill: #263237;
  --art-fill-2: #34434a;
  --ink: #ede4d0;
  --ink-dim: #c4c0b1;
  --rule: rgba(237, 228, 208, 0.16);
  --rule-strong: rgba(237, 228, 208, 0.32);
  --alarm: #f2a48e;
  --shadow: rgba(8, 14, 16, 0.5);
  --glass: #34434a;
  --vignette: rgba(10, 16, 18, 0.38);
  --grain: 0.08;
  --blot-1: rgba(104, 124, 122, 0.5);
  --blot-2: rgba(28, 38, 44, 0.55);
  --blot-3: rgba(140, 110, 70, 0.16);
  --sil: #263136;
  --sil-well: #1c2629;

  /* the stage */
  --wave-1: #46595d;
  --wave-2: #516468;
  --wave-3: #5d7073;
  --wave-edge: #233033;
  --curl: #869896;
  --orn-sage: #74877f;
  --orn-tan: #a8987a;
  --orn-dark: #243035;
  --orn-line: #e2d8c0;
  --tree: #212b2f;

  --temper: var(--ochre);
  --temper-ink: #eecb80;
  --temper-light: #eecb80;
  --temper-dark: #6e4e0e;
}

/* Parchment: the lit lamp. Aged cardstock, dark teal silhouettes. */
:root[data-theme="parchment"] {
  color-scheme: light;
  --bg: #d8c9a8;
  --bg-2: #e5d9bf;
  --bg-3: #efe6d2;
  --well: #cbbb98;
  --art-fill: #e4d8bd;
  --art-fill-2: #cfbf9c;
  --ink: #2a2623;
  --ink-dim: #554d43;
  --rule: rgba(42, 38, 35, 0.16);
  --rule-strong: rgba(42, 38, 35, 0.34);
  --alarm: #8e2a1f;
  --shadow: rgba(70, 52, 30, 0.32);
  --glass: #e5d9bf;
  --vignette: rgba(90, 64, 34, 0.24);
  --grain: 0.1;
  --blot-1: rgba(255, 250, 235, 0.4);
  --blot-2: rgba(150, 120, 80, 0.22);
  --blot-3: rgba(90, 120, 110, 0.14);
  --sil: #2b4246;
  --sil-well: #1f3234;

  --wave-1: #c4b592;
  --wave-2: #baa884;
  --wave-3: #af9c77;
  --wave-edge: #6b5a3c;
  --curl: #8b7a58;
  --orn-sage: #8fa095;
  --orn-tan: #b9a57d;
  --orn-dark: #2b4246;
  --orn-line: #f0e7d3;
  --tree: #2b3a3d;

  --temper-ink: #6e4e0e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* No rubber-band bounce past the top or bottom: the theatre stays put. */
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
  overscroll-behavior: none;
  background-color: var(--bg);
}
html.locked { overflow: hidden; }

body {
  margin: 0;
  overscroll-behavior: none;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-narr);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-x: clip;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/*
  The wall. A fixed layer of its own, painted once and handed to the graphics card, so
  scrolling only slides the rooms over it and never repaints it. (A fixed background on
  <body> repaints the whole screen on every frame of a scroll.)
*/
.wall {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg);
  /* plaster: lamplight from above tinted by the room's temper, then blotches and a stain */
  background-image:
    radial-gradient(110% 55% at 50% -12%, color-mix(in srgb, var(--temper) 18%, transparent), transparent 70%),
    radial-gradient(45% 35% at 18% 28%, var(--blot-1), transparent 70%),
    radial-gradient(40% 45% at 84% 72%, var(--blot-2), transparent 70%),
    radial-gradient(30% 25% at 62% 18%, var(--blot-3), transparent 70%),
    radial-gradient(35% 30% at 30% 88%, var(--blot-2), transparent 70%),
    var(--fiber);
  transform: translateZ(0);
  will-change: transform;
}
.wall::after { /* film grain, printed into the wall rather than blended over everything */
  content: "";
  position: absolute;
  inset: 0;
  opacity: calc(var(--grain) * 0.7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}
/* a soft vignette over everything, touching nothing */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: radial-gradient(130% 100% at 50% 40%, transparent 55%, var(--vignette));
  transform: translateZ(0);
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: var(--temper-ink); text-underline-offset: 0.2em; }

:focus-visible {
  outline: 2px dashed var(--temper-ink);
  outline-offset: 3px;
}

/* room titles take focus when a room opens, for screen readers; no box needed */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

.skip {
  position: absolute;
  left: 16px;
  top: -4rem;
  z-index: 80;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.8rem;
  font-family: var(--font-ind);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }

/* ---------- shared type ---------- */

.narrator { font-family: var(--font-narr); }

h1, h2, h3, h4 { font-family: var(--font-ind); font-weight: 900; line-height: 0.95; text-wrap: balance; margin: 0; }

h2 {
  font-size: var(--step-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.eyebrow, .specimen, .fig-no, .ledger-head, .kicker {
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--temper-ink);
  margin: 0;
}
.mono-meta {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}

.sub-head {
  font-size: var(--step-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--temper-ink);
  text-decoration: none;
  padding: 0.65rem 1rem 0.55rem;
  border: 1.5px solid var(--temper-ink);
  border-radius: 2px;
  box-shadow: 0 6px 12px -6px var(--shadow);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn:hover { background: var(--ink); border-color: var(--ink); transform: translateY(-1px); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); box-shadow: none; }
.btn-quiet:hover { background: transparent; border-color: var(--temper-ink); color: var(--temper-ink); }

/* ---------- the stage: paper pieces behind the rooms ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
  transform: translateZ(0);
}
@media (min-width: 60rem) { .backdrop { left: var(--rail-w); } }

.bd-piece {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, -40%);
  width: var(--w, 7rem);
  opacity: var(--o, 1);
  transition: left 1.8s cubic-bezier(.55, 0, .2, 1), top 1.8s cubic-bezier(.55, 0, .2, 1), opacity 1.2s ease;
  translate: -50% 0;
}
.bd-piece svg { display: block; width: 100%; height: auto; overflow: visible; }
.bd-piece .string {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: 140vh;
  background: linear-gradient(transparent, var(--wave-edge) 40%);
  opacity: 0.7;
}
.bd-sway { position: relative; transform-origin: 50% -40vh; }
.bd-balloon .string { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .bd-sway { animation: sway var(--sway, 9s) ease-in-out infinite alternate; will-change: transform; }
  @keyframes sway { from { transform: rotate(-1.4deg); } to { transform: rotate(1.4deg); } }
}
@keyframes turn { to { transform: rotate(360deg); } }

/* where the pieces hang in each room; someone moves them between rooms */
.bd-o1 { --w: 7.5rem; --sway: 8s; }
.bd-o2 { --w: 6rem; --sway: 11s; }
.bd-o3 { --w: 5rem; --sway: 7s; }
.bd-balloon { --w: 5.5rem; --sway: 6s; }
.bd-eye { --w: min(30rem, 52vw); --y: -60%; --x: 78%; --o: 0; }

:root[data-room="foyer"] .bd-o1 { --x: 91%; --y: 9%; }
:root[data-room="foyer"] .bd-o2 { --x: 6%; --y: 6%; }
:root[data-room="foyer"] .bd-o3 { --x: 86%; --y: 42%; }
:root[data-room="record"] .bd-o1 { --x: 7%; --y: 16%; }
:root[data-room="record"] .bd-o2 { --x: 93%; --y: 58%; }
:root[data-room="record"] .bd-o3 { --x: 9%; --y: 62%; }
:root[data-room="record"] .bd-eye { --y: 3%; --x: 84%; --o: 0.45; }
:root[data-room="archive"] .bd-o1 { --x: 93%; --y: 30%; }
:root[data-room="archive"] .bd-o2 { --x: 88%; --y: 4%; }
:root[data-room="archive"] .bd-o3 { --x: 5%; --y: 14%; }
:root[data-room="letters"] .bd-o1 { --x: 5%; --y: 8%; }
:root[data-room="letters"] .bd-o2 { --x: 94%; --y: 40%; }
:root[data-room="letters"] .bd-o3 { --y: -40%; }
:root[data-room="letters"] .bd-balloon { --x: 88%; --y: 30%; }

.bd-eye { translate: -50% 0; }
.bd-eye .bd-iris { transition: transform 0.4s ease-out; }

/* the crooked tree and the spiral hill come in from the wings */
.bd-tree, .bd-hill {
  position: absolute;
  bottom: calc(var(--sea-h) - 2.2rem);
  transition: transform 1.8s cubic-bezier(.55, 0, .2, 1), opacity 1.2s ease;
}
.bd-tree { left: -1rem; width: min(17rem, 26vw); transform: translateX(-110%); }
.bd-hill { right: -2rem; width: min(26rem, 38vw); transform: translateX(110%); }
:root[data-room="foyer"] .bd-tree, :root[data-room="archive"] .bd-tree { transform: none; }
:root[data-room="foyer"] .bd-hill, :root[data-room="record"] .bd-hill { transform: none; }
.bd-tree svg, .bd-hill svg { display: block; width: 100%; height: auto; overflow: visible; }

/*
  The paper sea, always at the bottom of the stage. Each strip is a repeating wave cut out
  with a mask and slid sideways with a transform, which the graphics card does on its own:
  no redrawing while it moves. A darker copy sits a few pixels higher, like the shadow one
  sheet of card throws on the one behind it.
*/
:root {
  --wave-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 60' preserveAspectRatio='none'%3E%3Cpath d='M0 18 Q40 2 80 18 T160 18 V60 H0Z'/%3E%3C/svg%3E");
  --curl-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='28'%3E%3Cg fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M4 20 C8 8 24 6 28 15 C31 22 22 25 19 19 C17 15 22 13 24 16'/%3E%3Cpath d='M40 9 C44 2 58 2 62 9 C65 15 58 18 55 14'/%3E%3Cpath d='M44 22 q8 -4 16 0'/%3E%3C/g%3E%3C/svg%3E");
}
.bd-sea {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sea-h);
  overflow: hidden;
}
.wave {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(100% + var(--p));
  height: var(--h);
  will-change: transform;
}
.wave i {
  position: absolute;
  inset: 0;
  -webkit-mask: var(--wave-tile) left top / var(--p) 100% repeat-x;
  mask: var(--wave-tile) left top / var(--p) 100% repeat-x;
}
.wave .shade { top: -4px; background: var(--wave-edge); opacity: 0.55; }
.wave .fill { background: var(--wc); }
.wave .curls {
  background: var(--curl);
  opacity: 0.55;
  -webkit-mask: var(--wave-tile) left top / var(--p) 100% repeat-x, var(--curl-tile) 0 0 / 72px 28px repeat;
  -webkit-mask-composite: source-in;
  mask: var(--wave-tile) left top / var(--p) 100% repeat-x, var(--curl-tile) 0 0 / 72px 28px repeat;
  mask-composite: intersect;
}
.wave-1 { --p: 180px; --h: 100%; --wc: var(--wave-1); }
.wave-2 { --p: 150px; --h: 70%; --wc: var(--wave-2); }
.wave-3 { --p: 124px; --h: 44%; --wc: var(--wave-3); }
@media (prefers-reduced-motion: no-preference) {
  .wave-1 { animation: drift 46s linear infinite; }
  .wave-2 { animation: drift 34s linear infinite reverse; }
  .wave-3 { animation: drift 26s linear infinite; }
  @keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(calc(var(--p) * -1), 0, 0); } }
  .bd-boat { animation: bob 5s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(3px) rotate(-2deg); } }
}
.bd-boat {
  position: absolute;
  left: 62%;
  bottom: 38%;
  width: 6.5rem;
  opacity: 0;
  transition: opacity 1.2s ease;
  transform-origin: 50% 100%;
  will-change: transform;
}
.bd-boat svg { display: block; width: 100%; height: auto; overflow: visible; }
:root[data-room="letters"] .bd-boat { opacity: 1; }

/* narrow screens: fewer pieces, smaller, out at the edges */
@media (max-width: 47.99rem) {
  .bd-tree, .bd-hill { display: none; }
  .bd-piece { --w: 3.6rem !important; }
  .bd-o3 { display: none; }
  .bd-eye { --w: 78vw !important; }
  :root[data-room="record"] .bd-eye { --o: 0.28; --y: 1%; --x: 74%; }
  .backdrop { bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  :root { --sea-h: 4.5rem; }
}

/* ---------- the app shell ---------- */

.app { min-height: 100vh; min-height: 100dvh; position: relative; z-index: 1; }

/* Narrow screens: a slim top bar, rooms as a tab bar along the bottom. */
.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.55rem) max(16px, env(safe-area-inset-right, 0px)) 0.55rem max(16px, env(safe-area-inset-left, 0px));
  background: var(--glass);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 6px 14px -8px var(--shadow);
}

.mark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-ind);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  min-width: 0;
}
.mark svg { width: 2.5rem; height: auto; color: var(--ink); flex: none; }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  background: var(--bg-2);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -6px 14px -8px var(--shadow);
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) var(--safe-b) max(8px, env(safe-area-inset-left, 0px));
}
.tabs::before { /* a thin iridescent seam along the top edge */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: var(--iridescent);
  opacity: 0.6;
}
.tabs ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tabs a {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.15rem;
  height: var(--tabbar-h);
  color: var(--ink-dim);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon { width: 1.5rem; height: 1.5rem; }
.tab-no { display: none; }
.tab-name {
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tabs a[aria-current="page"] { color: var(--temper-ink); }
.tabs a[aria-current="page"]::after { /* a striped ribbon, a little Burton */
  content: "";
  position: absolute;
  top: 0;
  left: 26%;
  right: 26%;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--temper-ink) 0 5px, transparent 5px 8px);
  filter: drop-shadow(0 0 4px var(--temper));
}
.tabs a:hover { color: var(--ink); }

.rail-tools { display: flex; align-items: center; gap: 0.5rem; }
.rail-note { display: none; }

.lamp {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 0.65rem;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.lamp svg { width: 1.2rem; height: 1.2rem; flex: none; }
.lamp:hover { color: var(--temper-ink); border-color: var(--temper-ink); }
.lamp[aria-pressed="true"] svg { color: var(--rust); }
@media (max-width: 30rem) {
  .lamp span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lamp { width: 2.5rem; justify-content: center; padding: 0; }
}

.pyrometer {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.3rem 0.55rem 0.25rem;
  background: var(--well);
  border: 1px solid color-mix(in srgb, var(--temper) 55%, var(--rule));
  border-radius: 2px;
  font-family: var(--font-mono);
  color: var(--temper-ink);
  font-variant-numeric: tabular-nums;
}
.pyro-temp { font-weight: 500; font-size: 1.05rem; line-height: 1; min-width: 3ch; text-align: right; }
.pyro-unit { font-size: 0.7rem; }
.pyro-phase { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); margin-left: 0.3rem; }
.pyrometer.spike { color: #fff1c8; border-color: #f4c060; background: #3a140a; }
@media (max-width: 24rem) { .pyro-phase { display: none; } }

main {
  display: block;
  container-type: inline-size;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 1rem);
  outline: none;
}
body.has-dock main { padding-bottom: calc(var(--tabbar-h) + var(--dock-h) + var(--safe-b) + 1.5rem); }

/* Wide screens: a side rail, like the spine of a ledger. */
@media (min-width: 60rem) {
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rail {
    top: 0;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2rem;
    padding: 1.6rem 1.2rem 1.4rem;
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    background: var(--fiber), color-mix(in srgb, var(--bg-2) 92%, transparent);
    box-shadow: 8px 0 18px -10px var(--shadow);
  }
  .rail::after { /* the spine */
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: -1px;
    width: 1px;
    background: linear-gradient(var(--ochre), var(--rust) 30%, var(--plum) 60%, var(--teal) 85%, var(--verdigris));
    opacity: 0.6;
  }
  .mark { flex-direction: column; align-items: flex-start; gap: 0.6rem; font-size: 1.15rem; }
  .mark svg { width: 4.2rem; }
  .tabs {
    position: static;
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .tabs::before { display: none; }
  .tabs ul { display: grid; grid-template-columns: none; gap: 0.15rem; }
  .tabs a {
    height: auto;
    grid-template-columns: 1.5rem 2.2rem 1fr;
    justify-items: start;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem 0.55rem 0.7rem;
    border-radius: 2px;
  }
  .tab-no { display: block; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.08em; }
  .tab-name { font-size: 1rem; }
  .tabs a[aria-current="page"] { background: color-mix(in srgb, var(--temper) 14%, transparent); }
  .tabs a[aria-current="page"]::after {
    top: 0.45rem;
    bottom: 0.45rem;
    left: 0;
    right: auto;
    width: 3px;
    height: auto;
    background: repeating-linear-gradient(180deg, var(--temper-ink) 0 5px, transparent 5px 8px);
  }
  .rail-tools { margin-top: auto; flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .rail-note { display: block; margin: 0; font-style: italic; font-size: 0.92rem; line-height: 1.4; color: var(--ink-dim); }
  .pyrometer { padding: 0.5rem 0.7rem 0.45rem; }
  .pyro-temp { font-size: 1.5rem; }
  .pyro-phase { margin-left: auto; }

  main { padding-bottom: calc(var(--sea-h) + 1rem); }
  body.has-dock main { padding-bottom: calc(var(--sea-h) + var(--dock-h) + 2rem); }
}

/* ---------- rooms ---------- */

.room {
  width: 100%;
  max-width: 64rem;
  margin-inline: auto;
  padding: 2rem max(16px, env(safe-area-inset-right, 0px)) 3rem max(16px, env(safe-area-inset-left, 0px));
  position: relative;
}
@media (min-width: 60rem) { .room { padding: 3rem 3rem 3.5rem; } }
.js .room:not(.is-active) { display: none; }

/* changing rooms: an iris, like an old film opening on a new scene */
@media (prefers-reduced-motion: no-preference) {
  .room.iris { animation: iris 0.8s cubic-bezier(.65, 0, .25, 1) backwards; }
  @keyframes iris {
    from { clip-path: circle(0px at var(--ox, 50%) var(--oy, 0px)); }
    to { clip-path: circle(var(--ir, 150vmax) at var(--ox, 50%) var(--oy, 0px)); }
  }
}

/* room titles sit centred, like a title card, with a scroll flourish beneath */
.room-head {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  text-align: center;
  padding-bottom: 1.8rem;
  margin-bottom: 2.4rem;
  position: relative;
}
.room-head::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  translate: -50% 0;
  width: min(100%, 22rem);
  height: 1.6rem;
  background: var(--temper-ink);
  -webkit-mask: var(--flourish) center / contain no-repeat;
  mask: var(--flourish) center / contain no-repeat;
}
:root {
  --flourish: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 28'%3E%3Cg fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M128 14 H150 C162 14 166 4 178 6 C188 8 188 20 179 21 C172 22 170 13 177 12'/%3E%3Cpath d='M112 14 H90 C78 14 74 4 62 6 C52 8 52 20 61 21 C68 22 70 13 63 12'/%3E%3Cpath d='M190 14 H236'/%3E%3Cpath d='M50 14 H4'/%3E%3C/g%3E%3Cpath d='M120 6 L126 14 L120 22 L114 14Z' fill='black'/%3E%3Ccircle cx='238' cy='14' r='1.6'/%3E%3Ccircle cx='2' cy='14' r='1.6'/%3E%3C/svg%3E");
}
.room-lede { margin: 0; max-width: var(--measure); color: var(--ink-dim); font-style: italic; font-size: 1.1rem; }

/* crop marks and liner-note labels in the corners, like a printed sheet */
.cropped { position: relative; padding: 2.4rem 1.4rem; }
.crop {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1;
  white-space: nowrap;
}
.crop::before {
  content: "";
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  border: 0 solid var(--rule-strong);
}
.crop-tl { top: 0; left: 0; padding: 0.2rem 0 0 1.3rem; }
.crop-tl::before { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.crop-tr { top: 0; right: 0; padding: 0.2rem 1.3rem 0 0; }
.crop-tr::before { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.crop-bl { bottom: 0; left: 0; padding: 0 0 0.2rem 1.3rem; }
.crop-bl::before { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.crop-br { bottom: 0; right: 0; padding: 0 1.3rem 0.2rem 0; }
.crop-br::before { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }
@media (max-width: 30rem) { .crop-br, .crop-bl { font-size: 0.52rem; } }

/* ---------- cut paper ---------- */

/* cream cardstock: a card lifted a little off the wall, edges cut by hand */
.frame {
  position: relative;
  isolation: isolate;
  padding: 1.5rem 1.4rem;
  color: var(--card-ink);
  --ink: var(--card-ink);
  --ink-dim: var(--card-dim);
  --rule: var(--card-rule);
  --rule-strong: rgba(42, 42, 39, 0.38);
  --temper-ink: var(--temper-dark);
  --alarm: #8e2a1f;
  --art-fill: var(--card-2);
  --well: var(--card-2);
  filter: drop-shadow(0 14px 14px var(--shadow)) drop-shadow(0 2px 1px rgba(0, 0, 0, 0.18));
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s cubic-bezier(.3, 1.4, .5, 1), filter 0.35s ease;
}
.frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--speck), var(--fiber), linear-gradient(172deg, var(--card), var(--card-2));
  clip-path: var(--cut);
}
.frame::after { /* the printed inner rule */
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--card-rule);
  pointer-events: none;
}
.frame .corner {
  position: absolute;
  width: 1.6rem;
  height: 1.6rem;
  color: var(--temper-ink);
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}
.corner-tl { top: 1px; left: 1px; }
.corner-tr { top: 1px; right: 1px; transform: scaleX(-1); }
.corner-bl { bottom: 1px; left: 1px; transform: scaleY(-1); }
.corner-br { bottom: 1px; right: 1px; transform: scale(-1, -1); }

/* ---------- Room I: the foyer ---------- */

.hero { display: grid; gap: 1rem; justify-items: center; text-align: center; margin-top: 0.5rem; }

.wordmark {
  font-size: clamp(4rem, 18cqi, 11rem);
  letter-spacing: 0.01em;
  color: var(--temper-ink);
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  line-height: 0.85;
  margin-top: 0.4rem;
  text-shadow:
    0 0 0.2em color-mix(in srgb, var(--temper) 55%, transparent),
    0 0 0.6em color-mix(in srgb, var(--temper) 35%, transparent);
}
:root[data-theme="parchment"] .wordmark {
  text-shadow: 0 0 0.3em color-mix(in srgb, var(--temper) 45%, transparent);
}
.wordmark span { display: inline-block; transform: translateY(var(--dy, 0)) rotate(var(--r, 0deg)); }
.wordmark .hot { position: relative; }
/* one letter never quite cools */
.wordmark .hot { color: #fff1c8; text-shadow: 0 0 0.2em #f4c060, 0 0 0.55em #e08a3a, 0 0 1.1em #c0571f; }
:root[data-theme="parchment"] .wordmark .hot { color: #b84f1e; text-shadow: 0 0 0.25em #f4c060, 0 0 0.7em #f4c060; }

@media (prefers-reduced-motion: no-preference) {
  /* page-load: the name is pulled out white-hot, then cools to the room's temper */
  .wordmark span { animation: quench 2.8s cubic-bezier(.2,.6,.2,1) both; animation-delay: calc(var(--i) * 70ms); }
  @keyframes quench {
    0% { color: #fffbe8; text-shadow: 0 0 0.4em #fff4cf, 0 0 1em #f4c060; }
    40% { color: #f6cf7a; text-shadow: 0 0 0.35em #e3b862; }
  }
  /* the hot letter breathes */
  /* the hot letter breathes: a glow layer fading in and out, which costs nothing to animate */
  .wordmark .hot::after {
    content: attr(data-ch);
    position: absolute;
    left: 0;
    top: 0;
    color: transparent;
    text-shadow: 0 0 0.3em #f4c060, 0 0 0.9em #e08a3a, 0 0 1.6em #c0571f;
    opacity: 0;
    pointer-events: none;
    animation: ember 4.6s ease-in-out 3s infinite;
    will-change: opacity;
  }
  @keyframes ember { 50% { opacity: 1; } }
  /* touch the name and its temper splits, like oil on steel */
  .wordmark:hover span { animation: temper-split 0.5s steps(2) 1; }
  @keyframes temper-split {
    0% { text-shadow: -0.04em 0 var(--plum), 0.04em 0 var(--teal); transform: translate(0.02em, var(--dy, 0)) rotate(var(--r, 0deg)); }
    100% { text-shadow: 0.03em 0 var(--rust), -0.03em 0 var(--verdigris); }
  }
}

.hero-line {
  font-size: var(--step-2);
  font-style: italic;
  line-height: 1.25;
  max-width: 24ch;
  margin: 0;
  text-wrap: balance;
}
.hero-cta { margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }

.lehr-figure { margin: 1.5rem 0 0; display: grid; gap: 0.75rem; }
.lehr-button {
  all: unset;
  display: block;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.lehr-button:focus-visible { outline: 2px dashed var(--temper-ink); outline-offset: 6px; }
.lehr { width: 100%; height: auto; max-width: 100%; color: var(--ink); overflow: visible; display: block; }
/* the smoke lives on its own sheet over the lehr, so puffing doesn't redraw the hand-inked lehr */
.lehr-button { position: relative; }
.lehr-smoke { position: absolute; left: 0; top: 0; width: 100%; height: auto; color: var(--ink); overflow: visible; pointer-events: none; }
.lehr .plate { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; fill: var(--ink-dim); }
.lehr .fig-letters text { font-family: var(--font-narr); font-style: italic; font-size: 20px; fill: var(--temper-ink); }
.lehr .fig-letters line { stroke: var(--temper-ink); stroke-width: 1; opacity: 0.7; }

.lehr .lid { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); }
.lehr .pupil { transition: transform 0.25s ease-out; }
.lehr .door { transform-box: fill-box; transform-origin: 50% 0; transition: transform 0.6s cubic-bezier(.3,1.6,.5,1); }
.lehr-button.awake .door { transform: translateY(-26px) rotate(-8deg); }
.lehr-button.awake .eye-glow, .lehr-button.awake .mouth-glow { filter: brightness(1.35) saturate(1.2); }
.lehr-button.blink .lid { animation: blink 0.32s ease-in-out; }
@keyframes blink { 50% { transform: scaleY(1); } }
.lehr-button.jolt .lehr { animation: jolt 0.35s ease-out; }
@keyframes jolt { 30% { transform: rotate(-0.8deg) translateY(-3px); } 70% { transform: rotate(0.5deg); } }
.pyro-needle { transform-box: view-box; transform-origin: 446px 88px; transition: transform 0.8s ease; }

@media (prefers-reduced-motion: no-preference) {
  .mouth-glow, .eye-glow { animation: flicker 3.4s steps(1) infinite; }
  @keyframes flicker {
    0% { opacity: 1; } 18% { opacity: 0.86; } 22% { opacity: 1; } 47% { opacity: 0.92; }
    53% { opacity: 1; } 78% { opacity: 0.84; } 80% { opacity: 1; }
  }
  .puff { animation: rise 5s ease-in infinite; }
  .puff.p2 { animation-delay: 2.5s; }
  @keyframes rise {
    0% { transform: translateY(14px); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translate(8px, -30px); opacity: 0; }
  }
  .lehr-button:hover .lehr { animation: shiver 0.6s ease-in-out; }
  @keyframes shiver { 25% { transform: rotate(0.3deg); } 75% { transform: rotate(-0.3deg); } }
}

.lehr-figure figcaption {
  font-size: var(--step--1);
  color: var(--ink-dim);
  font-style: italic;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  text-align: center;
}
.fig-no { margin-right: 0.4em; font-style: normal; }
.legend {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: fig;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 1.4rem;
}
.legend li { counter-increment: fig; }
.legend li::before { content: counter(fig, upper-alpha) ". "; font-family: var(--font-narr); color: var(--temper-ink); }

.lehr-says {
  min-height: 1.6em;
  margin: 0;
  font-style: italic;
  font-size: var(--step-1);
  color: var(--temper-ink);
  text-align: center;
}

.foyer-board {
  display: grid;
  gap: 1.8rem;
  margin-top: 2.8rem;
}
@container (min-width: 44rem) {
  .foyer-board { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .warning { grid-row: span 2; }
}
.foyer-board > :nth-child(1) { --tilt: -0.5deg; }
.foyer-board > :nth-child(2) { --tilt: 0.6deg; }
.foyer-board > :nth-child(3) { --tilt: -0.35deg; }

.warning { display: grid; gap: 0.7rem; align-content: start; padding: 1.8rem 1.6rem; }
.warning .kicker { color: var(--alarm); padding-right: 4.5rem; }
.warning-text p { margin: 0 0 0.8rem; font-size: 1.14rem; line-height: 1.6; }
.warning-text p:last-child { margin-bottom: 0; }
.warning-seal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 4.2rem;
  height: 4.2rem;
  color: var(--card-dim);
  opacity: 0.9;
  z-index: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .warning-seal { animation: turn 90s linear infinite; }
}
.seal-text { font-family: var(--font-mono); font-size: 6.4px; letter-spacing: 0.06em; fill: currentColor; }

.card {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  text-decoration: none;
}
.card:hover { transform: rotate(0deg) translateY(-4px); filter: drop-shadow(0 20px 18px var(--shadow)) drop-shadow(0 2px 1px rgba(0, 0, 0, 0.18)); }
.card-big {
  margin: 0.2rem 0 0;
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: 3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--temper-ink);
}
.card-big small { font-size: 0.42em; color: var(--ink-dim); margin-left: 0.15em; }
.card-line { margin: 0; font-size: 1.05rem; line-height: 1.5; color: var(--ink); }
.card-go {
  margin-top: 0.5rem;
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--temper-ink);
}

/* ---------- Room II: the record ---------- */

/* laid out like a sleeve: the emblem dead centre, everything else around it */
.album {
  display: grid;
  gap: 1.4rem;
  justify-items: center;
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.8rem 1.4rem 2.6rem;
}

.album-cover {
  margin: 0;
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 17rem);
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 70% at 30% 25%, rgba(255, 255, 255, 0.16), transparent 60%),
    conic-gradient(from 210deg, var(--ochre), var(--rust), var(--plum), var(--teal), var(--verdigris), var(--plum), var(--ochre));
  box-shadow: 0 1.4rem 2.4rem -1rem var(--shadow), 0 2px 1px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: rotate(-0.6deg);
}
.album-cover::before { /* a darker lacquer so the shape reads */
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fiber), radial-gradient(circle at 50% 50%, rgba(18, 24, 26, 0.5), rgba(18, 24, 26, 0.82));
}
.album-cover svg { position: relative; width: 86%; height: auto; color: #ece4d4; --art-fill: #26272c; overflow: visible; }
.tesseract line { stroke-width: var(--w, 1); opacity: var(--o, 1); }
.tess-pupil { transition: transform 0.3s ease-out; }
.cover-note {
  position: absolute;
  bottom: 0.6rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(236, 228, 212, 0.7);
}

.album-meta { display: grid; gap: 0.5rem; justify-items: center; min-width: 0; width: 100%; }
.album-title { margin: 0; font-family: var(--font-ind); font-weight: 900; font-size: clamp(2.2rem, 7cqi, 3.4rem); line-height: 1; text-transform: uppercase; }
.album-sub { margin: 0; color: var(--ink-dim); font-style: italic; max-width: 30rem; }

.process {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  width: min(100%, 34rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.process a {
  display: grid;
  gap: 0.1rem;
  padding: 0.6rem 0.6rem 0.55rem;
  border-top: 3px solid var(--c, var(--ochre));
  background: var(--fiber), var(--sil);
  color: var(--sil-ink);
  text-decoration: none;
  min-width: 0;
  box-shadow: 0 8px 12px -6px var(--shadow);
  transition: transform 0.25s ease;
}
.process a:hover { transform: translateY(-3px); }
.process [data-phase="heat"] { --c: var(--ochre); }
.process [data-phase="soak"] { --c: #b2456f; }
.process [data-phase="cool"] { --c: #3f8a95; }
.process .p-no { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--sil-dim); }
.process .p-name { font-family: var(--font-ind); font-weight: 900; font-size: clamp(0.92rem, 4.2cqi, 1.15rem); text-transform: uppercase; line-height: 1; }
@container (max-width: 26rem) {
  .process a { padding-inline: 0.45rem; }
  .process .p-no, .process .p-state { font-size: 0.56rem; letter-spacing: 0.04em; }
}
.process .p-state { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sil-dim); overflow-wrap: anywhere; }
.process [data-state="open"] .p-state { color: var(--temper-light); }

.chambers { display: grid; gap: 3rem; }

/* each chamber is a dark paper silhouette, arched like a kiln door */
.chamber {
  --c: var(--ochre);
  --ink: var(--sil-ink);
  --ink-dim: var(--sil-dim);
  --well: var(--sil-well);
  --rule: rgba(237, 228, 208, 0.16);
  --temper-ink: var(--temper-light);
  position: relative;
  isolation: isolate;
  color: var(--ink);
  padding: 3.4rem 1rem 1.6rem;
  display: grid;
  gap: 1.2rem;
  min-width: 0;
  scroll-margin-top: 5rem;
}
.chamber::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 46% 46% 8px 8px / 7rem 7rem 8px 8px;
  border: 1.5px solid color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 18px 26px -10px var(--shadow), 0 2px 1px rgba(0, 0, 0, 0.3);
  background:
    radial-gradient(90% 9rem at 50% 0, color-mix(in srgb, var(--c) 30%, transparent), transparent),
    var(--fiber),
    var(--sil);
}
.chamber[data-phase="heat"] { --c: var(--ochre); }
.chamber[data-phase="soak"] { --c: #b2456f; }
.chamber[data-phase="cool"] { --c: #3f8a95; }

.chamber-head { text-align: center; display: grid; gap: 0.35rem; justify-items: center; }
.chamber-no { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin: 0; }
.chamber h3 { font-size: clamp(2.4rem, 11cqi, 3.6rem); text-transform: uppercase; color: var(--ink); }
.chamber-summary { margin: 0; max-width: 28rem; color: var(--ink-dim); font-style: italic; }
.chamber-status {
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  margin: 0;
}
.chamber.is-open .chamber-status { color: var(--temper-ink); }
.chamber.is-sealed .chamber-status { color: var(--ink-dim); }

/* the gauge on a sealed chamber */
.gauge { display: grid; justify-items: center; gap: 0.4rem; }
.gauge svg { width: min(100%, 17rem); height: auto; display: block; }
.gauge .dial-face { fill: var(--well); stroke: var(--ink-dim); stroke-width: 1.5; }
.gauge .tick { stroke: var(--ink-dim); stroke-width: 1.4; }
.gauge .tick-label { font-family: var(--font-mono); font-size: 8.5px; fill: var(--ink-dim); }
.gauge .band { fill: none; stroke-width: 6; }
.gauge .needle { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; transform-origin: 100px 104px; transition: transform 1s ease; }
.gauge .hub { fill: var(--ink); }
.gauge .glyph { font-family: var(--font-narr); font-style: italic; font-size: 11px; fill: var(--ink-dim); }
.gauge-temp {
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: 3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin: 0;
}
.gauge-temp small { font-size: 0.45em; color: var(--ink-dim); margin-left: 0.1em; }
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 3.6rem));
  gap: 0.4rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  text-align: center;
}
.countdown li { border: 1px solid var(--rule); padding: 0.35rem 0 0.25rem; background: var(--well); }
.countdown b { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown span { font-family: var(--font-ind); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.gauge-date { margin: 0; font-size: var(--step--1); color: var(--ink-dim); text-align: center; }
.gauge-note { margin: 0; text-align: center; font-style: italic; max-width: 26rem; justify-self: center; }
/* sealed: a strip of striped tape, the kind you shouldn't cross */
.sealed-count {
  margin: 0 -1rem;
  padding: 0.5rem 1rem;
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: var(--step--2);
  color: var(--ink);
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 45%, transparent) 0 10px, transparent 10px 20px);
  border-block: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
}
.sealed-count span { background: var(--sil); padding: 0.2rem 0.7rem; }

/* arrivals: a cream card with a brass eyepiece cut into it, and through it, space.
   The only thing in the theatre that isn't paper. */
.arrivals { display: grid; gap: 2rem; padding: 0; margin: 0; list-style: none; }
@container (min-width: 44rem) { .arrivals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.arrival {
  position: relative;
  background: var(--speck), var(--fiber), linear-gradient(172deg, var(--card), var(--card-2));
  color: var(--tag-ink);
  padding: 1.4rem 1.2rem 1.2rem;
  display: grid;
  gap: 0.7rem;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 18px 24px -12px rgba(0, 0, 0, 0.6), 0 2px 1px rgba(0, 0, 0, 0.25);
  min-width: 0;
}
.arrival::after { /* the printed inner rule */
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--card-rule);
  pointer-events: none;
}
.arrival:nth-child(odd) { --tilt: -0.6deg; }
.arrival:nth-child(even) { --tilt: 0.5deg; }
.arrival h4 { font-size: 2rem; text-transform: uppercase; color: var(--tag-ink); letter-spacing: 0.01em; }
.arrival-origin { margin: 0; font-style: italic; font-size: 1.05rem; line-height: 1.45; color: var(--tag-ink-dim); }

.plate { position: relative; justify-self: center; width: min(100%, 17rem); margin: 0.2rem 0 0.4rem; }
.plate-lg { width: min(100%, 21rem); margin: 0 auto 0.6rem; }
.eyepiece {
  all: unset;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: #03060b;
  /* a brass bezel, then the hole cut in the card around it */
  box-shadow:
    0 0 0 3px #b8893a,
    0 0 0 4px #5a3f16,
    0 0 0 8px rgba(255, 250, 235, 0.5),
    0 0 0 9px rgba(42, 31, 23, 0.25),
    0 10px 18px 6px rgba(0, 0, 0, 0.28);
  -webkit-tap-highlight-color: transparent;
}
.eyepiece canvas { display: block; width: 100%; height: 100%; }
.eyepiece::after { /* depth: the window is set back into the paper */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 10px 24px rgba(0, 0, 0, 0.85), inset 0 -2px 8px rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.eyepiece:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 12px; }
.reticle { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(214, 226, 236, 0.3); pointer-events: none; }
.plate .stamp { top: auto; bottom: -0.2rem; right: -1.1rem; z-index: 1; background: rgba(235, 225, 204, 0.75); }

/* the meteor: the one thing on the wall that isn't paper */
.meteor {
  position: absolute;
  left: 0;
  top: 0;
  width: 9rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 250, 235, 0.95), rgba(190, 220, 255, 0.4) 30%, transparent);
  transform-origin: 0 50%;
  pointer-events: none;
  opacity: 0;
}
.meteor::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px rgba(210, 230, 255, 0.9);
}

/* a far point of light on a sealed chamber's tape: something on its way */
.twinkle { font-style: normal; color: var(--temper-ink); display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .twinkle { animation: twinkle 2.6s ease-in-out infinite; }
  @keyframes twinkle { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }
}
.tag-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tag-ink-dim);
  border-bottom: 1px solid var(--tag-ink-dim);
  padding-bottom: 0.35rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.tag-title {
  all: unset;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  text-decoration-color: rgba(42, 31, 23, 0.35);
}
.tag-title:hover { text-decoration-color: currentColor; }
.tag-title:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 3px; }
.tag dl, .dossier dl { margin: 0; display: grid; gap: 0.2rem 0.8rem; grid-template-columns: auto minmax(0, 1fr); }
.tag dt, .dossier dt { font-family: var(--font-ind); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tag-ink-dim); padding-top: 0.25rem; }
.tag dd, .dossier dd { margin: 0; font-size: 1rem; line-height: 1.4; }
.tag-note {
  margin: 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.45;
  padding: 0.6rem 0.7rem;
  background: rgba(255, 250, 235, 0.35);
  border-left: 2px solid var(--tag-ink-dim);
}
.tag-note cite { font-style: normal; display: block; text-align: right; color: var(--tag-ink-dim); }
.tag-more {
  justify-self: start;
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tag-ink);
  background: none;
  border: 1px solid var(--tag-ink-dim);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
}
.tag-more:hover { background: rgba(255, 250, 235, 0.35); }
.stamp {
  position: absolute;
  top: 2.6rem;
  right: 0.8rem;
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7a2c12;
  border: 2px solid currentColor;
  padding: 0.1rem 0.4rem;
  transform: rotate(-9deg);
  opacity: 0.75;
  mix-blend-mode: multiply;
}
[data-phase="soak"] .stamp { color: #6e1f2c; }
[data-phase="cool"] .stamp { color: #1f4a52; }

/* player (on tags and in the dossier) */
.player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--tag-ink-dim);
}
.player button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 2px solid var(--tag-ink);
  background: var(--tag-ink);
  color: var(--manila);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.player.is-playing button { box-shadow: 0 0 0 4px rgba(168, 83, 44, 0.4); }
.player button:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 3px; }
.player button svg, .dock-play svg { width: 1rem; height: 1rem; }
.player input[type="range"] {
  width: 100%;
  accent-color: var(--tag-ink);
  margin: 0;
  min-width: 0;
}
.player time { font-family: var(--font-mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--tag-ink-dim); white-space: nowrap; }
.player-caption { grid-column: 1 / -1; margin: -0.3rem 0 0; font-size: 0.82rem; font-style: italic; color: var(--tag-ink-dim); }

/* the edition */
.edition { margin: 3.5rem auto 0; display: grid; gap: 0.8rem; max-width: 42rem; padding: 2rem 1.8rem; --tilt: 0.4deg; }
.edition .kicker { color: var(--alarm); }
.edition h3 { font-size: var(--step-2); text-transform: uppercase; letter-spacing: 0.04em; }
.edition-text p { margin: 0 0 0.8rem; font-size: 1.1rem; }
.edition-text p:last-child { margin: 0; }
.edition-list {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-dim);
}
.edition-list li { display: grid; grid-template-columns: 1.3rem 1fr; }
.edition-list li::before { content: "◇"; color: var(--temper-ink); }

/* ---------- Room III: the archive ---------- */

.workshop > .sub-head, .log-head { text-align: center; }
.workshop-grid {
  display: grid;
  gap: 2.5rem;
  margin-top: 1.6rem;
}
@container (min-width: 50rem) {
  .workshop-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); align-items: start; }
}
.lore { max-width: var(--measure); min-width: 0; font-size: 1.15rem; line-height: 1.7; }
.lore p { margin: 0 0 1.1rem; }
.lore p:first-child::first-letter {
  font-family: var(--font-ind);
  font-weight: 900;
  float: left;
  font-size: 4.2em;
  line-height: 0.8;
  margin: 0.08em 0.1em 0 0;
  color: var(--temper-ink);
  text-shadow: 0 0 0.3em color-mix(in srgb, var(--temper) 40%, transparent);
}
.lore .signoff { font-style: italic; color: var(--ink-dim); }

/* invisible ink: the colour of the wall until a reader highlights it */
.lore .ink { color: var(--bg); text-shadow: none; }
.lore .ink::selection { color: var(--temper-ink); background: var(--well); }
.lore ::selection { background: color-mix(in srgb, var(--temper) 45%, transparent); color: var(--ink); }

.schedule { margin: 0; min-width: 0; display: grid; gap: 0.6rem; --tilt: 0.8deg; padding: 1.4rem 1.2rem 1.2rem; }
.schedule svg { width: 100%; height: auto; display: block; }
.schedule .grid line { stroke: var(--ink-dim); stroke-width: 1; }
.schedule .grid .faint { opacity: 0.25; stroke-dasharray: 2 4; }
.schedule .grid .zone { opacity: 0.4; stroke-dasharray: 4 4; }
.schedule .ticks text { font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-dim); font-variant-numeric: tabular-nums; }
.schedule .ticks .axis { font-family: var(--font-narr); font-style: italic; font-size: 12px; }
.schedule .marks line { stroke: var(--ink-dim); stroke-width: 1; stroke-dasharray: 6 3; opacity: 0.6; }
.schedule .mark-label { font-family: var(--font-narr); font-style: italic; font-size: 11px; fill: var(--ink-dim); }
.schedule .curve { fill: none; stroke: var(--temper-ink); stroke-width: 2.6; stroke-linecap: round; filter: url(#wobble); }
.schedule .zones text { font-family: var(--font-ind); font-weight: 900; font-size: 12px; letter-spacing: 0.12em; fill: var(--temper-ink); }
.schedule figcaption { font-size: var(--step--1); color: var(--ink-dim); font-style: italic; }

.peeker {
  position: absolute;
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: 0.5rem;
  width: 4.5rem;
  color: var(--ink-dim);
  transform: rotate(-6deg);
  opacity: 0.85;
}

/* the keeper's log: each entry a slip of paper pinned along a thread */
.log {
  padding-top: 3.5rem;
  display: grid;
  gap: 1.4rem;
  max-width: 42rem;
  margin-inline: auto;
}
.log-head { display: grid; gap: 0.3rem; }
.log-head p { margin: 0; color: var(--ink-dim); font-style: italic; }
.log-entries { list-style: none; margin: 0; padding: 0 0 0 0.6rem; display: grid; gap: 1.1rem; border-left: 1px dashed var(--rule-strong); }
.log-entries li {
  position: relative;
  margin-left: 1rem;
  padding: 0.8rem 1rem 0.9rem;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  color: var(--card-ink);
  background: var(--fiber), linear-gradient(172deg, var(--card), var(--card-2));
  clip-path: var(--cut);
  filter: drop-shadow(0 8px 8px var(--shadow));
  transform: rotate(var(--tilt, 0deg));
}
.log-entries li:nth-child(odd) { --tilt: -0.4deg; }
.log-entries li:nth-child(even) { --tilt: 0.5deg; }
.log-entries li::before { /* the pin */
  content: "";
  position: absolute;
  left: -1.55rem;
  top: 1.05rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--temper-ink);
}
.log-entries li:first-child::before { background: var(--temper-ink); box-shadow: 0 0 0.6rem var(--temper); }
.log-day {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  align-items: baseline;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--step--2);
  font-variant-numeric: tabular-nums;
}
.log-day span { color: var(--temper-dark); font-size: 0.85rem; }
.log-day time { color: var(--card-dim); }
.log-text { margin: 0; font-size: 1.1rem; line-height: 1.55; max-width: var(--measure); }

/* ---------- Room IV: correspondence ---------- */

.counter-grid { display: grid; gap: 2rem; align-items: end; justify-content: center; }
@container (min-width: 46rem) { .counter-grid { grid-template-columns: minmax(0, 32rem) auto; } }

.ledger {
  background:
    repeating-linear-gradient(transparent 0 1.95rem, rgba(42, 31, 23, 0.18) 1.95rem 2rem),
    var(--speck),
    linear-gradient(170deg, var(--manila), var(--manila-deep));
  color: var(--tag-ink);
  padding: 1.4rem 1.2rem 1.4rem;
  display: grid;
  gap: 0.4rem;
  transform: rotate(-0.6deg);
  box-shadow: 0 1.4rem 2rem -1rem var(--shadow), 0 2px 1px rgba(0, 0, 0, 0.2);
  min-width: 0;
}
.ledger-head { color: var(--tag-ink-dim); border-bottom: 1px solid var(--tag-ink-dim); padding-bottom: 0.4rem; }
.ledger-intro { margin: 0.4rem 0 0.6rem; font-style: italic; }
.ledger label {
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tag-ink-dim);
  margin-top: 0.5rem;
}
.ledger input {
  font: inherit;
  font-family: var(--font-narr);
  font-size: 1.25rem;
  color: var(--tag-ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--tag-ink);
  padding: 0.3rem 0.1rem;
  border-radius: 0;
  width: 100%;
  min-width: 0;
  color-scheme: light;
}
.ledger input:focus { outline: none; background: rgba(255, 250, 235, 0.4); }
.ledger input:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 2px; }
.ledger input[aria-invalid="true"] { border-bottom-color: #7a2c12; }
.bell {
  margin-top: 1.2rem;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--manila);
  background: var(--tag-ink);
  border: 0;
  padding: 0.75rem 1.2rem;
  cursor: pointer;
  border-radius: 2px;
}
.bell svg { width: 1.4rem; height: 1.4rem; }
.bell:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 3px; }
.bell.rung svg { animation: ring 0.6s ease-in-out; transform-origin: 50% 15%; }
@keyframes ring { 20% { transform: rotate(18deg); } 40% { transform: rotate(-14deg); } 60% { transform: rotate(9deg); } 80% { transform: rotate(-4deg); } }
.ledger-reply { margin: 0.8rem 0 0; min-height: 1.5em; font-style: italic; font-size: 1.1rem; }

.counter-lehr { margin: 0; justify-self: end; display: grid; justify-items: center; color: var(--ink-dim); }
.counter-lehr svg { width: 9rem; height: auto; }
.zzz { margin: 0; font-family: var(--font-narr); font-style: italic; color: var(--ink-dim); letter-spacing: 0.3em; transform: translate(1rem, -6.5rem) rotate(-12deg); }
@media (prefers-reduced-motion: no-preference) {
  .zzz { animation: doze 4s ease-in-out infinite; }
  @keyframes doze { 50% { opacity: 0.35; transform: translate(1.3rem, -7rem) rotate(-12deg); } }
}

/* ---------- footer ---------- */

.foot {
  max-width: 64rem;
  margin-inline: auto;
  padding: 2.5rem 16px 2rem;
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  text-align: center;
  position: relative;
}
.foot::before { /* the same flourish, smaller */
  content: "";
  width: min(80%, 14rem);
  height: 1.1rem;
  margin-bottom: 0.8rem;
  background: var(--rule-strong);
  -webkit-mask: var(--flourish) center / contain no-repeat;
  mask: var(--flourish) center / contain no-repeat;
}
.foot-lehr { width: 4rem; color: var(--ink-dim); opacity: 0.8; }
.foot-line { margin: 0; font-style: italic; color: var(--ink-dim); }
.foot-solo { margin: 0; font-style: italic; color: var(--ink); }
.foot-small { margin: 0; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.boltzmann {
  all: unset;
  cursor: help;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0.6;
  border-bottom: 1px dotted transparent;
}
.boltzmann:hover, .boltzmann:focus-visible { opacity: 1; border-bottom-color: currentColor; }
.boltzmann:focus-visible { outline: 2px dashed var(--temper-ink); outline-offset: 3px; }

/* ---------- the dock (now playing) ---------- */

.dock {
  position: fixed;
  z-index: 34;
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  height: var(--dock-h);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.8rem 0 0.45rem;
  background: var(--speck), linear-gradient(170deg, var(--manila), var(--manila-deep));
  color: var(--tag-ink);
  box-shadow: 0 0.8rem 1.8rem -0.6rem var(--shadow), 0 0 0 1px rgba(42, 31, 23, 0.25);
  border-radius: 3px;
  overflow: hidden;
}
@media (min-width: 60rem) {
  .dock { left: calc(var(--rail-w) + 1.5rem); right: 1.5rem; bottom: 1.2rem; max-width: 46rem; margin-inline: auto; }
}
.dock-play {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 0;
  background: var(--tag-ink);
  color: var(--manila);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.dock-meta {
  all: unset;
  display: grid;
  min-width: 0;
  cursor: pointer;
}
.dock-meta:focus-visible, .dock-play:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 2px; }
.dock-kicker { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tag-ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-title { font-family: var(--font-ind); font-weight: 900; font-size: 1.15rem; text-transform: uppercase; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--tag-ink-dim); font-variant-numeric: tabular-nums; }
.dock-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(42, 31, 23, 0.15); }
.dock-bar span { display: block; height: 100%; width: 0; background: var(--iridescent); }

/* ---------- the dossier sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 50%, rgba(8, 12, 14, 0.78));
  display: grid;
  align-items: end;
  justify-items: center;
  overflow-y: auto;
  padding-top: max(2rem, env(safe-area-inset-top, 0px));
}
@media (min-width: 40rem) { .sheet { align-items: center; padding: 2rem; } }
.sheet-card {
  position: relative;
  width: min(100%, 38rem);
  background: var(--speck), linear-gradient(170deg, var(--manila), var(--manila-deep));
  color: var(--tag-ink);
  padding: 1.4rem 1.2rem calc(1.6rem + var(--safe-b));
  box-shadow: 0 -1rem 3rem -1rem rgba(0, 0, 0, 0.5);
  border-radius: 6px 6px 0 0;
}
@media (min-width: 40rem) { .sheet-card { border-radius: 3px; padding: 1.8rem 1.8rem 2rem; } }
.sheet-card::before { /* the folder tab */
  content: "";
  position: absolute;
  top: -0.9rem;
  left: 1.2rem;
  width: 8rem;
  height: 1rem;
  background: var(--manila);
  border-radius: 6px 6px 0 0;
}
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) .sheet-card { animation: slide-up 0.4s cubic-bezier(.2,.8,.2,1); }
  @keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }
}
.sheet-body { padding-top: 2.6rem; }
.sheet-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 1;
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tag-ink);
  background: none;
  border: 1px solid var(--tag-ink-dim);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
}
.sheet-close:focus-visible { outline: 2px dashed var(--tag-ink); outline-offset: 2px; }
.dossier { display: grid; gap: 0.9rem; position: relative; }
.dossier .tag-meta { border-bottom-color: var(--tag-ink-dim); }
.dossier h2 { font-size: clamp(2.2rem, 8vw, 3rem); color: var(--tag-ink); padding-right: 5rem; }
.dossier-sec { display: grid; gap: 0.4rem; padding-top: 0.6rem; border-top: 1px solid rgba(42, 31, 23, 0.25); }
.dossier-sec h3 { font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tag-ink-dim); font-weight: 700; }
.words { margin: 0; white-space: pre-line; font-size: 1.15rem; line-height: 1.6; }
.words.is-empty { font-style: italic; color: var(--tag-ink-dim); }
.dossier blockquote { margin: 0; font-style: italic; font-size: 1.1rem; }
.dossier blockquote cite { display: block; font-style: normal; text-align: right; color: var(--tag-ink-dim); }
.dossier-credits { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--tag-ink-dim); }

/* ---------- the tangled note ---------- */

.tangle {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 40%, rgba(8, 12, 14, 0.85));
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
}
.tangle-card {
  width: min(100%, 34rem);
  padding: 1.8rem 1.6rem;
  display: grid;
  gap: 0.9rem;
}
.tangle-card h2 { font-size: var(--step-2); }
.tangle-letters {
  margin: 0;
  font-family: var(--font-ind);
  font-weight: 900;
  font-size: clamp(1.4rem, 6vw, 2rem);
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--temper-ink);
  word-break: break-word;
  min-height: 2.4em;
}
.tangle-letters .ok { color: var(--ink); }
.tangle-readout { margin: 0; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.tangle-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tangle-actions button {
  font-family: var(--font-ind);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.6rem 1rem;
  border: 1px solid var(--temper-ink);
  background: var(--temper-ink);
  color: var(--card);
  cursor: pointer;
  border-radius: 2px;
}
.tangle-actions .quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.tangle-after { margin: 0; font-style: italic; color: var(--ink-dim); }

.noscript { padding: 2rem 16px; color: var(--ink-dim); font-style: italic; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
