/* ==========================================================================
   Math Memory — marketing site (landing, how it works, about)
   Same palette and type as the app; paper background from the design canvas.
   ========================================================================== */

.site-body {
  background: var(--paper);
  color: var(--ink);
  font: 600 16px/1.6 var(--font-ui);
}

a { color: var(--indigo); text-decoration: none; }
a:hover { color: #3a1fa8; text-decoration: underline; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.wrap--narrow { width: min(760px, 100% - 40px); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(239, 236, 229, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, .07);
}
.site-header__inner {
  display: flex; align-items: center; gap: var(--s5);
  min-height: 68px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font: 600 20px var(--font-display); color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .mascot { --mascot: 30px; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--s5); }
.site-nav a {
  font: 700 14px var(--font-ui); color: var(--muted);
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); }

.btn-play {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--cta-2), var(--cta));
  color: #5b2c00;
  border-radius: var(--r-pill);
  padding: 11px 22px;
  font: 700 15px var(--font-display);
  box-shadow: 0 4px 0 var(--cta-shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  min-height: var(--tap);
}
.btn-play:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--cta-shadow); color: #5b2c00; text-decoration: none; }
.btn-play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cta-shadow); }
.btn-play--lg { padding: 18px 40px; font-size: 24px; box-shadow: 0 7px 0 var(--cta-shadow); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  border: 2px solid rgba(26, 20, 48, .18);
  border-radius: var(--r-pill);
  padding: 15px 28px;
  font: 800 15px var(--font-ui); color: var(--ink);
  min-height: var(--tap);
}
.btn-ghost:hover { background: rgba(26, 20, 48, .05); text-decoration: none; color: var(--ink); }

@media (max-width: 720px) {
  .site-nav { gap: var(--s3); }
  .site-nav a:not(.btn-play) { display: none; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  background: var(--app-bg);
  color: #fff;
  border-radius: var(--r-sheet);
  margin-top: var(--s6);
  padding: clamp(28px, 5vw, 64px);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; top: -120px; right: -100px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 182, 46, .28), transparent 70%);
}
.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
}
.hero__eyebrow {
  font: 600 11px var(--font-mono);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--s3);
}
.hero h1 {
  font: 700 clamp(38px, 6vw, 62px)/1.02 var(--font-display);
  letter-spacing: -1px;
  margin: 0 0 var(--s4);
}
.hero__lede {
  font: 600 clamp(16px, 2vw, 19px)/1.6 var(--font-ui);
  color: rgba(255, 255, 255, .78);
  margin: 0 0 var(--s6);
  max-width: 46ch;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.hero .btn-ghost { border-color: rgba(255, 255, 255, .3); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.hero__meta {
  display: flex; flex-wrap: wrap; gap: var(--s5);
  margin-top: var(--s6);
  font: 700 12px var(--font-ui);
  color: rgba(255, 255, 255, .55);
}
.hero__meta span { display: flex; align-items: center; gap: 7px; }

@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Live demo board on the landing page
   -------------------------------------------------------------------------- */

.demo {
  background: rgba(0, 0, 0, .22);
  border: 1.5px solid rgba(255, 255, 255, .14);
  border-radius: var(--r-sheet);
  padding: var(--s5);
}
.demo__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: var(--s4);
}
.demo__head .mascot { --mascot: 40px; }
.demo__status { font: 700 13px var(--font-ui); color: #fff; }
.demo__board {
  container-type: inline-size;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  --cols: 2; --gap: 12px;
}
.demo__hint {
  margin-top: var(--s4);
  font: 600 12px var(--font-ui);
  color: rgba(255, 255, 255, .5);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: clamp(48px, 8vw, 92px) 0; }
.section--tight { padding: clamp(32px, 5vw, 56px) 0; }

.section__label {
  font: 800 12px var(--font-ui);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: var(--s3);
}
.section h2 {
  font: 600 clamp(26px, 4vw, 38px)/1.15 var(--font-display);
  color: var(--ink);
  margin: 0 0 var(--s4);
  letter-spacing: -.4px;
}
.section__lede {
  font: 600 17px/1.65 var(--font-ui);
  color: var(--muted);
  max-width: 64ch;
  margin: 0 0 var(--s6);
}

.card-panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 26px 28px;
}
.card-panel h3 {
  font: 800 16px var(--font-ui); color: var(--ink);
  margin: 0 0 var(--s2);
}
.card-panel p { margin: 0; color: var(--muted); font-size: 14.5px; }

.cols { display: grid; gap: 18px; }
.cols--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cols--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.feature__icon {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  font-size: 22px;
  background: #f3f1f8;
  margin-bottom: var(--s3);
}

/* The core-loop strip */
.loop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  counter-reset: step;
}
.loop__step {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 22px;
  position: relative;
}
.loop__step::before {
  counter-increment: step;
  content: counter(step);
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--ink); color: #fff;
  font: 700 14px var(--font-display);
  margin-bottom: var(--s3);
}
.loop__step h3 { font: 800 15px var(--font-ui); margin: 0 0 6px; }
.loop__step p { margin: 0; font-size: 14px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Spec pieces reused from the design handoff
   -------------------------------------------------------------------------- */

.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.swatch { display: flex; flex-direction: column; gap: 8px; }
.swatch__demo {
  aspect-ratio: 1;
  border-radius: var(--r-card);
  display: grid; place-items: center;
  border: 2px solid #fff;
  background: linear-gradient(175deg, var(--card-front), var(--card-front-2));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
}
.swatch__demo.back {
  background: linear-gradient(160deg, var(--card-back-2), var(--card-back));
  border-color: rgba(255, 255, 255, .22);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .2);
}
.swatch__demo.is-selected { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 61, 255, .25); }
.swatch__demo.is-wrong { border-color: #ffb3cd; box-shadow: 0 0 0 3px rgba(255, 120, 170, .3); animation: mmwobble .45s ease infinite 1.4s; }
.swatch__demo.is-right { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold), 0 0 28px rgba(255, 205, 80, .8); }
.swatch__demo.is-gone { opacity: .22; box-shadow: none; }
.swatch__demo .eq { font-size: 19px; --eq-gap: 3px; }
.swatch__name { font: 700 11px var(--font-ui); color: var(--ink); }
.swatch__note { font: 600 10px/1.4 var(--font-mono); color: var(--muted-2); }

.tokens { display: flex; flex-direction: column; gap: 8px; }
.token-row { display: flex; align-items: center; gap: 11px; }
.token-row__chip { width: 26px; height: 26px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .1); flex: none; }
.token-row__name { font: 700 12.5px var(--font-ui); color: var(--ink); min-width: 118px; }
.token-row__hex { font: 500 11.5px var(--font-mono); color: var(--muted-2); }
.token-row__var { font: 500 11.5px var(--font-mono); color: #c0bbcc; margin-left: auto; }

.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.flow__node {
  background: #f3f1f8; color: #3d3560;
  border-radius: 9px; padding: 8px 12px;
  font: 700 12px var(--font-ui);
}
.flow__node--miss { background: #fdeef4; color: #a32b63; }
.flow__node--hit  { background: #fff6e0; color: #8a5a00; }
.flow__arrow { color: #c0bbcc; font-size: 13px; }

.micro-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.micro-list__item b { display: block; font: 800 12px var(--font-ui); color: var(--ink); }
.micro-list__item span { font: 600 11.5px/1.45 var(--font-ui); color: var(--muted-2); }

.type-spec { display: flex; flex-direction: column; gap: 9px; font: 600 12.5px var(--font-ui); color: var(--muted); }
.type-spec hr { border: 0; border-top: 1px solid var(--panel-line); margin: 4px 0; width: 100%; }

.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.level-spec {
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 13px;
  background: var(--panel);
}
.level-spec__title { font: 600 17px var(--font-display); color: var(--ink); }
.level-spec__size { font: 800 11px var(--font-ui); color: var(--indigo); margin: 3px 0 6px; }
.level-spec__facts { font: 500 10.5px/1.6 var(--font-mono); color: var(--muted-2); }

.weight-demo { display: flex; flex-direction: column; gap: 9px; }
.weight-row { display: flex; align-items: center; gap: 10px; }
.weight-row__fact { font: 500 12px var(--font-mono); color: var(--ink); min-width: 86px; }
.weight-row__bar { flex: 1; height: 8px; border-radius: 5px; background: #eeecf3; overflow: hidden; }
.weight-row__fill { display: block; height: 100%; border-radius: 5px; }
.weight-row__detail { font: 500 11px var(--font-mono); color: var(--muted-2); min-width: 104px; text-align: right; }

.formula {
  font: 500 14px var(--font-mono);
  background: #f3f1f8;
  border-radius: 10px;
  padding: 14px 16px;
  color: #3d3560;
  overflow-x: auto;
}

.callout {
  border-left: 3px solid var(--gold);
  background: #fff8e8;
  border-radius: 0 12px 12px 0;
  padding: 16px 20px;
  font: 600 14.5px/1.6 var(--font-ui);
  color: #6b4a00;
}

.faq details {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 12px;
}
.faq summary {
  font: 800 15px var(--font-ui); color: var(--ink);
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; gap: var(--s3);
  min-height: 28px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 600 22px var(--font-display); color: var(--muted-2); }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 12px 0 0; color: var(--muted); font-size: 14.5px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}
.stat-strip b {
  display: block;
  font: 600 34px var(--font-display); color: var(--ink);
}
.stat-strip span { font: 700 12px var(--font-ui); color: var(--muted-2); }

.eq-showcase {
  display: flex; flex-wrap: wrap; gap: var(--s5); align-items: center;
  justify-content: center;
  padding: var(--s6) 0;
}
.eq-showcase .eq { font-size: clamp(28px, 5vw, 44px); --eq-gap: 6px; }

/* --------------------------------------------------------------------------
   CTA band + footer
   -------------------------------------------------------------------------- */

.cta-band {
  background: var(--app-bg);
  border-radius: var(--r-sheet);
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
  color: #fff;
  margin-bottom: var(--s6);
}
.cta-band h2 { font: 600 clamp(26px, 4vw, 40px) var(--font-display); margin: 0 0 var(--s3); color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .7); margin: 0 0 var(--s6); font-size: 16px; }

.cta-band__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  justify-content: center;
}

/* .btn-ghost is drawn for the paper surface — dark ink on a dark border. The
   band runs on the app gradient, where that is all but invisible, so the
   secondary action is re-drawn in white here. */
.cta-band .btn-ghost {
  border-color: rgba(255, 255, 255, .34);
  color: #fff;
}

.cta-band .btn-ghost:hover {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .5);
  color: #fff;
}

/* Qualified with the element, because `.cta-band p` above is (0,1,1) and would
   otherwise win every one of these declarations — including the font-size,
   leaving the fine print the same size as the lede it sits under. */
.cta-band p.cta-band__fine {
  margin: var(--s5) auto 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .55);
  max-width: 52ch;
}

.site-footer {
  border-top: 1px solid rgba(0, 0, 0, .08);
  padding: var(--s6) 0 48px;
  font: 600 13px var(--font-ui);
  color: var(--muted-2);
}
.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--s5); align-items: center; }
.site-footer nav { margin-left: auto; display: flex; gap: var(--s5); flex-wrap: wrap; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 0 0 10px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; top: 0; }


/* --------------------------------------------------------------------------
   Quackers on the marketing page: one row of expressions, because the range
   of them is the point being made.
   -------------------------------------------------------------------------- */
.quack-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 26px 0 30px;
}
/* The tiles share the row and shrink together, so the five expressions stay
   on one line at any width rather than wrapping into an awkward 3 + 2. */
.quack-strip__duck {
  flex: 1 1 0;
  min-width: 0;
  max-width: 150px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: linear-gradient(170deg, #3a1c7d, #241056);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}
.quack-strip__duck .dk { --duck: min(130px, 88cqw); width: 88%; height: 88%; }
@media (max-width: 520px) {
  .quack-strip__duck:nth-child(n+5) { display: none; }
}
