/* ZoraMath landing page. Mobile-first; breakpoints 768 and 1024. No inline styles anywhere (CSP). */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--space-3);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  overflow-wrap: break-word;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
p, ul, ol { margin: 0; }
img, svg { max-width: 100%; }
a { color: var(--brand-dark); text-underline-offset: .2em; }

.wrap { width: min(100% - 2 * var(--space-3), 72rem); margin-inline: auto; }

/* focus: visible on every interactive element */
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.band-space :focus-visible { outline-color: var(--space-cyan); }

.skip {
  position: absolute; left: var(--space-3); top: -4rem; z-index: 10;
  background: var(--brand-dark); color: var(--white); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-s); font-weight: 700;
}
.skip:focus { top: var(--space-2); }

/* header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 var(--space-4); min-height: var(--header-h); padding-block: var(--space-2);
}
.brand { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--ink); }
.wordmark { width: 9.6rem; height: 2rem; display: block; color: var(--ink); }
.nav-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-3); }
.nav-list a {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  font-weight: 700; font-size: .875rem; color: var(--ink); text-decoration: none;
}
.nav-list a:hover { color: var(--brand); text-decoration: underline; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 3.25rem; padding: .6rem 1.5rem; width: 100%;
  border-radius: var(--radius-pill); border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; line-height: 1.2;
  text-decoration: none;
}
.btn-earth { background: var(--cta); color: var(--cta-ink); }
.btn-space { background: var(--brand-dark); color: var(--white); }
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform var(--motion-fast) var(--ease-out); }
  .btn:hover { transform: translateY(-2px); }
}

/* hero: mobile = copy on a sky panel, then a stacked Earth / atmosphere / Space scene */
.hero { position: relative; display: flex; flex-direction: column; background: var(--earth-sky-bottom); overflow: hidden; }
.hero-copy {
  order: 1; padding: var(--space-5) var(--space-3) var(--space-4); text-align: center;
  background: linear-gradient(var(--earth-sky-top), var(--earth-sky-bottom));
  color: var(--earth-text-on-sky);
}
.hero-copy h1 {
  font-size: clamp(2.25rem, 9vw, 3rem); font-weight: 700; font-stretch: 105%;
  color: var(--earth-text-on-sky);
}
.lede { font-size: 1.25rem; margin: var(--space-3) auto var(--space-4); max-width: 32rem; }
.cta-row { display: flex; flex-direction: column; gap: var(--space-3); align-items: stretch; }
.hero-scene { order: 2; position: relative; }
.scene { display: block; width: 100%; height: auto; }
.scene-wide { display: none; }

.tag {
  position: absolute; left: var(--space-3); margin: 0; padding: .3rem .9rem;
  border-radius: var(--radius-pill); font-family: var(--font-display); font-weight: 600; font-size: 1rem;
}
.tag-earth { top: 3%; background: var(--paper); color: var(--earth-text-on-sky); }
.tag-space { top: 57%; background: var(--space-navy); color: var(--space-text-on-navy); border: 1px solid var(--space-cyan); }

/* scene entrance: one run, transform only, nothing under reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .fx-balloon { animation: rise 3.5s var(--ease-out) 1 forwards; }
  .fx-plane { animation: drift 3.5s var(--ease-out) 1 forwards; }
  .fx-rocket { animation: fly 3.5s var(--ease-out) 1 forwards; }
}
@keyframes rise { from { transform: translateY(24px); } to { transform: translateY(0); } }
@keyframes drift { from { transform: translateX(-40px); } to { transform: translateX(0); } }
@keyframes fly { from { transform: translate(-40px, 60px); } to { transform: translate(0, 0); } }

@media (min-width: 768px) {
  .btn { width: auto; }
  .cta-row { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .hero { display: grid; justify-items: center; align-items: start; min-height: 760px; padding: var(--space-5) var(--space-3); }
  .hero-scene { position: absolute; inset: 0; }
  .scene-wide { display: block; width: 100%; height: 100%; }
  .scene-stack { display: none; }
  .hero-copy {
    position: relative; z-index: 1; max-width: 40rem; padding: var(--space-4);
    border-radius: var(--radius-l); background: var(--paper); color: var(--ink); /* opaque: the wide scene is cropped here and must not show through */
    box-shadow: 0 12px 40px var(--shadow-hero);
  }
  .hero-copy h1 { color: var(--ink); font-size: clamp(2.75rem, 6vw, 3.5rem); }
  .tag-earth { top: auto; bottom: var(--space-4); left: var(--space-4); }
  .tag-space { top: 25rem; left: auto; right: var(--space-4); }
}
@media (min-width: 1024px) {
  .hero {
    align-items: center;
    min-height: min(900px, calc(100vh - var(--header-h)));
    min-height: min(900px, max(640px, calc(100svh - var(--header-h))));
  }
  .tag-space { top: var(--space-4); }
  .hero-copy { background: var(--paper-veil-hero); }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .hero-copy { max-width: 29rem; } /* the cropped scene puts the plane and balloon left of centre: keep the panel clear of them */
}

/* chapter bands */
.band { position: relative; padding-block: var(--space-6); overflow: hidden; }
.band-art { position: absolute; inset: 0 0 auto 0; width: 100%; object-fit: cover; pointer-events: none; }
.band-earth .band-art { height: 12.5rem; }
.band-space .band-art { height: 18.75rem; }
.band > .wrap { position: relative; }
.band h2, .plain h2 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.band-intro { margin-top: var(--space-2); max-width: 40rem; }
.band-earth { background: linear-gradient(var(--earth-sky-top), var(--earth-sky-bottom) 60%); color: var(--earth-text-on-sky); font-size: var(--text-body-kids); }
.band-earth h2, .band-earth h3 { font-weight: 700; font-stretch: 112%; color: var(--earth-text-on-sky); }
.band-space { background: var(--space-navy); color: var(--space-text-on-navy); }
.band-space h2, .band-space h3 { font-weight: 400; font-stretch: 85%; color: var(--space-text-on-navy); }
.band-space .band-intro { color: var(--space-muted-on-navy); background: var(--space-navy); } /* opaque: stars never sit under the text */

.cards { display: grid; gap: var(--space-4); margin-top: var(--space-5); grid-template-columns: 1fr; }
.card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.card h3 { font-size: 1.625rem; }
.card-head { display: flex; align-items: center; gap: var(--space-3); }
.badge {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
}
.badge .icon, .icon { width: 2rem; height: 2rem; display: block; }
.pill {
  display: inline-block; padding: .15rem .8rem; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
}
.topics { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.topics li { padding-left: 1.25rem; position: relative; }
.topics li::before { content: ""; position: absolute; left: 0; top: .6em; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: .55; }
.status { margin-top: auto; font-size: 1rem; font-weight: 700; }

.cards-earth .card { background: var(--earth-cloud); border-radius: var(--radius-l); box-shadow: 0 6px 20px var(--shadow-card); }
.cards-earth .badge { background: var(--earth-sky-bottom); color: var(--earth-text-on-sky); }
.cards-earth .pill { background: var(--earth-sun); color: var(--earth-text-on-sky); }
.cards-earth .status { color: var(--muted); }

.cards-space .card { background: var(--space-indigo); border-radius: var(--radius-s); border: 1px solid var(--space-card-edge); font-size: var(--text-body); }
.cards-space .badge { background: var(--space-navy); color: var(--space-aurora); border-radius: var(--radius-s); }
.cards-space .pill { background: var(--space-navy); color: var(--space-cyan); border-radius: var(--radius-s); }
.cards-space .status { color: var(--space-muted-on-navy); }

/* Grade 3 -> 4 launch strip */
.launch {
  padding-block: var(--space-6);
  background: linear-gradient(var(--earth-sky-bottom), var(--atmo-bottom) 25%, var(--atmo-mid) 65%, var(--atmo-top));
}
.launch-note {
  display: flex; align-items: center; gap: var(--space-4); max-width: 40rem; margin-inline: auto;
  padding: var(--space-4); border-radius: var(--radius-l); background: var(--paper-veil-note); color: var(--ink);
}
.launch-note h2 { font-size: clamp(1.375rem, 4vw, 1.75rem); font-weight: 600; }
.launch-note p { margin-top: var(--space-1); }
.launch-note .badge { background: var(--brand-dark); color: var(--white); }

/* plain sections */
.plain { padding-block: var(--space-6); }
.plain-tint { background: var(--earth-sky-bottom); color: var(--earth-text-on-sky); }
.plain-tint a { color: var(--earth-text-on-sky); }
.prose { max-width: 46rem; }
.prose > * + * { margin-top: var(--space-3); }
.prose h2 { margin-top: var(--space-5); }
.prose > h2:first-child, .plain .prose > h2 { margin-top: 0; }
.prose h3 { font-size: 1.375rem; margin-top: var(--space-4); }
.prose p { font-size: var(--text-body-kids); }
.plain-list { padding-left: 1.25rem; font-size: var(--text-body-kids); }
.plain-list li + li { margin-top: var(--space-2); }

.steps { list-style: none; padding: 0; margin-top: var(--space-5); display: grid; gap: var(--space-4); position: relative; }
.step { display: grid; grid-template-columns: 3.5rem 1fr; column-gap: var(--space-3); align-items: center; }
.step .badge { grid-row: span 2; background: var(--paper); color: var(--brand-dark); border: 3px solid var(--brand); position: relative; }
.step h3 { font-size: 1.375rem; font-weight: 600; }
.step p { grid-column: 2; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-6) var(--space-5); background: var(--paper); }
.footer-grid { display: grid; gap: var(--space-4); }
.footer-line { margin-top: var(--space-2); }
.footer-links { list-style: none; padding: 0; margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.footer-links a { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; }
.privacy { padding-block: var(--space-6); }
.privacy h1 { font-size: clamp(2.25rem, 7vw, 3rem); font-weight: 700; }
.privacy h2 { font-size: 1.5rem; font-weight: 600; }

@media (min-width: 768px) {
  .cards-earth { grid-template-columns: repeat(2, 1fr); } /* Space stays one column until 1024: three cards never leave an orphan */
  .header-row { flex-wrap: nowrap; }
  .nav-list a { font-size: 1rem; }
  .nav-list { gap: 0 var(--space-3); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .cards-earth { grid-template-columns: repeat(4, 1fr); }
  .cards-space { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(5, 1fr); gap: var(--space-3); }
  .steps::before { content: ""; position: absolute; left: 10%; right: 10%; top: 1.7rem; border-top: 3px dotted var(--brand); }
  .step { grid-template-columns: 1fr; justify-items: center; text-align: center; row-gap: var(--space-2); }
  .step .badge { grid-row: auto; }
  .step p { grid-column: 1; }
}
