:root {
  color-scheme: light dark;
  --paper: #f7f6f1;
  --surface: #fffefb;
  --ink: #211e1b;
  --muted: #625e57;
  --line: #aaa49a;
  --accent: #a8331d;
  --button-ink: #fffefb;
  --carbon: #708692;
  font-family: "Helvetica Neue", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1916;
    --surface: #292521;
    --ink: #f5eee4;
    --muted: #c6bbae;
    --line: #867b70;
    --accent: #ff967a;
    --button-ink: #211e1b;
    --carbon: #4f6775;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c1916;
  --surface: #292521;
  --ink: #f5eee4;
  --muted: #c6bbae;
  --line: #867b70;
  --accent: #ff967a;
  --button-ink: #211e1b;
  --carbon: #4f6775;
}

:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.55; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
a { color: var(--accent); text-underline-offset: .23em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip:focus { display: block; padding: 8px 16px; background: var(--surface); }
.shell { width: min(1360px, calc(100% - clamp(32px, 9vw, 144px))); margin-inline: auto; }
.mast, .footer { display: flex; justify-content: space-between; gap: 12px 24px; padding-block: 16px; flex-wrap: wrap; }
.mast { border-bottom: 1px solid var(--line); align-items: center; }
.wordmark {
  display: inline-flex;
  gap: .3em;
  align-items: center;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -.06em;
  color: var(--ink);
  text-decoration: none;
}
.mark { width: 14px; height: 18px; background: var(--accent); border-radius: 1px 6px 1px 1px; }
nav, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
nav a, .touch, .wordmark, button, .button { min-height: 44px; }
nav a, .touch, .button { display: inline-flex; align-items: center; }
nav a { font-size: 14px; }
button, .button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  color: var(--ink);
  text-decoration: none;
}
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--button-ink); font-weight: 650; }
.hero { display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: clamp(24px, 5vw, 72px); padding-block: clamp(32px, 7vw, 96px); }
.meta { color: var(--muted); font-size: 14px; }
h1 { font-size: clamp(64px, 10.5vw, 144px); letter-spacing: -.085em; margin: 8px 0 16px; }
.hero-lead { font-size: clamp(22px, 3vw, 36px); font-weight: 680; line-height: 1.2; }
.lead { font-size: 17px; max-width: 26em; margin: 12px 0 20px; color: var(--muted); }
.specimen { container-type: inline-size; min-width: 0; }
.carbon {
  display: grid;
  min-height: clamp(250px, 32vw, 420px);
  place-items: center;
  padding: clamp(16px, 6%, 48px);
  background: repeating-linear-gradient(0deg, transparent 0 16px, #ffffff19 17px 18px), var(--carbon);
  border-radius: 3px 22px 3px 3px;
}
.paper {
  width: min(100%, 490px);
  min-width: 0;
  padding: clamp(12px, 5cqw, 32px) clamp(14px, 6cqw, 40px);
  background: #e7eceb;
  color: #1c262b;
  border-left: 7px solid #254251;
  box-shadow: 9px 10px 0 #14222a54;
  font-variant-numeric: tabular-nums;
}
.paper header { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; color: #384d58; font-size: 13px; }
#order-number { color: #a8331d; font: 650 clamp(36px, 13cqw, 84px)/1.2 ui-monospace, monospace; margin-block: 8px; }
.paper dl { margin: 0; }
.paper dl div { display: grid; grid-template-columns: 3.5em 1fr; gap: 8px; align-items: baseline; border-top: 1px solid #84959b; padding-block: 6px; }
.paper dd { margin: 0; font-family: ui-monospace, monospace; font-size: clamp(13px, 3.2cqw, 24px); overflow-wrap: anywhere; }
.scrubber { margin-top: 10px; }
.scrubber input { display: block; width: 100%; min-height: 44px; accent-color: var(--accent); }
.stage-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.scrubber .stage-buttons { justify-content: space-between; }
.stage-buttons button[aria-pressed="true"], table button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
figcaption { margin-top: 12px; color: var(--muted); min-height: 3.1em; }
.section { padding-block: clamp(24px, 5vw, 56px); border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.section-heading { display: flex; gap: 12px 24px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
h2 { font-size: clamp(24px, 3vw, 42px); letter-spacing: -.04em; margin-bottom: 8px; }
.section-heading p, .inspection p { color: var(--muted); }
.ledger { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 25%); gap: 16px; margin-top: 12px; }
.table-region { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--surface); text-align: left; font: 14px/1.5 ui-monospace, monospace; }
th, td { padding: 4px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { padding-block: 12px; color: var(--muted); }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr[aria-current="true"] { box-shadow: inset 3px 0 var(--accent); }
tbody button { font: inherit; }
.inspection { background: var(--surface); border: 1px solid var(--line); padding: 16px; }
.inspection p { margin-top: 8px; }
.detail { margin-top: 16px; }
summary { min-height: 44px; padding-block: 8px; font-weight: 650; }
.detail p { margin-block: 8px; max-width: 76ch; }
.scatter-figure, #scatter-table { max-width: 740px; }
.scatter-figure canvas { display: block; width: 100%; height: clamp(224px, 38vw, 320px); background: var(--surface); border: 1px solid var(--line); }
.scatter-figure figcaption { margin-block: 8px; min-height: 0; font-variant-numeric: tabular-nums; }
.scatter-settings { margin-block: 12px; }
.scatter-settings select { min-height: 44px; margin-inline-start: 6px; padding-inline: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.conversion-review { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; gap: 16px; margin-block: 12px; }
.conversion-review caption { padding: 8px 12px; border-bottom: 1px solid var(--line); font: 650 15px/1.5 system-ui, sans-serif; }
pre { overflow-x: auto; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); }
.project { padding: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px 16px; grid-template-columns: max-content 1fr max-content; align-items: baseline; }
.project a { font-size: 20px; font-weight: 700; }
form { display: grid; gap: 12px; justify-items: start; width: min(100%, 520px); }
form label { display: grid; width: 100%; gap: 4px; }
form input, form select, form textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 44px; padding: 8px; }
.brief-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; width: 100%; }
.brief-fields label, .brief-fields input { min-width: 0; }
#brief-source { color: var(--muted); }
.footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer a { margin-inline-end: 12px; }

@media (max-width: 760px) {
  .hero, .ledger, .project { grid-template-columns: minmax(0, 1fr); }
  .hero { align-items: start; }
  h1 { font-size: clamp(66px, 15vw, 108px); }
}

