/* Quire, Woodblock style (DESIGN.md). Light paper site; apps also ship [data-theme="dark"]. */
@font-face { font-family: "Shippori Mincho"; src: url("../../../_shared/fonts/shippori-mincho-600.woff2?v=2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Shippori Mincho"; src: url("../../../_shared/fonts/shippori-mincho-800.woff2?v=2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../../../_shared/fonts/source-serif-var.woff2?v=2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../../../_shared/fonts/jetbrains-mono-var.woff2?v=2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --paper: #EDE3CF;
  --surface: #F6EFE0;
  --sumi: #1E1C1A;
  --muted: #5A5246;
  --indigo: #24406B;
  --on-indigo: #F6EFE0;
  --vermilion: #A8361F;
  --keyline: rgba(36, 64, 107, .35);
  --register: 4px 4px 0 rgba(36, 64, 107, .15);
  --radius: 4px;
  --display: "Shippori Mincho", "Source Serif 4", Georgia, serif;
  --text: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --rain: rgba(36, 64, 107, .28);
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #151A26; --surface: #1C2232; --sumi: #EDE3CF; --muted: #B3AA98;
  --indigo: #8FB0E0; --on-indigo: #151A26; --vermilion: #F08A6E;
  --keyline: rgba(143, 176, 224, .35); --register: 4px 4px 0 rgba(0, 0, 0, .35);
  --rain: rgba(143, 176, 224, .30);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--paper); color: var(--sumi); font: 400 1.0625rem/1.65 var(--text); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.08; font-family: var(--display); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 3rem); text-wrap: balance; }
h3 { font-size: 1.18rem; line-height: 1.25; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a[href], button, summary, label[for], input[type="range"] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -100px; z-index: 90; background: var(--sumi); color: var(--paper); padding: 0 18px; min-height: 44px; display: inline-flex; align-items: center; border-radius: var(--radius); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.mist { color: var(--muted); }
.small { font-size: .9rem; }
.vermilion { color: var(--vermilion); }
.ph { font-size: 1.15em; vertical-align: -0.15em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.wrap-wide { max-width: 1360px; margin: 0 auto; padding: 0 28px; }

/* Logo mark: a paper crane over a keyline, cropped to its box. */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 800 1.35rem/1 var(--display); letter-spacing: -0.02em; min-height: 44px; flex: none; }
.logo svg { flex: none; overflow: visible; }
.logo-crane { stroke: var(--indigo); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.logo-wing { fill: var(--vermilion); stroke: none; }

/* Header (site). Transparent over the print; keyline solid after scroll. */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; transition: background-color 220ms ease, border-color 220ms ease; border-bottom: 1px solid transparent; }
.nav.solid, .nav.open { background: var(--paper); border-bottom-color: var(--keyline); }
.nav .wrap { display: flex; align-items: center; min-height: 80px; gap: 24px; max-width: 1360px; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 auto; padding: 0; }
.nav-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; text-decoration: none; font-weight: 600; font-size: 1rem; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 8px; height: 2px; background: var(--indigo); transform: scaleX(0); transform-origin: left; transition: transform 200ms ease; }
.nav-links a:hover::after, .nav-links a:focus-visible::after { transform: scaleX(1); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-right .menu-btn, .only-menu { display: none; }

/* Buttons: rectangles, keyline or vermilion. WB4, WB2. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: var(--radius); border: 1px solid transparent; font: 600 1rem var(--display); text-decoration: none; color: var(--paper); background: var(--indigo); transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease; white-space: nowrap; }
[data-theme="dark"] .btn { background: #24406B; }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn:hover { box-shadow: var(--register); }
.btn-vermilion { background: var(--vermilion); color: #F6EFE0; }
[data-theme="dark"] .btn-vermilion { color: #151A26; }
.btn-ghost { background: transparent; color: var(--indigo); border-color: var(--keyline); }
[data-theme="dark"] .btn-ghost { color: var(--indigo); }
.btn-ghost:hover { background: var(--surface); box-shadow: none; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: .95rem; }

/* WB2: one vermilion element per screen is the primary action. */
/* Hero: the print. Page body is paper (WB3); hero fades into it. */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; text-align: center; overflow: hidden; isolation: isolate; padding: 120px 24px 130px; }
.hero .art { position: absolute; inset: 0 0 auto; height: max(100%, 43vw); z-index: -2; -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent); mask-image: linear-gradient(180deg, #000 72%, transparent); }
@media (min-aspect-ratio: 16/11) { .hero .art { height: 43vw; } }
.hero .art img { width: 100%; height: 110%; object-fit: cover; object-position: 50% 22%; will-change: transform; }
/* Scrim measured on the lightest pixel under the glyphs (PA1): the paper-white
   crane wings at (252,245,234). Flat band .66 over the whole text block gives
   4.61:1 for the h1, 5.12:1 for the sub, 4.61:1 for the note; all pass H7. */
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 44% 30% at 50% 46%, rgba(21, 26, 38, .86), rgba(21, 26, 38, .5) 62%, transparent 100%),
              linear-gradient(180deg, rgba(21, 26, 38, .55) 0%, rgba(21, 26, 38, 0) 18%, rgba(21, 26, 38, 0) 60%, #151A26 96%); }
/* The hero is the print block: it sits on indigo and ends in a clean paper keyline, like a print on its sheet. */
.hero { background: #151A26; border-bottom: 3px double rgba(237, 227, 207, .55); }
/* Over the print the header reads in paper; once it turns solid on scroll it returns to ink. */
.nav:not(.solid):not(.open) { color: #F6EFE0; background: linear-gradient(180deg, rgba(11, 17, 29, .72), rgba(11, 17, 29, 0)); }
.nav:not(.solid):not(.open) .logo, .nav:not(.solid):not(.open) .nav-links a, .nav:not(.solid):not(.open) .nav-right .icon-btn, .nav:not(.solid):not(.open) .nav-right .btn-ghost { color: #F6EFE0; border-color: rgba(246, 239, 224, .45); }
.nav:not(.solid):not(.open) .logo-crane { stroke: #F6EFE0; }
.nav:not(.solid):not(.open) .nav-links a::after { background: #F6EFE0; }
/* WB5: the rain drifts, under 4px, pausable. A pause control sits on the hero. */
.rain { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.rain span { position: absolute; top: -12vh; width: 1.5px; height: 60px; background: var(--rain); transform: skewX(-18deg); animation: rainfall 7s linear infinite; }
.rain[hidden] { display: none; }
@keyframes rainfall { to { transform: translateY(112vh) skewX(-18deg); } }
.rain-pause { position: absolute; right: 28px; bottom: 22px; z-index: 3; background: rgba(21, 26, 38, .72); border-color: rgba(237, 227, 207, .35); color: #F6EFE0; }
.rain-pause:hover { background: rgba(21, 26, 38, .85); }
.hero-inner { max-width: 1060px; display: grid; justify-items: center; gap: 22px; color: #F6EFE0; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 6rem); font-weight: 600; letter-spacing: -0.02em; color: #EDE3CF; text-wrap: balance; max-width: 14ch; text-shadow: 0 2px 26px rgba(11, 17, 29, .5); }
.hero .sub { font-size: clamp(1.08rem, 1.5vw, 1.32rem); max-width: 40ch; color: #F6EFE0; text-wrap: balance; text-shadow: 0 1px 14px rgba(11, 17, 29, .85); }
.hero-note { color: rgba(237, 227, 207, .82); font-size: .88rem; max-width: 58ch; text-shadow: 0 1px 10px rgba(11, 17, 29, .95); }

/* The glass bar: the one real thing over the print (P7 dose). */
.livebar { margin-top: 4px; display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: var(--radius); background: rgba(21, 26, 38, .58); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border: 1px solid rgba(237, 227, 207, .28); max-width: 100%; color: #F6EFE0; }
.livebar .seg { display: grid; gap: 1px; padding: 4px 14px; text-align: left; border-right: 1px solid rgba(237, 227, 207, .25); min-width: 0; }
.livebar .seg:last-of-type { border-right: 0; }
.livebar .k { font: 500 .7rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: rgba(237, 227, 207, .75); white-space: nowrap; }
.livebar .v { font: 600 1rem var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.livebar .v.vermilion { color: #F08A6E; }
.livebar .btn { background: var(--vermilion); color: #F6EFE0; border-color: transparent; }
.livebar .btn:hover { box-shadow: 4px 4px 0 rgba(21, 26, 38, .4); background: var(--vermilion); }

/* Sections on paper. Thin double keylines may separate them (style file). */
section { position: relative; padding: 120px 0; }
.rule-ink { border-top: 1px solid var(--keyline); box-shadow: 0 4px 0 -3px var(--keyline); }
.head { display: grid; gap: 16px; margin-bottom: 48px; max-width: 720px; }
.head.center { margin-left: auto; margin-right: auto; text-align: center; justify-items: center; }
.head p { color: var(--muted); font-size: 1.14rem; max-width: 54ch; }
.kicker { font: 600 .85rem var(--mono); color: var(--indigo); letter-spacing: .02em; display: inline-flex; align-items: center; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--keyline); border-radius: var(--radius); box-shadow: var(--register); }
.actions, .actions-left { display: flex; flex-wrap: wrap; gap: 12px; }
.actions { justify-content: center; }

/* The instrument: the draft reader, every state. */
.inst { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.board { padding: 26px; display: grid; gap: 18px; align-content: start; }
.board-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.board-top .title { font-weight: 600; font-family: var(--display); font-size: 1.08rem; display: flex; align-items: center; gap: 10px; }
.tool-label { font: 500 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
textarea { width: 100%; min-height: 170px; resize: vertical; border: 1px solid var(--keyline); border-radius: var(--radius); background: var(--paper); color: var(--sumi); font: 400 1rem/1.6 var(--text); padding: 14px; }
textarea:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; font-family: var(--mono); font-variant-numeric: tabular-nums; margin: 0; border-top: 1px solid var(--keyline); padding-top: 14px; }
.dl-row { display: contents; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; text-align: right; }
.dl em { font-style: normal; color: var(--muted); font-size: .85em; }
.flags { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--keyline); display: grid; gap: 8px; }
.flags li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; font-size: .92rem; color: var(--muted); }
.flags .count { font: 600 .95rem var(--mono); color: var(--vermilion); border: 1px solid var(--vermilion); border-radius: var(--radius); text-align: center; min-height: 26px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.flags .pat { color: var(--sumi); font-weight: 600; display: block; font-family: var(--display); }
.tool-empty { color: var(--muted); border-top: 1px solid var(--keyline); padding-top: 12px; }
.inst-side { display: grid; gap: 20px; align-content: start; }
.panel { padding: 22px; display: grid; gap: 14px; }
.panel h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.panel h3 .ph { font-size: 1.35rem; color: var(--indigo); }
.panel p { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font: 500 .95rem var(--mono); margin: 0; }
.kv dt { color: var(--muted); font-family: var(--text); }
.kv dd { margin: 0; text-align: right; }
.flash { animation: flash 600ms ease; }
@keyframes flash { from { color: var(--vermilion); } }

/* Ideas: asymmetric paper panels with keylines and the registration shadow (P10). */
.concepts { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.concept { padding: 28px; display: grid; gap: 12px; align-content: start; }
.concept .ico { font-size: 44px; color: var(--indigo); line-height: 1; }
.concept p { color: var(--muted); }
.concept.w7 { grid-column: span 7; } .concept.w5 { grid-column: span 5; }

/* Art band: the room print returns, with a paper panel on it. */
.artband { position: relative; isolation: isolate; overflow: hidden; padding: 130px 0; }
.artband .art { position: absolute; inset: 0; z-index: -2; }
.artband .art img { width: 100%; height: 112%; object-fit: cover; object-position: 50% 46%; }
.artband::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(21, 26, 38, .82) 0%, rgba(21, 26, 38, .55) 46%, rgba(21, 26, 38, .14) 100%),
              linear-gradient(180deg, var(--paper) 0%, transparent 14%, transparent 86%, var(--paper) 100%); }
.artband .head { color: #F6EFE0; }
.artband .head p { color: rgba(237, 227, 207, .85); }
.bandrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: stretch; margin-bottom: 26px; }
.frame-list { background: var(--surface); border: 1px solid var(--keyline); box-shadow: var(--register); border-radius: var(--radius); }
.frame-list ul { list-style: none; margin: 0; padding: 6px 20px; display: grid; }
.frame-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 16px 4px; border-bottom: 1px solid var(--keyline); }
.frame-list li:last-child { border-bottom: 0; }
.frame-list .ph { font-size: 1.5rem; color: var(--indigo); }
.frame-list b { display: block; font-weight: 600; font-family: var(--display); color: var(--sumi); }
.frame-list span { color: var(--muted); font-size: .96rem; }
.panel-on-art { padding: 22px; display: grid; gap: 4px; justify-items: start; align-content: center; background: var(--surface); border: 1px solid var(--keyline); box-shadow: var(--register); border-radius: var(--radius); }
.panel-on-art .big-num { font: 600 2.2rem var(--mono); letter-spacing: -0.02em; }
.panel-on-art .kicker { font: 600 .78rem var(--mono); }
.panel-on-art .mono.small { color: var(--muted); }
.paper-note { margin-top: 10px; font-size: .84rem; color: var(--muted); }
.actions-left .btn-ghost { background: rgba(21, 26, 38, .5); color: #F6EFE0; border-color: rgba(237, 227, 207, .35); }
.actions-left .btn-ghost:hover { background: rgba(21, 26, 38, .7); }

/* FAQ */
.faq { max-width: 840px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--keyline); }
.faq summary { list-style: none; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 600; font-family: var(--display); font-size: 1.08rem; padding: 14px 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ph { transition: transform 200ms ease; color: var(--indigo); flex: none; }
.faq details[open] summary .ph { transform: rotate(45deg); }
.faq .a { padding: 0 0 24px; color: var(--muted); max-width: 70ch; }

/* Final band: art returns with one CTA. */
.final { min-height: 76svh; display: grid; place-items: center; text-align: center; padding: 130px 24px; }
.final::after { background: linear-gradient(180deg, var(--paper) 0%, rgba(21, 26, 38, .3) 24%, rgba(21, 26, 38, .22) 55%, rgba(21, 26, 38, .55) 85%, var(--paper) 100%); }
.final .inner { display: grid; gap: 20px; justify-items: center; max-width: 760px; color: #F6EFE0; }
.final h2 { font-size: clamp(2.3rem, 5.6vw, 4.6rem); letter-spacing: -0.02em; }
.final p { font-size: 1.2rem; max-width: 44ch; text-wrap: balance; text-shadow: 0 1px 14px rgba(11, 17, 29, .8); }

/* Footer: colophon. */
.foot { border-top: 1px solid var(--keyline); padding: 56px 0 40px; }
.foot > .wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr)); gap: 32px; }
.foot h3 { margin: 0 0 12px; font: 600 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.foot ul a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.foot ul a:hover { color: var(--indigo); text-decoration: underline; }
.foot .small { color: var(--muted); margin-top: 12px; max-width: 44ch; }
.foot a { color: var(--indigo); }

/* App (app.html) */
body.app { background: var(--paper); }
.appbar { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 1px solid var(--keyline); }
.appbar-in { max-width: 1360px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 20px; min-height: 64px; }
.appnav { display: flex; gap: 4px; margin: 0 auto; }
.appnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; text-decoration: none; font-weight: 600; font-size: .98rem; font-family: var(--display); color: var(--muted); border-radius: var(--radius); }
.appnav a:hover { color: var(--sumi); background: var(--surface); }
.appnav a[aria-current="true"] { color: var(--sumi); background: var(--surface); box-shadow: inset 0 -2px 0 var(--indigo); }
.appbar-right { display: flex; gap: 8px; margin-left: auto; }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--keyline); border-radius: var(--radius); background: transparent; color: var(--sumi); font: 600 .95rem var(--display); text-decoration: none; }
.icon-btn:hover { background: var(--surface); }
.icon-btn .ph { color: var(--indigo); }

/* Painted banner cut from the room print, 160 to 220px. */
.banner { position: relative; overflow: hidden; height: 200px; }
.banner img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 55%; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(21, 26, 38, .75), rgba(21, 26, 38, .45) 55%, rgba(21, 26, 38, .15)), linear-gradient(180deg, rgba(21, 26, 38, .25), rgba(21, 26, 38, .6) 88%); }
.banner-in { position: absolute; z-index: 1; inset: auto 28px 18px; max-width: 1200px; margin: 0 auto; left: 0; right: 0; display: grid; gap: 4px; color: #F6EFE0; }
.banner-h { font-size: clamp(1.8rem, 3.4vw, 2.6rem); color: #EDE3CF; letter-spacing: -0.01em; text-shadow: 0 1px 14px rgba(11, 17, 29, .7); }
.banner .kicker { color: #EDE3CF; }
.banner-status { color: rgba(237, 227, 207, .9); font-size: .82rem; }

.app-note { padding: 10px 28px; text-align: center; font-size: .84rem; color: var(--muted); border-bottom: 1px solid var(--keyline); }
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 60vh; }
.rail { border-right: 1px solid var(--keyline); padding: 20px 12px 20px 28px; position: sticky; top: 64px; align-self: start; }
.rail-title { font: 800 1.05rem var(--display); margin: 0 0 10px; color: var(--sumi); }
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rail a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); text-decoration: none; color: var(--muted); font-weight: 600; font-size: .98rem; font-family: var(--display); position: relative; }
.rail a .ph { color: var(--indigo); flex: none; }
.rail a[aria-current="true"] { color: var(--sumi); background: var(--surface); }
.rail a[aria-current="true"]::after { content: ""; width: 5px; height: 22px; background: var(--vermilion); position: absolute; left: -12px; border-radius: 1px; }
.rail-note { margin: 22px 12px 0 0; padding-top: 14px; border-top: 1px solid var(--keyline); font-size: .84rem; color: var(--muted); }
.main { padding: 28px 28px 56px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head h1, .page-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.sample-label { display: inline-flex; align-items: center; gap: 8px; font: 500 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--sumi); background: var(--surface); border: 1px solid var(--keyline); border-radius: var(--radius); padding: 5px 12px; }
.sample-label .ph { color: var(--indigo); }

/* Documents table (U3): numbers right-aligned in tabular figures, sticky header. */
.docs { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 540px; }
.docs caption { text-align: left; padding-bottom: 12px; }
.docs th { text-align: left; font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 12px 12px 0; border-bottom: 1px solid var(--keyline); }
.docs .num { text-align: right; }
.docs tbody th { font: 600 .95rem var(--display); color: var(--sumi); border-bottom: 1px solid var(--keyline); text-align: left; }
.docs td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--keyline); color: var(--sumi); }
.docs tbody tr:hover { background: var(--surface); }
.docs tr[aria-selected="true"] th, .docs tr[aria-selected="true"] td { border-bottom-color: var(--keyline); }
.docs tr[aria-selected="true"] th::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--vermilion); margin-left: 9px; vertical-align: .1em; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions button { min-height: 34px; padding: 0 12px; font-size: .85rem; border: 1px solid var(--keyline); background: transparent; color: var(--indigo); border-radius: var(--radius); font-family: var(--display); font-weight: 600; }
.row-actions button:hover { background: var(--surface); }
.row-actions .danger { color: var(--vermilion); border-color: var(--vermilion); }
.scroll-x { overflow-x: auto; }

/* Editor: reading size, 66ch measure, live counts. */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 26px; }
.editor-pane { border: 1px solid var(--keyline); border-radius: var(--radius); background: var(--surface); box-shadow: var(--register); padding: 20px; }
.doc-title-input { width: 100%; font-family: var(--display); font-size: 1.35rem; font-weight: 600; background: transparent; border: none; border-bottom: 1px solid var(--keyline); color: var(--sumi); padding: .35rem 0 .55rem; }
.doc-title-input:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }
#doc-body { min-height: 280px; font-size: 1.0625rem; line-height: 1.68; max-width: 66ch; }
.editor-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .88rem; }
.editor-meta span { display: inline-flex; align-items: center; gap: 6px; }
.editor-meta .ph { font-size: 1.1em; color: var(--indigo); }
.editor-side .panel { background: var(--surface); border: 1px solid var(--keyline); box-shadow: var(--register); border-radius: var(--radius); }
.editor-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; max-width: 66ch; }

/* Undo bar (U5) */
.undo-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 60; display: flex; align-items: center; gap: 16px; background: var(--sumi); color: var(--paper); padding: 10px 16px 10px 20px; border-radius: var(--radius); box-shadow: var(--register); }
[data-theme="dark"] .undo-bar { background: var(--surface); color: var(--sumi); border: 1px solid var(--keyline); }
.undo-bar p { font-size: .95rem; }
.undo-bar .btn { background: transparent; color: inherit; border: 1px solid currentColor; min-height: 38px; box-shadow: none; }
.undo-bar .btn:hover { box-shadow: none; background: rgba(127, 127, 127, .15); }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: 84px; z-index: 55; background: var(--sumi); color: var(--paper); padding: 10px 20px; border-radius: var(--radius); opacity: 0; transition: opacity 220ms ease, transform 220ms ease; pointer-events: none; max-width: min(90vw, 480px); text-align: center; }
[data-theme="dark"] .toast { background: var(--surface); color: var(--sumi); border: 1px solid var(--keyline); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Dialogs (U12): native <dialog> with the sheet look. */
dialog.sheet { border: 1px solid var(--keyline); border-radius: var(--radius); background: var(--surface); color: var(--sumi); box-shadow: var(--register); padding: 26px; width: min(440px, calc(100vw - 40px)); }
dialog.sheet::backdrop { background: rgba(21, 26, 38, .55); }
dialog.sheet h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
dialog.sheet p { color: var(--muted); margin: 10px 0 0; }
dialog.sheet label { display: block; font-weight: 600; margin: 18px 0 6px; }
dialog.sheet input[type="text"] { width: 100%; font: 400 1rem var(--text); background: var(--paper); border: 1px solid var(--keyline); border-radius: var(--radius); color: var(--sumi); padding: .7rem; }
dialog.sheet input[type="text"]:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
dialog.sheet fieldset { border: 1px solid var(--keyline); border-radius: var(--radius); padding: 12px 16px 16px; margin: 18px 0 0; }
dialog.sheet legend { padding: 0 8px; font-weight: 600; font-family: var(--display); }
.opt { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 0; }
.opt input { width: 18px; height: 18px; accent-color: var(--vermilion); }
.opt .ext { margin-left: auto; font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.hint { color: var(--muted); font-size: .88rem; }

/* Motion: purpose list in DESIGN.md. Rain is handled above (WB5). */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .rise { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%; }
    @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .rain { display: none; }
}

/* Responsive: 390, 820, 1440 designed. */
@media (max-width: 1100px) {
  .inst { grid-template-columns: 1fr; }
  .concept.w7, .concept.w5 { grid-column: 1 / -1; }
  .bandrow { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
  section { padding: 100px 0; }
}
@media (max-width: 900px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 12px; right: 12px; flex-direction: column; padding: 10px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--keyline); box-shadow: var(--register); }
  .nav.open .nav-links { display: flex; }
  .only-menu { display: list-item; }
  .nav-right .menu-btn { display: inline-flex; }
  .livebar .hide-sm { display: none; }
  .appnav { display: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-shell > * { min-width: 0; }
  .rail { position: static; border-right: 0; border-bottom: 1px solid var(--keyline); padding: 12px 0 12px 28px; display: flex; overflow-x: auto; }
  .rail-title, .rail-note { display: none; }
  .rail ul { display: flex; gap: 4px; }
  .rail a[aria-current="true"]::after { display: none; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  section { padding: 76px 0; }
  .hero { padding: 16svh 16px 104px; align-items: start; }
  .hero h1 { font-size: clamp(1.9rem, 8.4vw, 2.4rem); line-height: 1.1; }
  .livebar { flex-wrap: wrap; justify-content: center; padding: 10px; }
  .livebar .seg { border-right: 0; text-align: center; padding: 4px 10px; }
  .livebar .btn { width: 100%; margin-left: 0; }
  .board { padding: 18px 14px; }
  .concept { padding: 22px; }
  .final .btn { width: 100%; }
  .final .actions { width: 100%; }
  .foot > .wrap { grid-template-columns: 1fr 1fr; }
  .foot > .wrap > div:first-child { grid-column: 1 / -1; }
  body.app .main { padding: 20px 16px 48px; }
  .banner { height: 176px; }
  .banner-in { left: 16px; right: 16px; }
  .appbar-in { padding: 0 16px; }
  .app-note { padding: 10px 16px; }
  .rail { padding-left: 16px; }
  .editor-foot { max-width: none; }
}
/* PA2: portrait screens get the 9:16 print, pushed down so the text sits in the sky.
   The print fades in from the page paper, so the headline runs in ink over paper
   (13.34:1) and the lower text sits on a measured scrim over the art. */
@media (max-width: 700px), (orientation: portrait) and (max-width: 1100px) {
  .hero .art { inset: 22svh 0 auto; height: 100%; -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 74%, transparent); mask-image: linear-gradient(180deg, transparent, #000 12%, #000 74%, transparent); }
  .hero .art img { object-position: 50% 8%; }
  .hero h1 { color: #EDE3CF; text-shadow: 0 2px 20px rgba(11, 17, 29, .6); }
  /* The sub gets its own dark plate so it never depends on the art beneath it. */
  .hero .sub { color: #F6EFE0; display: inline-block; background: rgba(21, 26, 38, .78); padding: 10px 16px; border-radius: var(--radius); text-shadow: none; max-width: 40ch; }
  /* Measured on the lightest art pixel under the glyphs (236,230,211): .72 gives 6.72:1
     for the sub; the ink headline ends at ~27% and stays over unscrimmed paper (13.34:1). */
  .hero::after { background: linear-gradient(180deg, transparent 29%, rgba(21, 26, 38, .72) 34%, rgba(21, 26, 38, .72) 84%, #151A26 100%); }
  .hero .livebar { background: rgba(21, 26, 38, .82); }
  .hero::before { display: none; }
  .hero-note { color: #F6EFE0; text-shadow: 0 1px 10px rgba(11, 17, 29, .95); }
}
@media (max-width: 480px) {
  .menu-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .menu-btn { width: 44px; padding: 0; justify-content: center; }
  .hide-xs { display: none; }
  .foot > .wrap { grid-template-columns: 1fr; }
  .livebar .hide-xs { display: none; }
}

/* These follow the generic .icon-btn rules, so they need the extra specificity. */
.hero .icon-btn.rain-pause { background: rgba(21, 26, 38, .78); border-color: rgba(237, 227, 207, .4); color: #F6EFE0; }
.hero .icon-btn.rain-pause:hover { background: rgba(21, 26, 38, .92); }
.hero .icon-btn.rain-pause .ph, .nav:not(.solid):not(.open) .nav-right .icon-btn .ph { color: #F6EFE0; }

/* Narrow screens: every level of the app column may shrink, and wide tables scroll inside their card. */
.app-shell .main, .app-shell .panel, .app-shell .card { min-width: 0; }
.app-shell .scroll-x { max-width: 100%; overflow-x: auto; position: relative; }
.page-head { min-width: 0; }
