/*
  Kōma: focus timer app page (Screenery template)
  Sumi ink on washi. One ground (warm paper with a fibre texture), ink in three strengths, hairlines, and one
  vermilion that only ever means "now": the ember, the seal, the current row. Shippori Mincho speaks; Zen Kaku
  Gothic New does the work. Three type sizes do almost everything. Space is left empty on purpose (ma).

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Components: buttons, segmented choices, stepper, fields, switch, select, banners
   4. Header
   5. Hero: words, setup form, the stick drawing, readout and controls
   6. Ledger: totals, day trail, table, empty state
   7. Settings window and menu bar strip
   8. The clock: measured drawing and specs
   9. Release notes
  10. Get Kōma
  11. Small print and footer
  12. Vertical type
  13. Motion
  14. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
:root {
  /* paper */
  --washi: #f2ede3;          /* ground */
  --washi-2: #ebe4d6;        /* a sheet laid on the ground */
  --washi-3: #e2d9c7;        /* pressed: wells, track */
  /* ink, three strengths (all measured on --washi) */
  --sumi: #1c1b18;           /* 15.6:1 */
  --sumi-2: #4b4840;         /* 8.4:1, secondary text */
  --sumi-3: #6a655a;         /* 5.3:1, labels and meta */
  --line: rgb(28 27 24 / 0.16);
  --line-strong: rgb(28 27 24 / 0.42);
  /* the one colour: shu, vermilion. Means "now". 5.4:1 on washi */
  --shu: #b2361f;
  --shu-soft: rgb(178 54 31 / 0.1);
  --ember: #e0573a;          /* only inside the drawing */
  --ash: #b9b2a5;
  --ash-white: #f7f4ee;

  /* type: three sizes do the work, the display size is for the hero only */
  --f-mincho: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --f-gothic: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  --t-display: clamp(2.5rem, 1.6rem + 3.4vw, 4.5rem);
  --t-head: clamp(1.625rem, 1.3rem + 1.2vw, 2.25rem);
  --t-body: 1rem;
  --t-small: 0.8125rem;      /* 13px; nothing functional goes below 12px */

  /* space: a 4px step, with wide intervals between sections */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --s-ma: clamp(88px, 4rem + 5vw, 168px);  /* the interval between sections */
  --gutter: clamp(16px, 4vw, 64px);
  --radius: 2px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 1px rgb(28 27 24 / 0.06), 0 12px 32px -12px rgb(28 27 24 / 0.22);
  --header-h: 60px;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background-color: var(--washi);
  /* paper fibre: long thin turbulence, very faint */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.22' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 0.9 -0.42'/%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23f)' opacity='0.16'/%3E%3C/svg%3E");
  color: var(--sumi);
  font: 400 var(--t-body)/1.75 var(--f-gothic);
  letter-spacing: 0.01em;
  caret-color: var(--shu);
  accent-color: var(--sumi);
  overflow-x: clip;
}
::selection { background: var(--sumi); color: var(--washi); }
html { scrollbar-color: var(--sumi-3) var(--washi-2); scrollbar-width: thin; }
h1, h2, h3 { font-family: var(--f-mincho); font-weight: 500; line-height: 1.25; margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--shu); }
:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; border-radius: var(--radius); }
.num, output, time, .readout__time, .log td, .totals dd { font-variant-numeric: tabular-nums; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 30; background: var(--sumi); color: var(--washi); padding: 8px 14px; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sub { color: var(--sumi-2); max-width: 60ch; }
.hint { color: var(--sumi-3); font-size: var(--t-small); line-height: 1.5; }
.err { color: var(--shu); font-size: var(--t-small); line-height: 1.5; min-height: 0; }
.err:empty { display: none; }
.opt { color: var(--sumi-3); font-weight: 400; }

/* ---------- 3. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 20px;
  font: 500 0.9375rem/1 var(--f-gothic); letter-spacing: 0.04em; color: var(--sumi);
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius);
  cursor: pointer; transition: background-color .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.btn:hover { border-color: var(--sumi); background: rgb(28 27 24 / 0.04); }
.btn:active { background: rgb(28 27 24 / 0.08); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--ink { background: var(--sumi); color: var(--washi); border-color: var(--sumi); }
.btn--ink:hover { background: #33312c; border-color: #33312c; }
.btn--ink:active { background: #000; }
.btn--quiet { border-color: transparent; padding: 0 12px; color: var(--sumi-2); }
.btn--quiet:hover { border-color: var(--line); color: var(--sumi); }
.btn--wide { width: 100%; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::after { content: ''; width: 28px; height: 1px; background: currentColor; transform-origin: left; animation: wick 1s var(--ease) infinite; }
@keyframes wick { from { transform: scaleX(0); } to { transform: scaleX(1); opacity: 0; } }

.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--sumi); border-radius: var(--radius); cursor: pointer; }
.icon-btn:hover { border-color: var(--sumi); }

.field { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.field legend, .field__label { padding: 0; font-size: var(--t-small); color: var(--sumi-3); letter-spacing: 0.04em; margin-bottom: 6px; }
.field legend { float: left; width: 100%; }
.field legend + * { clear: both; }

/* segmented choice: radios drawn as a row of paper tabs */
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius); width: fit-content; max-width: 100%; }
.seg label { position: relative; display: flex; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; font-size: 0.9375rem; color: var(--sumi-2); cursor: pointer; transition: background-color .25s var(--ease), color .25s var(--ease); white-space: nowrap; }
.seg b { font: 500 1.0625rem/1 var(--f-mincho); color: var(--sumi); }
.seg input:hover + span { background: rgb(28 27 24 / 0.04); }
.seg input:checked + span { background: var(--sumi); color: var(--washi); }
.seg input:checked + span b { color: var(--washi); }
.seg input:focus-visible + span { outline: 2px solid var(--shu); outline-offset: 2px; position: relative; z-index: 1; }
.seg input:disabled + span { opacity: 0.45; cursor: not-allowed; }
.seg--sm span { padding: 0 12px; font-size: var(--t-small); }

input[type=text], input[type=email], input[type=number], select {
  width: 100%; min-height: 44px; padding: 0 12px;
  font: 400 1rem/1.2 var(--f-gothic); color: var(--sumi);
  background: rgb(255 255 255 / 0.45); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
input::placeholder { color: var(--sumi-3); }
input:hover, select:hover { border-color: var(--sumi-2); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--sumi); box-shadow: 0 0 0 1px var(--sumi); background: rgb(255 255 255 / 0.7); }
input[aria-invalid=true] { border-color: var(--shu); box-shadow: 0 0 0 1px var(--shu); }
select { appearance: none; width: auto; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1b18' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); width: fit-content; }
.stepper__btn { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--sumi); cursor: pointer; }
.stepper__btn:hover { background: rgb(28 27 24 / 0.05); }
.stepper__btn:disabled { color: var(--sumi-3); opacity: .5; cursor: not-allowed; }
.stepper output { min-width: 2.5ch; text-align: center; font: 500 1.25rem/1 var(--f-mincho); }

.switch { position: relative; display: inline-flex; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--washi-3); transition: background-color .3s var(--ease); }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--washi); border: 1px solid var(--line-strong); transition: transform .35s var(--ease); }
.switch input:checked + span { background: var(--sumi); border-color: var(--sumi); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--shu); outline-offset: 3px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--t-small); color: var(--sumi-2); cursor: pointer; line-height: 1.6; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }

.banner, .done { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 0.9375rem; line-height: 1.6; }
.banner .ic, .done .ic { margin-top: 3px; }
.banner--err { border-color: var(--shu); color: var(--sumi); background: var(--shu-soft); }
.banner--err .ic { color: var(--shu); }
.done { background: rgb(255 255 255 / 0.4); flex-wrap: wrap; }
.done p { flex: 1 1 220px; }
.done:focus { outline: none; }

/* ---------- 4. Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: var(--s-6); padding: 0 var(--gutter);
  background: var(--washi); border-bottom: 1px solid var(--line);
}
.mark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.mark__word { font: 500 1.375rem/1 var(--f-mincho); letter-spacing: 0.04em; }
.seal {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  background: var(--shu); color: var(--ash-white); border-radius: 3px;
  font: 600 1.0625rem/1 var(--f-mincho);
  box-shadow: inset 0 0 0 2px var(--shu), inset 0 0 0 3px rgb(247 244 238 / 0.55);
}
.nav { display: flex; gap: var(--s-5); margin-left: auto; font-size: var(--t-small); letter-spacing: 0.08em; }
.nav a { text-decoration: none; color: var(--sumi-2); padding: 10px 0; }
.nav a:hover { color: var(--sumi); text-decoration: underline; text-decoration-color: var(--shu); }
.top__get { font-size: var(--t-small); letter-spacing: 0.08em; text-decoration: none; padding: 10px 16px; border: 1px solid var(--sumi); border-radius: var(--radius); }
.top__get:hover { background: var(--sumi); color: var(--washi); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 33rem) minmax(0, 1fr);
  gap: var(--s-8); align-items: start;
  padding: clamp(40px, 6vh, 80px) var(--gutter) var(--s-ma);
  min-height: calc(100svh - var(--header-h));
}
.hero__words { display: grid; gap: var(--s-5); align-content: start; padding-top: 8px; }
.hero h1 { font-size: var(--t-display); line-height: 1.12; font-weight: 500; max-width: 12ch; letter-spacing: -0.005em; }
.lede { font-size: 1.0625rem; color: var(--sumi-2); max-width: 44ch; }

.setup { display: grid; gap: var(--s-5); margin-top: var(--s-3); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.setup__row { display: flex; flex-wrap: wrap; gap: var(--s-5) var(--s-6); }
.custom { display: grid; grid-template-columns: 10rem; gap: 6px; margin-top: 10px; }
.custom label { font-size: var(--t-small); color: var(--sumi-3); }
.setup input[type=text] { max-width: 26rem; }
.plan { font-size: var(--t-small); color: var(--sumi-2); max-width: 46ch; line-height: 1.6; }
.setup.is-locked .seg, .setup.is-locked .stepper { opacity: .55; }

/* the stage: drawing, readout, vertical inscription */
.stage { position: relative; margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-6); align-items: end; justify-self: center; width: 100%; max-width: 640px; }
.stick { width: auto; height: min(72svh, 640px); min-height: 420px; aspect-ratio: 240 / 640; overflow: visible; }
.stick__body { fill: #6d4f3a; }
.stick__bare { fill: #c9b79b; }
.tip { opacity: 0; }
.ash { fill: var(--ash); }
.ember { fill: var(--ember); }
.ember__glow { opacity: 0; transition: opacity .6s var(--ease); }
.flake { fill: var(--ash); opacity: 0; }
.bowl__ash { fill: var(--ash-white); stroke: var(--line); }
.bowl__rim { fill: none; stroke: rgb(247 244 238 / 0.25); stroke-width: 1; }
.bowl__foot { fill: var(--sumi); opacity: .14; }
.fallen rect { fill: var(--ash); }
.notches line { stroke: var(--sumi-3); stroke-width: 1; }
.notches text { fill: var(--sumi-3); font: 400 15px/1 var(--f-gothic); }
.notches .is-burned line { stroke: var(--line); }
.notches .is-burned text { fill: var(--line-strong); }
.smoke path { fill: none; stroke: var(--sumi-3); stroke-width: 1.4; stroke-linecap: round; opacity: 0; stroke-dasharray: 46 54; stroke-dashoffset: 0; }

/* lit: glow on, smoke on */
.stage.is-lit .ember__glow { opacity: 1; }
.stage.is-lit .smoke path { opacity: .35; }
.stage.is-lit .smoke .smoke__b { opacity: .22; }
.stage.is-paused .ember { fill: #8a3a26; }
.stage.no-smoke .smoke { display: none; }
/* during a pause the stick is gone: the bowl and an empty field remain */
.ma-mark { opacity: 0; transition: opacity .8s var(--ease); }
.ma-mark line { stroke: var(--sumi-2); stroke-width: 1; }
.ma-mark text { font: 400 44px/1 var(--f-mincho); fill: var(--sumi-2); writing-mode: vertical-rl; }
.stage.is-ma .ma-mark { opacity: 1; }
.stage.is-ma .tip, .stage.is-ma [clip-path], .stage.is-ma .notches, .stage.is-ma .smoke { opacity: 0; transition: opacity .8s var(--ease); }

.readout { display: grid; gap: var(--s-2); padding-bottom: 70px; min-width: 0; }
.readout__phase { font-size: var(--t-small); letter-spacing: 0.12em; color: var(--sumi-3); display: flex; align-items: center; gap: 8px; }
.stage.is-lit .readout__phase { color: var(--shu); }
.stage.is-lit .readout__phase::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--shu); }
.readout__time { font: 400 clamp(3.5rem, 2.6rem + 2.6vw, 5.25rem)/1 var(--f-mincho); letter-spacing: 0.02em; }
.readout__sub { color: var(--sumi-2); font-size: 0.9375rem; }
.controls { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.readout__note { font-size: var(--t-small); color: var(--sumi-2); min-height: 1.5em; max-width: 34ch; }
.keys { font-size: 12px; color: var(--sumi-3); letter-spacing: 0.04em; }
.vert-gloss { position: absolute; right: 0; bottom: -28px; font-size: 12px; color: var(--sumi-3); letter-spacing: 0.04em; text-align: right; }

/* completion panel inside readout */
.readout.is-done .readout__time { font-size: clamp(2.25rem, 1.8rem + 1.6vw, 3.25rem); }

/* ---------- 6. Ledger ---------- */
.ledger, .settings, .clock, .notes, .get, .print { position: relative; padding: 0 var(--gutter) var(--s-ma); }
.ledger { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); max-width: 1200px; margin-inline: auto; }
.ledger__head { display: grid; gap: var(--s-3); }
h2 { font-size: var(--t-head); }
.totals { display: flex; flex-wrap: wrap; gap: var(--s-5) var(--s-8); margin: 0; }
.totals div { display: grid; gap: 2px; }
.totals dt { font-size: var(--t-small); color: var(--sumi-3); letter-spacing: 0.04em; }
.totals dd { margin: 0; font: 400 1.75rem/1.2 var(--f-mincho); }
.totals div:last-child dd { color: var(--sumi); }
.trail { margin: 0; }
.trail svg { display: block; width: 100%; height: 64px; }
.trail .t-base { stroke: var(--line-strong); stroke-width: 1; }
.trail .t-hour { stroke: var(--line); }
.trail .t-stick { fill: var(--sumi); }
.trail .t-stick.is-short { fill: var(--sumi-3); }
.trail .t-ma { fill: var(--ash); }
.trail .t-now { stroke: var(--shu); stroke-width: 1.5; }
.trail__hours { display: flex; justify-content: space-between; font-size: 12px; color: var(--sumi-3); margin-top: 6px; }

.ledger__table-wrap { border-top: 1px solid var(--sumi); }
.log { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.log th, .log td { text-align: left; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.log thead th { font-size: var(--t-small); font-weight: 400; color: var(--sumi-3); letter-spacing: 0.04em; padding-top: 12px; }
.log .num { text-align: right; padding-right: 24px; }
.log td:first-child { white-space: nowrap; font-family: var(--f-mincho); font-size: 1.0625rem; }
.log tr.is-ma td { color: var(--sumi-3); font-size: var(--t-small); padding-block: 8px; }
.log tr.is-ma td:first-child { font-size: var(--t-small); font-family: var(--f-gothic); }
.log tr.is-new td:first-child { color: var(--shu); }
.log tfoot th, .log tfoot td { border-bottom: 0; border-top: 1px solid var(--sumi); font-weight: 500; padding-top: 16px; }
.log tfoot td:last-child { color: var(--sumi-2); font-weight: 400; font-size: var(--t-small); }
.end { display: inline-flex; align-items: center; gap: 8px; }
.end::before { content: ''; width: 18px; height: 3px; background: var(--sumi); border-radius: 1px; }
.end.is-short::before { width: 10px; background: var(--sumi-3); }
.empty { display: flex; gap: var(--s-5); align-items: center; padding: var(--s-7) 0; color: var(--sumi-2); max-width: 60ch; }
.empty svg { width: 120px; flex: none; fill: none; stroke: var(--sumi-3); stroke-width: 1.2; }
.ledger__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

/* ---------- 7. Settings ---------- */
.settings { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 40rem); gap: var(--s-8); justify-content: center; align-items: start; }
.settings__words { display: grid; gap: var(--s-4); position: sticky; top: calc(var(--header-h) + 32px); }
.menubar { display: flex; align-items: center; gap: 14px; height: 30px; padding: 0 12px; margin-top: var(--s-4); background: var(--washi-2); border: 1px solid var(--line); border-radius: 4px; font-size: var(--t-small); color: var(--sumi); }
.menubar__dots { display: flex; gap: 6px; }
.menubar__dots i { width: 14px; height: 2px; background: var(--sumi-3); border-radius: 1px; }
.menubar__fill { flex: 1; }
.menubar__item { display: inline-flex; align-items: center; gap: 6px; min-width: 24px; font-variant-numeric: tabular-nums; }
.menubar__item svg { width: 26px; height: 14px; }
.menubar__clock { color: var(--sumi-2); font-variant-numeric: tabular-nums; }

.window { background: var(--washi-2); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); }
.window__bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.window__bar i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line-strong); }
.window__bar span { margin-left: auto; margin-right: auto; transform: translateX(-24px); font-size: var(--t-small); color: var(--sumi-2); letter-spacing: 0.04em; }
.pref { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pref__name { font-size: 0.9375rem; }
.pref__ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pref__ctl--text { font-size: var(--t-small); color: var(--sumi-2); gap: 8px; }
.pref input[type=range] { width: 160px; accent-color: var(--sumi); }
.pref output { min-width: 4ch; font-size: var(--t-small); color: var(--sumi-2); text-align: right; }
.window__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; flex-wrap: wrap; }

/* ---------- 8. The clock ---------- */
.clock { display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 34rem); gap: var(--s-7) var(--s-8); justify-content: center; }
.clock__words { display: grid; gap: var(--s-4); align-content: start; }
.clock__words p { color: var(--sumi-2); max-width: 62ch; }
.clock__words i { font-style: italic; color: var(--sumi); }
.measure { margin: 0; grid-row: span 2; }
.measure svg { width: 100%; height: auto; display: block; }
.measure .m-grid path { stroke: var(--line); stroke-dasharray: 2 4; }
.measure .m-stick rect { fill: #6d4f3a; }
.measure .m-ticks line { stroke: var(--sumi-3); }
.measure text { font: 400 15px var(--f-mincho); fill: var(--sumi); }
.measure .m-sub { font: 400 13px var(--f-gothic); fill: var(--sumi-3); }
.measure .m-dim path { stroke: var(--sumi-3); fill: none; }
.measure .m-dim text { font: 400 13px var(--f-gothic); fill: var(--sumi-3); }
.measure figcaption { font-size: var(--t-small); color: var(--sumi-3); margin-top: var(--s-3); max-width: 52ch; }
.specs { margin: 0; display: grid; border-top: 1px solid var(--sumi); }
.specs div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--s-4); padding: 12px 0; border-bottom: 1px solid var(--line); }
.specs dt { font-size: var(--t-small); color: var(--sumi-3); letter-spacing: 0.04em; padding-top: 2px; }
.specs dd { margin: 0; font-size: 0.9375rem; }

/* ---------- 9. Release notes ---------- */
.notes { max-width: 1000px; margin-inline: auto; display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--s-6) var(--s-8); }
.releases { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--sumi); }
.releases > li { display: grid; grid-template-columns: 5rem 7.5rem minmax(0, 1fr); gap: var(--s-4); padding: 18px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.rel__v { font: 500 1.25rem/1.2 var(--f-mincho); }
.releases > li:first-child .rel__v { color: var(--shu); }
.rel__d { font-size: var(--t-small); color: var(--sumi-3); }
.releases ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 0.9375rem; color: var(--sumi-2); }
.releases ul li { max-width: 60ch; }

/* ---------- 10. Get Kōma ---------- */
.get { max-width: 1080px; margin-inline: auto; display: grid; gap: var(--s-4); }
.get__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s-6); margin-top: var(--s-5); align-items: start; }
.get__desk, .get__phone { display: grid; gap: var(--s-4); padding: var(--s-6); border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgb(255 255 255 / 0.28); }
h3 { font-size: 1.375rem; }
.get__file { font-size: var(--t-small); color: var(--sumi-3); }
.get__needs { margin: var(--s-2) 0 0; padding-top: var(--s-4); border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: var(--t-small); }
.get__needs div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--s-3); }
.get__needs dt { color: var(--sumi-3); }
.get__needs dd { margin: 0; color: var(--sumi-2); }
.progress { display: grid; gap: 8px; }
.progress__track { height: 2px; background: var(--washi-3); overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--sumi); transition: width .2s linear; }

/* ---------- 11. Small print and footer ---------- */
.print { max-width: 1000px; margin-inline: auto; display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--s-6) var(--s-8); }
.print dl { margin: 0; border-top: 1px solid var(--sumi); }
.print dl div { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: var(--s-4); padding: 14px 0; border-bottom: 1px solid var(--line); }
.print dt { font-family: var(--f-mincho); font-weight: 500; }
.print dd { margin: 0; color: var(--sumi-2); max-width: 60ch; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-6); padding: var(--s-6) var(--gutter) var(--s-7); border-top: 1px solid var(--line); font-size: var(--t-small); color: var(--sumi-2); }
.foot__mark { display: flex; align-items: center; gap: 10px; font: 500 1rem var(--f-mincho); color: var(--sumi); }
.foot nav { display: flex; gap: var(--s-5); margin-left: auto; }
.foot nav a { padding: 10px 0; }

/* ---------- 12. Vertical type ---------- */
.vert {
  position: absolute; writing-mode: vertical-rl; text-orientation: upright;
  font: 400 1.75rem/1 var(--f-mincho); letter-spacing: 0.5em; color: var(--sumi); margin: 0;
  pointer-events: none;
}
.vert--hero { right: 0; top: 0; font-size: clamp(1.75rem, 1rem + 1.6vw, 2.75rem); }
.vert--side { right: var(--gutter); top: 0; font-size: 1.25rem; color: var(--sumi-3); }
.vert--left { right: auto; left: calc(var(--gutter) * 0.5); }

/* ---------- 13. Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .stage.is-lit .smoke__a { animation: drift 6s linear infinite; }
  .stage.is-lit .smoke__b { animation: drift 8.5s linear infinite; animation-delay: -3s; }
  .stage.is-paused .smoke path { animation-play-state: paused; }
  .stage.is-lit .ember__glow { animation: breathe 3.2s ease-in-out infinite; }
  .flake.is-falling { animation: fall 1.4s cubic-bezier(.5, 0, .9, .6) forwards; }
  .totals dd, .readout__time { transition: color .4s var(--ease); }
  .log tr.is-new td { animation: ink 1.6s var(--ease); }
}
@keyframes drift { from { stroke-dashoffset: 46; } to { stroke-dashoffset: -54; } }
@keyframes breathe { 50% { opacity: .55; } }
@keyframes fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--fx, 6px), var(--fy, 300px)) rotate(70deg); } }
@keyframes ink { from { background: var(--shu-soft); } to { background: transparent; } }

/* ---------- 14. Narrow screens ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-6); }
  .stage { gap: var(--s-5); padding-right: 56px; }
  .stick { height: min(64svh, 560px); min-height: 400px; }
  .readout { padding-bottom: 40px; }
  .vert-gloss { position: static; grid-column: 1 / -1; text-align: right; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .settings__words { position: static; }
  .clock { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .measure { grid-row: auto; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .top__get { margin-left: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero__words { display: contents; }
  .hero h1 { order: 0; }
  .lede { order: 1; }
  .setup { order: 3; margin-top: 0; }
  .stage { order: 2; grid-template-columns: auto minmax(0, 1fr); justify-items: stretch; align-items: end; max-width: none; padding-right: 48px; }
  .readout { justify-items: start; text-align: left; padding-bottom: 40px; }
  .controls { justify-content: flex-start; }
  .vert-gloss { text-align: left; }
  .clock, .notes, .print { grid-template-columns: minmax(0, 1fr); }
  .get__grid { grid-template-columns: minmax(0, 1fr); }
  .releases > li { grid-template-columns: 4rem minmax(0, 1fr); }
  .releases ul { grid-column: 1 / -1; }
  .print dl div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .vert--side { display: none; }
}
@media (max-width: 560px) {
  :root { --header-h: 56px; }
  .hero { padding-top: var(--s-5); gap: var(--s-5); }
  .stage { order: 1; }
  .lede { order: 2; }
  .stage { gap: var(--s-4); padding-right: 36px; }
  .stage { grid-template-columns: 128px minmax(0, 1fr); }
  .stick { height: 340px; min-height: 0; width: 128px; }
  .notches text { font-size: 21px; }
  .readout { padding-bottom: 12px; }
  .readout__time { font-size: 3.25rem; }
  .controls .btn { padding: 0 14px; }
  .keys { display: none; }
  .vert--hero { font-size: 1.5rem; letter-spacing: 0.35em; }
  .seg span { padding: 0 12px; }
  .totals { gap: var(--s-4) var(--s-6); }
  .totals div { min-width: 40%; }
  .totals dd { font-size: 1.5rem; }
  /* the ledger table becomes a list of rows */
  .log thead { display: none; }
  .log, .log tbody, .log tfoot { display: block; }
  .log tr { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .log th, .log td { border: 0; padding: 0; }
  .log tbody td:nth-child(2) { grid-column: 2 / 4; }
  .log tbody td:nth-child(3) { display: none; }
  .log tbody td:nth-child(4) { grid-column: 2; text-align: left; padding: 0; }
  .log tbody td:nth-child(5) { grid-column: 3; grid-row: 2; font-size: var(--t-small); color: var(--sumi-2); }
  .log tbody td:nth-child(4)::after { content: ' burned'; color: var(--sumi-3); font-size: var(--t-small); }
  .log tr.is-ma { padding: 8px 0; align-items: baseline; }
  .log tr.is-ma td { padding: 0; }
  .log tr.is-ma td:nth-child(2) { display: none; }
  .log tr.is-ma td:nth-child(4), .log tr.is-ma td:nth-child(5) { grid-row: 1; }
  .log tr.is-ma td:nth-child(4)::after { content: ' paused'; }
  .log tfoot tr { border-top: 1px solid var(--sumi); border-bottom: 0; padding-top: 14px; }
  .log tfoot th, .log tfoot td { border: 0; padding: 0; }
  .log tfoot td#f-plan { display: none; }
  .log tfoot td#f-burn { grid-column: 2 / 4; text-align: left; }
  .log tfoot td#f-note { grid-column: 2 / 4; grid-row: 2; }
  .window__bar span { transform: none; }
  .pref { padding: 14px 16px; }
  .get__desk, .get__phone { padding: var(--s-5) var(--s-4); }
  .specs div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .foot nav { margin-left: 0; }
}
