/* aoroot: graphite and chalk on cool drawing paper with one cobalt accent.
   Same look as parameterz/OMAM-Aortic-Root (after intro2echo.com); charts sketched with
   rough.js, annotations in a hand face. Hand-written, no framework; fonts served from fonts/. */
/* Self-hosted fonts (SIL Open Font License 1.1; licenses in fonts/). Latin subset, only the
   weights the site uses. Files from the Fontsource packages (v5.3.0) of the Google Fonts releases. */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/newsreader-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/newsreader-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/caveat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/caveat-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #e2e4e3;              /* drawing paper */
  --surface: #f1f2f0;         /* chalk panel */
  --ink: #1f262b;             /* graphite */
  --muted: #4a555c;
  --rule: #a9aeac;
  --accent: #2b5d8a;          /* cobalt */
  --accent-soft: #d3dfe9;
  --band: #a9c1d8;            /* reference band (hatched) */
  --ok: #3f7a45; --ok-soft: #dbe7da;
  --warn: #94600f; --warn-soft: #efe4cc;
  --crit: #b23a2e; --crit-soft: #f0d9d5;
  --grain: 0.07;
  --f-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --f-hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #1a1f23; --surface: #22282d; --ink: #e4e7e3; --muted: #a3adb3; --rule: #4a5760;
  --accent: #86b4e0; --accent-soft: #263646; --band: #3d5770;
  --ok: #8cc47a; --ok-soft: #24331f; --warn: #e3b05a; --warn-soft: #352b17; --crit: #e8705f; --crit-soft: #3d2320;
  color-scheme: dark; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0 auto; max-width: 1040px; background: var(--bg); color: var(--ink); font-family: var(--f-body);
  font-size: 15px; line-height: 1.55; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
/* paper tooth */
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--grain); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.4 -0.2'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>"); }
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; filter: invert(1); } }
body > * { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 500; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.08; }
h1 em { font-style: italic; color: var(--accent); }
h2 { font-size: 24px; margin: 36px 0 12px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hand, .handnote { font-family: var(--f-hand); font-weight: 600; }
.handnote { font-size: 19px; color: var(--accent); line-height: 1.15; }
.muted { color: var(--muted); }
small, .small { font-size: 13px; }

header { display: flex; flex-direction: column; gap: 12px; padding: 24px 0 24px; }
.sub, .lede { max-width: 66ch; color: var(--muted); font-size: 16px; margin: 0; }

/* Form panels */
fieldset { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 24px; }
legend { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 6px; }
.row { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input[type=number], select { font-family: var(--f-mono); font-size: 15px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; }
select { font-family: var(--f-body); font-size: 13.5px; }
input[type=number] { width: 8rem; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg label { flex-direction: row; font-size: 14px; font-weight: 400; color: var(--ink); padding: 8px 14px; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--surface); font-weight: 500; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.meas { display: grid; grid-template-columns: 12rem 9rem 1fr; gap: 10px 16px; align-items: center; }
.meas .name { font-weight: 500; }
.meas select { justify-self: start; }
.msg { grid-column: 2 / -1; font-size: 13px; margin-top: -4px; }
.msg:empty { display: none; }
.msg.warn { color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 6px 10px; }
.msg button { font: inherit; font-size: 12.5px; margin-left: 8px; padding: 2px 8px; border: 1px solid var(--warn); border-radius: 4px; background: transparent; color: var(--warn); cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 12px; }
button.primary, .btn { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--surface); cursor: pointer; }
button.secondary, .btn.ghost { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
button.primary:hover, button.secondary:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Results */
.summary { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 12px 18px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.summary b { font-weight: 600; }
.summary .seg { margin-left: auto; }
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
th.num { text-align: right; }
td.z { font-weight: 500; }
td.z.hi { color: var(--crit); }
tr.ref-start td { border-top: 2px solid var(--rule); }
tbody tr:first-child td { border-top: 0; }
tr.na td { color: var(--muted); font-style: italic; }
.ref { font-weight: 600; white-space: nowrap; }
.model { color: var(--muted); font-size: 12.5px; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  border-radius: 99px; padding: 1px 8px; margin: 4px 4px 0 0; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.flag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.flag.draft { background: transparent; color: var(--muted); border: 1px dashed var(--rule); }
.flag.draft::before { background: transparent; border: 1px solid currentColor; box-sizing: border-box; }
details.notes { font-size: 13px; margin-top: 4px; }
details.notes summary { cursor: pointer; color: var(--accent); font-family: var(--f-hand); font-size: 17px; font-weight: 600; list-style: none; }
details.notes summary::before { content: "→ "; }
details.notes[open] summary::before { content: "↓ "; }
details.notes ul { margin: 6px 0 0; padding: 10px 12px 10px 28px; max-width: 40rem; background: var(--bg); border-radius: 6px; }
details.notes li { margin: 2px 0; }
details.notes li.important { border-left: 3px solid var(--warn); padding-left: 8px; margin-left: -11px; list-style: none; }
td select { font-size: 12.5px; padding: 3px 6px; margin-top: 6px; }
td label { font-weight: 400; color: var(--muted); }
.report { margin-top: 32px; }
.report textarea { width: 100%; min-height: 6rem; font: 13.5px/1.5 var(--f-mono); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; }
.errors { background: var(--warn-soft); color: var(--warn); padding: 8px 14px; border-radius: 6px; font-size: 13.5px; }
footer { margin-top: 48px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 16px; max-width: 80ch;
  display: flex; flex-direction: column; gap: 6px; }
footer strong { color: var(--ink); font-weight: 600; }

/* Cards */
.card { margin-top: 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px 12px; }
.card-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.card h3 { font-size: 18px; }
.card .handnote { font-size: 18px; }
svg.pct { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
@media (max-width: 600px) { .card { padding: 12px 10px 10px; } .card .handnote { font-size: 16px; } }
svg text.lbl { font-family: var(--f-body); font-size: 13px; fill: var(--ink); }
svg text.lbl.sub, svg tspan.sub { font-size: 11px; fill: var(--muted); }
svg text.lbl.ref { font-weight: 600; }
/* Percent-of-predicted rows: component chips, group separators, filter dimming */
svg text.chiptxt { font-family: var(--f-body); font-size: 11px; fill: var(--muted); }
svg .chip rect { fill: var(--surface); stroke: var(--rule); stroke-width: 1; }
svg .chip.age rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: .8; }
svg .chip.age text, svg .chip.band text { fill: var(--accent); }
svg .chip.band rect { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 2; }
svg .chip.warn rect { fill: var(--warn-soft); stroke: var(--warn); stroke-dasharray: none; }
svg .chip.warn text { fill: var(--warn); }
svg .chiptag text { font-style: italic; }
.g-sep { color: var(--rule); }
svg .prow .hit { fill: transparent; }
svg .prow.dim { opacity: .16; }
svg .prow { transition: opacity .15s; }
.chipkey { display: inline-block; font-size: 11px; line-height: 14px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--rule); background: var(--surface); }
.chipkey.age { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chipkey.band { background: none; border: 1px dashed var(--accent); color: var(--accent); }
.chipkey.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.pfilter { display: flex; flex-wrap: wrap; gap: 6px 6px; align-items: center; font-size: 12.5px; color: var(--muted); padding-top: 8px; }
button.pf { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 99px; padding: 2px 10px; cursor: pointer; }
button.pf[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pfilter .sep { width: 8px; }
.pfilter .count { margin-left: auto; }
svg text.tick { font-size: 16px; }
svg text.tick.hundred { fill: var(--accent); font-weight: 700; }
svg text.note { font-size: 15px; fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--muted); padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--rule); align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 26px; height: 16px; overflow: visible; display: block; }

/* Curve card: one colour per reference (registry order) */
:root { --c0: #2b5d8a; --c1: #b4532a; --c2: #5d7a2c; --c3: #7a3f73; --c4: #a07a12; --c5: #2f7f7a; }
@media (prefers-color-scheme: dark) { :root { --c0: #86b4e0; --c1: #e8936a; --c2: #a5c77a; --c3: #c995c2; --c4: #e3c25a; --c5: #7fcfc8; } }
.g-c0, .key.c0 { color: var(--c0); } .g-c1, .key.c1 { color: var(--c1); } .g-c2, .key.c2 { color: var(--c2); }
.g-c3, .key.c3 { color: var(--c3); } .g-c4, .key.c4 { color: var(--c4); } .g-c5, .key.c5 { color: var(--c5); }
g.extrap { opacity: .35; }
svg.curve { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
svg line.grid { stroke: var(--rule); stroke-width: 1; opacity: .35; }
svg line.guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; opacity: .6; }
svg text.axis { font-family: var(--f-body); font-size: 12.5px; fill: var(--muted); }
svg text.pt { font-family: var(--f-hand); font-size: 18px; font-weight: 700; fill: var(--accent); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
svg path.uln { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-dasharray: 7 5; stroke-linecap: round; }
.small-seg label { font-size: 13px; padding: 4px 10px; }
.legend.keys { gap: 8px 10px; }
button.key { font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px;
  border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); cursor: pointer; }
button.key::before { content: ""; width: 18px; border-top: 2.5px solid currentColor; }
button.key[aria-pressed="false"] { color: var(--muted); opacity: .55; text-decoration: line-through; }

/* Threshold card */
.g-risk { color: var(--warn); } .g-surg { color: var(--crit); }
svg path.thr { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
svg path.thr.risk { stroke-dasharray: 8 5; }
svg text.thrlbl { font-family: var(--f-hand); font-size: 16px; font-weight: 700; }
svg text.thrlbl.risk, svg text.note-risk { fill: var(--warn); }
svg text.thrlbl.surg { fill: var(--crit); }
.g-norm { color: var(--accent); } svg path.thr.norm { stroke-dasharray: 2 5; stroke-width: 2.4; }
svg text.thrlbl.norm { fill: var(--accent); } svg .faded { opacity: .45; }
.thresholds tr.normal.above td { background: var(--accent-soft, rgba(43, 93, 138, .08)); }
.kind.normal { background: var(--accent-soft, rgba(43, 93, 138, .1)); color: var(--accent); }
button.tkey { font: inherit; color: inherit; background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin: -2px -6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button.tkey:hover { border-color: var(--rule); }
button.tkey[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.sw.norm { border-color: var(--accent); border-top-style: dotted; }
.thresholds tr.reached td { background: var(--crit-soft); }
.kind { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border-radius: 4px; padding: 0 6px; margin-right: 4px; }
.kind.risk { background: var(--warn-soft); color: var(--warn); } .kind.surgery { background: var(--crit-soft); color: var(--crit); }
svg text.thrlbl.small { font-size: 13.5px; }
@media (max-width: 600px) {
  .thresholds .model { display: none; }
  .thresholds th:nth-child(3), .thresholds td:nth-child(3) { display: none; }
  .thresholds th, .thresholds td { padding: 8px; }
  .thresholds th:nth-child(2) { white-space: normal; }
}
label.inline-report { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin-left: 8px; font-weight: 500; color: var(--accent); white-space: nowrap; }
.sw { display: inline-block; width: 22px; border-top: 2.5px solid; }
.sw.risk { border-color: var(--warn); border-top-style: dashed; } .sw.surg { border-color: var(--crit); }

/* References / verification page */
.refsec { margin-top: 40px; }
.refsec > h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.cite { font-size: 13.5px; color: var(--muted); max-width: 90ch; margin: 0 0 12px; }
.cite i { font-family: var(--f-display); font-size: 14.5px; }
h3.sub3 { font-size: 18px; margin: 22px 0 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13.5px; }
dl.facts dt { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
dl.facts dd { margin: 0; }
.eq { font-family: var(--f-mono); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.eq.sp { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.eq .sex { font-family: var(--f-body); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; }
table.models td.chk { width: 28px; }
table.models tr.checked td { background: color-mix(in srgb, var(--ok-soft) 70%, transparent); }
table.models input[type=checkbox] { width: 18px; height: 18px; }
.ok { color: var(--ok); font-weight: 600; } .bad { color: var(--crit); font-weight: 600; }
.flag.ok { background: var(--ok-soft); color: var(--ok); }
table.tests td:first-child { width: 28px; font-size: 18px; }
.kind:not(.risk):not(.surgery):not(.normal) { background: var(--bg); color: var(--muted); }
ul.notelist { font-size: 13.5px; max-width: 90ch; padding-left: 20px; }
ul.notelist li { margin: 4px 0; }
ul.notelist li.important::marker { color: var(--warn); }
pre.src { font: 12px/1.45 var(--f-mono); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: 12px; max-height: 32rem; overflow: auto; white-space: pre; }
details.source summary::before { content: "→ "; }
.review { margin-top: 16px; }
.review textarea { width: 100%; font: 14px/1.5 var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; margin-top: 6px; }
button.small-btn { font-size: 13px; padding: 4px 10px; }
@media (max-width: 600px) { dl.facts { grid-template-columns: 1fr; } table.models td:nth-child(4), table.models th:nth-child(4) { display: none; } }

/* Sketched charts (rough.js strokes use currentColor) */
.g-rule { color: var(--muted); }
.g-band { color: var(--band); }
.g-dot { color: var(--accent); }
.g-dot.out { color: var(--crit); }
.g-ghost { color: var(--warn); }
svg text { font-family: var(--f-hand); font-size: 15px; fill: var(--muted); }

@media (max-width: 720px) {
  .meas { grid-template-columns: 1fr 8rem; }
  .meas select { grid-column: 1 / -1; }
  .msg { grid-column: 1 / -1; }
}
.legend.chips-key { border-top: none; padding-top: 2px; margin-top: 0; }
