/* Hushroom — "paper and ink" styling.
   Warm cream, ink-brown and rust. Serif display type with italic accents, mono field-note labels,
   grain texture, hard offset shadows and slightly crooked cards (like pinned paper),
   plus a set of hand-built motion effects (see js/main.js).
   Four themes (Dawn, Day, Dusk, Night) via CSS custom properties.
   Text colours were chosen to meet WCAG AA against their surfaces. */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Times New Roman", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --expo: cubic-bezier(.16, 1, .3, 1);
  --danger: #b3362e;
  --nav-h: 60px;
}

/* ---------- Theme palettes (sections below the hero) ---------- */
[data-theme="dawn"] {
  --bg: #f5e9df; --bg-alt: #ecdccf; --text: #2c211f; --muted: #6a5750; --line: rgba(44, 33, 31, .2);
  --paper: #fbf4ec; --field: rgba(44, 33, 31, .06);
  --accent: #9c4129; --accent-ink: #ffffff; color-scheme: light;
}
[data-theme="day"] {
  --bg: #f8f4ec; --bg-alt: #efe9de; --text: #2a2622; --muted: #685f55; --line: rgba(42, 38, 34, .2);
  --paper: #fffdf8; --field: rgba(42, 38, 34, .06);
  --accent: #8c3b25; --accent-ink: #ffffff; color-scheme: light;
}
[data-theme="dusk"] {
  --bg: #2a2320; --bg-alt: #342b27; --text: #f4ebdf; --muted: #c6b8a8; --line: rgba(244, 235, 223, .22);
  --paper: #3a302b; --field: rgba(244, 235, 223, .08);
  --accent: #e8935f; --accent-ink: #26150b; --danger: #ff9a92; color-scheme: dark;
}
[data-theme="night"] {
  --bg: #15171c; --bg-alt: #1b1e25; --text: #ece8e1; --muted: #aaa69d; --line: rgba(236, 232, 225, .2);
  --paper: #232731; --field: rgba(236, 232, 225, .08);
  --accent: #dba56b; --accent-ink: #1a1208; --danger: #ff9a92; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--text); line-height: 1.6;
  background: var(--bg); transition: background-color .6s var(--ease), color .3s; overflow-x: hidden;
}
/* paper grain over everything */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .45;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .2  0 0 0 0 .15  0 0 0 0 .1  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
h1, h2, h3 { margin: 0; font-weight: 400; }
h1, h2 { font-family: var(--serif); letter-spacing: -.025em; line-height: 1.02; }
h1 em, h2 em { font-style: italic; color: var(--muted); }
h3 { font-family: var(--serif); font-size: 1.2rem; letter-spacing: -.01em; }
p { margin: 0 0 .9rem; }
a { color: var(--accent); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand svg, .stamp, .stamp * { stroke: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: #fff; color: #222; padding: .6rem 1rem; border-radius: 999px; z-index: 200; transition: top .2s; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- Loader curtain + scroll progress ---------- */
.loader { position: fixed; inset: 0; z-index: 150; background: #15110e; display: grid; place-items: center; transition: transform .85s var(--expo) .1s; }
.loader span { font-family: var(--serif); font-style: italic; font-size: clamp(2.4rem, 9vw, 5rem); color: #f4ebdf; letter-spacing: -.03em; animation: loaderIn .8s var(--expo) both; }
.loader.done { transform: translateY(-101%); }
.loader { animation: loaderFailsafe .01s 4s forwards; } /* if scripts fail, never trap the page */
@keyframes loaderFailsafe { to { transform: translateY(-101%); visibility: hidden; } }
.loader.done span { opacity: 0; transition: opacity .3s; }
@keyframes loaderIn { from { opacity: 0; transform: translateY(24px); letter-spacing: .1em; } }
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 120; background: var(--accent, #f0b48a); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Dark ink context: nav + hero ---------- */
.nav, .stage {
  --text: #f6efe6; --muted: #d8cdbf; --accent: #f0b48a; --accent-ink: #2a160c;
  --field: rgba(255, 255, 255, .13); --line: rgba(255, 255, 255, .26); --ink-bar: rgba(21, 16, 13, .92);
  --danger: #ff9a92; color: var(--text);
}

/* ---------- Nav ---------- */
.nav { position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: var(--nav-h); display: flex; align-items: center; gap: 1rem; padding: 0 clamp(14px, 3vw, 36px); transition: background .4s, transform .5s var(--expo), box-shadow .4s; }
.nav.solid { background: var(--ink-bar); box-shadow: 0 1px 0 var(--line); }
.nav.hide { transform: translateY(-100%); }
.nav.hide:focus-within { transform: none; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); font-family: var(--serif); font-size: 1.35rem; letter-spacing: -.02em; margin-right: auto; }
.brand svg { transition: transform .6s var(--spring); }
.brand:hover svg { transform: rotate(-24deg) scale(1.1); }
.nav-links { display: flex; gap: 2rem; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-links a { position: relative; display: block; overflow: hidden; height: 1.35em; line-height: 1.35; color: var(--muted); text-decoration: none; font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.nav-links a span { display: block; transition: transform .45s var(--expo); }
.nav-links a::after { content: attr(data-t); position: absolute; left: 0; top: 100%; color: var(--text); transition: transform .45s var(--expo); }
.nav-links a:hover span, .nav-links a:hover::after, .nav-links a:focus-visible span, .nav-links a:focus-visible::after { transform: translateY(-100%); }
.top-actions { display: flex; align-items: center; gap: .4rem; }

/* ---------- Buttons ---------- */
.mag { transition: transform .35s var(--expo), background .2s, color .2s; will-change: transform; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; transition: transform .2s var(--spring), background .2s, color .2s; }
.icon-btn:hover { background: var(--field); }
.icon-btn:active { transform: scale(.9) rotate(-8deg); }
.icon-btn.small { width: 32px; height: 32px; border-color: transparent; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.small svg { width: 17px; height: 17px; }
#btnMute .slash { display: none; }
#btnMute[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#btnMute[aria-pressed="true"] .slash { display: block; }
#btnMute[aria-pressed="true"] .waves { display: none; }

.pill-btn { position: relative; overflow: hidden; isolation: isolate; border: 1.5px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: .55rem 1.2rem; font-family: var(--mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; transition: color .35s var(--expo), border-color .35s, transform .2s var(--spring); }
/* ink fill that wipes up from the bottom on hover */
.pill-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); transform: translateY(101%); border-radius: 50% 50% 0 0 / 40% 40% 0 0; transition: transform .45s var(--expo), border-radius .45s var(--expo); }
.pill-btn:hover::before, .pill-btn:focus-visible::before { transform: translateY(0); border-radius: 0; }
.pill-btn:hover, .pill-btn:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
.pill-btn:active { transform: scale(.95); }
.pill-btn.solid, .pill-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill-btn.solid::before, .pill-btn[aria-pressed="true"]::before { display: none; }
.pill-btn.solid:hover { filter: brightness(1.1); }
.pill-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.pill-btn.danger::before { background: var(--danger); }
.pill-btn.danger:hover { color: #fff; }
.pill-btn.danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.pill-btn.danger-solid::before { display: none; }
.primary-btn { border: 0; border-radius: 999px; padding: .85rem 2.3rem; min-width: 132px; font-family: var(--serif); font-size: 1.25rem; font-style: italic; background: var(--accent); color: var(--accent-ink); transition: transform .3s var(--spring), box-shadow .3s; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.primary-btn:hover { box-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
.primary-btn:active { transform: translateY(3px) scale(.97); box-shadow: 0 0 0 rgba(0, 0, 0, .35); }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; padding: .3rem; }
.link-btn:disabled { color: var(--muted); text-decoration: none; opacity: .6; cursor: default; }

/* ---------- Hero ---------- */
.stage { position: relative; height: 100vh; height: 100svh; min-height: 700px; overflow: hidden; background: #151b2b; isolation: isolate; --mx: 72%; --my: 30%; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; }
/* warm lamp that follows the pointer across the window */
.stage::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .5s; background: radial-gradient(380px circle at var(--mx) var(--my), rgba(255, 196, 130, .22), rgba(255, 196, 130, .05) 55%, transparent 70%); }
.stage.lit::before { opacity: 1; }
/* warm hearth glow while the fireplace is on; sits above the dark scrim so it actually shows */
.hearth { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s; background: radial-gradient(ellipse 75% 65% at 50% 108%, rgba(255, 150, 60, .6), rgba(255, 100, 30, .2) 45%, transparent 72%); }
.stage.fire-on .hearth { opacity: var(--fire, .8); animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { filter: brightness(1); } 20% { filter: brightness(.82); } 45% { filter: brightness(1.18); } 70% { filter: brightness(.9); } }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(180deg, rgba(14, 10, 8, .45) 0%, rgba(14, 10, 8, 0) 20%, rgba(14, 10, 8, .12) 36%, rgba(14, 10, 8, .6) 58%, rgba(14, 10, 8, .86) 100%); }
.stage > * { z-index: 1; }

.hero-copy { position: absolute; left: clamp(20px, 5vw, 72px); bottom: clamp(28px, 6vh, 64px); max-width: min(600px, 48vw); translate: 0 calc(var(--sy, 0) * -.16px); }
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; display: flex; align-items: center; gap: .7rem; }
.eyebrow span { color: var(--accent); }
.eyebrow::after { content: ""; flex: 0 1 60px; height: 1px; background: currentColor; opacity: .5; transform-origin: 0 50%; }
.hero-copy h1 { font-size: clamp(3rem, 7vw, 6.4rem); margin-bottom: 1.7rem; color: var(--text); text-shadow: 0 2px 30px rgba(0, 0, 0, .35); }
.hero-copy h1 em { color: #f0b48a; }
.lede { color: #ece3d7; max-width: 42ch; font-size: 1rem; text-shadow: 0 1px 14px rgba(0, 0, 0, .55); }
.js .hero-copy .eyebrow, .js .hero-copy .lede, .js .hero-copy .theme-switch { opacity: 0; transform: translateY(16px); transition: opacity .9s var(--expo), transform .9s var(--expo); }
.js .stage.ready .hero-copy .eyebrow { opacity: 1; transform: none; transition-delay: .05s; }
.js .stage.ready .hero-copy .lede { opacity: 1; transform: none; transition-delay: .5s; }
.js .stage.ready .hero-copy .theme-switch { opacity: 1; transform: none; transition-delay: .65s; }

.theme-switch { display: inline-flex; align-items: center; gap: 2px; border: 1.5px solid var(--line); background: rgba(21, 16, 13, .62); border-radius: 999px; padding: 3px; margin: .8rem 0 0; min-width: 0; }
.theme-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.theme-switch label { position: relative; }
.theme-switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.theme-switch span { display: block; padding: .3rem .8rem; border-radius: 999px; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); transition: background .25s, color .25s, transform .3s var(--spring); }
.theme-switch input:hover + span { transform: translateY(-1px); color: var(--text); }
.theme-switch input:checked + span { background: var(--accent); color: var(--accent-ink); }
.theme-switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ===== Timer ticket ===== */
.timer-card {
  --text: #2a2220; --muted: #6a5e52; --accent: #8c3b25; --accent-ink: #ffffff; --field: rgba(42, 34, 32, .07); --line: rgba(42, 34, 32, .24); --danger: #b3362e;
  position: absolute; right: clamp(16px, 4.5vw, 64px); bottom: clamp(24px, 6vh, 56px); width: 340px; padding: 2.2rem 1.2rem 1.1rem; isolation: isolate; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  rotate: -1.4deg; transition: rotate .6s var(--spring);
}
.timer-card:hover, .timer-card:focus-within { rotate: 0deg; }
/* the paper itself, with ticket notches cut into both sides */
.timer-card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 6px; background: repeating-linear-gradient(90deg, rgba(42, 34, 32, .28) 0 6px, transparent 6px 11px) 14px 34px / calc(100% - 28px) 1.5px no-repeat, #f3e9d6;
  -webkit-mask: radial-gradient(circle 11px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 11px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat; }
.timer-card::after { content: ""; position: absolute; inset: 6px 4px; z-index: -2; border-radius: 10px; background: rgba(0, 0, 0, .55); filter: blur(16px); translate: 0 22px; pointer-events: none; }
.js .timer-card { opacity: 0; translate: 0 40px; transition: opacity .8s var(--expo) .3s, translate .9s var(--expo) .3s, rotate .6s var(--spring); }
.js .stage.ready .timer-card { opacity: 1; translate: 0 calc(var(--sy, 0) * -.08px); }

.stamp { position: absolute; top: -52px; right: -34px; width: 88px; height: 88px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); pointer-events: none; }
.stamp::before { content: ""; }
.stamp text { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; fill: #f4ebdf; font-weight: 700; }
.stamp-spin { transform-origin: 60px 60px; animation: spin 22s linear infinite; }
.stamp-moon { fill: #f4ebdf; transform: translate(-3px, 2px); }
.stamp { background: radial-gradient(circle, #8c3b25 0 56%, transparent 57%); border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

.modes { display: flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1.5px solid var(--line); max-width: 100%; }
.modes button { border: 0; background: transparent; border-radius: 999px; padding: .3rem .75rem; font-family: var(--mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .3s var(--expo), color .3s, transform .25s var(--spring); }
.modes button:hover { color: var(--text); }
.modes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.modes button:active { transform: scale(.92); }
.ring-wrap { position: relative; width: 190px; aspect-ratio: 1; margin-top: .3rem; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--text); opacity: .12; }
.ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .4s; }
.stage[data-mode="short"] .timer-card, .stage[data-mode="long"] .timer-card { --accent: #2f7d5b; }
.readout { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.time { font-family: var(--serif); font-size: 3.2rem; line-height: 1; height: 1em; }
.digits { display: inline-flex; align-items: flex-start; height: 1em; overflow: hidden; font-variant-numeric: tabular-nums; }
.dg { display: block; height: 1em; width: .56em; overflow: hidden; text-align: center; }
.dg .col { display: flex; flex-direction: column; transition: transform .55s cubic-bezier(.22, 1, .36, 1); transform: translateY(calc(var(--d, 0) * -1em)); }
.dg .col b { display: block; height: 1em; line-height: 1; font-weight: 400; }
.colon { display: block; width: .3em; text-align: center; line-height: .95; }
.running .colon { animation: blink 1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.mode-label { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .2em; color: var(--muted); margin-top: .7rem; }
.current-task { margin: 0; max-width: 100%; text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-task:not(.empty)::before { content: "→ "; color: var(--accent); font-style: normal; }
.current-task.empty { color: var(--muted); }
.controls { display: flex; align-items: center; gap: .6rem; }
.dots { display: flex; gap: 7px; min-height: 10px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); transition: background .3s, border-color .3s, transform .4s var(--spring); }
.dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.25) rotate(45deg); border-radius: 2px; }
.timer-card :focus-visible { outline-color: var(--accent); }

.scroll-cue { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font-family: var(--mono); font-size: .62rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding-bottom: 20px; }
.scroll-cue::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 16px; background: var(--muted); animation: cue 2s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.exit-focus { display: none; position: absolute; top: 16px; right: 16px; border: 1.5px solid var(--line); background: rgba(21, 16, 13, .7); border-radius: 999px; padding: .5rem 1.1rem; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.audio-hint { position: absolute; top: 78px; right: 18px; border: 1.5px solid var(--line); background: rgba(21, 16, 13, .75); border-radius: 999px; padding: .5rem 1.1rem; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 28%, transparent); } }

/* ---------- Marquee ---------- */
.marquee { background: #8c3b25; color: #f8f1e4; overflow: hidden; padding: .9rem 0; border-block: 2px solid #15110e; transform: skewX(var(--sk, 0deg)); transition: transform .2s linear; position: relative; z-index: 2; }
.marquee .track { will-change: transform; display: flex; align-items: center; width: max-content; gap: 2rem; animation: marq 34s linear infinite; padding-left: 2rem; }
.marquee:hover .track { animation-play-state: paused; }
.marquee span { font-family: var(--serif); font-style: italic; font-size: clamp(1.8rem, 4.2vw, 3.2rem); letter-spacing: -.02em; white-space: nowrap; }
.marquee i { flex: none; width: 14px; height: 14px; background: currentColor; transform: rotate(45deg); opacity: .8; }
@keyframes marq { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { position: relative; padding: clamp(4.5rem, 11vw, 9rem) 0; background: var(--bg); transition: background-color .6s var(--ease); overflow: hidden; }
.section.alt { background: var(--bg-alt); }
.wrap { position: relative; width: min(1120px, calc(100% - 2.4rem)); margin: 0 auto; }
.wrap.two { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.secno { position: absolute; right: -1rem; top: -2.4rem; font-family: var(--serif); font-style: italic; font-size: clamp(9rem, 24vw, 19rem); line-height: 1; letter-spacing: -.06em; color: transparent; -webkit-text-stroke: 1.5px var(--line); pointer-events: none; user-select: none; translate: 0 calc(var(--p, 0) * 90px); z-index: 0; }
.wrap > *:not(.secno) { position: relative; z-index: 1; }
.sec-head { margin-bottom: 2.6rem; }
.sec-head.center { text-align: center; }
.sec-head.center .eyebrow { justify-content: center; }
.sec-head .eyebrow { color: var(--muted); }
.sec-head h2 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); }
.sub { color: var(--muted); max-width: 50ch; margin: 1.1rem 0 0; }
.note { color: var(--muted); }
.note.small { font-size: .82rem; }
.row { display: flex; align-items: center; gap: .8rem; }
.row.between { justify-content: space-between; margin-top: .8rem; }
.row.flexwrap { flex-wrap: wrap; }
.aside { text-align: center; color: var(--muted); margin-top: 2.6rem; }
.aside strong { color: var(--accent); font-weight: 600; }

/* ----- split-word headline reveal ----- */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .06em .14em 0; margin-bottom: -.14em; }
.js .split .wi { display: inline-block; transform: translateY(112%) rotate(5deg); transform-origin: 0 100%; transition: transform 1.1s var(--expo); transition-delay: calc(var(--i, 0) * 80ms + var(--base, 0ms)); }
.js .split.in .wi { transform: none; }
/* hand-drawn underline under italic words */
h1 em, h2 em, .foot-line em { position: relative; white-space: nowrap; }
.squig { position: absolute; left: 0; bottom: -.1em; width: 100%; height: .2em; overflow: visible; pointer-events: none; }
.squig path { stroke: var(--accent); stroke-width: 3; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.3s var(--ease) .7s; }
.in .squig path, .in.squig path { stroke-dashoffset: 0; }
.hero-copy h1 .squig path { stroke: #f0b48a; }

/* ----- reveal variants ----- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--expo), transform .9s var(--expo), clip-path 1s var(--expo), translate .35s var(--spring), rotate .5s var(--spring), box-shadow .35s var(--spring); transition-delay: var(--d, 0s), var(--d, 0s), var(--d, 0s), 0s, 0s, 0s; }
.js .reveal[data-fx="wipe"] { opacity: 0; transform: translateY(36px) scale(.94) rotate(-1.5deg); transform-origin: 50% 100%; }
.js .reveal.in { opacity: 1; transform: none; }


/* ----- paper cards: hairline ink border, hard offset shadow, slightly crooked ----- */
.step, .channel, .task-card, .card, .stat-grid > div, .badge-card {
  background: var(--paper); border: 1.5px solid color-mix(in srgb, var(--text) 78%, transparent); border-radius: 10px;
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--text) 22%, transparent);
  transition: translate .35s var(--spring), rotate .5s var(--spring), box-shadow .35s var(--spring), border-color .3s, background .3s, opacity .9s var(--expo), transform .9s var(--expo), clip-path 1s var(--expo);
}
.step:hover, .channel:hover, .card:hover, .stat-grid > div:hover { translate: -2px -3px; box-shadow: 8px 9px 0 color-mix(in srgb, var(--text) 26%, transparent); rotate: 0deg !important; }
.step:nth-child(odd), .channel:nth-child(3n+1), .stat-grid > div:nth-child(odd) { rotate: -.5deg; }
.step:nth-child(even), .channel:nth-child(3n+2), .stat-grid > div:nth-child(even) { rotate: .6deg; }

kbd { font-family: var(--mono); font-weight: 700; font-size: .78rem; padding: .1rem .55rem; border-radius: 6px; border: 1.5px solid var(--line); background: var(--field); border-bottom-width: 3px; color: var(--text); }

/* Method */
.steps-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem; }
.step { display: flex; gap: 1.2rem; align-items: flex-start; padding: 1.5rem; }
.step .num { position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; color: var(--accent); font-family: var(--serif); font-style: italic; font-size: 1.7rem; }
.step .num svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.step .num circle { stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 151; stroke-dashoffset: 151; transition: stroke-dashoffset 1.2s var(--ease) .5s; }
.js .step.in .num circle { stroke-dashoffset: 0; }
html:not(.js) .step .num circle { stroke-dashoffset: 0; }
.step h3 { margin-bottom: .25rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Mixer */
.presets { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.4rem; }
.chip { border: 1.5px solid var(--text); background: transparent; border-radius: 999px; padding: .5rem 1.15rem; font-family: var(--serif); font-style: italic; font-size: 1.02rem; transition: background .25s, color .25s, transform .3s var(--spring), rotate .3s var(--spring); }
.chip:nth-child(odd) { rotate: -1.5deg; } .chip:nth-child(even) { rotate: 1.2deg; }
.chip:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); rotate: 0deg; transform: translateY(-3px); }
.chip:active { transform: scale(.94); }
.master { display: flex; align-items: center; gap: 1rem; max-width: 460px; margin-bottom: 1.8rem; }
.master label { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.channels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem 1.4rem; }
.channel { position: relative; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "icon name sw" "vol vol vol" "eq eq eq"; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem .9rem; overflow: hidden; }
.channel:has(.switch:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--paper)); box-shadow: 5px 5px 0 color-mix(in srgb, var(--accent) 55%, transparent); }
.ch-icon { grid-area: icon; width: 26px; height: 26px; color: var(--muted); transition: transform .4s var(--spring); }
.channel:has(.switch:checked) .ch-icon { color: var(--accent); animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-6deg); } }
.ch-name { grid-area: name; font-family: var(--serif); font-size: 1.2rem; }
.channel .switch { grid-area: sw; }
.channel input[type="range"] { grid-area: vol; }
.channel:not(:has(.switch:checked)) input[type="range"] { opacity: .45; }
/* equalizer bars: only alive while the channel is on */
.eq { grid-area: eq; display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.eq i { flex: 1; max-width: 6px; height: 3px; background: var(--muted); opacity: .35; border-radius: 1px; transform-origin: bottom; }
.channel:has(.switch:checked) .eq i { background: var(--accent); opacity: 1; height: 16px; animation: eq 1.1s ease-in-out infinite; animation-delay: calc(var(--k) * -.17s); }
@keyframes eq { 0%, 100% { transform: scaleY(.18); } 50% { transform: scaleY(1); } }
body.muted .channel .eq i { animation-play-state: paused; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 24px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 999px; background: var(--field); border: 1.5px solid var(--muted); position: relative; cursor: pointer; transition: background .25s, border-color .25s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--muted); transition: transform .45s var(--spring), background .2s, width .2s; }
.switch:active::after { width: 22px; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(20px); background: var(--accent-ink); }
.switch:checked:active::after { transform: translateX(15px); }

/* Tasks */
.task-card { padding: 1.4rem; }
.add-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
input[type="text"], input[type="number"] { width: 100%; background: var(--field); border: 1.5px solid var(--line); border-radius: 999px; padding: .65rem 1.1rem; min-width: 0; transition: border-color .25s, box-shadow .25s; }
input[type="text"]:focus, input[type="number"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="number"] { border-radius: 12px; }
input::placeholder { color: var(--muted); opacity: 1; font-style: italic; }
.tasklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.tasklist .empty { color: var(--muted); padding: 1.2rem; text-align: center; border: 1.5px dashed var(--line); border-radius: 12px; font-size: .92rem; font-family: var(--serif); font-style: italic; }
.task { display: flex; align-items: center; gap: .6rem; padding: .5rem .5rem .5rem .9rem; border-radius: 10px; background: var(--field); border: 1.5px solid transparent; transition: border-color .25s, opacity .2s, background .25s; cursor: grab; }
.task:hover { background: color-mix(in srgb, var(--field) 70%, var(--accent) 8%); }
.task.current { border-color: var(--accent); }
.task.dragging { opacity: .4; }
.task.fx-new { animation: taskIn .7s var(--spring); }
@keyframes taskIn { from { opacity: 0; transform: translateX(-26px) rotate(-3deg) scale(.96); } }
.task-title { overflow-wrap: anywhere; background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0% 1.5px; transition: background-size .5s var(--expo), color .3s; }
.task.done .task-title { background-size: 100% 1.5px; color: var(--muted); }
.task.fx-done .task-title { animation: strike .6s var(--expo); }
@keyframes strike { from { background-size: 0% 1.5px; } }
.check { accent-color: var(--accent); width: 20px; height: 20px; flex: none; cursor: pointer; }
.task-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: .66rem; letter-spacing: .04em; padding: .12rem .55rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.task-actions { display: flex; flex: none; }
.task-actions [aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.edit-input { padding: .35rem .8rem; }

/* Insights */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; margin: 0 0 2rem; }
.stat-grid > div { padding: 1.4rem 1.2rem; }
.stat-grid dt { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.stat-grid dd { margin: .3rem 0 0; font-family: var(--serif); font-style: italic; font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent); }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
.card { padding: 1.4rem; }
.card h3 { margin-bottom: 1rem; font-size: 1.1rem; }
h3.mini { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); margin: 2.4rem 0 .9rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart rect { stroke: none; } /* don't inherit the global svg stroke */
.chart .bar { fill: var(--accent); opacity: .5; transform-box: fill-box; transform-origin: bottom; }
.chart .bar.today { opacity: 1; }
.js .card:not(.in) .bar { transform: scaleY(0); }
.js .card.in .bar { animation: grow .9s var(--spring) both; }
.js .card.in .bar:nth-of-type(2) { animation-delay: .08s; } .js .card.in .bar:nth-of-type(3) { animation-delay: .16s; } .js .card.in .bar:nth-of-type(4) { animation-delay: .24s; }
.js .card.in .bar:nth-of-type(5) { animation-delay: .32s; } .js .card.in .bar:nth-of-type(6) { animation-delay: .4s; } .js .card.in .bar:nth-of-type(7) { animation-delay: .48s; }
@keyframes grow { from { transform: scaleY(0); } }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--mono); stroke: none; }
.chart .val { fill: var(--text); font-weight: 700; }
.cell { transform-box: fill-box; transform-origin: center; }
.js .card:not(.in) .cell { opacity: 0; transform: scale(.3); }
.js .card.in .cell { animation: pop .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 9ms); }
@keyframes pop { from { opacity: 0; transform: scale(.3); } }
.cell.l0 { fill: var(--text); fill-opacity: .1; }
.cell.l1 { fill: var(--accent); fill-opacity: .3; }
.cell.l2 { fill: var(--accent); fill-opacity: .55; }
.cell.l3 { fill: var(--accent); fill-opacity: .8; }
.cell.l4 { fill: var(--accent); }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.badge-card { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; font-size: .9rem; box-shadow: none; border-style: dashed; border-color: var(--line); background: transparent; }
.badge-card strong { font-family: var(--serif); font-weight: 400; font-size: 1.1rem; }
.badge-card span { color: var(--muted); font-size: .8rem; }
.badge-card em { font-style: normal; font-family: var(--mono); font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.badge-card.earned { border-style: solid; border-color: var(--accent); background: var(--paper); box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent) 55%, transparent); rotate: -1deg; }
.badge-card.earned em { color: var(--accent); }
.data-tools { margin-top: 2.6rem; padding-top: 1.6rem; border-top: 1.5px dashed var(--line); }
.data-tools .pill-btn { color: var(--text); }
.data-tools .pill-btn:hover { color: var(--accent-ink); }
.data-tools .pill-btn.danger { color: var(--danger); }
.data-tools .pill-btn.danger:hover { color: #fff; }

/* ---------- Footer ---------- */
.footer { position: relative; overflow: hidden; background: #211b17; color: #efe6da; padding: clamp(3.5rem, 8vw, 6rem) 0 0; }
.foot-line { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.9rem); letter-spacing: -.025em; line-height: 1.12; max-width: 20em; margin-bottom: 2.8rem; }
.foot-line em { color: #f0b48a; font-style: italic; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; max-width: 820px; }
.foot-cols h3 { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; margin-bottom: .8rem; color: #9d9184; }
.foot-cols a, .foot-cols span { display: block; color: #cfc4b6; font-size: .92rem; text-decoration: none; margin-bottom: .4rem; background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px; transition: background-size .4s var(--expo), color .2s; width: fit-content; }
.foot-cols a:hover { color: #fff; background-size: 100% 1px; }
.footer :focus-visible { outline-color: #f0b48a; }
.watermark { font-family: var(--serif); font-style: italic; font-size: clamp(5rem, 22vw, 17rem); line-height: .85; letter-spacing: -.045em; text-align: center; color: rgba(255, 255, 255, .08); margin-top: 2rem; transform: translateY(14%); user-select: none; white-space: nowrap; }
.watermark span { display: inline-block; transition: transform .6s var(--spring), color .4s; }
.js .watermark span { transform: translateY(90%); }
.js .watermark.in span { transform: none; transition-delay: calc(var(--i) * 60ms); }
.watermark.in span:hover { transform: translateY(-8%) rotate(-3deg); color: rgba(240, 180, 138, .5); transition-delay: 0s; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px) rotate(-2deg); opacity: 0; pointer-events: none; background: #f0b48a; color: #2a160c; padding: .7rem 1.3rem; border-radius: 10px; font-family: var(--serif); font-style: italic; font-size: 1.05rem; max-width: calc(100% - 32px); text-align: center; transition: transform .5s var(--spring), opacity .3s; z-index: 130; box-shadow: 4px 4px 0 rgba(0, 0, 0, .45); }
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }

/* ---------- Dialogs ---------- */
dialog { border: 1.5px solid var(--text); border-radius: 12px; padding: 1.7rem; width: min(92vw, 460px); color: var(--text); background: var(--paper); box-shadow: 8px 8px 0 color-mix(in srgb, var(--text) 30%, transparent); }
dialog h2 { font-size: 2.2rem; margin-bottom: .8rem; }
dialog::backdrop { background: rgba(14, 10, 8, .62); }
dialog[open] { animation: pop-in .5s var(--spring); }
dialog[open]::backdrop { animation: fade .3s; }
@keyframes pop-in { from { opacity: 0; transform: translateY(24px) rotate(-3deg) scale(.94); } }
@keyframes fade { from { opacity: 0; } }
.dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.grid2 label { display: flex; flex-direction: column; gap: .3rem; font-family: var(--mono); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.check-row { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; font-size: .95rem; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.steps { padding-left: 1.2rem; display: grid; gap: .6rem; }
.keys { display: grid; gap: .5rem; margin: 0; }
.keys div { display: flex; align-items: center; gap: 1rem; }
.keys dt { min-width: 70px; } .keys dd { margin: 0; color: var(--muted); }
dialog .pill-btn { color: var(--text); }
dialog .pill-btn:hover { color: var(--accent-ink); }
dialog .pill-btn.solid { color: var(--accent-ink); }
dialog .pill-btn.danger-solid { color: #fff; }

/* ---------- Theme / focus-mode iris wipe (View Transitions API) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: iris .7s cubic-bezier(.7, 0, .2, 1) both; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
@keyframes iris { from { clip-path: circle(0 at var(--vx, 50%) var(--vy, 50%)); } to { clip-path: circle(150vmax at var(--vx, 50%) var(--vy, 50%)); } }

/* ---------- Focus mode ---------- */
.focus-mode .nav, .focus-mode .hero-copy, .focus-mode .scroll-cue, .focus-mode .marquee, .focus-mode main > .section, .focus-mode .footer, .focus-mode .progress { display: none; }
.focus-mode { overflow: hidden; }
.focus-mode .stage { position: fixed; inset: 0; height: 100dvh; z-index: 20; }
.focus-mode .exit-focus { display: block; }
.focus-mode .timer-card { left: 0; right: 0; margin-inline: auto; translate: 0 0 !important; width: min(calc(100% - 28px), 380px); bottom: clamp(16px, 7vh, 64px); }
.focus-mode .ring-wrap { width: clamp(170px, 28vh, 240px); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stage::after { background: linear-gradient(180deg, rgba(14, 10, 8, .72) 0%, rgba(14, 10, 8, .58) 30%, rgba(14, 10, 8, .12) 48%, rgba(14, 10, 8, .15) 60%, rgba(14, 10, 8, .82) 100%); }
  .nav-links { display: none; }
  .hero-copy { max-width: 90vw; top: 84px; bottom: auto; translate: none; }
  .hero-copy h1 { font-size: clamp(2.8rem, 12vw, 4.2rem); }
  .timer-card { left: 0; right: 0; margin-inline: auto; width: min(calc(100% - 40px), 360px); bottom: 42px; }
  .js .stage.ready .timer-card { translate: 0 0; }
  .stamp { width: 76px; height: 76px; right: -12px; top: -46px; }
  .stage { min-height: 840px; }
  .wrap.two, .charts { grid-template-columns: 1fr; }
  .channels { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .scroll-cue { display: none; }
  .audio-hint { top: auto; right: auto; left: 50%; bottom: 4px; transform: translateX(-50%); padding: .3rem .8rem; white-space: nowrap; font-size: .62rem; }
  .secno { font-size: 9rem; top: -1rem; }
}
@media (max-width: 600px) {
  .steps-grid, .channels, .foot-cols { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .lede { display: none; }
  .ring-wrap { width: 160px; }
  .time { font-size: 2.8rem; }
  .theme-switch span { padding: .3rem .55rem; font-size: .66rem; }
  .brand span { display: none; }
  .modes button { padding: .3rem .55rem; font-size: .62rem; }
  .top-actions .pill-btn { padding: .5rem .85rem; }
}
@media (max-height: 640px) and (orientation: landscape) {
  .focus-mode .ring-wrap { width: 120px; }
  .focus-mode .timer-card { gap: .3rem; padding: .8rem; }
}
@media (hover: none) { .stage::before { display: none; } }

/* ---------- Reduced motion: no loaders, no parallax, no big movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .loader { display: none; }
  .marquee .track { animation: none; }
  .js .reveal, .js .split .wi, .js .hero-copy .eyebrow, .js .hero-copy .lede, .js .hero-copy .theme-switch, .js .timer-card, .js .watermark span { opacity: 1; transform: none; clip-path: none; translate: none; }
  .squig path { stroke-dashoffset: 0; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
