/* ============================================================
   CAPA — shared design system
   Journal-grade / modern research lab. Light, editorial, hairline grid.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,300;1,6..72,400;1,6..72,500&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Hanken+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* type */
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* paper + ink — warm off-white, cool near-black */
  --paper:   oklch(0.989 0.004 85);
  --paper-2: oklch(0.971 0.005 85);
  --paper-3: oklch(0.955 0.006 85);
  --ink:     oklch(0.205 0.014 260);
  --ink-2:   oklch(0.42 0.016 260);
  --ink-3:   oklch(0.58 0.014 260);
  --line:    oklch(0.205 0.014 260 / 0.14);
  --line-2:  oklch(0.205 0.014 260 / 0.07);

  /* accent — oxblood red (tweakable) */
  --accent:    oklch(0.46 0.13 25);
  --accent-2:  oklch(0.46 0.13 25 / 0.10);
  --accent-ink: oklch(0.39 0.14 25);

  /* categorical competing-risk colors (shared L/C, varied hue) */
  --risk-gvhd:    oklch(0.60 0.15 28);   /* warm red */
  --risk-relapse: oklch(0.58 0.13 255);  /* blue */
  --risk-trm:     oklch(0.58 0.10 155);  /* green */

  /* layout */
  --maxw: 1240px;
  --gutter: clamp(20px, 4vw, 64px);
  --radius: 3px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; text-decoration: none; }

/* ---------- type helpers ---------- */
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; margin: 0; line-height: 1.04; }
h1 { font-size: clamp(2.6rem, 6vw, 5rem); }
h2 { font-size: clamp(2rem, 4vw, 3.1rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.65rem); line-height: 1.12; }

p { margin: 0; text-wrap: pretty; }

.display-italic { font-style: italic; }

/* ---------- layout primitives ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 9vw, 130px); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* shared section header: mono eyebrow over serif title */
.sec-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: clamp(36px, 5vw, 64px); }
.sec-head .num { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); padding-top: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-size: 14.5px; font-weight: 600;
  padding: 12px 20px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: all .18s ease;
  letter-spacing: -0.005em; white-space: nowrap;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-2); }
.btn .arr { transition: transform .18s ease; }
.btn:hover .arr { transform: translateX(3px); }

/* link with mono underline-on-hover */
.tlink { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14.5px;
  border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color .18s ease; }
.tlink:hover { border-color: var(--ink); }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: oklch(0.989 0.004 85 / 0.82);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px;
  max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 26px; height: 26px; border: 1.5px solid var(--ink); border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-size: 15px; font-style: italic; }
.brand-txt { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.06em; }
.brand-txt b { font-weight: 600; }
.brand-txt span { color: var(--ink-3); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em; color: var(--ink-2);
  padding: 7px 12px; border-radius: var(--radius); transition: color .15s, background .15s; }
.nav-links a:hover { color: var(--ink); background: var(--paper-3); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { content: ''; display: block; height: 1.5px; background: var(--accent);
  margin-top: 3px; }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-cta .gh { font-family: var(--mono); font-size: 12px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.nav-cta .gh:hover { color: var(--ink); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-cta .gh { display: none; }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--paper-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 48px;
  padding-block: 64px 40px; }
.footer h4 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 16px; font-weight: 500; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-col a { font-size: 14.5px; color: var(--ink-2); transition: color .15s; }
.footer-col a:hover { color: var(--ink); }
.footer-about { max-width: 360px; }
.footer-about p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-top: 12px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding-block: 22px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- misc components ---------- */
.tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px;
  letter-spacing: 0.06em; color: var(--ink-2); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.kbd { font-family: var(--mono); font-size: 12px; background: var(--paper-3); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 7px; color: var(--ink-2); }

/* journal table */
.jtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.jtable thead th { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; text-align: right; padding: 12px 16px; border-bottom: 1px solid var(--ink); }
.jtable thead th:first-child { text-align: left; }
.jtable tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 14px; }
.jtable tbody td:first-child { text-align: left; font-family: var(--sans); font-size: 15px; }
.jtable tbody tr:hover { background: var(--paper-2); }
.jtable .best { color: var(--accent-ink); font-weight: 600; }
.jtable caption { caption-side: bottom; text-align: left; font-size: 13px; color: var(--ink-3); padding-top: 14px; font-style: italic; font-family: var(--serif); }

/* risk colors as classes (so SVG strokes resolve in computed style + survive capture) */
.s-gvhd { stroke: var(--risk-gvhd); }
.s-relapse { stroke: var(--risk-relapse); }
.s-trm { stroke: var(--risk-trm); }
.s-axis { stroke: var(--ink); }
.s-line { stroke: var(--line); }
.s-line2 { stroke: var(--line-2); }
.t-mut { fill: var(--ink-3); }
.t-ink { fill: var(--ink); }
.f-box { fill: var(--paper); stroke: var(--line); stroke-width: 1; }
.f-out { fill: var(--accent-2); stroke: color-mix(in oklch, var(--accent) 30%, transparent); stroke-width: 1; }
.s-arrow { stroke: var(--ink-3); }
.f-arrowhead { fill: var(--ink-3); }

/* fade-up on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { scroll-behavior: auto !important; }
}
