/* earlysignsautism.com — shared styles */

:root {
  --ink: #1c2b3a;
  --ink-soft: #46586c;
  --bg: #f9fbfd;
  --surface: #ffffff;
  --brand: #1a5fb4;
  --brand-dark: #12477e;
  --brand-soft: #e8f1fa;
  --accent: #b45309;
  --accent-soft: #fdf2e3;
  --line: #dde5ee;
  --radius: 10px;
  --max-w: 72rem;
  --content-w: 46rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

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

a { color: var(--brand-dark); }
a:hover { color: var(--brand); }

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--ink);
  font-weight: 700;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }

p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: 0.4rem; }

/* Header & nav */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand span { color: var(--brand); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--brand-dark); }
.site-nav a[aria-current="page"] {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* Layout */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.content { max-width: var(--content-w); margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--brand-soft), var(--bg));
  border-bottom: 1px solid var(--line);
}
.hero .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 3rem;
  text-align: center;
}
.hero p.lede {
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: 44rem;
  margin: 0 auto 1.75rem;
}
.hero .actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--brand-dark); border: 1.5px solid var(--brand); }

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
  margin: 2rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover {
  box-shadow: 0 6px 18px rgba(26, 95, 180, 0.14);
  transform: translateY(-2px);
  color: inherit;
}
.card h3 { margin: 0 0 0.4rem; color: var(--brand-dark); }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

/* Callouts */
.callout {
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.callout.warn {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 0.25rem; }

/* Age sections */
.age-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem 1.1rem;
  margin: 1.5rem 0;
}
.age-block h2, .age-block h3 { margin-top: 0; }
.age-tag {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Checklist */
ul.signs { list-style: none; padding-left: 0; }
ul.signs li {
  padding-left: 1.7rem;
  position: relative;
  margin-bottom: 0.55rem;
}
ul.signs li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--brand);
  border-radius: 4px;
}

/* Steps */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3.2rem;
  margin-bottom: 1.6rem;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
ol.steps h3 { margin: 0 0 0.35rem; }

/* Myth/fact */
.myth {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  margin: 1.25rem 0;
}
.myth .label-myth, .myth .label-fact {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}
.myth .label-myth { color: var(--accent); }
.myth .label-fact { color: var(--brand-dark); }
.myth p { margin: 0.3rem 0 0.9rem; }
.myth p:last-child { margin-bottom: 0; }

/* FAQ */
details.faq {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  margin: 0.75rem 0;
  overflow: hidden;
}
details.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 1rem 1.25rem;
  list-style: none;
  position: relative;
  padding-right: 2.75rem;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--brand);
}
details.faq[open] summary::after { content: "–"; }
details.faq .answer { padding: 0 1.25rem 1.1rem; color: var(--ink-soft); }
details.faq .answer p:last-child { margin-bottom: 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.97rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--brand-soft); color: var(--brand-dark); }
.table-scroll { overflow-x: auto; }

/* Resource list */
.resource {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
}
.resource h3 { margin: 0 0 0.3rem; }
.resource p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

/* Interactive checklist (progressive enhancement, signs-by-age) */
ul.signs.interactive li { padding-left: 0; }
ul.signs.interactive li::before { display: none; }
ul.signs.interactive label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  margin: -0.15rem -0.4rem;
}
ul.signs.interactive label:hover { background: var(--brand-soft); }
ul.signs.interactive input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.28rem;
  accent-color: var(--brand);
  flex: none;
}
ul.signs.interactive li.checked label { background: var(--accent-soft); }

.signs-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-dark);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 8px 24px rgba(18, 71, 126, 0.35);
  z-index: 30;
  font-size: 0.92rem;
  max-width: calc(100vw - 2rem);
  flex-wrap: wrap;
  justify-content: center;
}
.signs-bar button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.signs-bar button:hover { background: rgba(255, 255, 255, 0.25); }
@media print { .signs-bar { display: none; } }

/* Print summary: only the marked signs, built by the checklist script */
#print-summary { display: none; }
@media print {
  body.print-summary-mode main { display: none !important; }
  body.print-summary-mode #print-summary { display: block; }
  #print-summary h1 { font-size: 16pt; margin: 0 0 6pt; }
  #print-summary h2 { font-size: 12pt; margin: 10pt 0 4pt; }
  #print-summary .meta { color: #333; font-size: 9.5pt; line-height: 1.4; }
  #print-summary ul { margin: 0 0 8pt 14pt; padding: 0; }
  #print-summary li { margin-bottom: 3pt; }
}

/* Test finder widget */
.finder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin: 1.75rem 0;
}
.finder h2 { margin-top: 0; }
.finder .options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 0.5rem;
}
.finder .options label {
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink-soft);
  user-select: none;
}
.finder .options label:hover { border-color: var(--brand); color: var(--brand-dark); }
.finder .options input { position: absolute; opacity: 0; pointer-events: none; }
.finder .options label.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.finder .rec { display: none; margin-top: 1rem; }
.finder .rec.visible { display: block; }

/* Byline (author / medical review) */
.byline {
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
  margin: -0.5rem 0 1.5rem;
}
.byline strong { color: var(--ink); font-weight: 600; }

/* Statistics: figure cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.stat .figure {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--brand-dark);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat .caption { margin: 0.35rem 0 0; font-size: 0.93rem; color: var(--ink-soft); }
.stat .src { display: block; margin-top: 0.5rem; font-size: 0.8rem; color: var(--ink-soft); opacity: 0.85; }

/* Citation box (link magnet) */
.cite-box {
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
  font-size: 0.94rem;
}
.cite-box p:first-child { margin-top: 0; }
.cite-box code {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.6rem;
}

/* Infographics */
.graphic {
  margin: 2.25rem 0 3rem;
}
.graphic figure {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.graphic figure img { display: block; width: 100%; height: auto; }
.graphic h2 { margin-bottom: 0.4rem; }
.graphic .use { font-size: 0.95rem; color: var(--ink-soft); }

details.embed {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--brand-soft);
  overflow: hidden;
  margin-top: 0.9rem;
}
details.embed summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.1rem;
  color: var(--brand-dark);
  list-style: none;
}
details.embed summary::-webkit-details-marker { display: none; }
details.embed summary::before { content: "</> "; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
details.embed .inner { padding: 0 1.1rem 1rem; }
details.embed pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem 0.9rem;
  margin: 0 0 0.6rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}
details.embed p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); }

/* References */
.references {
  border-top: 1px solid var(--line);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.references h2 { font-size: 1.05rem; margin: 0 0 0.6rem; color: var(--ink); }
.references ol { padding-left: 1.2rem; margin: 0; }
.references li { margin-bottom: 0.45rem; }
.references a { word-break: break-word; }

/* Breadcrumbs */
.crumbs {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
}
.crumbs a { text-decoration: none; }

/* Quick-facts box */
.quick-facts {
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  margin: 1.5rem 0;
}
.quick-facts table { margin: 0.5rem 0; }
.quick-facts th { background: transparent; white-space: nowrap; padding-left: 0; }
.quick-facts td, .quick-facts th { border-bottom: 1px solid rgba(26, 95, 180, 0.15); }
.quick-facts tr:last-child td, .quick-facts tr:last-child th { border-bottom: none; }

/* Disclaimer & footer */
.disclaimer {
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1.25rem;
}
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: 3rem;
}
.site-footer .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.site-footer a { color: var(--ink-soft); }

@media print {
  .site-header, .site-footer, .hero .actions { display: none; }
  body { font-size: 11pt; }
  ul.signs li::before { border-color: #000; }
}

/* Per-claim evidence block inside myth cards */
.myth .evidence {
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  margin: 1rem 0 0;
}
.myth .evidence strong { color: var(--brand-dark); }

/* Figures — information graphics inside article flow */
figure.fig {
  margin: 2rem 0;
  padding: 0;
}
figure.fig img, figure.fig svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
figure.fig figcaption {
  font-size: 0.87rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
  line-height: 1.55;
}
figure.fig figcaption a { color: var(--brand-dark); }

/* Key numbers — borderless headline figures.
   Distinct from .stat-grid/.stat above, which is the boxed variant on /statistics. */
.keynums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 1.4rem 2.2rem;
  margin: 2rem 0;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.keynum .n {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}
.keynum .t {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.keynum.accent .n { color: var(--accent); }

/* Age-range bar on instrument pages */
.agebar { margin: 1.1rem 0 0; }
.agebar svg { display: block; width: 100%; height: auto; }

/* Page head — the interior-page counterpart to .hero on the home page.
   Title, byline and lede sit on a tinted band; the article starts below it. */
.pagehead {
  background: linear-gradient(180deg, var(--brand-soft), var(--bg));
  border-bottom: 1px solid var(--line);
}
.pagehead .inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2.25rem;
}
.pagehead .crumbs { margin: 0 0 1rem; }
.pagehead h1 { margin: 0 0 0.75rem; }
.pagehead .byline {
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.pagehead .lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
.pagehead > .inner > *:last-child { margin-bottom: 0; }
/* The article no longer opens with an h1, so its first heading needs no top gap. */
.content > h2:first-child,
.content > .quick-facts:first-child,
.content > figure:first-child { margin-top: 0; }

/* Faint milestone motif in the head bands. Only when the viewport is wide
   enough that it sits in the empty gutter beside the text column — below
   that it would run under the words, so it is simply not drawn. */
@media (min-width: 1100px) {
  .pagehead,
  .hero {
    background-image:
      url("/img/motif-milestones.svg"),
      linear-gradient(180deg, var(--brand-soft), var(--bg));
    background-repeat: no-repeat, no-repeat;
    background-position: right 3.5rem center, center;
    background-size: 190px auto, auto;
  }
}
