:root {
  --navy: #073e48;
  --text: #163e43;
  --muted: #6b7e7c;
  --teal: #007f76;
  --soft: #ecf5f2;
  --line: #dde8e4;
  --white: #fff;
  --clinical-bg: #f4f7f8;
  --clinical-accent: #123d49;
  --focus: #e3a66b;
  --danger-bg: #fff2e8;
  --danger-text: #8f4a32;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: #fbfcfa;
}
body.reduce-motion * { animation: none !important; transition: none !important; }
body.theme-kids { background: #fbfcfa; }
body.theme-clinical { background: var(--clinical-bg); color: #1a3338; }
body.theme-portal { background: #f7faf9; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: 10px 16px;
}
.skip-link:focus { left: 8px; top: 8px; }

.dev-banner, .synthetic-banner {
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 8px 12px;
}
.dev-banner { background: #f7e9cc; color: #6b491d; }
.synthetic-banner { background: #fde2e2; color: #7a3030; }

.container { width: min(1140px, calc(100% - 40px)); margin: 0 auto; }
.page-main { padding: 32px 0 64px; min-height: 60vh; }

a { color: var(--teal); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

.site-header {
  background: var(--white); border-bottom: 1px solid #eef0ea; position: sticky; top: 0; z-index: 20;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: #08766f; color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 26px; letter-spacing: -4px;
}
.brand-mark span { font-size: 13px; letter-spacing: 0; color: #c2f1df; }
.brand-text strong { display: block; font-size: 15px; color: var(--navy); }
.brand-text small { font-size: 10px; color: #758e89; }

.nav-toggle {
  margin-left: auto; display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; padding: 8px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--navy); }

.primary-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.nav-list a {
  text-decoration: none; color: #5f7774; font-weight: 700; font-size: 13px; padding: 6px 0;
}
.nav-list a.active, .nav-list a[aria-current="page"] { color: var(--navy); box-shadow: 0 2px 0 var(--teal); }
.nav-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.header-switch, .header-portal {
  font-size: 12px; font-weight: 800; text-decoration: none; padding: 8px 12px; border-radius: 20px;
}
.header-portal { border: 1px solid #d8eae3; color: var(--teal); }
.header-switch { color: #4a6865; }

.theme-clinical .site-header { background: var(--clinical-accent); border-color: #0f4a55; }
.theme-clinical .brand-text strong, .theme-clinical .brand-text small { color: #e8f4f1; }
.theme-clinical .nav-list a { color: #b8d4ce; }
.theme-clinical .nav-list a.active { color: #fff; box-shadow: 0 2px 0 #7fd4c5; }
.theme-clinical .header-portal { border-color: #3a6b72; color: #b9e8de; }

.portal-hero { padding: 48px 0 24px; }
.portal-hero h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.04em; color: var(--navy); margin: 8px 0; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 52ch; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal); }
.portal-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 36px 0; }
.portal-card {
  display: block; text-decoration: none; color: inherit; border-radius: 20px; padding: 28px;
  border: 1px solid var(--line); background: #fff; transition: transform 0.15s, box-shadow 0.15s;
}
.portal-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px #0c504418; }
.portal-kids { background: linear-gradient(145deg, #fff, #eef7f2); }
.portal-clinical { background: linear-gradient(145deg, #fff, #eef3f5); }
.portal-icon { font-size: 2rem; }
.portal-cta { display: inline-block; margin-top: 16px; font-weight: 800; color: var(--teal); }
.portal-note { font-size: 13px; color: var(--muted); }

.kids-hero, .clinical-hero {
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; align-items: center;
  padding: 28px 0 40px;
}
.kids-hero h1, .clinical-hero h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 4.5vw, 2.85rem);
  letter-spacing: -0.05em; line-height: 1.12; color: var(--navy); margin: 12px 0;
}
.kids-hero em { font-style: normal; color: var(--teal); }
.kids-hero-art { position: relative; min-height: 200px; }
.hero-orbit {
  position: absolute; inset: 10% 5%; border: 1px solid #c5ddd5; border-radius: 50%;
}
.hero-card {
  position: relative; background: #f8f4e9; border-radius: 120px 120px 20px 20px;
  padding: 48px 24px; text-align: center; font-size: 1.25rem; box-shadow: 16px 16px 0 #194f5622;
}
.hero-search-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

.theme-clinical .clinical-hero h1 { color: var(--clinical-accent); }
.theme-clinical .clinical-hero { grid-template-columns: 1fr; }

.search-field {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid #dfe9e6; border-radius: 12px; padding: 0 14px; min-height: 52px; margin-top: 16px;
}
.search-field input { border: 0; flex: 1; min-width: 0; font-size: 15px; background: transparent; }
.search-icon { font-size: 22px; color: var(--teal); }
.search-hint { font-size: 10px; font-weight: 800; color: #a2b1ae; letter-spacing: 0.08em; }

.section-block { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 1.35rem; color: var(--navy); }
.theme-clinical .section-head h2 { color: var(--clinical-accent); }

.topic-grid, .age-grid, .card-grid { display: grid; gap: 14px; }
.topic-grid { grid-template-columns: repeat(4, 1fr); }
.age-grid { grid-template-columns: repeat(4, 1fr); }
.age-grid-full { grid-template-columns: repeat(3, 1fr); margin-bottom: 32px; }
.card-grid { grid-template-columns: repeat(3, 1fr); }

.topic-card, .age-card {
  display: block; text-decoration: none; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; padding: 18px;
}
.topic-card:hover, .age-card:hover { border-color: #b8d4cc; }
.topic-icon { font-size: 1.6rem; }
.topic-soon { opacity: 0.85; }
.topic-soon-label, .topic-link { font-size: 11px; font-weight: 800; color: var(--teal); }
.topic-soon-label { color: #b06545; }

.article-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-category { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--teal); text-transform: uppercase; }
.article-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.article-card h3 a { color: var(--navy); text-decoration: none; }
.article-card p { margin: 0; font-size: 14px; color: var(--muted); flex: 1; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: #859693; margin-top: 8px; }

.badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  padding: 4px 8px; border-radius: 6px;
}
.badge-published { background: #e3f2ea; color: #0a6b5e; }
.badge-draft { background: #f3ece6; color: #8a5c40; }
.badge-synthetic { background: #fdeaea; color: #8a3030; }
.badge-soon { background: #eef1f3; color: #5a6a70; }

.empty-state {
  text-align: center; background: #f3f7f4; border-radius: 18px; padding: 40px 24px;
}
.empty-icon { font-size: 2rem; margin-bottom: 8px; }
.empty-state h3 { margin: 0 0 8px; color: var(--navy); }

.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 12px 18px;
  font-weight: 800; font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-secondary { background: #e9f4ee; color: #0a5c55; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  display: inline-block; padding: 7px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; text-decoration: none; font-size: 12px; font-weight: 700; color: #5b7772;
}
.chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.page-header h1 { margin: 0 0 8px; font-size: clamp(1.75rem, 3vw, 2.25rem); letter-spacing: -0.03em; }
.page-header p { color: var(--muted); max-width: 65ch; }

.emergency-section { background: #fff7f2; border-radius: 18px; padding: 24px; border: 1px solid #f0ddd0; }
.emergency-preview, .resource-list, .recent-list { padding-left: 20px; }
.emergency-list { display: grid; gap: 14px; }
.emergency-item { background: #fff; border: 1px solid #f0e0d6; border-radius: 14px; padding: 18px; }

.clinical-dashboard {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0;
}
.dash-card {
  background: #fff; border: 1px solid #dce5e8; border-radius: 14px; padding: 18px;
}
.dash-muted { background: #f8fafb; }
.dash-card h2 { margin: 0 0 8px; font-size: 1rem; }

.guideline-list { display: grid; gap: 10px; }
.guideline-row {
  display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start;
  background: #fff; border: 1px solid #dce5e8; border-radius: 12px; padding: 14px 16px;
}
.guideline-id { font-size: 11px; font-weight: 800; color: var(--teal); }
.guideline-body h3 { margin: 0 0 4px; font-size: 1rem; }
.guideline-body p { margin: 0; font-size: 12px; color: var(--muted); }

.alpha-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 24px; }
.alpha-nav a {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  text-decoration: none; font-weight: 800; font-size: 12px; color: #4a6865; background: #fff; border: 1px solid var(--line);
}
.alpha-nav a.active { background: var(--clinical-accent); color: #fff; }

.specialty-block { margin-bottom: 32px; }
.specialty-block h2 { font-size: 1.15rem; color: var(--clinical-accent); border-bottom: 2px solid #dce5e8; padding-bottom: 8px; }

.reader { max-width: 920px; margin: 0 auto; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--teal); }
.reader-head h1 { font-size: clamp(1.85rem, 3.5vw, 2.5rem); letter-spacing: -0.04em; line-height: 1.15; margin: 8px 0; color: var(--navy); }
.reader-lead { font-size: 1.1rem; color: var(--muted); line-height: 1.7; }
.reader-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; color: #6a8580; margin: 16px 0; }
.reader-section { margin: 28px 0; }
.reader-section h2 { font-size: 1.35rem; color: #0a4b4f; margin: 0 0 12px; }
.reader-section p { line-height: 1.85; color: #3f5c58; }

.callout { border-radius: 14px; padding: 18px 22px; margin: 24px 0; }
.callout-info { background: #edf5ff; border: 1px solid #d6e4f7; }
.callout-care { background: #edf5f2; border: 1px solid #d6e6e0; }
.callout-danger, .callout-clinical-warn { background: var(--danger-bg); border: 1px solid #f4e3d0; }
.callout-clinic { background: #e9f4ee; border: 1px solid #d6e6e0; }
.callout h2 { margin: 0 0 10px; font-size: 1.15rem; }

.media-figure { margin: 24px 0; }
.media-figure img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.media-figure figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; }

.references ul { padding-left: 20px; }
.ref-note { display: block; font-size: 12px; color: var(--muted); }
.ref-disclaimer { font-size: 13px; color: var(--muted); margin-top: 16px; }

.clinical-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.toc-desktop { position: sticky; top: 88px; background: #fff; border: 1px solid #dce5e8; border-radius: 12px; padding: 16px; font-size: 13px; }
.toc-desktop h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 10px; color: #5a7078; }
.toc-desktop ol { margin: 0; padding-left: 18px; }
.toc-mobile { display: none; margin-bottom: 16px; background: #fff; border: 1px solid #dce5e8; border-radius: 10px; padding: 10px 14px; }

.quick-ref {
  background: #123d49; color: #e8f4f1; border-radius: 14px; padding: 18px 20px; margin-bottom: 24px;
}
.quick-ref h2 { margin: 0 0 10px; font-size: 1rem; color: #b9e8de; }
.quick-ref ul { margin: 0; padding-left: 18px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { border: 1px solid #dce5e8; padding: 10px 12px; text-align: left; }
.data-table th { background: #eef3f5; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.comparison-card { background: #f8fafb; border: 1px solid #dce5e8; border-radius: 12px; padding: 16px; margin: 12px 0; }
.placeholder-section .muted { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }

.dev-token-form { background: #fff8e6; border: 1px solid #ecdab0; border-radius: 12px; padding: 16px; margin-bottom: 20px; font-size: 13px; }
.dev-token-form input { width: 100%; max-width: 420px; margin: 8px 8px 8px 0; padding: 10px; border-radius: 8px; border: 1px solid #ccc; }

.loading { display: flex; align-items: center; gap: 12px; padding: 24px; color: var(--muted); }
.spinner {
  width: 22px; height: 22px; border: 3px solid #dce8e4; border-top-color: var(--teal);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert-error { background: #ffede6; color: #8a4030; padding: 14px 18px; border-radius: 10px; margin: 16px 0; }

.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 32px 0; margin-top: 48px; font-size: 13px; }
.footer-grid { display: grid; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { text-decoration: none; font-weight: 700; }
.footer-copy { color: var(--muted); margin: 0; }

@media (max-width: 900px) {
  .portal-cards, .topic-grid, .card-grid, .clinical-dashboard { grid-template-columns: 1fr 1fr; }
  .kids-hero { grid-template-columns: 1fr; }
  .kids-hero-art { display: none; }
  .clinical-layout { grid-template-columns: 1fr; }
  .toc-desktop { display: none; }
  .toc-mobile { display: block; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; flex-direction: column; align-items: stretch; padding: 16px 20px 24px;
    border-bottom: 1px solid var(--line); box-shadow: 0 12px 30px #00000012;
  }
  .primary-nav.open { display: flex; }
  .nav-list { flex-direction: column; gap: 4px; }
  .theme-clinical .primary-nav { background: var(--clinical-accent); }
  .portal-cards, .topic-grid, .age-grid, .age-grid-full, .card-grid, .clinical-dashboard { grid-template-columns: 1fr; }
  .guideline-row { grid-template-columns: 1fr; }
  .search-hint { display: none; }
}
