/* birthinjuryanswers.org
   Mobile first. Calm, high contrast, WCAG 2.1 AA.
   No web fonts: a scared parent on a slow phone should not wait for type. */

:root {
  --ink: #16211f;
  --ink-soft: #43514e;
  --deep: #14453f;
  --deep-dark: #0d322e;
  --link: #0a5560;
  --link-visited: #4a3a72;
  --bg: #fbfaf8;
  --panel: #f1eee8;
  --panel-2: #e7f0ed;
  --line: #d8d3c9;
  --amber: #7a4a12;
  --amber-bg: #fdf5e6;
  --focus: #a4530a;
  --radius: 10px;
  --wrap: 74rem;
  --prose: 40rem;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 18px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-synthesis-weight: none;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.15rem; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--deep); color: #fff; padding: 0.75rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

a { color: var(--link); text-underline-offset: 2px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* ---------- header ---------- */
.site-head { background: var(--deep); color: #fff; border-bottom: 4px solid var(--deep-dark); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.06rem; letter-spacing: -0.01em; margin-right: auto; }
.brand:visited { color: #fff; }
.brand-mark { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #f6d9a8; box-shadow: inset 0 0 0 4px var(--deep); border: 2px solid #f6d9a8; flex: none; }
.nav-toggle {
  font: inherit; font-size: 0.95rem; background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,0.6); border-radius: 6px; padding: 0.35rem 0.7rem; cursor: pointer;
}
.site-nav { display: none; width: 100%; flex-direction: column; gap: 0.1rem; padding-bottom: 0.4rem; }
.site-nav.open { display: flex; }
.site-nav a { color: #fff; padding: 0.6rem 0.2rem; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.16); }
.site-nav a:hover, .site-nav a:focus { text-decoration: underline; }
.site-nav a[aria-current="page"] { font-weight: 700; }
.site-nav a:visited { color: #fff; }

@media (min-width: 56rem) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; flex-direction: row; width: auto; gap: 1.15rem; padding: 0; }
  .site-nav a { border: 0; padding: 0.25rem 0; }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 #f6d9a8; }
}

/* ---------- layout ---------- */
main { padding: 1rem 0 3rem; }
.page { max-width: var(--prose); }
.page > section, .page > .faq, .page > .related, .page > .sources, .page > .terms, .page > .icd { margin-top: 2.25rem; }

h1 { font-size: 1.72rem; line-height: 1.22; letter-spacing: -0.018em; margin: 0.4rem 0 0.6rem; color: var(--deep-dark); }
h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.012em; margin: 0 0 0.6rem; color: var(--deep-dark); }
h3 { font-size: 1.06rem; line-height: 1.35; margin: 1.5rem 0 0.4rem; color: var(--deep-dark); }
h4 { font-size: 0.97rem; margin: 1.2rem 0 0.3rem; color: var(--ink); }
p { margin: 0 0 0.95rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.35rem; }
li { margin-bottom: 0.4rem; }
strong { font-weight: 650; }

@media (min-width: 40rem) {
  body { font-size: 19px; }
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.42rem; }
}

.standfirst { font-size: 1.06rem; color: var(--ink-soft); margin-bottom: 1.1rem; }

.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin: 0.9rem 0 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.crumbs li + li::before { content: "› "; color: var(--line); }
.crumbs li { margin: 0; }

/* ---------- answer box ---------- */
.answer {
  background: var(--panel-2);
  border-left: 5px solid var(--deep);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.05rem 0.35rem;
  margin: 0 0 1.5rem;
}
.answer p { font-size: 1.05rem; }
.answer p:last-child { margin-bottom: 0.65rem; }

/* ---------- key facts ---------- */
.key-facts { background: var(--panel); border-radius: var(--radius); padding: 1.05rem 1.1rem 0.5rem; margin-bottom: 1.75rem; }
.key-facts h2 { font-size: 1.05rem; margin-bottom: 0.7rem; }
.key-facts dl { margin: 0; }
.fact { padding: 0.6rem 0; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; padding-top: 0; }
.fact dt { font-weight: 650; font-size: 0.92rem; color: var(--ink-soft); }
.fact dd { margin: 0.15rem 0 0; }

/* ---------- toc ---------- */
.toc { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem 0.5rem; margin-bottom: 1.9rem; background: #fff; }
.toc h2 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: 0.95rem; }

/* ---------- inline bits ---------- */
.cite { text-decoration: none; font-weight: 600; }
.cite sup { font-size: 0.7em; padding: 0 0.08em; }
.cite:focus-visible { outline-offset: 1px; }
a.term { text-decoration: underline dotted; text-decoration-thickness: 1.5px; }

.callout { background: var(--amber-bg); border: 1px solid #e6cfa4; border-left: 5px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0; padding: 0.85rem 1rem 0.05rem; margin: 1.25rem 0; }
.callout p { margin-bottom: 0.85rem; }

.table-wrap { overflow-x: auto; margin: 1.1rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; background: #fff; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--panel); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 650; }

/* ---------- faq, terms, sources ---------- */
.qa { border-top: 1px solid var(--line); padding-top: 0.9rem; margin-top: 0.9rem; }
.qa h3 { margin-top: 0; }

.term-list { margin: 0; }
.gterm { padding: 0.7rem 0; border-top: 1px solid var(--line); }
.gterm dt { font-weight: 650; }
.gterm dd { margin: 0.15rem 0 0; color: var(--ink-soft); }
.more-terms { margin-top: 1rem; font-size: 0.94rem; }

.source-list { font-size: 0.9rem; color: var(--ink-soft); padding-left: 1.4rem; }
.source-list li { margin-bottom: 0.65rem; }
.src-pub { color: var(--ink); font-weight: 600; }
.src-checked { display: block; font-size: 0.85em; }

.related-list { list-style: none; padding: 0; }
.related-list li { border-bottom: 1px solid var(--line); padding: 0.55rem 0; }
.rel-note { color: var(--ink-soft); font-size: 0.9rem; display: block; }

/* ---------- scope + stamp ---------- */
.scope { background: var(--panel); border-radius: var(--radius); padding: 0.9rem 1rem; margin-top: 2.25rem; font-size: 0.93rem; color: var(--ink-soft); }
.scope p { margin: 0; }
.page-stamp { margin-top: 1.1rem; font-size: 0.88rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 0.9rem; }
.page-stamp p { margin-bottom: 0.4rem; }

/* ---------- cards and grids ---------- */
.grid { display: grid; gap: 0.9rem; grid-template-columns: 1fr; margin: 1.25rem 0 2rem; padding: 0; list-style: none; }
@media (min-width: 42rem) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 62rem) { .grid.g3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.95rem 1rem; margin: 0; }
.card h3 { margin: 0 0 0.3rem; font-size: 1.02rem; }
.card p { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }
.card a { text-decoration: none; }
.card a:hover { text-decoration: underline; }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.wide { max-width: none; }
.wide .page { max-width: none; }

.lead-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.4rem 0 2rem; }
.btn {
  display: inline-block; background: var(--deep); color: #fff; text-decoration: none;
  padding: 0.7rem 1.05rem; border-radius: 8px; font-weight: 600; font-size: 0.97rem;
  border: 2px solid var(--deep); cursor: pointer; font-family: inherit;
}
.btn:visited { color: #fff; }
.btn:hover { background: var(--deep-dark); border-color: var(--deep-dark); }
.btn.secondary { background: #fff; color: var(--deep-dark); }
.btn.secondary:visited { color: var(--deep-dark); }
.btn.secondary:hover { background: var(--panel-2); }

/* ---------- tools ---------- */
.tool { max-width: 46rem; }
.tool fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0 0 1.15rem; background: #fff; }
.tool legend { font-weight: 650; padding: 0 0.4rem; }
.tool label { display: block; font-weight: 600; font-size: 0.95rem; margin: 0.85rem 0 0.25rem; }
.tool input[type="text"], .tool input[type="date"], .tool input[type="time"], .tool input[type="number"], .tool select, .tool textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.55rem 0.65rem;
  border: 1.5px solid #9aa5a2; border-radius: 7px; background: #fff; color: var(--ink);
}
.tool textarea { min-height: 5.5rem; resize: vertical; }
.tool input:focus-visible, .tool select:focus-visible, .tool textarea:focus-visible { border-color: var(--deep); }
.tool .hint { font-size: 0.88rem; color: var(--ink-soft); margin: 0.2rem 0 0; }
.tool .check { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.5rem 0; font-weight: 400; }
.tool .check input { margin-top: 0.35rem; flex: none; width: 1.05rem; height: 1.05rem; }
.privacy-badge {
  background: var(--panel-2); border: 1px solid #bcd4cd; border-radius: var(--radius);
  padding: 0.8rem 1rem; margin: 0 0 1.5rem; font-size: 0.93rem;
}
.privacy-badge p { margin: 0; }
.output { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-top: 1.25rem; }
.output:empty { display: none; }
.result-strong { font-weight: 650; color: var(--deep-dark); }
.letter { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; line-height: 1.55; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1rem; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
[hidden] { display: none !important; }
.bar { height: 0.7rem; background: var(--panel); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--deep); }

/* ---------- footer ---------- */
.site-foot { background: var(--deep-dark); color: #e8efed; padding: 2rem 0 2.5rem; margin-top: 2rem; font-size: 0.92rem; }
.site-foot a { color: #cfe3de; }
.site-foot a:visited { color: #cfe3de; }
.foot-lead { font-weight: 600; color: #fff; max-width: 40rem; }
.site-foot nav ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.15rem; margin: 1rem 0; }
.site-foot nav li { margin: 0; }
.foot-legal { color: #b9cbc6; max-width: 46rem; font-size: 0.87rem; }
.foot-copy { color: #96aca7; font-size: 0.85rem; margin: 0; }

/* ---------- diagrams ---------- */
figure.diagram { margin: 1.4rem 0 1.6rem; }
figure.diagram svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
figure.diagram figcaption { font-size: 0.9rem; color: var(--ink-soft); margin-top: 0.5rem; }

/* ---------- state grid ---------- */
.state-grid { gap: 0.55rem; }
.state-grid .card { padding: 0.65rem 0.8rem; }
.state-grid .card h3 { font-size: 0.98rem; margin: 0; }
.state-grid .card p { font-size: 0.82rem; margin-top: 0.15rem; }
@media (min-width: 42rem) { .state-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 62rem) { .state-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- tracker rows ---------- */
.tl-row, .th-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.85rem; margin-bottom: 0.7rem; background: #fff; }
.tl-row label, .th-row label { margin-top: 0.4rem; }
.tl-row .btn, .th-row .btn { margin-top: 0.6rem; font-size: 0.85rem; padding: 0.35rem 0.7rem; }
@media (min-width: 46rem) {
  .th-row { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 0.5rem; align-items: end; }
  .th-row .btn { margin-top: 0; }
}
#tl-prompts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
#tl-prompts li { margin: 0; }
#tl-prompts .btn { font-size: 0.83rem; padding: 0.35rem 0.7rem; text-align: left; font-weight: 500; }
.save-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.save-status { font-size: 0.88rem; color: var(--ink-soft); }

/* ---------- link lists ---------- */
.linklist { columns: 1; }
@media (min-width: 42rem) { .linklist { columns: 2; column-gap: 2rem; } }
@media (min-width: 62rem) { .linklist { columns: 3; } }
.linklist li { break-inside: avoid; }

/* ---------- printable packs ---------- */
.write-line { display: block; border-bottom: 1px solid var(--line); min-height: 1.6rem; margin: 0.35rem 0; }
.write-box { display: block; border: 1px solid var(--line); border-radius: 6px; min-height: 4.5rem; margin: 0.5rem 0; }
.print-only { display: none; }
.pack-page { border-top: 2px solid var(--line); padding-top: 1.25rem; margin-top: 2rem; }
.tickbox { list-style: none; padding-left: 0; }
.tickbox li { position: relative; padding-left: 1.9rem; margin-bottom: 0.65rem; }
.tickbox li::before {
  content: ""; position: absolute; left: 0; top: 0.25rem;
  width: 1.05rem; height: 1.05rem; border: 1.5px solid var(--ink-soft); border-radius: 3px;
}

/* ---------- index and hub layout ----------
   Prose stays at a readable measure. Card grids use the width they need. */
body.layout-index .page { max-width: 64rem; }
body.layout-index .page > h1,
body.layout-index .page > .standfirst,
body.layout-index .page > .answer,
body.layout-index .page > .key-facts,
body.layout-index .page > .toc,
body.layout-index .page > .faq,
body.layout-index .page > .terms,
body.layout-index .page > .sources,
body.layout-index .page > .related,
body.layout-index .page > .scope,
body.layout-index .page > .page-stamp { max-width: var(--prose); }
body.layout-index .page > section > p,
body.layout-index .page > section > ul:not(.grid):not(.linklist):not(.tickbox),
body.layout-index .page > section > ol,
body.layout-index .page > section > h2,
body.layout-index .page > section > h3,
body.layout-index .page > section > .callout { max-width: var(--prose); }
@media (min-width: 62rem) {
  body.layout-index .grid { grid-template-columns: repeat(3, 1fr); }
  body.layout-index .grid.g3 { grid-template-columns: repeat(3, 1fr); }
}
