/* =========================================================================
   James A. Umapathi — site stylesheet
   Layout concept: a scholarly long-form column (~68ch) on cool clinical paper,
   with the ECG strip (25 mm/s grid) as the one signature surface. Wide screens
   get a sticky contents rail on long articles.
   ========================================================================= */

:root {
  /* Color */
  --paper: #f5f8f9;          /* cool clinical white */
  --surface: #ffffff;
  --ink: #14212a;            /* deep slate ink */
  --ink-2: #44545f;
  --muted: #6a7983;
  --rule: #d8e0e4;
  --rhythm: #b3243a;         /* the ECG trace, links, rhythm concepts */
  --rhythm-soft: #f6e4e7;
  --metab: #0d6b67;          /* metabolism / glucose concepts */
  --metab-soft: #dff0ee;
  --grid-minor: rgba(196, 64, 86, 0.10);
  --grid-major: rgba(196, 64, 86, 0.24);
  --sweep: rgba(245, 248, 249, 0.92);

  /* Type */
  --f-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Scale (1.25) */
  --t-xs: 0.78rem;
  --t-sm: 0.875rem;
  --t-md: 1.0625rem;
  --t-lg: 1.3rem;
  --t-xl: 1.7rem;
  --t-2xl: 2.25rem;
  --t-3xl: clamp(2.4rem, 5.2vw, 3.6rem);

  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1519;
    --surface: #131e23;
    --ink: #e6edf0;
    --ink-2: #b2c0c7;
    --muted: #8696a0;
    --rule: #25343b;
    --rhythm: #ff7586;
    --rhythm-soft: #3a1d24;
    --metab: #55c7bf;
    --metab-soft: #16302f;
    --grid-minor: rgba(255, 117, 134, 0.07);
    --grid-major: rgba(255, 117, 134, 0.17);
    --sweep: rgba(13, 21, 25, 0.92);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1519;
  --surface: #131e23;
  --ink: #e6edf0;
  --ink-2: #b2c0c7;
  --muted: #8696a0;
  --rule: #25343b;
  --rhythm: #ff7586;
  --rhythm-soft: #3a1d24;
  --metab: #55c7bf;
  --metab-soft: #16302f;
  --grid-minor: rgba(255, 117, 134, 0.07);
  --grid-major: rgba(255, 117, 134, 0.17);
  --sweep: rgba(13, 21, 25, 0.92);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--rhythm); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--rhythm); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--t-3xl); font-weight: 400; }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-lg); font-weight: 600; }
p { margin: 0; }
strong { font-weight: 600; }
sup { line-height: 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; background: var(--surface); padding: 6px 10px; z-index: 50; }

.label {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono { font-family: var(--f-mono); font-size: 0.92em; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
  min-width: 0;
}
.wordmark .name { font-family: var(--f-display); font-size: 1.3rem; font-weight: 500; white-space: nowrap; }
.wordmark .tag { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--muted); letter-spacing: 0.06em; white-space: nowrap; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a {
  font-size: var(--t-sm);
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
}
.nav a:hover { color: var(--ink); background: var(--rhythm-soft); }
.nav a[aria-current="page"] { color: var(--rhythm); font-weight: 600; }
.theme-toggle {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.menu-btn { display: none; }

@media (max-width: 760px) {
  .wordmark .tag { display: none; }
  .menu-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--rule); background: transparent; color: var(--ink);
    font: inherit; font-size: var(--t-sm); padding: 6px 12px; border-radius: 4px; cursor: pointer;
  }
  .nav { display: none; order: 5; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 6px; border-bottom: 1px solid var(--rule); border-radius: 0; }
}

/* ---------- Page scaffolding ---------- */
main { display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); }
.prose { max-width: var(--measure); }
.prose > * + *, .prose section > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2.4em; }
.prose h3 { margin-top: 1.8em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.lede { font-size: 1.22rem; line-height: 1.6; color: var(--ink-2); }
.section { padding-block: clamp(48px, 7vw, 88px); }
.section + .section { border-top: 1px solid var(--rule); }
.eyebrow { display: block; margin-bottom: 14px; }

/* ---------- Hero / ECG strip ---------- */
.hero { padding-block: clamp(40px, 7vw, 80px) 28px; }
.hero h1 { max-width: 16ch; }
.hero h1 em { font-style: italic; color: var(--rhythm); }
.hero .lede { max-width: 58ch; margin-top: 20px; }
.hero .who { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-2); font-size: var(--t-sm); }
.hero .who span { display: inline-flex; gap: 8px; align-items: baseline; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--t-sm); font-weight: 600;
  padding: 11px 18px; border-radius: 4px; text-decoration: none;
  border: 1px solid var(--rhythm);
}
.btn-primary { background: var(--rhythm); color: var(--paper); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--rhythm); background: transparent; }
.btn-ghost:hover { background: var(--rhythm-soft); }

.ecg {
  position: relative;
  margin-top: 36px;
  border-top: 1px solid var(--grid-major);
  border-bottom: 1px solid var(--grid-major);
  overflow: hidden;
}
.ecg svg { display: block; width: 100%; height: 190px; }
.ecg .trace { fill: none; stroke: var(--rhythm); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ecg .g-minor { stroke: var(--grid-minor); stroke-width: 0.5; }
.ecg .g-major { stroke: var(--grid-major); stroke-width: 0.8; }
.ecg .sweep { fill: var(--sweep); }
.ecg .ann { font-family: var(--f-mono); font-size: 11px; fill: var(--ink-2); letter-spacing: 0.04em; }
.ecg .ann-strong { fill: var(--rhythm); font-weight: 600; }
.ecg .divider { stroke: var(--muted); stroke-dasharray: 3 4; stroke-width: 1; }
.ecg-caption {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px;
  font-family: var(--f-mono); font-size: var(--t-xs); color: var(--muted); padding-top: 8px;
}

/* ---------- Home: feature + scales ---------- */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.feature > * { min-width: 0; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }

.stat-list { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.stat {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 16px;
  padding-block: 16px; border-bottom: 1px solid var(--rule); align-items: baseline;
}
.stat .num { font-family: var(--f-display); font-size: 2rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .num small { font-size: 0.5em; color: var(--muted); }
.stat p { font-size: var(--t-sm); color: var(--ink-2); }
.stat .src { display: block; font-family: var(--f-mono); font-size: 0.7rem; color: var(--muted); margin-top: 4px; }

.scales { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 36px; border-top: 2px solid var(--ink); }
.scale { padding: 20px 22px 4px 0; }
.scale + .scale { padding-left: 22px; border-left: 1px solid var(--rule); }
.scale .label { display: block; margin-bottom: 8px; }
.scale h3 { font-size: 1.25rem; margin-bottom: 8px; }
.scale p { font-size: var(--t-sm); color: var(--ink-2); }
.scale a { font-size: var(--t-sm); display: inline-block; margin-top: 10px; }
@media (max-width: 960px) {
  .scales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scale:nth-child(3) { padding-left: 0; border-left: 0; }
  .scale:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .scales { grid-template-columns: 1fr; }
  .scale, .scale + .scale { padding-left: 0; border-left: 0; }
  .scale + .scale { border-top: 1px solid var(--rule); }
}

/* ---------- Article (research) ---------- */
.article-head { padding-block: clamp(40px, 6vw, 72px) 28px; border-bottom: 1px solid var(--rule); }
.article-head h1 { max-width: 22ch; font-size: clamp(2.1rem, 4.6vw, 3.2rem); }
.article-head .lede { margin-top: 18px; max-width: 62ch; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 24px; font-size: var(--t-sm); color: var(--ink-2); }
.byline b { color: var(--ink); font-weight: 600; }

.article-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  padding-block: 40px 80px;
}
.article-layout > * { min-width: 0; }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.toc ol { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 1.8em 1fr; gap: 2px;
  font-size: 0.84rem; line-height: 1.35; color: var(--ink-2); text-decoration: none;
  padding: 6px 0 6px 10px; border-left: 2px solid var(--rule);
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); padding-top: 1px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--rhythm); border-left-color: var(--rhythm); }
.toc .toc-plain a::before { content: "·"; }
@media (max-width: 980px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
}

.abstract {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.abstract .label { display: block; margin-bottom: 8px; }
.abstract p { font-size: 0.98rem; }
.keypoints { margin-top: 14px; padding-left: 1.2em; font-size: 0.95rem; }

.cite { font-family: var(--f-mono); font-size: 0.68em; text-decoration: none; padding: 0 1px; vertical-align: super; }
.cite:hover { text-decoration: underline; }

.callout {
  border-left: 3px solid var(--metab);
  background: var(--metab-soft);
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.97rem;
}
.callout.rhythm { border-left-color: var(--rhythm); background: var(--rhythm-soft); }
.callout .label { display: block; margin-bottom: 4px; color: var(--ink-2); }

.term-r { color: var(--rhythm); font-weight: 600; }
.term-m { color: var(--metab); font-weight: 600; }

/* Figures */
figure.fig { margin: 2.2em 0; max-width: none; }
figure.fig figcaption { margin-top: 12px; font-size: var(--t-sm); color: var(--ink-2); max-width: var(--measure); }
figure.fig figcaption b { font-family: var(--f-mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--ink); margin-right: 6px; }
.fig-frame { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; overflow-x: auto; }

/* Figure 1: pathway flow */
.flow { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 0; min-width: 660px; }
.flow-col { padding: 0 14px; position: relative; }
.flow-col + .flow-col { border-left: 1px dashed var(--rule); }
.flow-col h4 { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.flow-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.flow-col li { font-size: 0.84rem; line-height: 1.3; padding: 7px 9px; border-radius: 4px; border: 1px solid var(--rule); background: var(--paper); }
.flow-col li.m { border-color: color-mix(in srgb, var(--metab) 45%, transparent); background: var(--metab-soft); }
.flow-col li.r { border-color: color-mix(in srgb, var(--rhythm) 45%, transparent); background: var(--rhythm-soft); }
.flow-col li.key { font-weight: 600; border-width: 2px; }
.flow-col:not(:last-child)::after {
  content: "→"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%);
  background: var(--surface); color: var(--muted); font-size: 0.95rem; line-height: 1; padding: 2px 0;
}
.flow-end { display: grid; place-items: center; text-align: center; }
.flow-end .af { font-family: var(--f-display); font-size: 1.6rem; color: var(--rhythm); line-height: 1.1; }
.flow-end p { font-size: 0.8rem; color: var(--ink-2); margin-top: 6px; }

/* Figure 2: CaMKII explorer */
.camk { display: grid; gap: 18px; }
.camk-domain { min-width: 560px; }
.camk-domain svg { width: 100%; height: auto; display: block; }
.camk-domain .dom { stroke: var(--ink-2); stroke-width: 1; }
.camk-domain .dom-cat { fill: var(--paper); }
.camk-domain .dom-reg { fill: var(--rhythm-soft); }
.camk-domain .dom-hub { fill: var(--metab-soft); }
.camk-domain .dom-lnk { fill: var(--rule); }
.camk-domain text { font-family: var(--f-mono); font-size: 11px; fill: var(--ink-2); }
.camk-domain .site circle { stroke: var(--surface); stroke-width: 2; transition: r 0.15s; }
.camk-domain .site text { font-size: 10.5px; fill: var(--ink); font-weight: 600; }
.camk-domain .site line { stroke: var(--muted); stroke-width: 1; }
.camk-domain .site.dim { opacity: 0.32; }
.camk-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.camk-tabs button {
  font: inherit; font-size: 0.82rem; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2);
  padding: 7px 12px; border-radius: 999px;
}
.camk-tabs button:hover { border-color: var(--muted); color: var(--ink); }
.camk-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.camk-panel { border-top: 1px solid var(--rule); padding-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.camk-panel h4 { font-family: var(--f-display); font-size: 1.2rem; margin-bottom: 6px; }
.camk-panel p { font-size: 0.92rem; color: var(--ink-2); }
.camk-panel .verdict { font-size: 0.9rem; padding: 12px 14px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--rule); }
.camk-panel .verdict .label { display: block; margin-bottom: 4px; }
@media (max-width: 640px) { .camk-panel { grid-template-columns: 1fr; } }

/* Figure 3: myocyte */
.cell svg { width: 100%; min-width: 560px; height: auto; display: block; }
.cell .membrane { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.cell .sr { fill: var(--metab-soft); stroke: var(--metab); stroke-width: 1.4; }
.cell .chan { fill: var(--surface); stroke: var(--ink); stroke-width: 1.4; }
.cell .chan-hot { fill: var(--rhythm-soft); stroke: var(--rhythm); stroke-width: 1.6; }
.cell .kinase { fill: var(--rhythm); }
.cell text { font-family: var(--f-body); font-size: 12px; fill: var(--ink); }
.cell .small { font-family: var(--f-mono); font-size: 10.5px; fill: var(--ink-2); }
.cell .lbl-k { fill: var(--paper); font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; }
.cell .arrow { stroke: var(--rhythm); stroke-width: 1.5; fill: none; }
.cell .flux { stroke: var(--metab); stroke-width: 1.5; fill: none; stroke-dasharray: 4 3; }
.cell .ap { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.cell .dad { stroke: var(--rhythm); stroke-width: 1.8; fill: none; }
.cell .axis { stroke: var(--rule); stroke-width: 1; }
.cell .step { fill: var(--ink); }
.cell .step-t { fill: var(--paper); font-family: var(--f-mono); font-size: 10px; font-weight: 600; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 0.92rem; color: var(--ink-2); }
.steps li::before {
  content: counter(s); font-family: var(--f-mono); font-size: 0.72rem; font-weight: 600;
  width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; margin-top: 2px;
}

/* Figure 4: forest plot */
.forest svg { width: 100%; min-width: 520px; height: auto; display: block; }
.forest .row-label { font-family: var(--f-body); font-size: 12.5px; fill: var(--ink); }
.forest .row-sub { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
.forest .val { font-family: var(--f-mono); font-size: 11.5px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.forest .ci { stroke: var(--rhythm); stroke-width: 2; stroke-linecap: round; }
.forest .pt { fill: var(--rhythm); stroke: var(--surface); stroke-width: 2; }
.forest .pt.overall { fill: var(--ink); }
.forest .ci.overall { stroke: var(--ink); }
.forest .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.forest .grid { stroke: var(--rule); stroke-width: 1; }
.forest .tick { font-family: var(--f-mono); font-size: 10.5px; fill: var(--muted); }
.forest .axis-t { font-family: var(--f-body); font-size: 11.5px; fill: var(--ink-2); }
.forest .hit { fill: transparent; cursor: default; }
.forest .hit:hover + g .pt, .forest g.row:hover .pt { r: 7; }
.forest g.row:hover .row-label { font-weight: 600; }
.tooltip {
  position: fixed; z-index: 40; pointer-events: none;
  background: var(--ink); color: var(--paper);
  font-size: 0.8rem; line-height: 1.4; padding: 8px 10px; border-radius: 4px;
  max-width: 260px; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
details.data-table { margin-top: 12px; font-size: var(--t-sm); }
details.data-table summary { cursor: pointer; color: var(--ink-2); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
th { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td code, .code { font-family: var(--f-mono); font-size: 0.85em; background: var(--paper); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--rule); white-space: nowrap; }
.tag {
  display: inline-block; font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.tag-yes { background: var(--metab-soft); color: var(--metab); }
.tag-no { background: var(--rhythm-soft); color: var(--rhythm); }
.tag-q { background: var(--paper); color: var(--ink-2); border: 1px solid var(--rule); }

/* Glossary & references */
dl.glossary { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 10px 22px; font-size: 0.94rem; }
dl.glossary dt { font-weight: 600; }
dl.glossary dd { margin: 0; color: var(--ink-2); }
@media (max-width: 560px) { dl.glossary { grid-template-columns: 1fr; gap: 2px; } dl.glossary dd { margin-bottom: 10px; } }
ol.refs { font-size: 0.86rem; color: var(--ink-2); padding-left: 2.2em; }
ol.refs li { padding-left: 4px; scroll-margin-top: 100px; overflow-wrap: anywhere; }
ol.refs li:target { background: var(--rhythm-soft); border-radius: 3px; }
ol.refs a { color: var(--ink-2); }
.note { font-size: var(--t-sm); color: var(--muted); }

[id] { scroll-margin-top: 90px; }

/* ---------- Bench & bedside ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); }
.split > * { min-width: 0; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: var(--t-sm); margin: 0; }
.facts dt { font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 24px; }
.toolkit { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border-top: 1px solid var(--rule); margin-top: 18px; }
.tool { padding: 16px 18px 16px 0; border-bottom: 1px solid var(--rule); }
.tool h3 { font-family: var(--f-body); font-size: 0.98rem; font-weight: 600; margin-bottom: 4px; }
.tool p { font-size: 0.9rem; color: var(--ink-2); }
.tool .label { display: block; margin-bottom: 6px; }

/* ---------- About ---------- */
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding-block: clamp(40px, 6vw, 72px) 32px; }
.monogram {
  width: 120px; height: 120px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-display); font-size: 2.6rem; font-style: italic; color: var(--rhythm);
  border: 1px solid var(--rule); background: var(--surface);
  overflow: hidden;
}
.monogram img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 560px) { .profile-head { grid-template-columns: 1fr; } .monogram { width: 88px; height: 88px; font-size: 2rem; } }
.cv { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px 48px; padding-block: 40px; border-top: 1px solid var(--rule); }
.cv > * { min-width: 0; }
.cv > h2 { font-size: 1.5rem; }
@media (max-width: 760px) { .cv { grid-template-columns: 1fr; gap: 14px; } }
.entries { display: grid; gap: 22px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; }
.entry h3 { font-family: var(--f-body); font-size: 1rem; font-weight: 600; line-height: 1.35; }
.entry .where { grid-column: 1; color: var(--ink-2); font-size: 0.92rem; }
.entry .when { grid-column: 2; grid-row: 1; font-family: var(--f-mono); font-size: 0.76rem; color: var(--muted); white-space: nowrap; padding-top: 3px; font-variant-numeric: tabular-nums; }
.entry ul { grid-column: 1 / -1; margin: 6px 0 0; padding-left: 1.15em; font-size: 0.93rem; color: var(--ink-2); }
.entry ul li + li { margin-top: 3px; }
@media (max-width: 480px) { .entry { grid-template-columns: 1fr; } .entry .when { grid-column: 1; grid-row: auto; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 0.84rem; padding: 4px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink-2); }
.contact-line { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.copy-btn { font: inherit; font-size: 0.78rem; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
.copy-btn:hover { border-color: var(--muted); color: var(--ink); }

/* ---------- Updates timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7.4rem; top: 6px; bottom: 6px; width: 1px; background: var(--rule); }
.timeline li { display: grid; grid-template-columns: 7.4rem minmax(0, 1fr); gap: 0 28px; padding-bottom: 30px; position: relative; }
.timeline li::after { content: ""; position: absolute; left: calc(7.4rem - 5px); top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--rhythm); }
.timeline li.m::after { border-color: var(--metab); }
.timeline time { font-family: var(--f-mono); font-size: 0.78rem; color: var(--muted); padding-top: 3px; padding-right: 18px; text-align: right; }
.timeline h3 { font-family: var(--f-body); font-size: 1.02rem; font-weight: 600; }
.timeline p { font-size: 0.94rem; color: var(--ink-2); margin-top: 4px; }
.timeline .k { margin-top: 6px; }
@media (max-width: 560px) {
  .timeline::before { left: 5px; }
  .timeline li { grid-template-columns: 1fr; padding-left: 26px; }
  .timeline li::after { left: 0; }
  .timeline time { text-align: left; padding: 0 0 2px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 36px 48px; font-size: var(--t-sm); color: var(--muted); }
.site-footer .inner { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); display: flex; flex-wrap: wrap; gap: 14px 40px; justify-content: space-between; }
.site-footer a { color: var(--ink-2); }
.site-footer .fnav { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- Print ---------- */
@media print {
  .site-header, .toc, .theme-toggle, .cta-row, .camk-tabs, .site-footer .fnav { display: none !important; }
  body { background: #fff; color: #000; }
  .article-layout { grid-template-columns: 1fr; }
  a { color: #000; }
}

/* eyebrow directly above a heading: no extra gap */
.prose .eyebrow + h2, .prose .eyebrow + h1 { margin-top: 0; }
.hero h1 { max-width: 17ch; }

/* 3-column flow (silent killer figure) */
.flow.flow-3 { grid-template-columns: repeat(3, minmax(170px, 1fr)); min-width: 560px; }

/* Horizontal bar / dot charts */
.chart svg { width: 100%; height: auto; display: block; min-width: 460px; }
.chart .lbl { font-family: var(--f-body); font-size: 12.5px; fill: var(--ink); }
.chart .lbl.hl { font-weight: 600; }
.chart .val { font-family: var(--f-mono); font-size: 12px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--muted); opacity: 0.55; }
.chart .bar.hl { fill: var(--rhythm); opacity: 1; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .tick { font-family: var(--f-mono); font-size: 10.5px; fill: var(--muted); }
.chart .axis-t { font-family: var(--f-body); font-size: 11.5px; fill: var(--ink-2); }
.chart .dot { fill: var(--muted); stroke: var(--surface); stroke-width: 2; }
.chart .dot.hl { fill: var(--rhythm); }
.chart .stem { stroke: var(--rule); stroke-width: 2; }
.chart .gap { stroke: var(--rhythm); stroke-width: 1.5; }
.chart .gap-t { font-family: var(--f-display); font-size: 17px; fill: var(--rhythm); font-style: italic; }
.chart g.row:hover .bar { opacity: 0.85; }
.chart g.row:hover .bar.hl { opacity: 1; filter: brightness(1.08); }
@media (max-width: 1100px) { .wordmark .tag { display: none; } }

/* =====================================================================
   Single-page awareness site additions
   ===================================================================== */
.alert-bar {
  background: var(--rhythm); color: var(--paper);
  font-size: var(--t-sm); text-align: center;
  padding: 8px var(--gutter);
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
.alert-bar a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.alert-bar b { font-weight: 700; }

.section-head { display: grid; gap: 12px; max-width: 64ch; margin-bottom: 32px; }
.section-head .lede { font-size: 1.1rem; }
.section.tint { background: var(--surface); }
.section.tint + .section, .section + .section.tint { border-top: 1px solid var(--rule); }

/* Risk cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.card { padding: 22px 22px 22px 0; border-bottom: 1px solid var(--rule); }
.card:not(:nth-child(3n+1)) { padding-left: 22px; border-left: 1px solid var(--rule); }
.card .label { display: block; margin-bottom: 8px; }
.card h3 { font-size: 1.22rem; margin-bottom: 8px; }
.card p { font-size: 0.93rem; color: var(--ink-2); }
.card .big { font-family: var(--f-display); font-size: 1.9rem; line-height: 1; color: var(--rhythm); display: block; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card:not(:nth-child(3n+1)) { padding-left: 0; border-left: 0; }
  .card:nth-child(2n) { padding-left: 22px; border-left: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .card:nth-child(2n) { padding-left: 0; border-left: 0; }
}

.chart-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 36px; }
.chart-row > * { min-width: 0; }
.chart-row figure { margin: 0; }
.chart-row figcaption { margin-top: 10px; font-size: var(--t-sm); color: var(--ink-2); }
.chart-row figcaption b { font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--ink); margin-right: 6px; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }

/* Warning signs */
.signs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.signs > * { min-width: 0; }
@media (max-width: 820px) { .signs { grid-template-columns: 1fr; } }
.sign-panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; }
.sign-panel h3 { font-size: 1.45rem; margin-bottom: 14px; }
.sign-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sign-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 0.97rem; }
.sign-list li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rhythm); margin-top: 8px; }
.fast { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fast li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; font-size: 0.97rem; }
.fast .letter { width: 44px; height: 44px; border-radius: 6px; background: var(--ink); color: var(--paper); font-family: var(--f-display); font-size: 1.5rem; display: grid; place-items: center; }
.fast li:last-child .letter { background: var(--rhythm); }
.call-911 {
  margin-top: 24px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between;
  border: 2px solid var(--rhythm); border-radius: var(--radius); padding: 18px 22px; background: var(--rhythm-soft);
}
.call-911 strong { font-family: var(--f-display); font-size: 1.5rem; font-weight: 500; color: var(--ink); }
.call-911 p { font-size: 0.95rem; color: var(--ink-2); max-width: 52ch; }
.small-note { font-size: var(--t-sm); color: var(--muted); margin-top: 14px; }

/* Know your numbers checklist */
.numbers-top { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.progress { display: flex; align-items: center; gap: 12px; font-size: var(--t-sm); color: var(--ink-2); }
.progress-track { width: 160px; height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--metab); border-radius: 4px; transition: width 0.25s; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .checklist { grid-template-columns: 1fr; } }
.check-item { position: relative; }
.check-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-item label {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; cursor: pointer; height: 100%;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px;
}
.check-item label:hover { border-color: var(--muted); }
.check-item .box { width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 5px; margin-top: 2px; display: grid; place-items: center; }
.check-item .box svg { opacity: 0; }
.check-item input:checked + label { border-color: var(--metab); background: var(--metab-soft); }
.check-item input:checked + label .box { background: var(--metab); border-color: var(--metab); }
.check-item input:checked + label .box svg { opacity: 1; }
.check-item input:focus-visible + label { outline: 2px solid var(--rhythm); outline-offset: 2px; }
.check-item .ci-t { display: block; font-family: var(--f-body); font-size: 1rem; font-weight: 600; }
.check-item .target { font-family: var(--f-mono); font-size: 0.8rem; color: var(--ink); margin-top: 4px; display: block; }
.check-item p { font-size: 0.9rem; color: var(--ink-2); margin-top: 6px; }

/* Prevention tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }
.tile .label { display: block; margin-bottom: 6px; }
.tile h3 { font-size: 1.15rem; margin-bottom: 6px; }
.tile p { font-size: 0.9rem; color: var(--ink-2); }

/* Help / resources */
.help-groups { display: grid; gap: 34px; }
.help-group h3 { font-size: 1.3rem; margin-bottom: 4px; }
.help-group > p { font-size: 0.93rem; color: var(--ink-2); margin-bottom: 14px; max-width: 70ch; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.link-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: start;
  text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px;
  transition: border-color 0.15s, transform 0.15s;
}
.link-btn:hover { border-color: var(--rhythm); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .link-btn, .link-btn:hover { transition: none; transform: none; } }
.link-btn .t { font-weight: 600; font-size: 0.97rem; line-height: 1.3; }
.link-btn .d { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-2); line-height: 1.45; }
.link-btn .arrow { color: var(--rhythm); font-size: 1rem; line-height: 1.3; }
.link-btn .meta { grid-column: 1 / -1; font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.03em; overflow-wrap: anywhere; }
.link-btn.urgent { border: 2px solid var(--rhythm); background: var(--rhythm-soft); }
.link-btn.urgent .t { font-family: var(--f-display); font-size: 1.35rem; font-weight: 500; }
.disclaimer { font-size: var(--t-sm); color: var(--muted); margin-top: 28px; max-width: 80ch; }

/* Research + about */
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.findings li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; color: var(--ink-2); }
.findings .k { font-family: var(--f-display); font-size: 1.5rem; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .findings li { grid-template-columns: 1fr; gap: 4px; } }
details.refs-wrap { margin-top: 26px; }
details.refs-wrap summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; }
details.refs-wrap ol.refs { margin-top: 12px; }
.about-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.about-box > * { min-width: 0; }
@media (max-width: 560px) { .about-box { grid-template-columns: 1fr; } }
.about-box .monogram { width: 84px; height: 84px; font-size: 1.8rem; }
.stat-row .stat { grid-template-columns: 1fr; gap: 8px; }
.link-btn { align-content: start; }
.help-group h3 + .links { margin-top: 12px; }
.chart-row .chart .lbl { font-size: 15px; }
.chart-row .chart .val { font-size: 14px; }
.chart-row .chart .tick { font-size: 12.5px; }
.chart-row .chart .axis-t { font-size: 14px; }
.chart-row .chart .gap-t { font-size: 19px; }
.chart-row .chart svg { min-width: 0; }
@media (max-width: 600px) { .chart-row .chart svg { min-width: 520px; } }
@media (max-width: 1280px) { .wordmark .tag { display: none; } }
@media (max-width: 480px) {
  .site-header .inner { gap: 10px; }
  .wordmark .name { font-size: 1.08rem; }
  .menu-btn { padding: 6px 10px; }
}
.wordmark .tag { display: none; }
@media (max-width: 900px) {
  .menu-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--rule); background: transparent; color: var(--ink);
    font: inherit; font-size: var(--t-sm); padding: 6px 12px; border-radius: 4px; cursor: pointer;
  }
  .nav { display: none; order: 5; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 6px; border-bottom: 1px solid var(--rule); border-radius: 0; }
}
