/* White paper, navy ink and one highlighter. The yellow mark is kept for what made the cut: the
   words a search matched, the labeled answer page, the patients on the call list, and the
   monogram. Charts use two data hues and a gray for context, chosen so each pair stays apart for
   color-blind readers on both themes. */

@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-2: #f5f7fa;
  --paper-3: #ebeff5;
  --ink: #0f1d2e;
  --ink-2: #4b586b;
  --ink-3: #5f6b7d;
  --rule: #e3e8ef;
  --rule-2: #c9d1dc;
  --grid: #e9edf2;
  --link: #1c5cab;
  --mark: #ffe066;
  --data-1: #2a78d6;
  --data-2: #eb6834;
  --context: #9aa4b2;
  --track: #e4eaf2;
  --miss: #b42318;
  --lift: 0 1px 0 rgba(15, 29, 46, 0.04), 0 18px 40px -24px rgba(15, 29, 46, 0.28);
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --doc: "Times New Roman", Times, "Liberation Serif", serif;
  --wide: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: light;
}

/* Dark follows the system unless the theme button pinned one with data-theme on <html>. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1420;
    --paper-2: #141d2b;
    --paper-3: #1b2636;
    --ink: #e9eef5;
    --ink-2: #aab6c6;
    --ink-3: #8b97a9;
    --rule: #223047;
    --rule-2: #33435c;
    --grid: #1c2738;
    --link: #8db7f0;
    --mark: #5c4b00;
    --data-1: #3987e5;
    --data-2: #d95926;
    --context: #5d6b80;
    --track: #1f2a3b;
    --miss: #f97066;
    --lift: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1420;
  --paper-2: #141d2b;
  --paper-3: #1b2636;
  --ink: #e9eef5;
  --ink-2: #aab6c6;
  --ink-3: #8b97a9;
  --rule: #223047;
  --rule-2: #33435c;
  --grid: #1c2738;
  --link: #8db7f0;
  --mark: #5c4b00;
  --data-1: #3987e5;
  --data-2: #d95926;
  --context: #5d6b80;
  --track: #1f2a3b;
  --miss: #f97066;
  --lift: none;
  color-scheme: dark;
}

/* Base ------------------------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
p, ul, ol, dl, figure, table { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
pre { overflow-x: auto; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.1rem; font-size: 0.88rem; line-height: 1.55; margin: 0 0 1.25rem; }
pre code { font-size: inherit; }
mark { background: var(--mark); color: inherit; padding: 0 0.08em; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }

h1, h2, h3, h4 { color: var(--ink); text-wrap: balance; }
h2 { font-size: 1.65rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.012em; margin: 0 0 0.75rem; }
h3 { font-size: 1.2rem; line-height: 1.3; font-weight: 650; letter-spacing: -0.005em; margin: 0 0 0.5rem; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.quiet { color: var(--ink-2); }
.small { font-size: 0.9rem; }
.error { color: var(--miss); }

button {
  font: inherit; font-weight: 600; font-size: 0.95rem; color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 10px; padding: 0 1.1rem; height: 2.85rem; cursor: pointer;
}
button:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
button.text {
  height: auto; padding: 0; color: var(--link); background: none; border: 0; border-radius: 2px; font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-align: left;
}
button.text:hover { text-decoration-thickness: 2px; background: none; }

/* Header and footer ---------------------------------------------------------------------- */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.005em; }
.brand:hover .brand-name { text-decoration: underline; text-underline-offset: 0.2em; }
.monogram {
  display: inline-block; font-weight: 820; font-size: 1.05rem; letter-spacing: -0.02em; line-height: 1;
  padding: 0.2rem 0.18rem 0.12rem; color: var(--ink);
  background: linear-gradient(transparent 50%, var(--mark) 50%, var(--mark) 94%, transparent 94%);
}
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; padding: 0.45rem 0.65rem; border-radius: 6px; }
.site-nav a:hover { color: var(--ink); background: var(--paper-2); }
.theme {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; margin-left: 0.25rem;
  color: var(--ink-2); background: none; border: 1px solid var(--rule); border-radius: 8px;
}
.theme:hover { color: var(--ink); border-color: var(--rule-2); background: var(--paper-2); }
.theme svg { max-width: none; flex: none; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 6rem; }
.site-footer .wrap { padding-top: 2rem; padding-bottom: 3rem; }
.site-footer p { font-size: 0.9rem; color: var(--ink-2); margin: 0; }

/* Home: introduction ---------------------------------------------------------------------- */

.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(1rem, 3vw, 2rem); }
.portrait { display: block; width: 6.5rem; height: 6.5rem; border-radius: 16px; object-fit: cover; margin: 0 0 1.5rem; background: var(--paper-2); }
.display { font-size: clamp(2.75rem, 5.4vw, 4.4rem); line-height: 0.98; font-weight: 760; letter-spacing: -0.03em; margin: 0 0 1rem; }
.tagline { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.45; color: var(--ink-2); max-width: 42rem; margin: 0; }

.links { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.links li { margin: 0; }
.links a {
  display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.55rem 1.15rem 0.55rem 0.95rem;
  border: 1px solid var(--rule-2); border-radius: 999px; background: var(--paper);
  color: var(--ink); font-weight: 550; font-size: 0.95rem; text-decoration: none;
}
.links a:hover { border-color: var(--ink-3); background: var(--paper-2); }
.links svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
/* GitHub's and LinkedIn's logos can't be recolored, so each theme shows its own file. */
.links .logo { display: block; width: 1.15rem; height: 1.15rem; flex: none; object-fit: contain; }
.links .on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .links .on-light { display: none; }
  :root:not([data-theme="light"]) .links .on-dark { display: block; }
}
:root[data-theme="dark"] .links .on-light { display: none; }
:root[data-theme="dark"] .links .on-dark { display: block; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; list-style: none; padding: 0; margin: 2.25rem 0 0; }
.stats li { margin: 0; border: 1px solid var(--rule-2); border-radius: 12px; padding: 0.9rem 1rem 1rem; font-size: 0.88rem; line-height: 1.4; color: var(--ink-2); background: var(--paper); }
.stats b { display: block; font-size: 1.4rem; line-height: 1.2; font-weight: 720; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 0.3rem; }
.stats .src { color: var(--ink-3); }

/* Home: sections -------------------------------------------------------------------------- */

.section { padding-top: clamp(3rem, 7vw, 5rem); }
.section-head { margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head .section-note { margin: 0.6rem 0 0; max-width: 42rem; color: var(--ink-2); }
.eyebrow { font-size: 0.85rem; font-weight: 600; color: var(--ink-3); margin: 0 0 0.3rem; }

/* A project: its heading across the top, then the thing to try or look at (the search, a
   chart, a diagram), with its numbers, pipeline, stack and links beside it. */
.project {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "head head" "show side";
  gap: 1.5rem 2.75rem; align-items: start; padding: 2.5rem 0; border-top: 1px solid var(--rule);
}
.project:last-child { border-bottom: 1px solid var(--rule); }
.project-head { grid-area: head; }
.project-head h3 { font-size: 1.45rem; line-height: 1.22; letter-spacing: -0.012em; font-weight: 700; margin: 0 0 0.6rem; }
.project-head h3 a { color: var(--ink); text-decoration: none; }
.project-head h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.project-head p { color: var(--ink-2); max-width: 46rem; margin: 0; }
.project-show { grid-area: show; min-width: 0; }
.project-show figure.fig { margin: 0; }
.project-show .search, .project-show .fig-frame { border: 1px solid var(--rule-2); border-radius: 14px; box-shadow: none; padding: clamp(1rem, 2.2vw, 1.4rem); }
.project-side { grid-area: side; min-width: 0; }
.project-side .table-wrap { margin: 0; }

table.metrics caption { font-size: 0.85rem; font-weight: 600; color: var(--ink-3); }
table.metrics thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.metrics td { padding: 0.55rem 0; }
table.metrics td.n { font-weight: 600; color: var(--ink); }

.arch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0; list-style: none; padding: 0; margin: 1.25rem 0 1rem; font-size: 0.82rem; }
.arch li { position: relative; margin: 0; padding: 0.22rem 0.6rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper-2); color: var(--ink); }
.arch li + li { margin-left: 1.25rem; }
.arch li + li::before {
  content: ""; position: absolute; left: -0.85rem; top: 50%; width: 0.38rem; height: 0.38rem;
  border-top: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3); transform: translateY(-50%) rotate(45deg);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 1.25rem 0 0; }
.arch + .tags { margin-top: 0; }
.tags li { margin: 0; font-size: 0.8rem; line-height: 1.4; padding: 0.15rem 0.6rem; border: 1px solid var(--rule-2); border-radius: 999px; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; list-style: none; padding: 0; margin: 1.1rem 0 0; font-size: 0.97rem; }
.actions li { margin: 0; }
.actions a { font-weight: 550; }

/* Experience: the lead bullet for each job, the rest one click away. */
.job { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0.5rem 3rem; padding: 2rem 0; border-top: 1px solid var(--rule); }
.job:last-of-type { border-bottom: 1px solid var(--rule); }
.job h3 { margin: 0 0 0.15rem; font-size: 1.2rem; }
.job .title { margin: 0; color: var(--ink); }
.job .when { margin: 0.15rem 0 0; color: var(--ink-3); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.job-body { min-width: 0; }
.job-body ul { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.job-body li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
.job-body li::marker { color: var(--ink-3); }
details.more { margin-top: 0.35rem; }
details.more > summary { cursor: pointer; color: var(--link); font-size: 0.92rem; width: max-content; list-style-position: outside; }
details.more > summary:hover { text-decoration: underline; text-underline-offset: 0.18em; }
details.more[open] > summary { margin-bottom: 0.6rem; }

/* Skills: the group on the left, its tools on the right. */
.skill { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0.75rem 3rem; padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.skill:last-of-type { border-bottom: 1px solid var(--rule); }
.skill h3 { margin: 0; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0; }
.chips li { margin: 0; font-size: 0.9rem; line-height: 1.4; padding: 0.3rem 0.75rem; border: 1px solid var(--rule-2); border-radius: 999px; color: var(--ink); background: var(--paper); }

/* Education and contact */
.creds { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.5rem 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.creds h3 { font-size: 1rem; color: var(--ink-2); font-weight: 600; margin: 0 0 0.5rem; }
.creds p, .creds ul { margin: 0; }
.creds ul { list-style: none; padding: 0; }
.creds li { margin: 0 0 0.3rem; }
.contact { padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.contact .links { margin: 0; }
.where { margin: 1rem 0 0; color: var(--ink-3); }

/* The 404 page's way back */
.missing { list-style: none; padding: 0; margin: 2rem 0 0; font-size: 1.05rem; }
.missing li { margin: 0 0 0.6rem; }

/* Filing search: the card on the home page and the demo in the finance case study --------- */

.search {
  border: 1px solid var(--rule-2); border-radius: 16px; background: var(--paper);
  box-shadow: var(--lift); padding: clamp(1rem, 2.4vw, 1.5rem);
}
.search-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
.search-head h4 { font-size: 1.05rem; line-height: 1.3; font-weight: 650; margin: 0; }
.search-head p { margin: 0; font-size: 0.875rem; color: var(--ink-3); }
.ask { display: flex; gap: 0.5rem; margin: 0 0 0.6rem; }
.ask input {
  flex: 1; min-width: 0; font: inherit; font-size: 0.98rem; color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--rule-2); border-radius: 10px; padding: 0.6rem 0.8rem; height: 2.85rem;
}
.ask input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 22%, transparent); }
.examples { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: 0.9rem; }
.examples li { margin: 0; }
.examples .why { color: var(--ink-3); }
.switches { display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; font-size: 0.92rem; margin: -0.25rem 0 1rem; }
.switches label { display: inline-flex; gap: 0.45rem; align-items: center; cursor: pointer; }
.switches input { accent-color: var(--ink); width: 1rem; height: 1rem; }

.trace { border-top: 1px solid var(--rule); padding-top: 0.85rem; font-size: 0.9rem; color: var(--ink-2); min-height: 2.5rem; font-variant-numeric: tabular-nums; }
.trace p { margin: 0 0 0.45rem; }
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0; list-style: none; padding: 0; margin: 0 0 0.6rem; }
.steps li { margin: 0; color: var(--ink); }
.steps li + li::before {
  content: ""; display: inline-block; width: 0.38rem; height: 0.38rem; margin: 0 0.6rem 0.1rem 0.5rem;
  border-top: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3); transform: rotate(45deg);
}
.steps b { font-weight: 650; }

.hits { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.hits > li { border-top: 1px solid var(--rule); padding: 0.8rem 0 0.7rem; margin: 0; }
.hit-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.hit-head .rank { font-weight: 700; min-width: 1.1rem; }
.hit-head .at { font-weight: 600; color: var(--ink); }
.hit-head .score { color: var(--ink-3); }
.tag { display: inline-block; font-size: 0.78rem; line-height: 1.5; padding: 0 0.45rem; border: 1px solid var(--rule-2); border-radius: 999px; color: var(--ink-2); }
.tag.answer { background: var(--mark); border-color: transparent; color: var(--ink); font-weight: 600; }
.excerpt { font: 1rem/1.5 var(--doc); margin: 0.35rem 0 0 1.7rem; color: var(--ink); overflow-wrap: anywhere; }
.search .excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search .brief .excerpt { -webkit-line-clamp: 1; }
details.page { margin: 0.35rem 0 0 1.7rem; font-size: 0.86rem; }
details.page summary { cursor: pointer; color: var(--link); width: max-content; }
.page-text {
  font: 0.95rem/1.5 var(--doc); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
  max-height: 22rem; overflow: auto; border-left: 2px solid var(--rule-2); padding: 0.4rem 0 0.4rem 0.85rem; margin-top: 0.4rem;
}
.search-foot { font-size: 0.85rem; color: var(--ink-3); margin: 0.6rem 0 0; }

/* Case studies ------------------------------------------------------------------------- */

.cs-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem; }
.crumb { font-size: 0.92rem; color: var(--ink-3); margin: 0 0 1.25rem; }
.crumb a { color: var(--ink-2); }
.cs-head h1 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); line-height: 1.06; font-weight: 740; letter-spacing: -0.025em; margin: 0 0 1.1rem; max-width: 22ch; }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.28rem); line-height: 1.55; color: var(--ink-2); max-width: 42rem; margin: 0 0 2rem; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0; }
.facts div { padding: 1rem 1.25rem 1.1rem 0; }
.facts div + div { padding-left: 1.25rem; border-left: 1px solid var(--rule); }
.facts dt { font-size: 0.85rem; color: var(--ink-3); margin: 0 0 0.3rem; }
.facts dd { margin: 0; font-size: 0.97rem; line-height: 1.45; }
.facts dd b { font-weight: 650; }

.cs { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 3.5rem; padding-top: 1rem; }
.toc { position: sticky; top: 1.5rem; align-self: start; font-size: 0.9rem; padding-top: 2.6rem; }
.toc p { color: var(--ink-3); margin: 0 0 0.5rem; font-size: 0.85rem; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--rule); }
.toc li { margin: 0; }
.toc a { display: block; color: var(--ink-2); text-decoration: none; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -1px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--ink); font-weight: 550; }
.prose { min-width: 0; }
.prose > section { padding-top: 2.6rem; }
.prose > section > p, .prose > section > ul, .prose > section > ol, .prose > section > h3, .prose > section > .table-wrap.narrow { max-width: 42rem; }
.prose h2 { font-size: 1.55rem; margin-bottom: 0.9rem; }
.prose h3 { margin-top: 1.75rem; }
.prose li { color: var(--ink); }
.callout { border-left: 3px solid var(--rule-2); padding: 0.1rem 0 0.1rem 1rem; color: var(--ink-2); max-width: 42rem; }
.sources { font-size: 0.92rem; color: var(--ink-2); }

.demo-block { border: 1px solid var(--rule-2); border-radius: 16px; padding: clamp(1rem, 2.5vw, 1.6rem); margin: 0.5rem 0 1.5rem; background: var(--paper); box-shadow: var(--lift); }
.demo-block > h2 { font-size: 1.2rem; margin: 0 0 0.35rem; }
.demo-block > p.about { color: var(--ink-2); font-size: 0.95rem; max-width: 46rem; }

/* Figures ------------------------------------------------------------------------------- */

figure.fig { margin: 1.5rem 0 1.75rem; }
.fig-frame { border: 1px solid var(--rule); border-radius: 14px; padding: 1.1rem 1.25rem 1rem; background: var(--paper); }
figure.fig figcaption { font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); margin-top: 0.7rem; max-width: 46rem; }
figure.fig figcaption b { color: var(--ink); font-weight: 650; }
.fig-title { font-size: 0.95rem; font-weight: 650; margin: 0 0 0.85rem; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; list-style: none; padding: 0; margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--ink-2); }
.legend li { margin: 0; display: inline-flex; align-items: center; gap: 0.45rem; }
.key { display: inline-block; width: 1.1rem; height: 0; border-top: 2px solid currentColor; }
.key.thin { border-top-width: 1px; }
.key.box { width: 0.75rem; height: 0.75rem; border: 0; border-radius: 3px; background: currentColor; }
.key.box.track { background: var(--track); box-shadow: inset 0 0 0 1px var(--rule-2); }
.s1 { color: var(--data-1); }
.s2 { color: var(--data-2); }
.s0 { color: var(--context); }
.sx { color: var(--ink-3); }
.multiples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; }
.multiples .fig-title { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin: 0 0 0.25rem; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: start; }
.pair .table-wrap { margin: 0; }

/* Line and scatter charts: the SVG stretches to the box, text stays HTML at its own size. */
.chart { position: relative; padding: 0.5rem 0.75rem 2rem 2.6rem; font-variant-numeric: tabular-nums; }
.chart:has(.axis-title.x) { padding-bottom: 2.9rem; }
.chart:has(.axis-title.y) { padding-top: 1.6rem; }
.chart.tall { height: 20rem; }
.chart.mid { height: 15rem; }
.chart.short { height: 11.5rem; }
.chart.square { aspect-ratio: 1 / 1; height: auto; max-width: 25rem; }
.chart.gutter { padding-right: 9.5rem; }
.area { position: relative; height: 100%; }
.plot { position: absolute; inset: 0; }
.plot > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.area .grid line { stroke: var(--grid); stroke-width: 1; }
.area .base { stroke: var(--rule-2); stroke-width: 1; }
.area .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.area .line.thin { stroke-width: 1.25; }
.area .ref { fill: none; stroke: var(--rule-2); stroke-width: 1; }
.tick { position: absolute; font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; line-height: 1; }
.tick.y { right: calc(100% + 0.5rem); transform: translateY(-50%); }
.tick.x { top: calc(100% + 0.55rem); transform: translateX(-50%); }
.axis-title { position: absolute; font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.axis-title.x { top: calc(100% + 1.5rem); right: 0; }
.axis-title.y { left: 0; top: -0.2rem; transform: translateY(-100%); }
.end-label {
  position: absolute; font-size: 0.8rem; color: var(--ink); white-space: nowrap; line-height: 1.2; transform: translate(0.45rem, -50%);
  background: color-mix(in srgb, var(--paper) 82%, transparent); padding: 0 0.15rem; border-radius: 3px;
}
.end-label .v { color: var(--ink-2); }
.end-label.left { transform: translate(calc(-100% - 0.45rem), -50%); text-align: right; }
.end-label.right { transform: translate(0.5rem, -50%); }
.end-label.above { transform: translate(-50%, calc(-100% - 0.45rem)); }
.end-label.below { transform: translate(-50%, 0.45rem); }
.end-label.left.above { transform: translate(calc(-100% - 0.3rem), calc(-100% - 0.25rem)); }
.end-label.left.below { transform: translate(calc(-100% - 0.3rem), 0.25rem); }
.pt {
  position: absolute; width: 0.65rem; height: 0.65rem; margin: -0.325rem 0 0 -0.325rem; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 2px var(--paper);
}
.pt.hit::after { content: ""; position: absolute; inset: -0.55rem; border-radius: 50%; }
.marker { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--ink-2); pointer-events: none; }
.marker .flag {
  position: absolute; top: -0.2rem; left: 0.4rem; font-size: 0.75rem; white-space: nowrap; color: var(--ink);
  background: var(--paper); padding: 0 0.2rem; border-radius: 3px;
}
.hover { position: absolute; inset: 0; cursor: crosshair; touch-action: pan-y; }
.hover:focus-visible { outline-offset: 6px; }
.cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--ink-3); pointer-events: none; display: none; }
.tip {
  position: absolute; z-index: 3; pointer-events: none; display: none; min-width: 9rem; max-width: 17rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule-2); border-radius: 8px;
  box-shadow: 0 8px 24px -12px rgba(15, 29, 46, 0.35); padding: 0.5rem 0.65rem; font-size: 0.8rem; line-height: 1.35;
}
.tip .tip-h { color: var(--ink-2); margin-bottom: 0.3rem; }
.tip .row { display: flex; align-items: center; gap: 0.5rem; justify-content: space-between; }
.tip .row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tip .row span { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-2); }
.tip .row .key { width: 0.8rem; }

/* Row charts: dot plots with intervals, and bars. */
.rows { display: grid; grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 3.4rem; column-gap: 1rem; row-gap: 0; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.rows .lab { padding: 0.42rem 0; color: var(--ink); line-height: 1.3; align-self: center; }
.rows .lab.alt { color: var(--ink-2); }
.rows .val { padding: 0.42rem 0; text-align: right; align-self: center; color: var(--ink); }
.rows .val.alt { color: var(--ink-2); }
.rows .lane { position: relative; align-self: stretch; min-height: 2.1rem; }
.rows .lane .g { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--grid); }
.rows .row-split { grid-column: 1 / -1; height: 0; border-top: 1px solid var(--rule); margin: 0.35rem 0; }
.rows.bars .tipval { position: absolute; top: 50%; transform: translate(0.45rem, -50%); font-size: 0.85rem; color: var(--ink); white-space: nowrap; }
.ci { position: absolute; top: 50%; height: 0; border-top: 2px solid currentColor; opacity: 0.55; }
.ci::before, .ci::after { content: ""; position: absolute; top: -5px; height: 8px; border-left: 2px solid currentColor; }
.ci::before { left: -1px; }
.ci::after { right: -1px; }
.dot { position: absolute; top: 50%; width: 0.75rem; height: 0.75rem; margin: -0.375rem 0 0 -0.375rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--paper); }
.bar { position: absolute; left: 0; top: 50%; height: 1.15rem; margin-top: -0.575rem; background: currentColor; border-radius: 0 4px 4px 0; }
.bar.track { background: var(--track); color: var(--track); border-radius: 0 4px 4px 0; }
.bar.part { border-radius: 0; }
.scale { display: grid; grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 3.4rem; column-gap: 1rem; font-size: 0.75rem; color: var(--ink-3); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.rows.bars, .scale.bars { grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr) 1.5rem; }
.scale .ticks { position: relative; height: 1rem; }
.scale .ticks span { position: absolute; transform: translateX(-50%); }
.scale .ticks span:first-child { transform: none; }
.scale .name { grid-column: 2; text-align: right; margin-top: 0.15rem; }

/* Pipeline flows: an ordered list that runs across on wide screens and down on phones. */
.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; counter-reset: step; }
.flow > li { position: relative; margin: 0; padding: 0 1.4rem 0 0; }
.flow > li:last-child { padding-right: 0; }
.flow > li:not(:last-child)::after {
  content: ""; position: absolute; top: 1.15rem; right: 0.35rem; width: 0.55rem; height: 0.55rem;
  border-top: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3); transform: rotate(45deg);
}
.flow .box { border: 1px solid var(--rule-2); border-radius: 10px; padding: 0.7rem 0.8rem; background: var(--paper); height: 100%; }
.flow .box.key-step { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.flow .what { font-weight: 650; font-size: 0.9rem; line-height: 1.3; display: block; color: var(--ink-2); }
.flow .count { display: block; font-size: 1.35rem; font-weight: 720; letter-spacing: -0.015em; line-height: 1.15; margin-top: 0.4rem; color: var(--ink); }
.flow .unit { display: block; font-size: 0.8rem; color: var(--ink-2); margin-top: 0.1rem; }
.flow .how { font-size: 0.8rem; line-height: 1.4; color: var(--ink-2); display: block; margin-top: 0.55rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }

/* Diagrams drawn at build time */
svg.diagram { display: block; width: 100%; height: auto; color: var(--ink); font-family: var(--sans); }
svg.diagram .node rect { fill: var(--paper); stroke: var(--rule-2); stroke-width: 1.25; }
svg.diagram .node.strong rect { stroke: var(--ink); stroke-width: 1.75; }
svg.diagram .node.soft rect { fill: var(--paper-2); stroke: var(--rule); }
svg.diagram .node.ends rect { fill: var(--paper-2); }
svg.diagram text { fill: var(--ink); font-size: 14px; }
svg.diagram text.sub { fill: var(--ink-2); font-size: 12px; }
svg.diagram text.edge { fill: var(--ink-2); font-size: 12px; }
svg.diagram text.title { font-weight: 650; }
svg.diagram .wire { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
svg.diagram .wire.loop { stroke: var(--data-1); stroke-width: 2; }
svg.diagram .head { fill: var(--ink-3); }
svg.diagram .head.loop { fill: var(--data-1); }
svg.diagram .lane { fill: var(--paper-2); stroke: var(--rule); }
svg.diagram .lane-title { font-weight: 650; font-size: 13px; fill: var(--ink-2); }
svg.diagram .swap rect { fill: var(--mark); stroke: none; }
svg.diagram-wide { display: block; }
svg.diagram-tall { display: none; }

/* Tables ------------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0.75rem 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 650; padding-bottom: 0.5rem; color: var(--ink); }
th, td { padding: 0.5rem 0.75rem 0.5rem 0; vertical-align: baseline; border-bottom: 1px solid var(--rule); text-align: left; }
th { font-weight: 600; color: var(--ink-2); font-size: 0.85rem; vertical-align: bottom; border-bottom-color: var(--rule-2); }
td.n, th.n { text-align: right; white-space: nowrap; }
td.n:last-child, th.n:last-child { padding-right: 0; }
td.ci { color: var(--ink-2); }
tr.total td { font-weight: 650; border-top: 1px solid var(--ink); }
tr.alt td { color: var(--ink-2); }
tr.on td { background: color-mix(in srgb, var(--mark) 45%, transparent); }
tr.group th { text-align: left; font-size: 0.82rem; font-weight: 650; color: var(--ink); padding-top: 1.1rem; border-bottom-color: var(--rule-2); }
table.wrap-head th { white-space: normal; }
table.calllist td:not(:last-child) { white-space: nowrap; }
details.twin { margin: 0.75rem 0 0; font-size: 0.88rem; }
details.twin > summary { cursor: pointer; color: var(--link); width: max-content; }
details.twin .table-wrap { margin-top: 0.6rem; }

/* Readmission controls -------------------------------------------------------------------- */

.capacity-control { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin: 0.25rem 0 1rem; }
.capacity-control label { font-weight: 600; }
.capacity-control input[type="range"] { flex: 1 1 14rem; max-width: 26rem; accent-color: var(--data-1); height: 1.6rem; }
.capacity-control output { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.patient { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.8rem 1.1rem; align-items: end; font-size: 0.9rem; margin: 0.75rem 0 0; }
.patient label { display: flex; flex-direction: column; gap: 0.3rem; color: var(--ink-2); }
.patient input, .patient select {
  font: inherit; color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule-2);
  border-radius: 8px; padding: 0.35rem 0.55rem; min-width: 0; height: 2.5rem;
}
.risk { margin-top: 1.1rem; padding: 0.9rem 1rem; border-radius: 12px; background: var(--paper-2); min-height: 3.4rem; font-variant-numeric: tabular-nums; }
.risk p { margin: 0; }
.risk strong { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: proportional-nums; }
.risk .listed { background: var(--mark); padding: 0 0.25rem; border-radius: 3px; color: var(--ink); }

/* Narrower screens ------------------------------------------------------------------------ */

@media (max-width: 1080px) {
  .cs { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
}
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "show" "side"; }
  .project-side { max-width: 36rem; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 760px) {
  .job, .skill, .creds, .multiples, .pair { grid-template-columns: minmax(0, 1fr); }
  .project { gap: 1.25rem; padding: 2rem 0; }
  .job { gap: 0.75rem; }
  .flow { grid-auto-flow: row; grid-auto-columns: auto; gap: 1.1rem; }
  .flow > li { padding: 0; }
  .flow > li:not(:last-child)::after { top: auto; bottom: -0.85rem; right: auto; left: 1.2rem; transform: rotate(135deg); }
  svg.diagram-wide { display: none; }
  svg.diagram-tall { display: block; max-width: 26rem; margin: 0 auto; }
  .rows, .scale { grid-template-columns: minmax(0, 1fr) 3rem; column-gap: 0.75rem; }
  .rows.bars, .scale.bars { grid-template-columns: minmax(0, 1fr) 1.5rem; }
  .rows .lab { grid-column: 1 / -1; padding: 0.55rem 0 0.1rem; }
  .rows .lane { grid-column: 1; min-height: 1.6rem; }
  .scale .ticks, .scale .name { grid-column: 1; }
  .scale > .lab-pad { display: none; }
  .chart.gutter { padding-right: 0.75rem; }
  .chart.gutter .end-label { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  .site-nav a.hide-sm { display: none; }
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stats { gap: 0.5rem; }
  .stats li { padding: 0.75rem 0.8rem 0.8rem; font-size: 0.8rem; }
  .stats b { font-size: 1.2rem; }
  .ask { flex-direction: column; }
  .ask button { width: 100%; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts div, .facts div + div { padding-left: 0; border-left: 0; }
  .facts div + div { border-top: 1px solid var(--rule); }
  .chart { padding-left: 2.3rem; padding-right: 0.25rem; }
  .chart.tall { height: 17rem; }
  .excerpt, details.page { margin-left: 0; }
  th, td { padding-right: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header nav, .search, .demo-block, .toc, .hover, .theme { display: none !important; }
  body { font-size: 11pt; }
  a { color: inherit; }
  .site-footer { margin-top: 2rem; }
}
