/* ==========================================================================
   Public Health Facts — shared stylesheet
   Single stylesheet for the whole site. No build step, no framework.
   Design tokens live in :root; every page composes the same primitives.
   ========================================================================== */

:root {
  --bg:            #ffffff;
  --bg-sunken:     #f4f6f8;
  --bg-raised:     #ffffff;
  --surface-tint:  #eef4f5;
  --text:          #16202a;
  --text-muted:    #55636f;
  --text-faint:    #7b8894;
  --border:        #d8dee5;
  --border-strong: #b6c0cb;

  --brand:         #0f5b63;
  --brand-deep:    #093f45;
  --brand-light:   #e3f0f1;
  --accent:        #a2531c;
  --accent-light:  #fbf0e4;

  --good:          #1b6b3a;
  --good-light:    #e6f3ea;
  --warn:          #8a6100;
  --warn-light:    #fbf3df;
  --alert:         #9b2226;
  --alert-light:   #fbeaea;

  --radius:        6px;
  --radius-lg:     10px;
  --measure:       68ch;
  --shadow-sm:     0 1px 2px rgba(16, 32, 42, .06), 0 1px 3px rgba(16, 32, 42, .04);
  --shadow-md:     0 2px 4px rgba(16, 32, 42, .05), 0 8px 20px rgba(16, 32, 42, .07);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Public Sans",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #10161c;
    --bg-sunken:     #0b1015;
    --bg-raised:     #161e26;
    --surface-tint:  #16262a;
    --text:          #e6ecf1;
    --text-muted:    #a3b0bc;
    --text-faint:    #7d8b98;
    --border:        #2a353f;
    --border-strong: #3d4a56;

    --brand:         #6fc3cb;
    --brand-deep:    #a8dde3;
    --brand-light:   #163034;
    --accent:        #e0a165;
    --accent-light:  #2d2216;

    --good:          #6cc48c;
    --good-light:    #14291c;
    --warn:          #ddb554;
    --warn-light:    #2a2415;
    --alert:         #f08a8d;
    --alert-light:   #2c1719;

    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md:     0 2px 4px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
  }
}

/* Explicit theme overrides must beat the media query in both directions. */
:root[data-theme="light"] {
  --bg: #ffffff;          --bg-sunken: #f4f6f8;    --bg-raised: #ffffff;
  --surface-tint: #eef4f5;
  --text: #16202a;        --text-muted: #55636f;   --text-faint: #7b8894;
  --border: #d8dee5;      --border-strong: #b6c0cb;
  --brand: #0f5b63;       --brand-deep: #093f45;   --brand-light: #e3f0f1;
  --accent: #a2531c;      --accent-light: #fbf0e4;
  --good: #1b6b3a;        --good-light: #e6f3ea;
  --warn: #8a6100;        --warn-light: #fbf3df;
  --alert: #9b2226;       --alert-light: #fbeaea;
  --shadow-sm: 0 1px 2px rgba(16, 32, 42, .06), 0 1px 3px rgba(16, 32, 42, .04);
  --shadow-md: 0 2px 4px rgba(16, 32, 42, .05), 0 8px 20px rgba(16, 32, 42, .07);
}

:root[data-theme="dark"] {
  --bg: #10161c;          --bg-sunken: #0b1015;    --bg-raised: #161e26;
  --surface-tint: #16262a;
  --text: #e6ecf1;        --text-muted: #a3b0bc;   --text-faint: #7d8b98;
  --border: #2a353f;      --border-strong: #3d4a56;
  --brand: #6fc3cb;       --brand-deep: #a8dde3;   --brand-light: #163034;
  --accent: #e0a165;      --accent-light: #2d2216;
  --good: #6cc48c;        --good-light: #14291c;
  --warn: #ddb554;        --warn-light: #2a2415;
  --alert: #f08a8d;       --alert-light: #2c1719;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
}

/* --------------------------------------------------------------- reset -- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -.012em;
  margin: 0 0 .5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); letter-spacing: -.022em; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2rem); margin-top: 2.5rem; }
h3 { font-size: 1.1875rem; margin-top: 2rem; }
h4 { font-size: 1.0625rem; margin-top: 1.5rem; color: var(--text-muted); }

p, ul, ol { margin: 0 0 1.1em; }
p { max-width: var(--measure); }
li { margin-bottom: .4em; }
ul, ol { padding-left: 1.35em; max-width: var(--measure); }
li > ul, li > ol { margin-top: .4em; margin-bottom: .4em; }

strong { font-weight: 640; }
small { font-size: .875rem; }

a { color: var(--brand); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-deep); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .08em .34em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.wrap--narrow { max-width: 780px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------ banners -- */

.gov-notice {
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
  color: var(--text-muted);
  padding: .5rem 0;
}
.gov-notice p { margin: 0; max-width: none; }
.gov-notice strong { color: var(--text); }

/* -------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* Solid, not a translucent backdrop-filter: these pages are long and
     table-heavy, and compositing a blurred backdrop on every scroll frame is
     an expensive repaint for a barely visible effect. */
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand:hover { color: var(--text); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  flex: 0 0 auto;
}
@media (prefers-color-scheme: dark) { .brand-mark { color: #0b1015; } }
:root[data-theme="dark"] .brand-mark { color: #0b1015; }
:root[data-theme="light"] .brand-mark { color: #fff; }

.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name span:last-child {
  font-size: .6875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .02em;
}

.site-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  align-items: center;
}

.site-nav a {
  display: block;
  padding: .4rem .7rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 550;
  white-space: nowrap;
}
.site-nav a:hover { background: var(--bg-sunken); color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-light);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  width: 2.125rem;
  height: 2.125rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: .95rem;
  flex: 0 0 auto;
}
.theme-toggle:hover { background: var(--bg-sunken); color: var(--text); }

/* Inline SVG rather than moon/sun glyphs, whose font coverage is unreliable.
   Both icons ship in the markup; CSS picks the one matching the active theme,
   so the correct icon shows even before site.js runs. */
.theme-toggle svg { display: none; width: 1rem; height: 1rem; }
.theme-toggle .icon-moon { fill: currentColor; }
.theme-toggle .icon-sun {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-moon { display: none; }
  .theme-toggle .icon-sun  { display: block; }
}
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }

/* ---------------------------------------------------------------- hero -- */

.hero {
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.hero p.lede { font-size: 1.1875rem; color: var(--text-muted); max-width: 62ch; }

.page-head {
  padding: clamp(2rem, 5vw, 3.25rem) 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.page-head .eyebrow {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}
.page-head p.lede { font-size: 1.125rem; color: var(--text-muted); max-width: 66ch; }

main { padding-bottom: 4rem; }

/* --------------------------------------------------------------- cards -- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  margin: 1.75rem 0 2rem;
}

/* Exactly two columns, for grids of four cards — auto-fit would give 3+1. */
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 46rem) { .grid--2 { grid-template-columns: 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; font-size: 1.0625rem; }
.card p { margin-bottom: .75rem; color: var(--text-muted); font-size: .9375rem; }
.card > :last-child { margin-bottom: 0; }
/* Pin only a trailing call-to-action to the bottom. Applying this to any last
   child pushes body copy down whenever a sibling heading wraps to two lines. */
.card .more { margin-top: auto; padding-top: .35rem; }

a.card { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}
a.card .more { color: var(--brand); font-weight: 600; font-size: .875rem; }

.card-icon { font-size: 1.5rem; line-height: 1; margin-bottom: .75rem; }

/* --------------------------------------------------------------- boxes -- */

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  background: var(--surface-tint);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.25rem;
  margin: 1.75rem 0;
  max-width: var(--measure);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout h3, .callout h4 { margin-top: 0; font-size: 1rem; color: var(--text); }

.callout--good  { border-left-color: var(--good);  background: var(--good-light); }
.callout--warn  { border-left-color: var(--warn);  background: var(--warn-light); }
.callout--alert { border-left-color: var(--alert); background: var(--alert-light); }

.bottom-line {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: 1.25rem 1.4rem;
  margin: 2rem 0;
  max-width: var(--measure);
  box-shadow: var(--shadow-sm);
}
.bottom-line h3 {
  margin: 0 0 .5rem;
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.bottom-line > :last-child { margin-bottom: 0; }

/* -------------------------------------------------------------- tables -- */

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: .9375rem;
}

caption {
  caption-side: top;
  text-align: left;
  padding: .9rem 1rem .25rem;
  font-size: .875rem;
  color: var(--text-muted);
}

th, td {
  text-align: left;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  background: var(--bg-sunken);
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-sunken); }
td strong { white-space: nowrap; }

/* --------------------------------------------------------------- stats -- */

.stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  margin: 1.75rem 0 2.25rem;
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: 1.1rem 1.2rem;
}
.stat .num {
  display: block;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.stat .label { display: block; font-size: .875rem; color: var(--text-muted); margin-top: .35rem; }

/* --------------------------------------------------------------- pills -- */

.tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .03em;
  padding: .15rem .55rem;
  border-radius: 100px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.tag--good  { background: var(--good-light);  border-color: transparent; color: var(--good); }
.tag--warn  { background: var(--warn-light);  border-color: transparent; color: var(--warn); }
.tag--alert { background: var(--alert-light); border-color: transparent; color: var(--alert); }

/* ------------------------------------------------------------ accordion -- */

details.qa {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  margin-bottom: .75rem;
  max-width: var(--measure);
}
details.qa > summary {
  cursor: pointer;
  padding: .85rem 1.1rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
details.qa > summary::-webkit-details-marker { display: none; }
details.qa > summary::before {
  content: "+";
  color: var(--brand);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.35;
  flex: 0 0 auto;
}
details.qa[open] > summary::before { content: "\2212"; }
details.qa[open] > summary { border-bottom: 1px solid var(--border); }
details.qa .qa-body { padding: 1rem 1.1rem .4rem 2.5rem; }
details.qa .qa-body > :last-child { margin-bottom: 1rem; }

/* ---------------------------------------------------------- references -- */

.refs { font-size: .875rem; color: var(--text-muted); }
.refs ol { padding-left: 1.4em; }
.refs li { margin-bottom: .55em; }

.reviewed {
  font-size: .8125rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 2.5rem;
}

/* -------------------------------------------------------------- footer -- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 2.5rem 0 3rem;
  font-size: .9375rem;
}
.footer-grid {
  display: grid;
  gap: 1.75rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin-bottom: 2rem;
}
.site-footer h4 {
  margin: 0 0 .6rem;
  font-size: .75rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35em; }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-legal {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  color: var(--text-faint);
  font-size: .8125rem;
}
.footer-legal p { max-width: 78ch; }
.footer-legal > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- utility -- */

.center { text-align: center; }
.muted { color: var(--text-muted); }
.stack-lg > * + * { margin-top: 2rem; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: .65rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: .9375rem;
  border: 1px solid var(--brand);
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--brand-light); color: var(--brand-deep); }
@media (prefers-color-scheme: dark) { .btn { color: #0b1015; } .btn:hover { color: #0b1015; } }
:root[data-theme="dark"] .btn { color: #0b1015; }
:root[data-theme="dark"] .btn:hover { color: #0b1015; }
:root[data-theme="light"] .btn { color: #fff; }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-sunken);
  padding: 1.1rem 1.35rem;
  margin: 0 0 2.5rem;
  max-width: var(--measure);
}
.toc h2 {
  margin: 0 0 .6rem;
  font-size: .75rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.toc ul { margin: 0; padding-left: 1.2em; columns: 2; column-gap: 2rem; }
.toc li { margin-bottom: .3em; break-inside: avoid; }
@media (max-width: 34rem) { .toc ul { columns: 1; } }

@media print {
  .site-header, .site-footer, .theme-toggle, .skip-link { display: none; }
  body { font-size: 11pt; }
  details.qa { break-inside: avoid; }
  details.qa .qa-body { display: block !important; }
}
