:root {
  --bg: #f7f7f5; --panel: #ffffff; --text: #1d1d1b; --muted: #6b6b66; --line: #e3e2dc;
  --accent: #2f5d8a; --accent-soft: #e6eef6; --warn: #a2461b; --warn-soft: #fbeee6; --ok: #2e7d4f;
  --k-registered: #8a8a84; --k-vaccination: #2f5d8a; --k-response: #7a4ea3; --k-report: #b5651d;
  --k-case: #b5651d; --k-call: #c08a2b; --k-success: #2e7d4f; --k-pregnancy: #b0407a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --panel: #1f1f1d; --text: #e8e7e2; --muted: #9b9a93; --line: #34332f;
    --accent: #7fb0e0; --accent-soft: #23303d; --warn: #f0a07a; --warn-soft: #3a2a21; --ok: #74c69a;
    --k-registered: #9b9a93; --k-vaccination: #7fb0e0; --k-response: #b896dc; --k-report: #e3a066;
    --k-case: #e3a066; --k-call: #e6c06f; --k-success: #74c69a; --k-pregnancy: #e48ab8;
  }
}
/* Inter (variable) for text and headings, Instrument Serif for the home page headline; Latin subsets self-hosted from static/fonts; licences there */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/inter-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap; src: url(/static/fonts/inter-latin-wght-italic.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 300 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
table, .tile .v { font-variant-numeric: tabular-nums; }   /* digits line up in columns */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; gap: 20px; align-items: center; padding: 10px 20px; background: var(--panel);
          border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); }
.topbar nav { display: flex; gap: 14px; }
.topbar nav a { color: var(--muted); }
.topbar nav a.on { color: var(--text); font-weight: 600; }
.quick { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.quick input { width: 300px; max-width: 100%; }
.quick-adv { color: var(--accent); white-space: nowrap; }   /* pale blue on the dark home page, darker blue on white pages */
.quick-icon { vertical-align: -4px; margin-right: 5px; }
.quick-adv:hover, .quick-adv.on { text-decoration: underline; }
.quick-adv.on { font-weight: 600; }
main { max-width: 1280px; margin: 0 auto; padding: 36px 16px 60px; }
h1 { font-size: 50px; font-weight: 250; line-height: 1.2; letter-spacing: -0.05em; margin: 0 0 8px; }
@media (max-width: 640px) { h1 { font-size: 36px; } }
.h1-half { font-size: 25px; font-weight: 250; line-height: 1.2; letter-spacing: -0.05em; margin: 0 0 6px; }   /* the h1 look at half its size */
@media (max-width: 640px) { .h1-half { font-size: 18px; } }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
/* small gray text stays at 400: Light (300) is too faint at 11-12px */
.small, .tile .l, .timeline .extra, .filters label, .meddra-pick, .suggest .suggest-head, .brand-by { font-weight: 400; }
input, select, button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line);
                        border-radius: 6px; padding: 6px 9px; }
button, .btn { cursor: pointer; background: var(--accent); color: #fff; border-color: var(--accent); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.grid .panel { margin: 0; }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 800px) { .grid.halves { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* "Show the numbers" under each chart */
.chart-data { margin: 8px 0 0; font-size: 12px; }
.chart-data summary { cursor: pointer; color: var(--muted); font-weight: 400; }
.chart-data table { margin-top: 6px; }
.chart-data th[scope="row"] { font-weight: 400; text-align: left; }
.scroll { overflow-x: auto; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft);
        color: var(--accent); margin: 0 4px 4px 0; white-space: nowrap; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 560px; }

/* case page */
.case-head { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.case-head dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; }
.case-head dt { color: var(--muted); }
.case-head dd { margin: 0; }
.case-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1000px) { .case-layout { grid-template-columns: 1fr; } }
.tl-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.tl-filter label { display: flex; gap: 4px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 12px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.timeline li[hidden] { display: none; }   /* the grid above would otherwise override the hidden attribute (timeline filters) */
.timeline .date { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.timeline .title { font-weight: 600; }
.timeline .detail { color: var(--text); }
.timeline .extra { color: var(--muted); font-size: 12px; }
li[data-kind=registered] .dot { background: var(--k-registered); }
li[data-kind=vaccination] .dot { background: var(--k-vaccination); }
li[data-kind=response] .dot { background: var(--k-response); }
li[data-kind=report] .dot, li[data-kind=case] .dot { background: var(--k-report); }
li[data-kind=call] .dot { background: var(--k-call); }
li[data-kind=success] .dot { background: var(--k-success); }
li[data-kind=pregnancy] .dot { background: var(--k-pregnancy); }
.mark-yes { color: var(--ok); font-weight: 700; }
.mark-inactive { color: var(--muted); }
.free-text { white-space: pre-wrap; }

/* search */
.filters { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters .checks { display: flex; flex-wrap: wrap; gap: 6px 14px; flex-direction: row; color: var(--text); font-size: 13px; }
.filters .checks label { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }
.filters > .checks { grid-column: 1 / -1; padding: 10px 0; }
.filters .filter-text { grid-column: 1 / -1; color: var(--text); font-size: 14px; font-weight: 600; }
.filters .filter-text input { padding: 11px 14px; font-size: 16px; font-weight: 400; }
.filters .topics { grid-column: 1 / -1; margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 6px; }
.filters .topics legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.filters .topics p { margin: 0 0 8px; }
.filters .demographics { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.error { color: var(--warn); }
/* error page (404, 429, 500, 503): photo beside the text, stacked on narrow screens */
.error-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 24px; }
main:has(> .error-page) { display: flex; flex-direction: column; justify-content: center; padding-bottom: 36px; }   /* box centered between menu bar and footer */
.error-page { width: 100%; }
.error-photo { display: block; width: 100%; height: auto; border-radius: 8px; }
.error-text h1 { margin-bottom: 12px; }
.error-lede { font-size: 18px; margin: 0 0 14px; max-width: 34ch; }
.error-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
@media (max-width: 760px) { .error-page { grid-template-columns: 1fr; gap: 20px; padding: 16px; } }

/* modal */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(900px, 94vw); max-height: 86vh;
         background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
              border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); font-weight: 600; }
.modal-head .close { background: none; color: var(--text); border: none; font-size: 22px; line-height: 1; padding: 0 4px; }
#modal-body { padding: 14px 16px 18px; overflow: auto; }
#modal-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0 0 10px; }
#modal-body dt { color: var(--muted); }
#modal-body dd { margin: 0; }
td a, .timeline .date { white-space: nowrap; }

/* search pagination */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 12px; }
.pager a, .pager span { padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; min-width: 34px; text-align: center; }
.pager .cur { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pager .off { color: var(--muted); opacity: .5; }
.pager .gap { border: none; min-width: 0; padding: 3px 2px; color: var(--muted); }

/* search: MedDRA term picker and age range */
.meddra-pick { position: relative; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.meddra-pick .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.pick { display: inline-flex; align-items: center; gap: 2px; margin: 0; font-size: 12px; }
.chip.pick .x { background: none; border: none; color: inherit; padding: 0 2px; cursor: pointer; font-size: 14px; line-height: 1; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--panel); border: 1px solid var(--line);
           border-radius: 8px; max-height: 320px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.suggest .suggest-head { padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; position: sticky; top: 0; background: var(--panel); }
.suggest .opt { padding: 6px 10px; cursor: pointer; color: var(--text); font-size: 13px; }
.suggest .opt:hover { background: var(--accent-soft); }
.linkish { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; }
.filters .pair { display: flex; gap: 6px; }
.filters .pair select { flex: 1; min-width: 0; }
/* tab links (pregnancy page box) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tabs a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* pregnancy page: one large chart per row */
.panel.stat { margin-top: 16px; }
.panel.stat h2 { margin-top: 0; }
.chart-box.big { height: 440px; }
/* two charts side by side, stacked on narrow screens */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pair .panel.stat { margin-top: 16px; min-width: 0; }
@media (max-width: 900px) { .pair { grid-template-columns: 1fr; } }
/* registrant page: possible VAERS reports */
.vaers-banner { border-left: 4px solid var(--accent); }
.chip.conf-high { background: #2e7d4f; color: #fff; border-color: #2e7d4f; }
.btn-link { display: inline-block; padding: 7px 14px; border-radius: 6px; background: var(--accent); color: var(--panel); font-weight: 600; }
.btn-link:hover, .btn-link:focus-visible { text-decoration: none; opacity: .9; }
.btn-link .btn-icon { vertical-align: -2px; margin-right: 2px; }
.chip.conf-medium { background: #c08a2b; color: #fff; border-color: #c08a2b; }
/* links that leave the viewer */
a.offsite { white-space: nowrap; }
a.offsite svg { margin-left: 4px; vertical-align: -1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* top-bar menu: a row of links on wide screens; below 1080px it folds behind the hamburger button */
.topbar-menu { display: contents; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); padding: 6px 8px; line-height: 0; }
@media (max-width: 1080px) {
  .menu-toggle { display: block; margin-left: auto; }
  .topbar-menu { display: none; flex-basis: 100%; flex-direction: column; gap: 10px; padding: 4px 0 6px; }
  .topbar-menu.open { display: flex; }
  .topbar nav { flex-direction: column; gap: 0; }
  .topbar nav a { padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
  .quick { margin-left: 0; }
  .quick input { display: none; }   /* the hamburger menu keeps only the Advanced search link */
  .quick-adv { padding: 10px 2px; font-size: 15px; }
}
/* shared footer: olive green, kept at the bottom of the window on short pages */
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.site-footer { --olive: #262624; background: var(--olive); color: #ecebe6; margin-top: 24px; }
.site-footer .footer-inner { padding: 28px 20px 32px; box-sizing: border-box;   /* full width, like the top bar */
                             display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 32px 48px; align-items: start; }
.site-footer .footer-title { font-weight: 650; font-size: 15px; margin-bottom: 8px; color: #fff; }
.site-footer p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #e4e7d6; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: #fff; }
.site-footer nav a { font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.4); }
.site-footer nav a:hover { text-decoration-color: #fff; }
.site-footer .footer-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 36px; margin-top: 4px; }
.site-footer .footer-logos img { display: block; height: 40px; width: auto; max-width: 100%; }
.site-footer .footer-logos a:hover img, .site-footer .footer-logos a:focus-visible img { opacity: .85; }
.site-footer .footer-ack { margin-top: 18px; font-size: .9em; }
@media (max-width: 1000px) { .site-footer .footer-inner { grid-template-columns: 1fr 1fr; } .site-footer .footer-book { grid-column: 1 / -1; grid-row: 1; } }
@media (max-width: 760px) { .site-footer .footer-inner { grid-template-columns: 1fr; } .site-footer .footer-logos img { height: 32px; } }
/* OpenVSafe logo with the "by OpenVAERS" credit: dark mode lightens "Open"; the footer copy is all white */
.brand-wrap { display: flex; flex-direction: column; line-height: 1.1; }
.brand img { display: block; height: 29px; width: auto; }
.site-footer .footer-logo { display: block; height: 35px; width: auto; margin-bottom: 4px; }
.brand-by { font-size: 11px; color: var(--muted); }
.brand-by:hover { color: var(--accent); }
.site-footer .footer-project { color: #fff; font-weight: 600; }
.site-footer .footer-project a { text-decoration: underline; text-underline-offset: 3px; }
.site-footer .footer-bottom { border-top: 1px solid rgba(255,255,255,.18); padding: 12px 20px 16px;
                              box-sizing: border-box; font-size: 12px; color: #d9dcc9; }
.site-footer .footer-disclaimer { margin: 0 0 6px; }
.site-footer .footer-legal { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.site-footer .footer-version { font-size: 11px; color: #8f8f89; }   /* easy to miss, but still 4.5:1 on the footer */
/* footer: Cries for Help book box */
.site-footer .footer-book { display: flex; gap: 18px; align-items: flex-start; background: rgba(0,0,0,.18);
                            border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: 16px; }
.site-footer .book-cover img { display: block; width: 96px; height: auto; border-radius: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.site-footer .book-sub { font-style: italic; color: #f3f4ec; margin-bottom: 8px; }
.site-footer .btn-download { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 6px;
                             background: #f3f4ec; color: #2f3b19; font-weight: 650; font-size: 14px; }
.site-footer .btn-download:hover, .site-footer .btn-download:focus-visible { background: #fff; }
.site-footer .btn-download { flex-wrap: wrap; row-gap: 2px; }
.site-footer .btn-download .dl-text { white-space: nowrap; }
.site-footer .book-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.site-footer .book-meta { margin: 6px 0 0; font-size: 12px; opacity: .75; }
.site-footer .btn-buy { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,.5);
                        color: #f3f4ec; font-weight: 650; font-size: 14px; white-space: nowrap; text-decoration: none; }
.site-footer .btn-buy:hover, .site-footer .btn-buy:focus-visible { background: rgba(255,255,255,.1); border-color: #fff; }
@media (max-width: 420px) { .site-footer .footer-book { flex-direction: column; } }
/* pregnancy page: narrow stats panel beside a chart */
.pair.pair-narrow { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 900px) { .pair.pair-narrow { grid-template-columns: 1fr; } }
.pair-narrow .tiles { grid-template-columns: 1fr; }

/* Analysis articles */
.article-card { display: block; color: inherit; text-decoration: none; }
.article-card:hover, .article-card:focus-visible { border-color: var(--accent); }
.article-card h3 { margin: 0 0 4px; font-size: 16px; color: var(--accent); }
/* Analysis page: our work and Aravind's on the left, published papers on the right */
.top-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 8px; }
@media (max-width: 900px) { .top-boxes { grid-template-columns: 1fr; } }
.top-box { display: flex; flex-direction: column; margin: 0; }
.top-box-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.top-box h2 { font-size: 17px; margin: 0 0 8px; color: var(--accent); }
.top-box p { margin: 0 0 8px; }
.top-box .top-box-btn { display: flex; flex-wrap: wrap; gap: 8px; margin: auto 0 0; padding-top: 8px; }   /* buttons line up along the bottom */
.analysis-section { margin: 28px 0 8px; }
.analysis-section > h2 { font-size: 20px; margin: 0 0 4px; }
.analysis-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; align-items: start; }
@media (max-width: 900px) { .analysis-cols { grid-template-columns: 1fr; } }
.analysis-sub { margin: 14px 0 8px; }
.analysis-sub + .analysis-sub { margin-top: 28px; }   /* a second analyst in the same column */
.analysis-sub > h3 { font-size: 16px; margin: 0 0 4px; }
.analysis-section > .muted { margin: 0 0 12px; max-width: 70ch; }
.link-list { list-style: none; padding: 4px 16px; margin-bottom: 8px; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border-bottom: 0; }
.link-list li > span { display: block; margin-top: 2px; }
.link-list li > p { margin: 4px 0 0; }
.link-list li > .link-debunk { display: inline-block; margin-top: 4px; font-weight: 600; }
.link-more { margin: 0 0 4px; font-weight: 600; }
.analysis-section > .link-empty { font-style: italic; max-width: none; margin: 0; }
.article-card p { margin: 0 0 4px; }
.prose { margin: 0 0 16px; padding: 28px 32px; font-size: 17px; line-height: 1.65; }
.prose h1 { margin: 4px 0 10px; }
.prose .dek { font-size: 19px; color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; }
.prose h3 { font-size: 18px; margin: 24px 0 6px; }
.prose img { display: block; width: 100%; height: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: 6px; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.prose li { margin-bottom: 4px; }
.prose a { overflow-wrap: anywhere; }
.prose .btn-download { display: inline-block; padding: 7px 14px; border-radius: 6px; background: var(--accent); color: var(--panel); font-size: 14px; font-weight: 600; text-decoration: none; }
.prose .btn-download:hover, .prose .btn-download:focus-visible { opacity: .9; }
@media (max-width: 760px) { .prose { padding: 20px 16px; font-size: 16px; } }

/* Home page: always dark, a large free-text search box over faint scrolling quotes from the free text */
body.page-dark { --bg: #0f0f0e; --panel: #1a1a18; --text: #ecebe6; --muted: #9b9a93; --line: #2e2d2a;
                 --accent: #9cc3e8; --accent-soft: #23303d; color-scheme: dark; }
body.page-dark main { max-width: none; padding: 0; }
body.page-dark .topbar nav a:not(.on) { color: #cdccc2; }   /* brighter here so the menu stands out from the moving quotes */
body.page-dark .site-footer { margin-top: 0; }
.home-hero { position: relative; overflow: hidden; min-height: calc(100vh - 58px); display: grid; place-items: center;
             padding: 48px 16px 64px; isolation: isolate; }
.home-quotes { position: absolute; inset: -40px 0; z-index: -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 36px;
               padding: 0 12px; pointer-events: none; user-select: none;
               -webkit-mask-image: radial-gradient(ellipse 52% 46% at 50% 50%, transparent 0, transparent 30%, rgba(0,0,0,.2) 60%, #000 100%);
               mask-image: radial-gradient(ellipse 52% 46% at 50% 50%, transparent 0, transparent 30%, rgba(0,0,0,.2) 60%, #000 100%); }
.home-quotes .qcol { overflow: hidden; }
.home-quotes .qtrack { animation: home-drift 160s linear infinite; }
.home-quotes .qcol:nth-child(even) .qtrack { animation-direction: reverse; animation-duration: 190s; }
.home-quotes .qcol:nth-child(3) .qtrack { animation-duration: 220s; }
.home-quotes p { margin: 0 0 28px; color: #7a7872; font: italic 17px/1.5 Georgia, "Times New Roman", serif; }
.home-quotes .qcol:nth-child(odd) p { color: #666560; }
@keyframes home-drift { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) { .home-quotes .qtrack { animation: none; } }
@media (max-width: 1100px) { .home-quotes { grid-template-columns: repeat(3, 1fr); } .home-quotes .qcol:nth-child(n+4) { display: none; } }
@media (max-width: 640px) { .home-quotes { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 0 12px; }
                            .home-quotes .qcol:nth-child(n+3) { display: none; } .home-quotes p { font-size: 15px; }
                            .home-quotes { opacity: .45; } }   /* the center text fills a phone, so the quotes run behind it */

.home-center { width: min(760px, 100%); text-align: center; }
.home-eyebrow { margin: 0 0 10px; color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.home-center h1 { margin: 0 0 28px; font: 400 clamp(42px, 7vw, 76px)/1.02 "Instrument Serif", Georgia, serif;
                  letter-spacing: -.01em; color: #f5f4ef; }
.home-search { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 16px;
               background: rgba(26,26,24,.92); border: 1px solid #3a3935; box-shadow: 0 18px 60px rgba(0,0,0,.6);
               backdrop-filter: blur(6px); }
.home-search:focus-within { border-color: var(--accent); }
.home-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 14px 16px; font-size: 21px; outline: none; }
.home-search input::placeholder { color: #75746e; }
.home-search button { padding: 14px 26px; border-radius: 10px; font-size: 17px; font-weight: 650;
                      background: #ecebe6; color: #141413; border-color: #ecebe6; }
.home-search button:hover, .home-search button:focus-visible { background: #fff; }
.home-examples { margin: 18px 0 0; color: var(--muted); font-size: 14px; }
.home-examples a { display: inline-block; margin: 4px 0 0 8px; padding: 3px 12px; border: 1px solid #3a3935; border-radius: 999px;
                   color: var(--text); background: rgba(15,15,14,.7); }
.home-examples a:hover, .home-examples a:focus-visible { border-color: var(--accent); text-decoration: none; }
.home-figures { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; margin: 36px 0 0; padding: 0;
                color: var(--muted); font-size: 14px; }
.home-figures b { color: var(--text); font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; margin-right: 2px; }
.home-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: 18px 0 0; font-size: 14px; }
@media (max-width: 640px) { .home-search { flex-direction: column; align-items: stretch; }
                            .home-search input { font-size: 18px; padding: 12px; } .home-search button { width: 100%; } }
.nowrap { white-space: nowrap; }
/* footer: charcoal grey (was olive), with neutral (not green-tinted) text */
body.page-dark .site-footer { border-top: 1px solid #34332f; }
.site-footer p { color: #b9b8b1; }
.site-footer .book-sub { color: #d6d5cf; }
.site-footer .footer-book { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); }
.site-footer .btn-download { background: #ecebe6; color: #1a1a18; }
.site-footer .btn-download:hover, .site-footer .btn-download:focus-visible { background: #fff; }
.site-footer .footer-bottom { border-top-color: rgba(255,255,255,.1); color: #9b9a93; }
/* home page: scrolling past the end (macOS bounce) shows charcoal to match the footer, not black */
html:has(body.page-dark) { background: #262624; }

/* About and data dictionary */
.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 20px; font-size: 13px; line-height: 1.4; }
.toc a { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; }
.toc a:hover, .toc a:focus-visible { border-color: var(--accent); text-decoration: none; }
.prose .toc { margin-top: 8px; }
.prose code, .dict code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
[id] { scroll-margin-top: 80px; }
.doc-page { margin: 0; }
.doc-page > h1 { margin-bottom: 6px; }
.doc-page > .muted { margin: 0 0 14px; max-width: 70ch; }
.dict h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 18px; margin: 0 0 6px; }
.dict h2 .count { font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.dict > p { margin: 0 0 10px; max-width: 75ch; }
.dict td:first-child { white-space: nowrap; font-weight: 600; width: 1%; padding-right: 20px; }
@media (max-width: 640px) { .dict td:first-child { white-space: normal; width: 34%; } }
.prose table { font-size: 15px; line-height: 1.45; margin: 16px 0 20px; }
.prose th { font-size: 13px; }
/* search results: sortable column headings */
th.sortable a { color: inherit; text-decoration: none; white-space: nowrap; }
th.sortable a:hover { color: var(--accent); }
th.sortable .arrow { display: inline-block; width: 1em; font-size: .75em; color: var(--accent); text-align: center; }
th.sortable .arrow.off { color: var(--muted); opacity: .55; }
th.sortable a:hover .arrow.off { opacity: 1; color: var(--accent); }
/* search results: "Per page" choice beside the result count */
.pager-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 12px; }
.pager-row .pager { margin: 0; }
.per-page { margin: 0 0 0 auto; color: var(--muted); }
.per-page label { display: flex; align-items: center; gap: 6px; }
.per-page select { width: auto; padding: 2px 6px; font-size: inherit; }
.chip.died { background: #2f2f2c; color: #fff; border-color: #2f2f2c; }
/* registrant page: free-text entries that report the person's death */
.ft-died { border-left: 4px solid #2f2f2c; background: #f3f2ee; padding: 8px 12px; margin: 4px 0; border-radius: 0 6px 6px 0; }
.ft-died-label { margin: 0 0 4px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: #2f2f2c; }
@media (prefers-color-scheme: dark) { .ft-died { background: rgba(255,255,255,.06); border-left-color: #ecebe6; } .ft-died-label { color: #ecebe6; } }
/* registrant page: "Died" flag at the right of the top box */
.died-flag { margin-left: auto; align-self: flex-start; display: inline-flex; flex-direction: column; align-items: center; padding: 6px 14px;
             border-radius: 8px; background: #2f2f2c; color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; line-height: 1.2; }
.died-flag span { font-weight: 400; font-size: 11px; opacity: .8; }
.died-flag:hover { background: #000; color: #fff; }
/* case page: show/hide boxes, and reflow what's left */
.box-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.box-toggles .show-all { font-size: inherit; font-weight: 600; }
.box-toggles label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.case-layout [data-box][hidden], .case-layout[hidden] { display: none; }
.case-layout.no-side { grid-template-columns: minmax(0, 1fr); }
.case-layout.no-timeline { grid-template-columns: minmax(0, 1fr); }
.case-layout.no-timeline > .case-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 16px; align-items: start; }
/* Spinner while a slow page or popup loads (app.js) */
.spinner { flex: none; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
           animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
#busy { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; gap: 10px; align-items: center;
        width: max-content; max-width: calc(100vw - 32px); padding: 10px 16px; background: var(--panel); color: var(--text);
        border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.18); font-weight: 500; }
#busy[hidden] { display: none; }
.loading { display: flex; gap: 10px; align-items: center; margin: 0; color: var(--muted); }

/* First-visit welcome on the home page */
.tour-tab { position: absolute; top: 0; right: 16px; z-index: 5; padding: 4px 12px 5px; border: 1px solid #34332f; border-top: 0; border-radius: 0 0 6px 6px; background: #1a1a18;
  color: #cdccc2; font-size: 12px; cursor: pointer; }
.tour-tab:hover, .tour-tab:focus-visible { border-color: #ff7a3d; color: #fff; }
.tour { --tour: #ff7a3d; position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.tour[hidden] { display: none; }
.tour-lines { position: absolute; top: 0; left: 0; width: 100%; overflow: visible; }
.tour-line { fill: none; stroke: var(--tour); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: tour-draw 1.1s ease-in-out forwards; }
.tour-head { fill: none; stroke: var(--tour); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; animation: tour-in .2s forwards; }
.tour-note { position: absolute; padding: 10px 28px 10px 14px; border: 1px solid var(--tour); border-radius: 10px; background: #161615; color: #e8e7e2; font-size: 14px; line-height: 1.45;
  opacity: 0; animation: tour-in .9s ease-out forwards; }
.tour-note b { color: var(--tour); font-weight: 650; }
.tour-x { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: #9b9a93; font-size: 18px; line-height: 1;
  cursor: pointer; pointer-events: auto; }
.tour-x:hover, .tour-x:focus-visible { background: #34332f; color: #fff; }
.tour-gone { animation: tour-out .8s ease-in forwards !important; }
.tour-settled .tour-note, .tour-settled .tour-head { animation: none; opacity: 1; }
.tour-settled .tour-line { animation: none; stroke-dashoffset: 0; }
.tour-welcome { width: min(470px, calc(100vw - 24px)); box-sizing: border-box; text-align: center; }
.tour-side { width: 200px; box-sizing: border-box; }
.tour-tap, .tour-narrow .tour-side { display: none; }
.tour-narrow .tour-replay { display: block; width: 170px; }
.tour-narrow .tour-tap, .tour-narrow .tour-tap:hover { display: block; margin-top: 2px; color: var(--tour); text-decoration: none; pointer-events: auto; }
@keyframes tour-draw { to { stroke-dashoffset: 0; } }
@keyframes tour-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tour-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tour-note, .tour-head { animation: none; opacity: 1; } .tour-line { animation: none; stroke-dashoffset: 0; } }

/* The ICAN feature on the stats page: dark in every theme, because the logo's lettering is white */
.ican-feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: center; margin: 24px 0; padding: 32px; border-radius: 12px; background: #161615; color: #e8e7e2; }
.ican-feature h2 { margin: 0 0 10px; color: #fff; font: 400 32px/1.15 "Instrument Serif", Georgia, serif; }
.ican-feature p { margin: 0 0 16px; line-height: 1.55; }
.ican-logo { display: block; }
.ican-logo img { display: block; width: 100%; height: auto; }
.ican-btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 6px; background: #f78f1e; color: #161615; font-weight: 650; }
.ican-btn:hover, .ican-btn:focus-visible { background: #ffa640; text-decoration: none; }
.tile-link { display: block; color: inherit; }
.tile-link:hover, .tile-link:focus-visible { border-color: var(--accent); text-decoration: none; }
@media (max-width: 800px) { .ican-feature { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px; } .ican-feature h2 { font-size: 28px; } .ican-logo { max-width: 320px; } }

/* Stats page: room between sections */
.stats-page > h1 { margin-bottom: 24px; }
.stats-page > h2 { margin-top: 48px; }
.stats-page > .ican-feature { margin: 48px 0; }
.stats-page > .grid { margin-top: 48px; }
.stats-page > .tiles { margin-bottom: 0; }
@media (max-width: 640px) { .stats-page > h2 { margin-top: 36px; } .stats-page > .ican-feature { margin: 36px 0; } .stats-page > .grid { margin-top: 36px; } }

/* Story wall: the page runs the full width of the window, edge to edge */
main:has(> #wall) { max-width: none; padding-left: 24px; padding-right: 24px; }
.wall-title { text-align: center; }
.wall-lede { max-width: 760px; margin: 0 auto 24px; text-align: center; }
.wall-filters { display: grid; gap: 10px 16px; grid-template-columns: 2fr repeat(3, 1fr) auto; align-items: end; }
.wall-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.wall-buttons { display: flex; gap: 14px; align-items: center; }
.wall-shuffle { white-space: nowrap; }
.wall { columns: 320px; column-gap: 24px; }
.wall.wall-js { columns: auto; display: flex; gap: 24px; align-items: flex-start; }
.wall-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.story { break-inside: avoid; margin: 0 0 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.wall-js .story { margin: 0; }
.story { transition: border-color .15s, box-shadow .15s, background-color .15s; }
.story:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--panel));
               box-shadow: 0 4px 14px rgb(0 0 0 / 7%); }
@media (prefers-reduced-motion: reduce) { .story { transition: none; } }
.story header { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; margin-bottom: 8px; }
.story-title { margin: 0 0 6px; font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.story-code { font-weight: 600; font-variant-numeric: tabular-nums; }
.story-meta { color: var(--muted); font-size: 13px; }
.story p { margin: 0 0 8px; line-height: 1.5; overflow-wrap: anywhere; }
.story p:last-child { margin-bottom: 0; }
.wall-fade { position: fixed; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none; z-index: 2;
             background: linear-gradient(to bottom, transparent, var(--bg)); opacity: 0; transition: opacity .3s; }
.wall-fade.on { opacity: 1; }
.wall-more[hidden] { display: none; }
.wall-more { display: block; width: max-content; margin: 20px auto 0; padding: 8px 18px; border-radius: 6px; color: #fff; }
@media (max-width: 760px) {
  main:has(> #wall) { padding-left: 16px; padding-right: 16px; }
  .wall.wall-js, .wall-col { gap: 16px; }
  .wall-filters { grid-template-columns: 1fr 1fr; }
  .wall-text, .wall-buttons { grid-column: 1 / -1; }
}

/* Share button on story cards, the share box, and a story's own page */
.story-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.story-share { background: none; border: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 3px 12px; border-radius: 999px; }
.story-share:hover, .story-share:focus-visible { color: var(--accent); border-color: var(--accent); }
.share-box { width: min(560px, 94vw); }
.share-body { padding: 16px; }
.share-picture { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; background: #0f0f0e; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.share-actions button, .share-actions .btn-link { padding: 7px 16px; border-radius: 6px; font-weight: 600; }
.share-copy { background: var(--panel); color: var(--accent); }
.share-note { font-size: 13px; margin: 12px 0 0; }
.story-back { margin: 0 0 16px; }
.story-single { max-width: 760px; margin: 0 auto; }
.story-single .story p { font-size: 17px; }
.story-more { max-width: 760px; margin: 20px auto 0; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
