/* casecorpus snapshot site. Plain CSS, no external fonts or requests. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-muted: #eef0f3;
  --ink: #1a1a1a;
  --ink-2: #4a4f57;
  --ink-3: #6b717b;
  --line: #dde1e6;
  --line-2: #c9ced5;
  --accent: #1f5fbf;
  --accent-soft: #e7effb;
  /* the three outcomes, everywhere on the site (as in the static figures; distinguishable with colour-blindness) */
  --as: #2a7de1;
  --normal: #b9b9b9;
  --opposite: #f07530;
  /* HPO statuses */
  --shown: #2a7de1;
  --broader: #9cc3f0;
  --notshown: #d5d8dd;
  --common: #f07530;
  --other: #efe3d6;
  --warn-bg: #fff6e8;
  --row-h: 30px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0.2rem 0 0.6rem; font-weight: 600; }
h2 { font-size: 1.12rem; margin: 1.6rem 0 0.6rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.4rem; font-weight: 600; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
main { padding: 16px 24px 40px; max-width: 1680px; margin: 0 auto; }
@media (max-width: 700px) { main { padding: 12px 16px 32px; } }

/* header */
.site-header { background: #14213d; color: #fff; }
.site-header .hbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 10px 24px; max-width: 1680px; margin: 0 auto; }
.site-header .brand { font-weight: 650; letter-spacing: 0.01em; color: #fff; }
.site-header .snap { color: #b9c3d6; font-size: 0.86rem; cursor: help; }
.site-header .abs { color: #dfe6f2; font-size: 0.84rem; display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.site-header .abs .muted2 { color: #9aa7c0; }
.site-header nav { display: flex; gap: 4px; }
.site-header nav a { color: #dfe6f2; padding: 5px 10px; border-radius: 6px; }
.site-header nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.site-header nav a.on { background: rgba(255,255,255,0.16); color: #fff; }
.search { position: relative; margin-left: auto; min-width: 260px; flex: 0 1 380px; }
.search input { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid #3a4a6b; background: #0d1830; color: #fff; font: inherit; }
.search input::placeholder { color: #8d99b3; }
.search .results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18); z-index: 50; max-height: 60vh; overflow: auto; margin-top: 4px; }
.search .results a { display: block; padding: 6px 10px; color: var(--ink); border-bottom: 1px solid var(--bg-muted); }
.search .results a.active, .search .results a:hover { background: var(--accent-soft); text-decoration: none; }
.search .results .kind { display: inline-block; min-width: 62px; color: var(--ink-3); font-size: 0.8rem; }
@media (max-width: 700px) { .site-header .hbar { padding: 10px 16px; } .search { min-width: 0; flex: 1 1 100%; } }

footer.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2); padding: 14px 24px; font-size: 0.86rem; }
footer.site-footer .inner { max-width: 1680px; margin: 0 auto; }
footer.site-footer strong { color: var(--ink); }

/* headline counts */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .v { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--ink-2); font-size: 0.85rem; }
.stat .d { font-size: 0.8rem; color: var(--ink-3); }
.stat .x { font-size: 0.78rem; color: var(--ink-3); line-height: 1.35; margin-top: 4px; }
.stat .d.up { color: #1d7a46; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 6px 0 10px; }
.controls label { color: var(--ink-2); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
select, input[type=text], input[type=number], input[type=search] { font: inherit; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--ink); }
input[type=number] { width: 72px; }
button, .btn { font: inherit; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; }
button:hover, .btn:hover { background: var(--bg-soft); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 12px 0 10px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.panel { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fff; margin: 10px 0; }
.panel.soft { background: var(--bg-soft); }
.notice { background: var(--warn-bg); border: 1px solid #f0d9b5; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 0.9rem; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; background: var(--bg-muted); color: var(--ink-2); white-space: nowrap; }
.pill.bulk { background: #e3f4ec; color: #17603a; }
.pill.tq.poor { background: #fbe3df; color: #9b2c1c; font-weight: 600; }
.pill.tq.fair { background: #fdf1d8; color: #7a5410; }
.notice.poor { background: #fbe3df; border-color: #efb9b0; }
.pill.judged { background: #f3e8f8; color: #6b2d86; }
.st { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 0.8rem; white-space: nowrap; }
.st-shown { background: var(--shown); color: #fff; }
.st-broader { background: var(--broader); color: #0d2f5c; }
.st-notshown { background: var(--notshown); color: #333; }
.st-common { background: var(--common); color: #fff; }
.st-other { background: var(--other); color: #5b4630; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; background: #fff; font-size: 0.85rem; user-select: none; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--ink-2); align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }

/* bars */
.bar { position: relative; height: 14px; background: var(--bg-muted); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > span { position: absolute; top: 0; bottom: 0; }
.stack { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--bg-muted); min-width: 60px; }
.stack > span { height: 100%; }
.stack > span + span { border-left: 1px solid #fff; }

/* overview layout */
.ov-top { margin-bottom: 18px; }
.treemap-wrap { position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.treemap-wrap svg { display: block; width: 100%; }
.treemap-wrap .tile { cursor: pointer; }
.treemap-wrap .tile rect { stroke: #fff; stroke-width: 1; }
.treemap-wrap .tile.sel rect { stroke: #111; stroke-width: 2.5; }
.treemap-wrap .fam rect { fill: none; stroke: #39404a; stroke-width: 1.5; }
.treemap-wrap .famlabel { font-size: 11px; font-weight: 600; fill: #222; pointer-events: none; }
.treemap-wrap .tilelabel { font-size: 10.5px; pointer-events: none; }
.tip { position: fixed; pointer-events: none; background: #111827; color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 0.82rem; z-index: 100;
  max-width: 340px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); line-height: 1.4; display: none; }
.tip b { font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.selected { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--accent-soft); border: 1px solid #c4d6f2; border-radius: 8px; padding: 8px 12px; margin: 10px 0; }

/* data table */
.dt { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.dt-tools { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg-soft); border-radius: 8px 8px 0 0; }
.dt-tools .count { color: var(--ink-2); font-size: 0.88rem; margin-right: auto; }
.dt-tools input[type=search] { min-width: 220px; }
.dt-cols { position: relative; }
.dt-cols > summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; }
.dt-cols > summary::-webkit-details-marker { display: none; }
.dt-cols .menu { position: absolute; right: 0; top: 110%; z-index: 30; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14); max-height: 60vh; overflow: auto; min-width: 220px; }
.dt-cols .menu label { display: flex; gap: 6px; align-items: center; padding: 2px 0; font-size: 0.88rem; white-space: nowrap; }
.dt-scroll { overflow: auto; position: relative; }
.dt-head { position: sticky; top: 0; z-index: 5; background: #fff; }
.dt-grid { display: grid; }
.dt-hcell { padding: 6px 8px; font-weight: 600; font-size: 0.84rem; line-height: 1.2; color: var(--ink-2); border-bottom: 1px solid var(--line); cursor: pointer;
  user-select: none; white-space: normal; overflow-wrap: anywhere; background: #fff; display: flex; align-items: flex-end; }
.dt-hcell:hover { color: var(--ink); }
.dt-hcell .arr { color: var(--accent); margin-left: 3px; }
.dt-fcell { padding: 3px 4px; border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.dt-fcell input { width: 100%; padding: 3px 6px; font-size: 0.82rem; border-radius: 4px; }
.dt-body { position: relative; }
.dt-rows { position: absolute; left: 0; right: 0; top: 0; }
.dt-row { height: var(--row-h); border-bottom: 1px solid var(--bg-muted); cursor: default; }
.dt-row.click { cursor: pointer; }
.dt-row:hover { background: #f4f8fe; }
.dt-row.grey { color: var(--ink-3); background: #fafafa; }
.dt-row.on { background: var(--accent-soft); }
.dt-cell { padding: 0 8px; line-height: var(--row-h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; }
.dt-cell.n { text-align: right; font-variant-numeric: tabular-nums; }
.dt-cell .bar, .dt-cell .stack { margin-top: 8px; }
.dt-empty { padding: 20px; color: var(--ink-3); }

/* detail lists (term, marker, patient) */
.items { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.items th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 6px 8px; position: sticky; top: 0; background: #fff; }
.items td { border-bottom: 1px solid var(--bg-muted); padding: 6px 8px; vertical-align: top; }
.items tr.absent td { background: #fbf7f2; }
.items tr.grey td { color: var(--ink-3); }
.quote { font-style: italic; color: #333; max-width: 640px; }
.quote::before { content: "“"; } .quote::after { content: "”"; }
.anchor { color: var(--ink-3); font-size: 0.8rem; }
.scrollbox { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* patient page */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 4px 14px; font-size: 0.92rem; }
.kv .k { color: var(--ink-3); }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } .kv .k { margin-top: 6px; } }
.others { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.others a { padding: 2px 10px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.85rem; }
.others a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.narr p { margin: 0.3rem 0 0.8rem; max-width: 900px; }
.dirH { color: #1757a6; font-weight: 600; } .dirL { color: #a84d14; font-weight: 600; } .dirN { color: var(--ink-3); }
.arrows { font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.hpo-index .row { display: grid; grid-template-columns: minmax(220px, 2.2fr) minmax(160px, 3fr) 90px 80px 90px; gap: 10px; align-items: center; padding: 5px 4px;
  border-bottom: 1px solid var(--bg-muted); font-size: 0.9rem; }
.hpo-index .row.head { font-weight: 600; color: var(--ink-2); font-size: 0.84rem; }
.hpo-index .row:not(.head):hover { background: #f4f8fe; }
@media (max-width: 760px) { .hpo-index .row { grid-template-columns: 1fr 1fr; } .hpo-index .row > :nth-child(n+3) { display: none; } }
.loading { color: var(--ink-3); padding: 20px 0; }

/* cases page */
.caselist-index { columns: 3 320px; column-gap: 28px; }
.caselist-index a { display: flex; justify-content: space-between; gap: 10px; padding: 4px 2px; border-bottom: 1px solid var(--bg-muted); break-inside: avoid; color: var(--ink); }
.caselist-index a:hover { background: #f4f8fe; text-decoration: none; }
.caselist-index a.unl span:first-child { color: var(--ink-2); font-style: italic; }
.case-paper { margin: 18px 0 6px; }
.case-paper h3 { font-size: 0.95rem; font-weight: 500; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 0 0 4px; }
.case { padding: 10px 2px 12px 12px; border-left: 3px solid var(--line); margin: 8px 0; max-width: 1100px; }
.case:hover { border-left-color: var(--accent); }
.case-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.case-name { font-weight: 600; font-size: 1.02rem; }
.case-facts { color: var(--ink-2); font-size: 0.9rem; }
.case-sum { margin: 6px 0 4px; font-size: 0.98rem; line-height: 1.55; }

/* patient page */
.paperhead { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 6px 0 8px; }
.paperhead .ptitle { font-weight: 600; font-size: 1.05rem; }
details.inline { display: inline; }
details.inline > summary { display: inline; cursor: pointer; color: var(--accent); }
details.inline[open] { display: block; color: var(--ink-2); margin-top: 4px; }
.pt-facts { color: var(--ink-2); margin: -4px 0 8px; }
.pt-summary { font-size: 1.02rem; line-height: 1.55; max-width: 1150px; margin: 6px 0 14px; padding: 10px 14px; background: var(--accent-soft); border-radius: 8px; }
.pt-summary .lbl { display: block; font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.pt-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .pt-split { grid-template-columns: minmax(0, 1fr); } }
.pt-text { position: sticky; top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex-direction: column; max-height: calc(100vh - 16px); }
@media (max-width: 1100px) { .pt-text { position: static; max-height: 75vh; } }
.pt-tabs { display: flex; gap: 2px; align-items: center; border-bottom: 1px solid var(--line); padding: 0 8px; background: var(--bg-soft); border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.pt-tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pt-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.pt-tabs a:hover { text-decoration: none; color: var(--ink); }
.pt-status { margin-left: auto; padding: 4px 6px; }
.pt-body { overflow: auto; padding: 8px 18px 24px; font-size: 0.97rem; line-height: 1.6; }
.pt-body .th { font-weight: 650; margin: 1.1em 0 0.3em; color: var(--ink); }
.pt-body .th2 { font-size: 1.05rem; }
.pt-body .th3, .pt-body .th4 { font-size: 0.97rem; color: var(--ink-2); }
.pt-body .tp { margin: 0 0 0.75em; }
.pt-body .about { box-shadow: -10px 0 0 -7px #7aa7e0; }
.pt-body .tfig { color: var(--ink-2); font-size: 0.92rem; }
.pt-body .hit { outline: 2px solid #f0a020; outline-offset: 2px; border-radius: 2px; }
.ttab { margin: 0.6em 0 1em; }
.ttab figcaption { font-size: 0.9rem; margin-bottom: 4px; }
.ttab-scroll { overflow-x: auto; }
.ttab table { border-collapse: collapse; font-size: 0.85rem; line-height: 1.35; }
.ttab td { border: 1px solid var(--line); padding: 3px 6px; vertical-align: top; }
.ttab tr.first td { background: var(--bg-soft); font-weight: 600; }
.ttab tr.mark td, .ttab td.mark { background: #edf3fc; }
.ttab tr.first.mark td { background: #e1ebf9; }
::highlight(quoted) { background-color: #fff1b8; }
::highlight(current) { background-color: #ffb648; color: #111; }
table.it td { font-size: 0.86rem; }
table.it .iq { font-style: italic; color: var(--ink-3); font-size: 0.8rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.it .iq::before { content: "“"; } table.it .iq::after { content: "”"; }
table.it .iq.none::before, table.it .iq.none::after { content: ""; }
.itrow { cursor: pointer; }
.itrow:hover td { background: #f4f8fe; }
.itrow.on td { background: #fff1d6; }
.pt-items h3 { margin-top: 1.1rem; }
.gene { white-space: nowrap; }

/* HPO comparison */
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.cmpbox { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; font-size: 0.88rem; color: var(--ink-2); }
.cmpbox .t { font-weight: 600; color: var(--ink); font-size: 0.86rem; }
.cmpbox .n { font-size: 1.5rem; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.cmpbox .n .of { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.legend-st { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; align-items: center; margin: 8px 0; }
.legend-st .chip { justify-self: start; }
.hpo-index.wide .row { grid-template-columns: minmax(220px, 2.2fr) 70px 130px 140px minmax(220px, 2.6fr); }
.barcell { display: grid; grid-template-columns: 1fr 80px; gap: 8px; align-items: center; }
.barcell .num { text-align: right; }
.iem-index .row { grid-template-columns: minmax(220px, 2fr) 90px 80px 80px 90px 80px 80px minmax(220px, 2.2fr); }
