/* Algorithm Adventures house skin: Direction B "Sheet Set" (locked 2026-09-25).
 * Shared by the roof and every tool. Fonts are self-hosted OFL woff2 (latin subset). */

@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Spline Sans Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/spline-sans-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Spline Sans Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/spline-sans-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Spline Sans Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/spline-sans-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;

  --sheet: #F7F8F5;
  --field: #FFFFFF;
  --margin: #E9EBE6;
  --minor: #C9CFD6;
  --navy: #16233F;
  --ink2: #3E4B63;
  --ink3: #5E6A7E;
  --redline: #C0341D; /* marker only: brand dot, active cell, CLIENT-ONLY stamp, given flag. Never a fill. */
  --focus: #1D5FD1;
  --band: #EEF0EC;
  --success: #27643F;
  --warn: #8C5B00;
  --danger: #9B1C1C;
  --success-bg: #E6EFE8;
  --warn-bg: #F6EDD6;
  --danger-bg: #F6E1DF;

  --rule: 1.5px solid var(--navy);
  --rule-minor: 1px solid var(--minor);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --row-form: 40px;
  --row-result: 32px;
  --row-head: 52px;

  --f-title: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-ui: "Barlow Semi Condensed", system-ui, sans-serif;
  --f-mono: "Spline Sans Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --t14: 14px; --t15: 15px; --t16: 16px; --t19: 19px;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--sheet);
  color: var(--navy);
  font: 400 var(--t15)/1.45 var(--f-ui);
}
h1, h2, h3, p, ol, ul { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Type roles ─────────────────────────────────────────────────────── */
.title { font-family: var(--f-title); font-weight: 700; text-transform: uppercase; letter-spacing: 0.01em; line-height: 1; }
.caption {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
}
.num, .mono, code, kbd {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.muted { color: var(--ink3); }
.link {
  text-decoration: underline;
  text-decoration-color: var(--redline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.link:hover { text-decoration-thickness: 2.5px; }

/* ── Title-block strips (header / footer) ───────────────────────────── */
.strip {
  display: flex;
  align-items: stretch;
  min-height: var(--row-head);
  background: var(--band);
  border-bottom: var(--rule);
}
.strip > * { display: flex; align-items: center; padding: 0 var(--s4); border-right: var(--rule-minor); }
.strip > .spacer { flex: 1; border-right: 0; padding: 0; }
.strip > .end { border-right: 0; border-left: var(--rule-minor); }
.strip a { text-decoration: none; }

.brand {
  gap: 10px;
  font-family: var(--f-title);
  font-weight: 700;
  font-size: var(--t19);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand svg { flex: none; }

.shelves { padding: 0 !important; overflow-x: auto; }
.shelf {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 var(--s4);
  border-right: var(--rule-minor);
  font-weight: 600;
  white-space: nowrap;
}
.shelf:last-child { border-right: 0; }
.shelf .key { font-family: var(--f-mono); font-size: 10px; color: var(--ink3); }
.shelf[aria-current] { background: var(--navy); color: var(--field); }
.shelf[aria-current] .key { color: var(--minor); }
.shelf:not([aria-current]):hover { background: var(--margin); }

.crumb { flex-direction: column; align-items: flex-start !important; justify-content: center; gap: 1px; }
.crumb b { font-weight: 600; font-size: var(--t15); line-height: 1.2; }
.crumb .active { text-decoration: underline; text-decoration-color: var(--redline); text-decoration-thickness: 2px; text-underline-offset: 3px; }

.strip-link { font-weight: 600; }
.strip-link a, a.strip-link { text-decoration: underline; text-decoration-color: var(--redline); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.strip-toggle { padding: 0 !important; }
.strip-toggle button {
  height: 100%;
  padding: 0 var(--s4);
  border: 0;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}
.strip-toggle button[aria-expanded="true"] { background: var(--navy); color: var(--field); }

.footer-strip {
  display: flex;
  align-items: stretch;
  min-height: 40px;
  background: var(--band);
  border-top: var(--rule);
  font-size: var(--t14);
}
.footer-strip > * { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); border-right: var(--rule-minor); }
.footer-strip > .spacer { flex: 1; border-right: 0; }
.footer-strip > .end { border-right: 0; border-left: var(--rule-minor); }

.stamp { font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--redline); }

/* Title block: project / sheet / build / site / data / account */
.title-block { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); background: var(--field); border-top: var(--rule); border-left: var(--rule); }
.title-block > div { padding: 6px var(--s2); border-right: var(--rule-minor); border-bottom: var(--rule-minor); min-height: var(--row-result); }
.title-block > div:nth-child(3n) { border-right: 0; }
.title-block > div:nth-last-child(-n+3) { border-bottom: 0; }
.title-block dt { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); }
.title-block dd { margin: 0; font-family: var(--f-mono); font-size: 12px; color: var(--navy); white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--row-form);
  padding: 0 var(--s4);
  border: var(--rule);
  background: var(--navy);
  color: var(--field);
  font-weight: 600;
  font-size: var(--t15);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #22325A; border-color: #22325A; }
.btn.secondary { background: var(--field); color: var(--navy); border-color: var(--navy); }
.btn.secondary:hover { background: var(--margin); }
.btn:disabled { background: var(--margin); color: var(--ink3); border-color: var(--minor); cursor: default; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: var(--rule);
  background: var(--field);
  cursor: pointer;
}
.icon-btn:hover { background: var(--margin); }

/* ── Chips ──────────────────────────────────────────────────────────── */
.chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--minor);
  background: var(--field);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
  line-height: 16px;
}
.chip.ready { border-color: var(--success); color: var(--success); }

/* ── Messages (danger/warn always fill + icon) ──────────────────────── */
.msg {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  padding: var(--s2) var(--s3);
  border: 1px solid currentColor;
  font-size: var(--t14);
}
.msg:empty { display: none; }
.msg::before {
  content: "!";
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  background: var(--tone);
  color: var(--tone-bg);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
}
.msg.danger { --tone: var(--danger); --tone-bg: var(--danger-bg); color: var(--danger); background: var(--danger-bg); }
.msg.danger::before { content: "\00D7"; }
.msg.warn { --tone: var(--warn); --tone-bg: var(--warn-bg); color: var(--warn); background: var(--warn-bg); }
.msg h3 { font-size: var(--t14); font-weight: 700; }
.msg ul { padding-left: var(--s4); }
.msg-body { display: grid; gap: 2px; }

/* ── Cell-grid forms ────────────────────────────────────────────────── */
.cells { border: var(--rule); background: var(--field); }
.cell-row {
  display: grid;
  grid-template-columns: minmax(92px, 38%) 1fr;
  min-height: var(--row-form);
  border-bottom: var(--rule-minor);
}
.cell-row:last-child { border-bottom: 0; }
.cell-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--s3);
  border-right: var(--rule-minor);
  font-weight: 600;
  font-size: var(--t14);
}
.cell-row input, .cell-row select {
  width: 100%;
  min-height: var(--row-form);
  padding: 0 var(--s3);
  border: 0;
  background: var(--field);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t15);
  font-weight: 500;
}
.cell-row input::placeholder { color: var(--ink3); opacity: 0.7; font-weight: 400; }
.cell-row input:focus, .cell-row select:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.cell-row.given .cell-label::after { content: "G"; margin-left: auto; font-family: var(--f-mono); font-size: 10px; font-weight: 600; color: var(--redline); }
.cell-row.given { box-shadow: inset 3px 0 0 var(--redline); }
.cell-row.invalid, .cell-row.invalid input { background: var(--danger-bg); }
.cell-row.invalid .cell-label { color: var(--danger); }
.cell-row.invalid input { color: var(--danger); }

/* ── Section heads ──────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s2);
}
.section-head .caption b { color: var(--navy); font-weight: 600; }

/* ── Tables: sheet index + readouts ─────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; }
thead th {
  padding: var(--s2) var(--s2) 6px;
  border-bottom: var(--rule);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
  white-space: nowrap;
}
tbody td, tbody th { padding: 0 var(--s2); height: var(--row-result); border-bottom: var(--rule-minor); vertical-align: middle; }

.index tbody td { height: 29px; }
.index .band th {
  height: 22px;
  padding-top: 2px;
  background: var(--band);
  border-top: var(--rule-minor);
  border-bottom: 1px solid var(--navy);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink2);
}
.index .sheet-no { font-family: var(--f-mono); font-size: 12px; color: var(--ink2); white-space: nowrap; width: 64px; }
.index .tool { font-weight: 700; white-space: nowrap; }
.index .tool a { text-decoration: underline; text-decoration-color: var(--redline); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.index .io { font-family: var(--f-mono); font-size: 12px; white-space: nowrap; }
.index .io.out::before { content: "\2192\00a0"; color: var(--ink3); }
.index tr.later td { color: var(--ink3); }
.index tr.later .tool { font-weight: 600; }
.index tr.ready:hover td { background: var(--field); }

.readout .sym { width: 44px; }
.readout td.sym { font-weight: 700; font-size: var(--t15); }
.readout td { color: var(--ink2); }
.readout td.sym { color: var(--navy); }
.readout .num { text-align: right; }
.readout th.num { padding-right: 24px; }
.readout td.num { color: var(--navy); font-size: var(--t15); white-space: nowrap; }
.readout tr.given td.num::after { content: "G"; display: inline-block; width: 12px; margin-left: 4px; text-align: right; font-size: 10px; font-weight: 600; color: var(--redline); vertical-align: 1px; }
.readout tr:not(.given) td.num::after { content: ""; display: inline-block; width: 12px; margin-left: 4px; }

.select-inline {
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--ink3);
  background: transparent;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink3);
  cursor: pointer;
}

.table-scroll { overflow-x: auto; }

/* ── Layout: roof drawing sheet (ruler frame, index) ────────────────── */
.frame {
  display: grid;
  grid-template-columns: 16px 1fr 16px;
  grid-template-rows: 16px 1fr 16px;
  min-height: calc(100vh - 24px);
  margin: 12px;
  border: 1px solid var(--navy);
}
.ruler { display: flex; font-family: var(--f-mono); font-size: 9px; color: var(--ink3); }
.ruler span { flex: 1; display: grid; place-items: center; }
.ruler.top, .ruler.bottom { grid-column: 2; }
.ruler.top span + span, .ruler.bottom span + span { border-left: var(--rule-minor); }
.ruler.left, .ruler.right { flex-direction: column; grid-row: 2; }
.ruler.left { grid-column: 1; }
.ruler.right { grid-column: 3; }
.ruler.left span + span, .ruler.right span + span { border-top: var(--rule-minor); }
.ruler.bottom { grid-row: 3; }

.drawing {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  border: var(--rule);
  background: var(--sheet);
  min-width: 0;
}
.roof-body { flex: 1; display: grid; grid-template-columns: minmax(260px, 300px) 1fr; }
.roof-aside {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: var(--s6) var(--s5) var(--s5);
  border-right: var(--rule);
}
.roof-aside h1 { font-size: 52px; line-height: 0.98; text-transform: none; letter-spacing: 0; }
.roof-aside .lede { color: var(--ink2); font-size: var(--t16); }
.roof-aside .btn { align-self: flex-start; margin-top: auto; }
.client-box { padding: var(--s3); border: var(--rule); background: var(--field); display: grid; gap: 4px; }
.client-box strong { font-size: var(--t16); line-height: 1.3; }
.client-box small { font-size: var(--t14); color: var(--ink2); }

.roof-index { display: flex; flex-direction: column; padding: var(--s4) var(--s5) 0; min-width: 0; }
.roof-index .section-head { justify-content: flex-start; margin-bottom: var(--s3); }
.roof-index h2 { font-size: 26px; }
.roof-index .table-scroll { margin-bottom: var(--s5); }
.roof-index .title-block { align-self: flex-end; margin: auto calc(-1 * var(--s5)) 0 0; }

/* ── Layout: tool desk (knowns + results + docs aside) ──────────────── */
.desk-page { display: flex; flex-direction: column; min-height: 100vh; }
.desk { flex: 1; display: grid; grid-template-columns: 1fr 280px; }
.desk.docs-closed { grid-template-columns: 1fr; }
.desk-main { min-width: 0; }
.desk-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s3) var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: var(--rule-minor);
}
.desk-title h1 { font-size: 32px; }
.desk-title p { color: var(--ink2); font-size: var(--t16); }
.desk-title .actions { margin-left: auto; display: flex; gap: var(--s2); }
.desk-grid {
  display: grid;
  grid-template-columns: minmax(250px, 300px) 1fr;
  gap: var(--s4) var(--s5);
  padding: var(--s5);
}
.desk-grid + .desk-grid { border-top: var(--rule-minor); }
.desk-col { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.desk-col .status { font-size: var(--t14); color: var(--ink2); }
.desk-col form { display: grid; gap: var(--s3); }

.docs {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s4);
  border-left: var(--rule);
  background: var(--field);
  font-size: var(--t14);
}
.docs-head { display: flex; align-items: center; gap: var(--s2); }
.docs-head h2 { font-size: var(--t16); font-weight: 700; }
.docs-head .icon-btn { margin-left: auto; }
.docs ol { padding-left: 18px; display: grid; gap: var(--s2); color: var(--ink2); }
.docs p { color: var(--ink2); }
.docs pre { margin: 0; padding: var(--s2) var(--s3); background: var(--margin); font: 13px/1.7 var(--f-mono); }
.docs section { display: grid; gap: 6px; }
kbd { padding: 0 4px; border: var(--rule-minor); background: var(--band); font-size: 12px; }

/* ── Sketch: to-scale SVG figure on a gridded sheet ─────────────────── */
.sketch { margin: 0; min-width: 0; }
.sketch-sheet {
  border: var(--rule);
  background-color: var(--field);
  background-image: linear-gradient(rgba(22, 35, 63, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 35, 63, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}
.sketch svg { display: block; width: 100%; height: auto; }
.sketch text { font-family: var(--f-mono); font-size: 11px; font-variant-numeric: tabular-nums; fill: var(--navy); }
.sketch text.sk-meta { fill: var(--ink3); }
.sketch text.sk-arc-label { fill: var(--redline); }
.sk-radial { fill: none; stroke: var(--ink3); stroke-width: 1; stroke-dasharray: 2 4; }
.sk-tangent { fill: none; stroke: var(--ink3); stroke-width: 1.2; }
.sk-chord { fill: none; stroke: var(--ink3); stroke-width: 1; stroke-dasharray: 4 4; }
.sk-arc { fill: none; stroke: var(--redline); stroke-width: 2.5; }
.sk-arc.draw { transition: stroke-dashoffset 900ms cubic-bezier(0.3, 0.7, 0.2, 1); }
.sk-point { fill: var(--navy); }
.sk-pi { fill: var(--field); stroke: var(--navy); stroke-width: 1.5; }
.sketch-key { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--redline); vertical-align: 3px; }
@media (prefers-reduced-motion: reduce) {
  .sk-arc.draw { transition: none; }
}

/* ── Layout: cover + sheet index (masthead, what/why/how, shelf plan) ── */
.drawing > main { flex: 1; display: flex; flex-direction: column; }
.g { font-family: var(--f-mono); font-size: 11px; font-weight: 600; color: var(--redline); }

.masthead { display: grid; grid-template-columns: 1.25fr 1.5fr repeat(4, minmax(0, 1fr)); margin: 0; background: var(--field); border-bottom: var(--rule); }
.masthead > div { min-width: 0; padding: 7px var(--s3) 8px; border-right: var(--rule-minor); }
.masthead > div:last-child { border-right: 0; }
.masthead dt { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); }
.masthead dd { margin: 2px 0 0; font-family: var(--f-mono); font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.masthead .mh-project dd { font-family: var(--f-title); font-weight: 700; font-size: var(--t19); letter-spacing: 0.03em; text-transform: uppercase; }

.drawing > .cover { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: 1fr auto; }
.cover-pitch { display: flex; flex-direction: column; gap: var(--s5); padding: var(--s7) var(--s6) var(--s6); border-right: var(--rule); }
.cover-pitch h1 { font-size: clamp(52px, 6.6vw, 104px); line-height: 0.9; text-transform: none; letter-spacing: -0.005em; }
.cover-pitch .lede { max-width: 42ch; color: var(--ink2); font-size: var(--t19); line-height: 1.45; }
.cover-pitch .client-box { max-width: 460px; margin-top: auto; }
.cover-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.cover-actions .btn { min-height: 52px; padding: 0 var(--s5); font-size: var(--t16); }
.btn.enter { gap: var(--s3); padding: 0 var(--s6); font-size: var(--t19); }
.btn.enter span { font-family: var(--f-mono); }

.cover-brief { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; padding: var(--s7) var(--s6) var(--s6); }
.wwh { margin: 0; border: var(--rule); background: var(--field); }
.wwh > div { display: grid; grid-template-columns: 112px 1fr; border-bottom: var(--rule-minor); }
.wwh > div:last-child { border-bottom: 0; }
.wwh dt { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border-right: var(--rule-minor); font-family: var(--f-title); font-size: 26px; font-weight: 700; line-height: 1; text-transform: uppercase; }
.wwh-no { font-family: var(--f-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em; color: var(--ink3); }
.wwh dd { margin: 0; padding: var(--s3) var(--s4); font-size: var(--t16); line-height: 1.45; color: var(--ink2); }
.belief { display: grid; gap: var(--s2); margin: 0; padding: var(--s4) var(--s5); border-top: var(--rule); border-bottom: var(--rule); }
.belief .caption b { color: var(--navy); font-weight: 600; }
.belief > p:not(.caption) { font-family: var(--f-title); font-size: 30px; font-weight: 700; line-height: 1.08; color: var(--navy); }
.belief footer { color: var(--ink2); }

.flow { grid-column: 1 / -1; border-top: var(--rule); background: var(--band); }
.flow-head { padding: var(--s2) var(--s6); border-bottom: var(--rule-minor); }
.flow-head b { color: var(--navy); font-weight: 600; }
.flow-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; list-style: none; }
.flow-steps li { position: relative; display: grid; align-content: start; gap: 6px; padding: var(--s4) var(--s6); border-right: var(--rule-minor); font-size: var(--t16); color: var(--ink2); }
.flow-steps li:last-child { border-right: 0; }
.flow-steps li + li::before { content: "\2192"; position: absolute; top: 50%; left: -9px; display: grid; place-items: center; width: 18px; height: 18px; margin-top: -9px; border: 1px solid var(--navy); background: var(--field); font-family: var(--f-mono); font-size: 11px; line-height: 1; color: var(--navy); }
.flow-steps q { font-family: var(--f-mono); font-size: var(--t15); color: var(--navy); }
.flow-steps .link { color: var(--navy); }
.flow-steps .chip { margin-left: var(--s2); vertical-align: 2px; }

.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4) var(--s5); padding: var(--s6) var(--s6) var(--s5); border-bottom: var(--rule); }
.page-title h1 { margin-top: var(--s2); font-size: clamp(44px, 5vw, 72px); }
.page-title p:not(.caption) { max-width: 60ch; margin-top: var(--s3); font-size: var(--t16); color: var(--ink2); }
.page-title .actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

.shelf-plan, .index-sheet { padding: var(--s6) var(--s6) 0; }
.shelf-plan .section-head, .index-sheet .section-head { justify-content: flex-start; margin-bottom: var(--s3); }
.shelf-plan h2, .index-sheet h2 { font-size: 30px; }
.shelf-grid { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); border: var(--rule); background: var(--field); }
.shelf-cell { display: flex; flex-direction: column; gap: var(--s2); min-height: 152px; padding: var(--s4); border-right: var(--rule-minor); text-decoration: none; }
.shelf-cell:last-child { border-right: 0; }
.shelf-cell:not(.open) { background: var(--band); color: var(--ink3); }
.shelf-cell:hover { background: var(--margin); }
.shelf-cell:focus-visible { outline-offset: -3px; }
.shelf-title { display: flex; align-items: center; gap: 10px; }
.shelf-key { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border: 1px solid var(--minor); background: var(--field); font-family: var(--f-mono); font-size: 13px; font-weight: 600; }
.shelf-cell.open .shelf-key { border-color: var(--navy); background: var(--navy); color: var(--field); }
.shelf-name { font-family: var(--f-title); font-size: 24px; font-weight: 700; text-transform: uppercase; line-height: 1; }
.shelf-cell.open .shelf-name { font-size: 32px; }
.shelf-meta { font-size: var(--t14); }
.shelf-feature { font-size: var(--t14); color: var(--ink2); }
.shelf-feature b { color: var(--navy); font-weight: 600; }
.shelf-cell.open .shelf-meta { color: var(--ink2); }
.shelf-foot { display: flex; align-items: center; gap: var(--s2); margin-top: auto; }
.meter { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 260px; height: 12px; border: 1px solid var(--navy); }
.meter i + i { border-left: 1px solid var(--minor); }
.meter i.on { background: var(--navy); }

.index-sheet .index tbody td { height: 36px; }
.index-sheet .index .band th { height: 26px; }
.index .does { color: var(--ink2); }
.index .status { width: 72px; }
.index tr[id], #index { scroll-margin-top: var(--s3); }

.notes { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s6); padding: var(--s6); }
.notes-col { padding-top: var(--s3); border-top: var(--rule); }
.notes ol { display: grid; gap: var(--s2); margin-top: var(--s3); padding: 0; list-style: none; counter-reset: note; }
.notes li { position: relative; padding-left: 28px; counter-increment: note; color: var(--ink2); }
.notes li::before { content: counter(note) "."; position: absolute; left: 0; top: 2px; font-family: var(--f-mono); font-size: 12px; color: var(--navy); }
.notes li b { color: var(--navy); font-weight: 600; }
.legend { display: grid; gap: 6px; margin: var(--s3) 0 0; }
.legend > div { display: grid; grid-template-columns: 104px 1fr; align-items: center; }
.legend dd { margin: 0; font-size: var(--t14); color: var(--ink2); }
.legend-link { font-weight: 700; text-decoration: underline; text-decoration-color: var(--redline); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.drawing > .footer-strip { flex-wrap: wrap; }

/* ── Narrow screens ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .frame { display: block; margin: 0; border: 0; min-height: 100vh; }
  .ruler { display: none; }
  .drawing { min-height: 100vh; border: 0; }
  .roof-body { grid-template-columns: 1fr; }
  .roof-aside { border-right: 0; border-bottom: var(--rule); padding: var(--s5) var(--s4); }
  .roof-aside h1 { font-size: 40px; }
  .roof-aside .btn { margin-top: 0; }
  .roof-index { padding: var(--s4) var(--s4) 0; }
  .roof-index .title-block { align-self: stretch; margin: var(--s5) calc(-1 * var(--s4)) 0; border-left: 0; }
  .desk, .desk.docs-closed { grid-template-columns: 1fr; }
  .docs { border-left: 0; border-top: var(--rule); }
  .desk-grid { grid-template-columns: 1fr; padding: var(--s4); }
  .desk-title { padding: var(--s4); }
  .strip { flex-wrap: wrap; }
  .strip > * { padding: 0 10px; min-height: 44px; }
  .strip > .spacer { display: block; flex: 1; min-width: 0; }
  .brand { font-size: var(--t16); gap: 8px; }
  .strip > .shelves { order: 10; flex-basis: 100%; border-top: var(--rule-minor); border-right: 0; min-height: 40px; }
  .strip > .crumb { order: 10; flex: 1 1 50%; border-top: var(--rule-minor); padding: 4px 10px; }
  .roof-body { align-content: start; }
  .index { min-width: 640px; }
  .title-block { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .title-block dd { white-space: normal; overflow-wrap: anywhere; }

  .masthead { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .masthead > div { border-bottom: var(--rule-minor); }
  .masthead > div:nth-child(2n) { border-right: 0; }
  .masthead > div:nth-last-child(-n+2) { border-bottom: 0; }
  .masthead > div { padding: 6px 10px 7px; }
  .masthead dd { font-size: 12px; }
  .masthead .mh-project dd { font-size: var(--t16); letter-spacing: 0.02em; }
  .drawing > .cover { grid-template-columns: 1fr; grid-template-rows: none; }
  .cover-pitch { gap: var(--s4); padding: var(--s5) var(--s4); border-right: 0; border-bottom: var(--rule); }
  .cover-pitch h1 { font-size: 52px; }
  .cover-pitch .lede { font-size: var(--t16); }
  .cover-pitch .client-box { margin-top: 0; }
  .cover-actions .btn { flex: 1 1 auto; }
  .cover-brief { gap: var(--s4); padding: var(--s5) var(--s4); }
  .wwh > div { grid-template-columns: 84px 1fr; }
  .wwh dt { padding: var(--s3) 10px; font-size: 22px; }
  .wwh dd { padding: var(--s3); font-size: var(--t15); }
  .belief { padding: var(--s4) 0; }
  .belief > p:not(.caption) { font-size: 26px; }
  .flow-head { padding: var(--s2) var(--s4); }
  .flow-steps { grid-template-columns: 1fr; }
  .flow-steps li { padding: var(--s4); border-right: 0; border-bottom: var(--rule-minor); }
  .flow-steps li:last-child { border-bottom: 0; }
  .flow-steps li + li::before { content: "\2193"; top: -9px; left: var(--s4); margin-top: 0; }
  .page-title { padding: var(--s5) var(--s4); }
  .page-title .actions, .page-title .actions .btn { flex: 1 1 auto; }
  .shelf-plan, .index-sheet { padding: var(--s5) var(--s4) 0; }
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-cell { min-height: 0; border-bottom: var(--rule-minor); }
  .shelf-cell.open { grid-column: 1 / -1; }
  .shelf-cell:nth-child(odd) { border-right: 0; }
  .shelf-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .shelf-cell.open .shelf-name { font-size: 28px; }
  .shelf-cell:not(.open) .shelf-name { font-size: 20px; }
  .index.stack { min-width: 0; }
  .notes { grid-template-columns: 1fr; gap: var(--s5); padding: var(--s5) var(--s4); }
}

@media (max-width: 640px) {
  .index.stack, .index.stack tbody { display: block; }
  .index.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .index.stack tr { display: grid; grid-template-columns: 52px auto minmax(0, 1fr) auto; align-items: baseline; gap: 2px var(--s2); padding: var(--s2) 0; border-bottom: var(--rule-minor); }
  .index.stack tr.band { display: block; padding: 0; border-bottom: 0; }
  .index.stack tr.band th { display: block; height: auto; padding: 4px var(--s2); }
  .index.stack td { height: auto !important; padding: 0; border: 0; }
  .index.stack .sheet-no { grid-column: 1; grid-row: 1; width: auto; padding-left: var(--s2); }
  .index.stack .tool { grid-column: 2 / 4; grid-row: 1; }
  .index.stack .status { grid-column: 4; grid-row: 1; width: auto; padding-right: var(--s2); }
  .index.stack .does { grid-column: 2 / 5; grid-row: 2; font-size: var(--t14); }
  .index.stack .io { grid-column: 2; grid-row: 3; }
  .index.stack .io.out { grid-column: 3; }
  .index.stack tr.shelf-later .does { grid-column: 2 / 4; grid-row: 1; font-size: var(--t15); }
}
