/*!
 * YourKids — shared styles for static SEO pages.
 * Design tokens and nav/hero/card/footer rules are lifted from landing.html so
 * the content pages read as the same product. landing.html itself is untouched.
 */

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

:root {
  --blue: #0284c7;
  --blue-light: #e0f2fe;
  --blue-dark: #0369a1;
  --green: #16a34a;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #8b5cf6;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gray-900);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}
a { text-decoration: none; color: inherit; }

/* ── NAV ──
   Scoped to `body > nav` on purpose. A bare `nav` selector leaks into the
   in-article table of contents, which is also a <nav>, and inherits height:60px
   + display:flex + position:sticky from here — squashing it into a broken bar. */
body > nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.25rem; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--blue-dark); }
.nav-brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.btn-launch {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.btn-launch:hover { background: var(--blue-dark); }

/* ── BREADCRUMB ── */
.crumb { max-width: 780px; margin: 0 auto; padding: 1.25rem 1.25rem 0; font-size: 0.8rem; color: var(--gray-500); }
.crumb a:hover { color: var(--blue); text-decoration: underline; }
.crumb span { margin: 0 6px; color: var(--gray-400); }

/* ── ARTICLE ── */
article { max-width: 780px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
article h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.35rem); font-weight: 800;
  line-height: 1.2; letter-spacing: -0.01em;
}
.lede { margin-top: 1rem; font-size: 1.075rem; color: var(--gray-500); line-height: 1.65; }
.meta-line { margin-top: 1rem; font-size: 0.8rem; color: var(--gray-400); }

article h2 {
  font-size: clamp(1.25rem, 3vw, 1.55rem); font-weight: 700;
  margin: 2.75rem 0 0.875rem; line-height: 1.3; scroll-margin-top: 76px;
}
article h3 { font-size: 1.05rem; font-weight: 700; margin: 1.75rem 0 0.625rem; }
article p { margin: 0.875rem 0; line-height: 1.75; color: var(--gray-700); }
article ul, article ol { margin: 0.875rem 0 0.875rem 1.25rem; }
article li { margin: 0.5rem 0; line-height: 1.7; color: var(--gray-700); }
article strong { color: var(--gray-900); }
article a.inline { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 2px; }
article a.inline:hover { color: var(--blue); }

/* ── TABLE OF CONTENTS ── */
.toc {
  /* Explicit resets: .toc is a <nav>, so it must not pick up header styling
     even if a bare `nav` rule is ever reintroduced above. */
  position: static; height: auto; z-index: auto;
  display: block; backdrop-filter: none; border-bottom: none;

  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 12px; padding: 1.125rem 1.25rem; margin: 2rem 0;
}
.toc-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 0.625rem; }
.toc ol { margin: 0 0 0 1.1rem; }
.toc li { margin: 0.3rem 0; font-size: 0.9rem; }
.toc a { color: var(--blue-dark); }
.toc a:hover { text-decoration: underline; }

/* ── DATA TABLE ── */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--gray-200); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; min-width: 560px; }
.table-caption {
  caption-side: top; text-align: left; padding: 0.875rem 0.875rem 0.625rem;
  font-size: 0.775rem; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.05em; background: var(--gray-50);
}
thead th {
  background: var(--gray-50); text-align: left; font-weight: 700;
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--gray-200);
  color: var(--gray-700); white-space: nowrap; font-size: 0.75rem;
}
thead tr:first-child th { border-bottom: 1px solid var(--gray-200); }
thead th[colspan] { text-align: center; border-left: 1px solid var(--gray-200); }
tbody td {
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: #fcfdfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Highlights the median column — the one parents should read first. */
td.median { background: var(--blue-light); font-weight: 700; color: var(--blue-dark); }

/* Prose comparison tables. The `nowrap` above is right for growth/BMI tables
   (a number must never break across lines) and wrong for tables of sentences:
   it turns every cell into one long line and pushes the right-hand columns
   outside the viewport. Opt in with <div class="table-wrap prose">.
   Asserted by tools/seo/check-css.mjs. */
.table-wrap.prose thead th,
.table-wrap.prose tbody td { white-space: normal; vertical-align: top; }
.table-wrap.prose tbody td { line-height: 1.5; }

/* ── CALCULATOR WIDGET ── */
.calc {
  border: 2px solid var(--blue-light); border-radius: 16px;
  background: linear-gradient(135deg, #f8fcff 0%, #f0f9ff 100%);
  padding: 1.5rem; margin: 2rem 0;
}
.calc-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.375rem; }
.calc-hint { font-size: 0.825rem; color: var(--gray-500); margin-bottom: 1.125rem; line-height: 1.55; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.875rem; }
.field label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.3rem; }
.field input, .field select {
  width: 100%; padding: 0.6rem 0.7rem; font-size: 0.95rem;
  border: 1px solid var(--gray-200); border-radius: 9px; background: #fff;
  color: var(--gray-900); font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.btn-calc {
  margin-top: 1.125rem; width: 100%;
  background: var(--blue); color: #fff; border: none; border-radius: 10px;
  padding: 0.8rem 1.5rem; font-size: 0.95rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s; font-family: inherit;
}
.btn-calc:hover { background: var(--blue-dark); }
.btn-ghost {
  margin-top: 0.625rem; width: 100%;
  background: #fff; color: var(--gray-700); border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 0.7rem 1.5rem; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue-dark); }

.result { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px dashed var(--gray-200); }
.result[hidden] { display: none; }
.result-headline { font-size: 1.4rem; font-weight: 800; line-height: 1.3; }
.result-sub { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.3rem; line-height: 1.6; }
.result-rows { margin-top: 1rem; display: grid; gap: 0.5rem; }
.result-row { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; padding: 0.5rem 0.75rem; background: #fff; border-radius: 8px; border: 1px solid var(--gray-200); }
.result-row b { font-variant-numeric: tabular-nums; }
.tone-ok    { color: var(--green); }
.tone-watch { color: var(--yellow); }
.tone-warn  { color: var(--red); }
.err { color: var(--red); font-size: 0.85rem; margin-top: 0.75rem; font-weight: 600; }
.err[hidden] { display: none; }

/* percentile bar */
.pbar { margin-top: 1rem; height: 12px; border-radius: 6px; position: relative; background: linear-gradient(90deg, #fca5a5 0%, #fde68a 14%, #86efac 42%, #86efac 58%, #fde68a 86%, #fca5a5 100%); }
.pbar-mark { position: absolute; top: -5px; width: 3px; height: 22px; background: var(--gray-900); border-radius: 2px; transform: translateX(-50%); }
.pbar-scale { display: flex; justify-content: space-between; font-size: 0.65rem; color: var(--gray-400); margin-top: 0.375rem; }

/* ── CALLOUTS ── */
.note, .disclaimer {
  border-radius: 12px; padding: 1rem 1.125rem; margin: 1.75rem 0;
  font-size: 0.875rem; line-height: 1.65;
}
.note { background: var(--blue-light); border-left: 4px solid var(--blue); color: var(--gray-700); }
.disclaimer { background: #fffbeb; border-left: 4px solid var(--yellow); color: #78350f; }
.note strong, .disclaimer strong { display: block; margin-bottom: 0.25rem; }

/* ── FAQ ── */
.faq { margin: 1.5rem 0; border: 1px solid var(--gray-200); border-radius: 12px; overflow: hidden; }
.faq details { border-bottom: 1px solid var(--gray-200); }
.faq details:last-child { border-bottom: none; }
.faq summary {
  padding: 1rem 1.125rem; font-weight: 600; cursor: pointer; font-size: 0.95rem;
  list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--blue); font-weight: 700; font-size: 1.2rem; flex-shrink: 0; }
.faq details[open] summary::after { content: '−'; }
.faq summary:hover { background: var(--gray-50); }
.faq .faq-body { padding: 0 1.125rem 1.125rem; font-size: 0.9rem; color: var(--gray-700); line-height: 1.7; }

/* ── CTA BAND ── */
.cta {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); color: #fff;
  border-radius: 16px; padding: 2rem 1.75rem; margin: 3rem 0 0; text-align: center;
}
.cta h2 { font-size: 1.35rem; font-weight: 800; margin: 0 0 0.625rem; color: #fff; }
.cta p { color: rgba(255,255,255,0.72); font-size: 0.9rem; line-height: 1.6; margin: 0 auto 1.5rem; max-width: 460px; }
.btn-primary {
  background: var(--blue); color: #fff; border-radius: 10px; display: inline-block;
  padding: 0.85rem 2rem; font-size: 0.975rem; font-weight: 700; cursor: pointer; border: none;
  box-shadow: 0 4px 14px rgba(2,132,199,0.35); transition: all 0.15s; font-family: inherit;
}
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.cta-sub { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-top: 0.875rem; }

/* ── RELATED ── */
.related { margin: 3rem 0 0; }
.related h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.875rem; }
.related-card {
  border: 1px solid var(--gray-200); border-radius: 12px; padding: 1rem 1.125rem;
  transition: all 0.15s; background: #fff; display: block;
}
.related-card:hover { border-color: var(--blue); box-shadow: 0 6px 20px rgba(0,0,0,0.06); transform: translateY(-2px); }
.related-card h3 { font-size: 0.9rem; font-weight: 700; line-height: 1.4; margin: 0; color: var(--gray-900); }
.related-card p { font-size: 0.775rem; color: var(--gray-500); margin: 0.375rem 0 0; line-height: 1.5; }

/* ── SOURCES ── */
.sources { margin: 2.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--gray-200); }
.sources h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin: 0 0 0.625rem; font-weight: 700; }
.sources ul { margin-left: 1.1rem; }
.sources li { font-size: 0.8rem; color: var(--gray-500); margin: 0.3rem 0; line-height: 1.5; }
.sources a { color: var(--blue-dark); text-decoration: underline; }

/* ── APP SHOWCASE ── */
.app-showcase {
  margin: 2.5rem 0;
  border: 1px solid var(--gray-200);
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.app-showcase-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: center;
}
.app-showcase-text {
  padding: 2rem 1.75rem;
}
.app-showcase-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-dark);
  background: var(--blue-light);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  margin-bottom: 0.75rem;
}
.app-showcase-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.4;
  margin-bottom: 0.625rem;
}
.app-showcase-desc {
  font-size: 0.9rem;
  color: var(--gray-500);
  line-height: 1.65;
  margin-bottom: 1.125rem;
}
.app-showcase-desc ul {
  margin: 0.5rem 0 0 1.1rem;
}
.app-showcase-desc li {
  margin: 0.25rem 0;
}
.app-showcase-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--blue);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.15s;
}
.app-showcase-btn:hover { background: var(--blue-dark); }
.app-showcase-img {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--gray-200);
  max-height: 320px;
  display: flex;
  align-items: flex-start;
}
.app-showcase-img img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: top left;
}

@media (max-width: 700px) {
  .app-showcase-inner { grid-template-columns: 1fr; }
  .app-showcase-img { border-left: none; border-top: 1px solid var(--gray-200); max-height: 220px; }
}

/* ── FOOTER ── */
footer {
  background: var(--gray-50); border-top: 1px solid var(--gray-200);
  padding: 2rem 1.25rem; text-align: center; color: var(--gray-500); font-size: 0.85rem;
}
footer strong { color: var(--gray-700); }
.footer-links { margin-bottom: 0.875rem; display: flex; gap: 1.125rem; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: var(--gray-500); font-size: 0.8rem; }
.footer-links a:hover { color: var(--blue); text-decoration: underline; }

@media (max-width: 640px) {
  article { padding: 1.25rem 1rem 3rem; }
  .crumb { padding: 1rem 1rem 0; }
  .calc { padding: 1.125rem; }
  .cta { padding: 1.75rem 1.25rem; }
}

@media print {
  /* `.toc` is listed explicitly: it is a <nav>, so a bare `nav` here would hide
     it as a side effect rather than by decision. Anchor links are dead weight on
     paper, so hiding it is intended — but it should be intended, not accidental. */
  body > nav, .toc, .cta, .related, .btn-calc, .btn-ghost { display: none; }
  article { max-width: none; }
}
