/* MaffsGames — Parent Guides
 *
 * ONE stylesheet for the whole /parents/ section: the hub and all 20 guides.
 *
 * WHY IT LOOKS LIKE THIS
 * ----------------------
 * The guides came from four different MathsWins templates (docs/audit-parent-guides.md
 * calls them families A-D). Jon's ruling, 28 Sep 2026: "I'm happy for the entire parents
 * section to have the same look. It's a stand alone section that should have its own feel.
 * Grown up, for adults." So the four families collapse to this one file, and every
 * template-level finding (T1-T18) is fixed here once rather than 20 times.
 *
 * Palette and fonts are canon 7.5's portal row -- Outfit, white surfaces, navy #1a2744,
 * teal #0d9488, no decorative emoji -- set on a wider, quieter reading column than the
 * portal uses, because this is prose for an adult, not a grid of game cards. Canon 7.5.1
 * (theme by lowest tier) does not apply: the reader is the parent, not the child, so a KS3
 * guide and a GCSE guide look identical.
 *
 * THE LEGACY CLASS NAMES ARE DELIBERATE
 * -------------------------------------
 * The porting contract forbids touching guide wording beyond the minimum needed to correct
 * an audit finding. Restyling rather than re-marking-up the content is how that is kept
 * honest: .worked-panel (family A), .worked (B), .cta-box (C) and .example-box (D) all
 * survive in the HTML and are given one appearance here. The old MathsWins custom property
 * names are re-declared at the bottom of :root for the handful of surviving inline styles
 * that reference them.
 */

:root {
  --navy: #1a2744;
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --accent-light: #f0fdfa;
  --amber: #b45309;
  --amber-light: #fffbeb;
  --red: #b91c1c;
  --red-light: #fef2f2;
  --green: #047857;
  --sky: #0369a1;

  /* Re-declared MathsWins names, for inline styles carried over with the content. */
  --accent: #0f766e;
  --surface: #f8fafc;
  --surface2: #f1f5f9;
  --border2: #e2e8f0;
  --text-bright: #1a2744;
}

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

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 44px;
  line-height: 1.75;
  font-size: 1rem;
}

/* ---------------------------------------------------------------- nav */
.nav {
  background: var(--navy);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 1rem; }
.nav .nav-right { display: flex; align-items: center; gap: 1rem; }
.nav .back { opacity: 0.8; font-size: 0.85rem; font-weight: 400; }
.nav .back:hover { opacity: 1; }

.a11y-btn {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.a11y-btn:hover { background: rgba(255, 255, 255, 0.12); }
.a11y-btn.active { background: #fff; color: var(--navy); border-color: #fff; }

.container { max-width: 720px; width: 100%; margin: 0 auto; padding: 2rem 1.5rem 3rem; }

/* ------------------------------------------------------------- heading */
.hero { margin-bottom: 2rem; }
.badge, .hero-eyebrow, .card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--teal-dark);
  border: 1px solid #99f6e4;
  margin-bottom: 0.9rem;
}
h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
.subtitle, .hero-sub {
  font-size: 1.08rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

/* The GCSE tier badge: one component, written by guide.js from its TIERS table, on
   the four guides whose DfE content is wholly or partly Higher-only
   (data/dfe-gcse-parts.json, bold = Higher) and on their hub cards. The words carry
   the meaning; the amber is only there to catch the eye, so nothing is colour-only. */
.tier-badge {
  display: block;
  margin: 0.2rem 0 0.9rem;
  padding: 0.6rem 0.9rem;
  background: var(--amber-light);
  border: 1px solid #fde68a;
  border-left: 3px solid var(--amber);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
  color: #78350f;
}
.tier-badge:empty { display: none; }
.topic-card .tier-badge { margin: 0.35rem 0 0.6rem; font-size: 0.8rem; padding: 0.4rem 0.6rem; }

/* The marker on each Higher-only part of a partly-Higher guide, so a parent of a
   Foundation-tier child can skip it. Its text is the word "Higher". */
.higher-mark {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
  padding: 0.05rem 0.4rem;
  margin-right: 0.35rem;
  border-radius: 4px;
  border: 1px solid #fcd34d;
  background: var(--amber-light);
  color: #78350f;
  vertical-align: 0.1em;
}

/* ------------------------------------------------------------ sections */
section, .section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem 1.75rem;
  margin-bottom: 1.5rem;
}
section h2, .section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  text-transform: none;
}
section h3, .section h3, .worked h3, .worked-panel h3, .cta-card h3, .cta-box h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.25rem 0 0.5rem;
}
section p, .section p { margin-bottom: 0.9rem; }
section p:last-child, .section p:last-child { margin-bottom: 0; }
section ul, section ol, .section ul, .section ol { margin: 0 0 0.9rem 1.2rem; }
section li, .section li { margin-bottom: 0.6rem; line-height: 1.7; }
strong { color: var(--navy); font-weight: 600; }
em { font-style: italic; }
a { color: var(--teal-dark); }

/* family C's "Section 1" labels are dropped at port time; the rule stays so a
   stray one can never render as unstyled text. */
.section-number { display: none; }

/* --------------------------------------------------------- list flavours */
.step-list { list-style: none; counter-reset: steps; padding: 0; margin-left: 0; }
.step-list li {
  counter-increment: steps;
  padding: 0.7rem 0 0.7rem 2.6rem;
  position: relative;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 1.8rem;
  height: 1.8rem;
  background: var(--accent-light);
  border: 1px solid #99f6e4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--teal-dark);
  font-weight: 700;
}

.mistakes-list { list-style: none; padding: 0; margin-left: 0; }
.mistakes-list li {
  padding: 0.6rem 0 0.6rem 1.5rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.mistakes-list li:last-child { border-bottom: none; }
.mistakes-list li::before {
  content: '!';
  position: absolute;
  left: 0.25rem;
  top: 0.6rem;
  color: var(--red);
  font-weight: 700;
}

.theorem-list { list-style: none; padding: 0; margin-left: 0; }
.theorem-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
}
.theorem-list li:last-child { border-bottom: none; }
.theorem-name { font-weight: 700; color: var(--navy); margin-bottom: 0.2rem; }

.mistake { font-weight: 700; color: var(--navy); }

/* ------------------------------------------------------------- panels */
.worked-panel, .worked, .example-box, .cta-box, .cta-card, .key-box, .rule-box, .explain {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.4rem;
  margin: 1.1rem 0;
}
.worked-panel .solution {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-top: 0.75rem;
}
.worked-panel .solution p:last-child { margin-bottom: 0; }
.worked-panel h3, .worked h3, .example-box .label {
  margin-top: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--teal-dark);
  margin-bottom: 0.6rem;
}
.label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--teal-dark);
  margin-bottom: 0.6rem;
}

.formula-box, .math-block, .step, .formula {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 0.9rem 0;
  overflow-x: auto;
}
.example-box .formula-box, .worked .step { background: var(--card); }

.tip {
  background: var(--accent-light);
  border: 1px solid #99f6e4;
  border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.2rem;
  margin: 1.1rem 0;
  font-size: 0.95rem;
  line-height: 1.7;
}
.tip-label, .warning-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  color: var(--teal-dark);
}
.warning {
  background: var(--red-light);
  border: 1px solid #fecaca;
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.2rem;
  margin: 1.1rem 0;
  font-size: 0.95rem;
  line-height: 1.7;
}
.warning-label { color: var(--red); }

/* ------------------------------------------------------------- tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}
th, td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { font-weight: 700; color: var(--navy); background: var(--bg); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }

/* -------------------------------------------------- guide-specific bits */
.number-line {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.25rem 0;
  padding: 1rem 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.nl-num { font-size: 0.9rem; font-weight: 600; padding: 0.3rem 0.45rem; text-align: center; min-width: 2.2rem; color: var(--text); }
.nl-num.negative { color: var(--sky); }
.nl-num.zero { color: var(--amber); font-weight: 700; }
.nl-num.positive { color: var(--green); }
.nl-line { height: 2px; background: var(--border-strong); flex: 1; min-width: 8px; }

.seq-visual { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.3rem; margin: 1.25rem 0; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.seq-num { font-weight: 700; color: var(--navy); background: var(--accent-light); border: 1px solid #99f6e4; border-radius: 6px; padding: 0.35rem 0.7rem; }
.seq-arrow { color: var(--teal-dark); font-size: 0.85rem; font-weight: 600; padding: 0 0.15rem; }
.seq-label { font-size: 0.85rem; color: var(--muted); text-align: center; }

.bar-model { display: flex; gap: 4px; margin: 1rem 0; }
.bar-part { background: var(--teal); color: #fff; text-align: center; padding: 0.6rem 0.4rem; border-radius: 6px; font-weight: 600; font-size: 0.9rem; }
.bar-label { font-size: 0.85rem; color: var(--muted); }

.soh-cah-toa { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin: 1.25rem 0; }

.chart-list li { margin-bottom: 0.7rem; }

svg { max-width: 100%; height: auto; }
svg text { fill: var(--text); font-family: 'Outfit', system-ui, sans-serif; }

/* --------------------------------------------------------- call to action */
.cta-box, .cta-card { text-align: left; }
.cta-btn, .practice-link {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 0.6rem;
}
.cta-btn:hover, .practice-link:hover { background: var(--teal-dark); }

.practice-note { font-size: 0.9rem; color: var(--muted); margin-top: 0.9rem; }
.practice-note a { color: var(--teal-dark); }

.back-link { display: inline-block; font-size: 0.9rem; color: var(--teal-dark); margin-bottom: 1rem; }

/* ------------------------------------------------------------ hub page */
.intro { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem 1.75rem; margin-bottom: 2rem; }
.intro p { margin-bottom: 0.9rem; }
.intro p:last-child { margin-bottom: 0; }

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-title .badge { margin-bottom: 0; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.topic-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--text);
}
.topic-card:hover { border-color: var(--teal); }
.topic-card h3 { font-size: 1.02rem; font-weight: 700; color: var(--navy); margin: 0.4rem 0 0.35rem; }
.topic-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.6; margin-bottom: 0.6rem; }
.topic-card .card-badge { margin-bottom: 0; font-size: 0.65rem; padding: 0.15rem 0.45rem; }
.topic-card .arrow { font-size: 0.85rem; font-weight: 600; color: var(--teal-dark); }

.faq-section { margin-top: 2.5rem; }
.faq-section h2 { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: 1rem; }
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 0.6rem; overflow: hidden; }
.faq-q { padding: 0.95rem 1.2rem; font-weight: 600; color: var(--navy); cursor: pointer; position: relative; padding-right: 2.5rem; }
.faq-q::after { content: '+'; position: absolute; right: 1.2rem; top: 0.85rem; color: var(--teal-dark); font-size: 1.2rem; font-weight: 400; }
.faq-item.open .faq-q::after { content: '\2212'; }
.faq-a { display: none; padding: 0 1.2rem 1.1rem; font-size: 0.95rem; line-height: 1.7; color: var(--text); }
.faq-item.open .faq-a { display: block; }

/* ------------------------------------------------------------- footers */
.guide-foot {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
.guide-foot a { color: var(--teal-dark); }

/* --------------------------------------------------- dyslexia-friendly Aa */
body.accessible {
  font-family: 'OpenDyslexic', 'Outfit', sans-serif !important;
  letter-spacing: 0.08em;
  word-spacing: 0.14em;
}
body.accessible p,
body.accessible li,
body.accessible .tip,
body.accessible .warning,
body.accessible .tier-badge { line-height: 2; }

@media (max-width: 560px) {
  .container { padding: 1.5rem 1rem 2.5rem; }
  section, .section { padding: 1.25rem 1.1rem; }
  .topic-grid { grid-template-columns: 1fr; }
}
