/* Open Source Cancer Cure. Palette taken from the H and E stain used on pathology slides:
   hematoxylin violet and eosin pink on slide white. The two chart colors pass the
   color-blind separation and contrast checks against the page surface. */
:root {
  --slide: #fcfbfd;
  --ink: #2b1d52;
  --muted: #655e7a;
  --rule: #e3deec;
  --wash: #f3eff8;
  --hema: #3f2c78;
  --accent: #a8306a;
  --alive: #5340a0;
  --lost: #d95f93;
  --w: 68rem;
  --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--slide); color: var(--ink); font: 400 1.0625rem/1.55 var(--font); font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--slide); padding: 0.5rem 0.75rem; z-index: 2; }

header.site { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; align-items: baseline; justify-content: space-between; padding-top: 1.1rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule); }
.mark { font-weight: 800; letter-spacing: -0.01em; text-decoration: none; font-size: 1.05rem; }
nav.site { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; font-size: 0.95rem; }
nav.site a { text-decoration: none; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
nav.site a:hover { border-bottom-color: var(--accent); }
nav.site a[aria-current='page'] { border-bottom-color: var(--hema); font-weight: 600; }

main.wrap { padding-top: 2.75rem; padding-bottom: 4rem; min-height: 60vh; }
h1 { font-size: clamp(2.1rem, 7vw, 3.9rem); line-height: 1.03; letter-spacing: -0.025em; font-weight: 800; margin: 0 0 1.1rem; max-width: 17ch; text-wrap: balance; }
h2 { font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.015em; font-weight: 800; margin: 3.25rem 0 0.75rem; }
h3 { font-size: 1.1rem; line-height: 1.3; margin: 2rem 0 0.4rem; font-weight: 700; }
p, ul, ol { max-width: 66ch; margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }
.lede { font-size: 1.2rem; line-height: 1.45; max-width: 46ch; }
.small { font-size: 0.875rem; color: var(--muted); }
.more { margin-top: 1rem; font-weight: 600; }
code, pre { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.9em; }
pre { background: var(--wash); padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; max-width: 66ch; white-space: pre-wrap; word-break: break-word; }

.btns { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.btn { display: inline-block; padding: 0.7rem 1.15rem; border: 2px solid var(--hema); border-radius: 999px; background: transparent; color: var(--ink); text-decoration: none; font: 700 1rem/1.2 var(--font); cursor: pointer; }
.btn.solid { background: var(--hema); color: #fff; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Hero: the registry's hardest number, drawn as 100 people. */
.hero { display: grid; gap: 2rem; align-items: center; }
.herofig { margin: 0; max-width: 22rem; }
.herofig figcaption { margin-top: 0.9rem; }
.herofig .big { display: block; font-size: 1.35rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
@media (min-width: 52rem) { .hero { grid-template-columns: 1.25fr 1fr; gap: 4rem; } .herofig { justify-self: end; width: 100%; } }
.dots { display: block; width: 100%; height: auto; }
.dots .on { fill: var(--alive); }
.dots .off { fill: var(--lost); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; font-size: 0.875rem; color: var(--muted); margin: 0.75rem 0 0; padding: 0; list-style: none; max-width: none; }
.legend li { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.legend i { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.legend .a { background: var(--alive); }
.legend .l { background: var(--lost); }

/* Registry: one block per cancer, one meter per stage. */
.reg { border-top: 2px solid var(--ink); margin-top: 1.25rem; }
.cancer { padding: 1.1rem 0 1.2rem; border-bottom: 1px solid var(--rule); }
.cancer .top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.1rem 1rem; margin-bottom: 0.6rem; }
.cancer .name { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; }
.cancer .deaths { color: var(--muted); font-size: 0.95rem; }
.stage { display: grid; grid-template-columns: 5.6rem 1fr 3.4rem; align-items: center; gap: 0.6rem; padding: 0.22rem 0; }
.stage .label { font-size: 0.95rem; }
.stage .val { font-weight: 800; text-align: right; }
.stage .tag { grid-column: 2 / 4; justify-self: start; margin-bottom: 0.25rem; }
@media (min-width: 44rem) { .stage { grid-template-columns: 7rem minmax(8rem, 26rem) 3.6rem auto; } .stage .tag { grid-column: auto; margin: 0; } }
.meter { display: flex; gap: 2px; height: 0.8rem; }
.meter i { display: block; height: 100%; min-width: 2px; }
.meter .a { background: var(--alive); border-radius: 0 4px 4px 0; }
.meter .l { background: var(--lost); border-radius: 0 4px 4px 0; flex: 1; }
.tag { display: inline-block; font-size: 0.8rem; font-weight: 700; line-height: 1.2; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1.5px solid var(--hema); white-space: nowrap; }
.tag.unsolved { background: var(--hema); color: #fff; }
.tag.partly { background: var(--wash); }
.tag.largely { background: transparent; }
.tag.unknown { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.note { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }

.seg { display: inline-flex; flex-wrap: wrap; border: 2px solid var(--hema); border-radius: 999px; overflow: hidden; margin: 0.5rem 0 0; }
.seg button { font: 700 0.95rem/1.2 var(--font); padding: 0.55rem 1rem; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--hema); color: #fff; }

/* Cancer record */
.stagegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1.25rem; margin: 1.5rem 0 0.5rem; max-width: 46rem; }
@media (min-width: 44rem) { .stagegrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stagegrid figure { margin: 0; }
.stagegrid figcaption { margin-top: 0.6rem; font-size: 0.95rem; }
.stagegrid .n { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem; margin: 1.25rem 0; padding: 0; list-style: none; max-width: none; }
.facts li { margin: 0; }
.facts b { display: block; font-size: 1.7rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
.facts span { color: var(--muted); font-size: 0.9rem; }
.reasons { max-width: 40rem; margin: 1rem 0; }
.reason { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; gap: 0.6rem; align-items: center; padding: 0.2rem 0; }
.reason .rbar { height: 0.8rem; background: var(--hema); border-radius: 0 4px 4px 0; min-width: 2px; }
.reason .val { text-align: right; font-weight: 700; }
.trials { list-style: none; padding: 0; margin: 0.75rem 0 0; max-width: 52rem; border-top: 1px solid var(--rule); }
.trials li { padding: 0.85rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.trials .t { font-weight: 700; }
.trials q { display: block; margin: 0.3rem 0; padding-left: 0.8rem; border-left: 3px solid var(--lost); quotes: none; }
.trials .meta { color: var(--muted); font-size: 0.875rem; }
.feed { list-style: none; padding: 0; margin: 0.75rem 0 0; max-width: 40rem; border-top: 1px solid var(--rule); }
.feed li { display: grid; gap: 0.15rem; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.feed .meta { color: var(--muted); font-size: 0.875rem; }
.empty { background: var(--wash); border-radius: 8px; padding: 1.1rem 1.25rem; max-width: 46rem; }
.empty p:last-child { margin-bottom: 0; }

table { border-collapse: collapse; width: 100%; max-width: 52rem; margin: 0.75rem 0 1rem; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { border-bottom: 2px solid var(--ink); font-size: 0.875rem; }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }
.ladder td:last-child { white-space: nowrap; font-weight: 700; }

.form { display: grid; gap: 0.4rem; max-width: 24rem; margin: 1rem 0; }
.form label { font-weight: 700; font-size: 0.95rem; margin-top: 0.5rem; }
.form input { font: 400 1rem/1.3 var(--font); padding: 0.65rem 0.75rem; border: 2px solid var(--hema); border-radius: 8px; background: #fff; color: var(--ink); }
.form .btn { margin-top: 0.9rem; justify-self: start; }
.result { background: var(--wash); border-radius: 8px; padding: 1rem 1.25rem; max-width: 46rem; margin: 1rem 0; }
.result code { word-break: break-all; }
.error { color: var(--accent); font-weight: 700; }

footer.site { border-top: 1px solid var(--rule); padding-top: 1.75rem; padding-bottom: 3rem; }
footer.site p { max-width: 72ch; }
@media (prefers-reduced-motion: no-preference) { .btn, nav.site a { transition: background-color 0.12s, border-color 0.12s, color 0.12s; } }
@media (max-width: 30rem) { table { font-size: 0.875rem; } th, td { padding: 0.5rem 0.4rem; } }
