/* ── MathCraft Maths Hub — Shared Styles ──────── */
/* Extends blog aesthetic for programmatic SEO pages */

/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1a1a2e;
  background: #F0F7FF;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #3498db; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 800; color: #1a1a2e; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); margin-bottom: 16px; }
h2 { font-size: clamp(1.25rem, 3.5vw, 1.6rem); margin-top: 40px; margin-bottom: 16px; }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.25rem); margin-top: 32px; margin-bottom: 12px; }
p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
strong { color: #1a1a2e; }

/* ── Nav ──────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(12, 18, 32, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topnav-brand {
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.topnav-brand:hover { text-decoration: none; color: #fff; }
.topnav-brand img { width: 28px; height: 28px; image-rendering: pixelated; }
.topnav-links { display: flex; align-items: center; gap: 20px; }
.topnav-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.topnav-links a:hover { color: #fff; text-decoration: none; }
.topnav-cta {
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 8px;
  background: #2ecc71;
  color: #fff !important;
  font-weight: 700;
}
.topnav-cta:hover { background: #27ae60; }

/* ── Breadcrumb ───────────────────────────────── */
.breadcrumb {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 0 20px;
  font-size: 0.85rem;
  color: #888;
}
.breadcrumb a { color: #3498db; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; color: #ccc; }

/* ── Page Header ──────────────────────────────── */
.page-header {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 0;
}
.page-header h1 { margin-top: 8px; }
.page-intro {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: #555;
  line-height: 1.7;
  max-width: 720px;
}

/* ── Year Badge ───────────────────────────────── */
.year-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(52, 152, 219, 0.1);
  color: #3498db;
}
.year-badge.ks1 { background: rgba(46, 204, 113, 0.1); color: #27ae60; }
.year-badge.ks2 { background: rgba(52, 152, 219, 0.1); color: #2980b9; }
.year-badge.ks3 { background: rgba(155, 89, 182, 0.1); color: #8e44ad; }

/* ── Phase Colours ────────────────────────────── */
.phase-feeding { --phase: #2ecc71; }
.phase-building { --phase: #3498db; }
.phase-crafting { --phase: #9b59b6; }
.phase-trading { --phase: #f39c12; }
.phase-exploring { --phase: #e74c3c; }

/* ── Topic Grid ───────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 20px;
}
@media (min-width: 640px) { .topic-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .topic-grid { grid-template-columns: repeat(3, 1fr); } }

.topic-card {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid var(--phase, #3498db);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  text-decoration: none;
}
.topic-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.3;
}
.topic-card .topic-meta {
  font-size: 0.82rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topic-card .topic-steps {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--phase, #3498db);
}

/* ── Year Hub Grid ────────────────────────────── */
.year-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 20px;
}
@media (min-width: 640px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }

.year-card {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.year-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  text-decoration: none;
}
.year-card h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.year-card .year-age {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 8px;
}
.year-card .year-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: #3498db;
}

/* ── Content Section ──────────────────────────── */
.content-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px;
}
.content-section.narrow { max-width: 720px; }

/* ── Worked Example Box ───────────────────────── */
.worked-example {
  background: #fff;
  border: 1px solid #e8eef5;
  border-left: 4px solid #2ecc71;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
}
.worked-example h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #1a1a2e;
}
.worked-example .we-question {
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
}
.worked-example ol {
  margin-bottom: 12px;
  padding-left: 20px;
}
.worked-example .we-answer {
  font-weight: 800;
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  color: #2ecc71;
}
.worked-example .we-npc {
  font-size: 0.82rem;
  font-weight: 700;
  color: #9b59b6;
  margin-bottom: 8px;
}

/* ── Step List ────────────────────────────────── */
.step-list {
  list-style: none;
  padding: 0;
  counter-reset: step-counter;
}
.step-list li {
  counter-increment: step-counter;
  padding: 12px 16px 12px 52px;
  position: relative;
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 10px;
  margin-bottom: 8px;
}
.step-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 16px;
  top: 12px;
  width: 24px;
  height: 24px;
  background: #3498db;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-list .step-name { font-weight: 700; color: #1a1a2e; }
.step-list .step-desc { font-size: 0.9rem; color: #555; }

/* ── Related Topics ───────────────────────────── */
.related-topics {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #e8eef5;
}
.related-topics h2 { margin-top: 0; }
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Info Box ─────────────────────────────────── */
.info-box {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
}
.info-box h4 { margin-bottom: 8px; font-size: 1rem; }
.info-box ul { margin-bottom: 0; }
.info-box li:last-child { margin-bottom: 0; }
.info-box.green { border-left: 4px solid #2ecc71; }
.info-box.blue { border-left: 4px solid #3498db; }

/* ── CTA Box ──────────────────────────────────── */
.cta-box {
  background: linear-gradient(135deg, #0c1220 0%, #1a1a3e 100%);
  color: #fff;
  border-radius: 16px;
  padding: 32px;
  margin: 40px 0 0;
  text-align: center;
}
.cta-box h3 { color: #fff; margin-top: 0; margin-bottom: 8px; }
.cta-box p { color: rgba(255,255,255,0.8); margin-bottom: 16px; }
.cta-box .btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 10px;
  background: #2ecc71;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cta-box .btn:hover {
  background: #27ae60;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(46, 204, 113, 0.45);
  text-decoration: none;
}
.cta-box .btn-note {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

/* ── Footer ───────────────────────────────────── */
footer {
  background: #0c1220;
  color: rgba(255,255,255,0.5);
  padding: 40px 0;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 48px;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}
.footer-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  display: block;
  margin-bottom: 16px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover { color: #fff; text-decoration: none; }

/* ── Responsive ───────────────────────────────── */
@media (min-width: 768px) {
  .page-header { padding: 40px 40px 0; }
  .content-section { padding: 40px; }
  .breadcrumb { padding: 0 40px; }
}
@media (max-width: 480px) {
  .topnav-links a:not(.topnav-cta) { display: none; }
}
