/* Maths & Martians — site styles
   Palette and type are taken from the app icon and splash: deep space
   navy, Mars orange, cyan and star yellow, with light "mission control"
   panels for reading. Fredoka + Outfit, both SIL OFL, self-hosted
   (see /fonts). */

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/Outfit-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/Outfit-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --space: #070b1f;
  --deep: #121a45;
  --nebula: #2a1b78;
  --star: #fde047;
  --mars: #f97316;
  --mars-deep: #c2410c;
  --cyan: #22d3ee;
  --panel: #f3f6ff;
  --panel-shade: #e1e8fb;
  --ink: #101633;
  --ink-soft: #454f78;
  --outline: #1e2a5c;
  --navy-ink: #1b2463;
  --link-on-page: #b23c0a;
  --mist: #dbe4ff;
  --mist-soft: #aab6e0;
  --pilot: #fb923c;
  --engineer: #22d3ee;
  --navigator: #c4a6ff;
  --wrap: 1080px;
  --display: "Fredoka", "Arial Rounded MT Bold", "Arial Black", sans-serif;
  --body: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--space);
  color: var(--mist);
  font: 400 1.0625rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--star); text-underline-offset: 0.18em; }
a:hover { color: #fff3a3; }
:focus-visible { outline: 3px solid var(--star); outline-offset: 3px; border-radius: 4px; }
.spread :focus-visible, .doc :focus-visible { outline-color: var(--mars-deep); }

.wrap { width: min(var(--wrap), calc(100% - 2.5rem)); margin-inline: auto; }
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 20;
  background: var(--star); color: var(--space); padding: .6rem 1rem; border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 1rem; }

h1, h2 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: .005em; }
h2 { font-size: clamp(1.9rem, 4.6vw, 2.75rem); line-height: 1.1; }
h3 { font: 700 1.25rem/1.25 var(--body); margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 5; }
.site-header.over { position: absolute; left: 0; right: 0; top: 0; }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem 2rem; padding-block: 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand img { width: 46px; height: 46px; border-radius: 11px; display: block; }
.brand span { font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--star); line-height: 1; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; list-style: none; }
.nav a {
  display: inline-block; padding: .5rem 0; color: var(--mist);
  font-weight: 700; text-decoration: none; border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--mars); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 11, 31, 0) 72%, var(--space) 100%),
    radial-gradient(120% 95% at 76% 32%, #3a2392 0%, #1c1250 40%, var(--space) 82%);
  padding-top: 5.5rem; /* clears the overlaid header */
}
/* a scatter of stars, drawn with gradients so there's nothing to load */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background-image:
    radial-gradient(2px 2px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 28% 68%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 46% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 82%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 64%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 86%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 70% 48%, #fff 50%, transparent 51%);
}
.hero-grid {
  position: relative;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem 3rem; align-items: center;
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
}
.wordmark {
  --o: #1a0f3d;
  font-size: clamp(2.8rem, 7.6vw, 5.4rem); line-height: 1;
  text-shadow:
    .04em 0 0 var(--o), -.04em 0 0 var(--o), 0 .04em 0 var(--o), 0 -.04em 0 var(--o),
    .03em .03em 0 var(--o), -.03em .03em 0 var(--o), .03em -.03em 0 var(--o), -.03em -.03em 0 var(--o),
    0 .09em .12em rgba(0, 0, 0, .35);
}
.wordmark span { display: block; color: #fff; }
.wordmark span:first-child { color: var(--star); }
.tagline { font: 700 clamp(1.3rem, 3vw, 1.7rem)/1.25 var(--body); color: var(--mist); margin: 1.1rem 0 .9rem; }
.lead { max-width: 34rem; color: var(--mist-soft); font-size: 1.15rem; }
.soon { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; margin-top: 1.6rem; }
.soon li {
  padding: .5rem 1.1rem; border: 2px solid rgba(253, 224, 71, .55); border-radius: 999px;
  font-weight: 700; font-size: .98rem; color: var(--star);
}
.soon li.linked { padding: 0; border: none; }
.soon a {
  display: inline-block; padding: .5rem 1.1rem; border-radius: 999px; text-decoration: none;
  font-weight: 700; font-size: .98rem; background: var(--star); color: var(--space);
  transition: background .15s, transform .1s;
}
.soon a:hover { background: #fff3a3; }
.soon a:active { transform: scale(.97); }
.emblem { position: relative; justify-self: center; width: min(400px, 100%); }
.emblem::before {
  content: ""; position: absolute; inset: 4% -8% 0;
  background: radial-gradient(closest-side, rgba(34, 211, 238, .45), rgba(34, 211, 238, 0));
  filter: blur(8px); z-index: 0;
}
.emblem img {
  position: relative; z-index: 1; display: block; width: 100%; height: auto;
  border-radius: 22%; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- sections ---------- */
.band { padding-block: clamp(3rem, 8vw, 5.5rem); }
.band > .wrap > h2 { max-width: 30ch; }

/* ---------- mission-control panels ---------- */
.spread {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--panel); color: var(--ink);
  border: 3px solid var(--outline); border-radius: 22px;
  box-shadow: 0 34px 60px -26px rgba(0, 0, 0, .8), 0 0 0 7px rgba(34, 211, 238, .12);
}
.page { padding: clamp(1.5rem, 4vw, 3rem); position: relative; }
.page.l { background: var(--panel); border-radius: 19px 0 0 19px; }
.page.r { background: var(--panel-shade); border-radius: 0 19px 19px 0; }
.spread h2, .doc h1, .doc h2 { color: var(--navy-ink); }
.spread a, .doc a { color: var(--link-on-page); }

.steps { list-style: none; counter-reset: step; margin-top: 1.5rem; display: grid; gap: 1.25rem; }
.steps li { counter-increment: step; position: relative; padding-left: 3.4rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: .1rem;
  display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  font: 700 1.15rem/1 var(--display); color: #fff; background: var(--mars-deep);
}
.steps h3 { color: var(--navy-ink); margin-bottom: .15rem; }
.steps p { margin: 0; }
.aside { margin: 1.5rem 0 0; font-size: .95rem; color: var(--ink-soft); }

.facts { list-style: none; display: grid; gap: 0; margin-top: .25rem; }
.facts li { padding: 1rem 0; border-bottom: 1px dashed rgba(30, 42, 92, .35); }
.facts li:last-child { border-bottom: 0; }
.facts b { display: block; color: var(--navy-ink); font-size: 1.1rem; margin-bottom: .1rem; }
.facts span { display: block; }
.page-intro { margin-top: 1.1rem; font-size: 1.15rem; }

/* the topics a grown-up can switch on, as little badges */
.topics { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin-top: 1.5rem; }
.topics li {
  padding: .4rem .9rem; border-radius: 999px; background: #fff; border: 2px solid var(--outline);
  font-weight: 700; font-size: .95rem; color: var(--navy-ink);
}

/* ---------- the mini battle ---------- */
.stage { display: grid; place-items: center; height: 100%; align-content: center; gap: .75rem; }
.battle {
  width: min(340px, 100%); padding: 1rem 1rem 1.1rem;
  background: linear-gradient(180deg, #17205a, #0b1030);
  border: 2px solid #3b4aa8; border-radius: 22px; color: var(--mist);
  box-shadow: 0 18px 30px -14px rgba(7, 11, 31, .8);
}
.foe { display: flex; align-items: center; gap: .9rem; }
.foe-img { width: 5.2rem; height: 5.2rem; margin: -.5rem -.3rem -.5rem -.5rem; display: block; }
.foe-img.hit { animation: hit .45s ease; }
.foe-img.down { animation: down .8s ease forwards; }
@keyframes hit { 0%, 100% { transform: none; } 20% { transform: translateX(-9px) rotate(-8deg); } 55% { transform: translateX(8px) rotate(6deg); } }
@keyframes down { to { transform: translate(40px, -60px) scale(.4) rotate(30deg); opacity: 0; } }
.foe-info { flex: 1; }
.foe-name { font-weight: 700; margin-bottom: .3rem; }
.hp { display: flex; gap: 5px; }
.hp i { height: 12px; flex: 1; border-radius: 6px; background: var(--cyan); transition: background .3s, opacity .3s; }
.hp i.gone { background: #26305e; }
.question {
  margin: 1rem 0 .6rem; padding: .7rem .8rem; border-radius: 14px; background: #070b1f;
  font: 700 2.2rem/1.2 var(--display); color: #fff; text-align: center;
}
.answer {
  margin: 0 auto .7rem; width: 7rem; min-height: 2.9rem; border-radius: 12px; border: 2px solid #3b4aa8;
  background: #0b1030; display: grid; place-items: center; font: 700 1.6rem var(--display); color: var(--star);
}
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.key {
  height: 3rem; border-radius: 12px; border: 0; padding: 0; cursor: pointer;
  background: #26305e; color: #fff; font: 700 1.35rem var(--display);
  box-shadow: 0 4px 0 #111842;
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #111842; }
.key.fire { background: linear-gradient(#fb923c, #ea580c); box-shadow: 0 4px 0 #9a3412; font-size: 1.05rem; }
.key.fire:active { box-shadow: 0 1px 0 #9a3412; }
.key:disabled { opacity: .45; cursor: default; }
.status { min-height: 1.6rem; margin: .8rem 0 0; text-align: center; font-weight: 700; font-size: .98rem; color: var(--star); }
.battle.shake .answer { animation: hit .45s ease; }
.mini-btn {
  display: block; margin: .35rem auto 0; padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
  background: transparent; border: 2px solid #3b4aa8; color: var(--mist); font: 700 .9rem var(--body);
}
.mini-btn:hover { border-color: var(--star); color: #fff; }
.mini-btn[hidden] { display: none; }
.stage-note { font-size: .9rem; color: var(--ink-soft); margin: 0; text-align: center; max-width: 30ch; }

/* ---------- crew ---------- */
.crew-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 2rem 4rem; align-items: start; margin-top: 2rem; }
.classes { list-style: none; }
.class { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.1rem; padding: 1.25rem 0; border-top: 1px solid rgba(170, 182, 224, .25); align-items: center; }
.class:first-child { border-top: 0; padding-top: 0; }
.class img { width: 4.5rem; height: 4.5rem; display: block; }
.class h3 { color: var(--c); margin-bottom: .2rem; }
.class p { margin: 0; color: var(--mist); }
.class p + p { margin-top: .35rem; color: var(--mist-soft); }
.class.pilot { --c: var(--pilot); }
.class.engineer { --c: var(--engineer); }
.class.navigator { --c: var(--navigator); }
.small { font-size: .95rem; color: var(--mist-soft); }
.collect { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(170, 182, 224, .25); }
.collect h3 { color: var(--star); margin-bottom: .35rem; }
.colony {
  justify-self: center; width: min(320px, 100%); padding: 1.25rem 1rem 0; border-radius: 26px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #2a1b78, #0b1030 70%); border: 2px solid #3b4aa8;
  box-shadow: 0 30px 50px -24px #000;
}
.colony .row { display: flex; justify-content: center; align-items: flex-end; gap: .25rem; }
.colony .row img { width: 30%; height: auto; }
.colony .ground {
  margin: -.5rem -1rem 0; height: 3.2rem;
  background: radial-gradient(140% 100% at 50% 100%, #e0734a 60%, #b5482a 61%, #b5482a 100%);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.colony-cap { text-align: center; font-size: .9rem; color: var(--mist-soft); margin: .9rem auto 0; max-width: 28ch; }

/* ---------- private + premium ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem 4.5rem; }
.two h2 { margin-bottom: 1rem; font-size: clamp(1.6rem, 3.3vw, 2.25rem); }
.checks { list-style: none; margin: 1rem 0 1rem; }
.checks li { position: relative; padding: .35rem 0 .35rem 1.9rem; }
.checks li::before {
  content: ""; position: absolute; left: .15rem; top: .8rem; width: .75rem; height: .75rem;
  background: var(--star); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.night-band { background: linear-gradient(180deg, var(--space), #10173f); }

/* ---------- long documents (privacy, support) ---------- */
.page-head { padding-block: clamp(1.5rem, 4vw, 2.5rem) 1.5rem; }
.page-head h1 { font-size: clamp(2.4rem, 7vw, 4rem); color: var(--star); line-height: 1; }
.page-head p { margin: .8rem 0 0; color: var(--mist-soft); max-width: 40rem; font-size: 1.15rem; }
.doc {
  background: var(--panel); color: var(--ink); border: 3px solid var(--outline); border-radius: 22px;
  box-shadow: 0 34px 60px -26px rgba(0, 0, 0, .8), 0 0 0 7px rgba(34, 211, 238, .12);
  padding: clamp(1.5rem, 5vw, 3.5rem); margin-bottom: 4rem;
}
.doc > * { max-width: 44rem; margin-inline: auto; }
.doc h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 2.4rem auto .7rem; }
.doc h3 { color: var(--navy-ink); margin: 1.5rem auto .3rem; font-size: 1.1rem; }
.doc ul.plain { margin: 0 auto 1em; padding-left: 1.3rem; }
.doc ul.plain li { margin: .35rem 0; }
.doc .updated { color: var(--ink-soft); margin-bottom: 1.5rem; }
.summary {
  background: #fff; border: 2px solid var(--outline); border-radius: 14px; padding: 1.2rem 1.4rem; margin-block: 1rem 1.5rem;
}
.summary h2 { margin: 0 0 .5rem !important; font-size: 1.4rem !important; }
.summary ul { margin: 0; padding-left: 1.2rem; }
.summary li { margin: .3rem 0; }
.quote { border-left: 4px solid var(--mars); padding: .2rem 0 .2rem 1rem; color: var(--ink-soft); font-size: .98rem; }
.doc code, .doc kbd {
  font: 600 .92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(30, 42, 92, .08); padding: .1em .35em; border-radius: 5px; color: var(--navy-ink); word-break: break-word;
}
details { border-top: 1px dashed rgba(30, 42, 92, .35); padding: .2rem 0; }
details:last-of-type { border-bottom: 1px dashed rgba(30, 42, 92, .35); }
summary {
  cursor: pointer; font-weight: 700; font-size: 1.1rem; color: var(--navy-ink); padding: .8rem 0; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 700 1.6rem/1 var(--display); color: var(--mars-deep); flex: none; }
details[open] summary::after { content: "\2212"; }
details > :not(summary) { margin-top: 0; }
details p:last-child, details ol:last-child { margin-bottom: 1rem; }
.contact-line { font-size: 1.2rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid rgba(170, 182, 224, .22); padding-block: 2.5rem 3rem; color: var(--mist-soft); font-size: .98rem; }
.foot { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1.5rem 3rem; }
.foot .brand span { font-size: 1.15rem; }
.foot ul { list-style: none; display: grid; gap: .3rem; }
.foot h2 { font: 700 1rem var(--body); color: var(--mist); margin-bottom: .5rem; }
.fine { margin-top: 2rem; font-size: .88rem; color: #8f9cc9; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero { padding-top: 8.25rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .wordmark { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .emblem { grid-row: 1; width: min(220px, 56%); justify-self: start; }
  .spread { grid-template-columns: 1fr; }
  .page.l { border-radius: 19px 19px 0 0; }
  .page.r { border-radius: 0 0 19px 19px; border-top: 3px solid var(--outline); }
  .crew-grid, .two { grid-template-columns: 1fr; }
  .colony { justify-self: start; }
  .colony-cap { text-align: left; margin-left: 0; }
  .foot { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .emblem img, .foe-img.hit, .foe-img.down, .battle.shake .answer { animation: none !important; }
}
