/* ==========================================================================
   The Allowance Adventure — one stylesheet, no JavaScript anywhere.
   ========================================================================== */

:root {
  --cream:   #fdf7ec;
  --paper:   #ffffff;
  --ink:     #1c1a17;
  --ink-soft:#5b554c;
  --line:    #1c1a17;

  --mint:    #10b981;
  --mint-dk: #0b8f66;
  --coral:   #ff6b53;
  --sun:     #ffd166;
  --grape:   #7c5cff;

  --bg:      var(--cream);
  --surface: var(--paper);
  --tint:    #eafaf3;
  --text:    var(--ink);
  --muted:   var(--ink-soft);
  --border:  var(--line);
  --accent:  var(--mint);
  --accent-ink: #ffffff;

  --radius:  18px;
  --radius-sm: 10px;
  --shadow:  5px 5px 0 var(--border);
  --shadow-lg: 8px 8px 0 var(--border);
  --bw: 2.5px;

  --measure: 68ch;
  --wrap: 1080px;
  --wrap-wide: 1320px;

  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Semibold", var(--font);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #15141a;
    --surface: #201e28;
    --tint:    #1c2a26;
    --text:    #f3efe6;
    --muted:   #a9a2b5;
    --border:  #423e50;
    --accent:  #2ee6a8;
    --accent-ink: #10231c;
    --shadow:  5px 5px 0 var(--border);
    --shadow-lg: 8px 8px 0 var(--border);
  }
}

/* --------------------------------------------------------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--sun) 22%, transparent) 0, transparent 38%),
    radial-gradient(circle at 88% 4%, color-mix(in srgb, var(--mint) 18%, transparent) 0, transparent 34%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(2.1rem, 1.5rem + 2.8vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: color-mix(in srgb, var(--border) 18%, transparent); padding: .1em .4em; border-radius: 5px; }

a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--accent); }

:focus-visible { outline: 3px solid var(--grape); outline-offset: 3px; border-radius: 4px; }

.muted { color: var(--muted); }
.fineprint { font-size: .8rem; color: var(--muted); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--accent); color: var(--accent-ink); padding: .7rem 1.1rem; font-weight: 700;
}
.skip:focus { left: .5rem; top: .5rem; }

/* --------------------------------------------------------- header -------- */

.site-head {
  max-width: var(--wrap-wide);
  margin: 0 auto;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; }
.brand__coin { font-size: 1.5rem; display: inline-block; transition: transform .35s cubic-bezier(.34,1.56,.64,1); }
.brand:hover .brand__coin { transform: rotate(-18deg) scale(1.15); }

.site-nav { display: flex; flex-wrap: wrap; gap: .35rem; }
.site-nav a {
  text-decoration: none;
  padding: .45rem .9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  border: 2px solid transparent;
}
.site-nav a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.site-nav a[aria-current="page"] { border-color: var(--border); background: var(--surface); }

/* --------------------------------------------------------- stepper ------- */

.stepper {
  list-style: none;
  max-width: var(--wrap);
  margin: .5rem auto 2.5rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  display: flex; gap: .5rem;
  counter-reset: none;
}
.stepper__item { flex: 1 1 0; min-width: 0; }
.stepper__item a {
  display: flex; align-items: center; gap: .55rem;
  text-decoration: none;
  padding: .6rem .75rem;
  border: var(--bw) solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700; font-size: .9rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stepper__item a:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--border); }
.stepper__num {
  flex: none;
  width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--border) 15%, transparent);
  font-size: .85rem;
}
.stepper__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper__item.is-current a { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--border); }
.stepper__item.is-current .stepper__num { background: color-mix(in srgb, var(--accent-ink) 25%, transparent); }
.stepper__item.is-done a { background: var(--tint); }
.stepper__item.is-done .stepper__num::after { content: "✓"; }
.stepper__item.is-done .stepper__num { color: transparent; position: relative; }
.stepper__item.is-done .stepper__num::after { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); }

@media (max-width: 620px) {
  .stepper__label { display: none; }
  .stepper__item.is-current .stepper__label { display: inline; }
  .stepper__item a { justify-content: center; }
}

/* --------------------------------------------------------- layout ------- */

main { min-height: 40vh; }

.band {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2.75rem clamp(1rem, 4vw, 2.5rem);
}
.band--wide { max-width: var(--wrap-wide); }
.band--tint {
  max-width: none;
  background: var(--tint);
  border-top: var(--bw) solid var(--border);
  border-bottom: var(--bw) solid var(--border);
  margin: 2rem 0;
  /* Keep the text lined up with the rest of the page while the tint runs full-bleed. */
  padding-inline: max(
    clamp(1rem, 4vw, 2.5rem),
    calc((100% - var(--wrap)) / 2 + clamp(1rem, 4vw, 2.5rem))
  );
}

.section-title { margin-bottom: .35em; }
.section-title--sm { font-size: 1.25rem; }
.section-lede { max-width: var(--measure); color: var(--muted); font-size: 1.05rem; margin-bottom: 2rem; }

.eyebrow {
  font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .6rem;
}
.eyebrow a { color: inherit; }

/* --------------------------------------------------------- hero --------- */

.hero {
  position: relative;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem) 3rem;
  text-align: center;
  overflow: hidden;
}
.hero__title { margin-bottom: .4em; }
.hero__lede {
  max-width: 46ch; margin: 0 auto 2rem;
  font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem);
  color: var(--muted);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }

.hero__coins { position: absolute; inset: 0; pointer-events: none; }
.coin { position: absolute; font-size: 2rem; opacity: .55; animation: bob 5s ease-in-out infinite; }
.coin--1 { left: 6%;  top: 18%; animation-delay: 0s;   }
.coin--2 { right: 9%; top: 12%; animation-delay: .8s;  font-size: 2.4rem; }
.coin--3 { right: 5%; bottom: 22%; animation-delay: 1.6s; }
.coin--4 { left: 11%; bottom: 16%; animation-delay: 2.4s; font-size: 1.6rem; }
@media (max-width: 780px) { .hero__coins { display: none; } }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-14px) rotate(8deg); }
}

.squiggle {
  height: 22px;
  background-repeat: repeat-x;
  background-size: 44px 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22' viewBox='0 0 44 22'%3E%3Cpath d='M0 15 Q11 2 22 15 T44 15' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  opacity: .8;
}

/* --------------------------------------------------------- buttons ------ */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.3rem;
  border: var(--bw) solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .13s ease, box-shadow .13s ease, background .13s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--border); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--big { font-size: 1.05rem; padding: .9rem 1.7rem; }
.btn--sm { font-size: .85rem; padding: .45rem .95rem; box-shadow: 3px 3px 0 var(--border); }

/* --------------------------------------------------------- how it works - */

.howto {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  counter-reset: howto;
}
.howto__step {
  position: relative;
  background: var(--surface);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 1.35rem 1.35rem;
  box-shadow: var(--shadow);
}
.howto__num {
  position: absolute; top: -1.1rem; left: 1.2rem;
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  border: var(--bw) solid var(--border);
  border-radius: 50%;
  background: var(--sun);
  color: #1c1a17;
  font-family: var(--font-display);
  font-weight: 800;
}
.howto__step:nth-child(2) .howto__num { background: var(--coral); color: #fff; }
.howto__step:nth-child(3) .howto__num { background: var(--grape); color: #fff; }
.howto__step h3 { margin-bottom: .35em; }
.howto__step p { margin: 0; color: var(--muted); font-size: .96rem; }

/* --------------------------------------------------------- chips -------- */

.chips { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1rem;
  border: var(--bw) solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none; font-weight: 600; font-size: .95rem;
  transition: transform .13s ease, background .13s ease;
}
.chip:hover { transform: translateY(-2px); background: var(--tint); }

/* --------------------------------------------------------- video -------- */

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: #0d0d10;
  margin: 0 0 2rem;
}
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.player--empty { background: var(--surface); display: grid; place-items: center; }
.player--soon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player__veil {
  position: absolute; inset: 0;
  display: grid; place-items: center; align-content: center;
  text-align: center; color: #fff;
  background: rgba(12, 12, 16, .58);
  backdrop-filter: blur(2px);
}
.player__veil p { margin: 0; }
.player__veil strong {
  display: inline-block;
  padding: .4rem 1.1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, .5);
  border: 2px solid rgba(255, 255, 255, .45);
}
.player--soon .player__reel { font-size: 2.6rem; }
.player__placeholder { text-align: center; padding: 1.5rem; }
.player__placeholder p { margin: .2rem 0; }
.player__reel { font-size: 3rem; display: block; margin-bottom: .5rem; animation: bob 6s ease-in-out infinite; }

/* --------------------------------------------------------- page heads --- */

.pagehead {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 0;
}
.pagehead .hero__lede { margin-left: 0; text-align: left; }
.lesson__emoji { display: inline-block; margin-right: .2em; }
.lesson__duration { color: var(--muted); font-weight: 600; }

/* --------------------------------------------------------- thumbnails --- */

/* Shared by lesson cards and game cards. Drop a `thumb` path in the data file and
   the image takes over; leave it empty and the entry's emoji fills the panel. */
.thumb {
  display: block;
  overflow: hidden;
  background: var(--tint);
  border: var(--bw) solid var(--border);
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb--emoji { display: grid; place-items: center; line-height: 1; }

.thumb--lesson {
  flex: none;
  width: 15rem;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  font-size: 3rem;
}
@media (max-width: 640px) {
  .lesson-card__link { flex-direction: column; }
  .thumb--lesson { width: 100%; }
}

.thumb--game {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-bottom: var(--bw) solid var(--border);
  font-size: 4rem;
}

/* --------------------------------------------------------- lesson list -- */

.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; counter-reset: lesson; }
.lesson-card__link {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--surface);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.lesson-card__link:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lg); background: var(--tint); }
.lesson-card__body { display: block; min-width: 0; }
.lesson-card__meta { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lesson-card__title { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; margin: .15rem 0 .3rem; }
.lesson-card__desc { display: block; color: var(--muted); font-size: .96rem; max-width: var(--measure); }
.lesson-card__go { display: inline-block; margin-top: .7rem; font-weight: 700; color: var(--accent); }

/* --------------------------------------------------------- lesson page -- */

.lesson__cols {
  display: grid; gap: 1.5rem;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 780px) { .lesson__cols { grid-template-columns: 1fr; } }
.lesson__desc p { max-width: var(--measure); }

.takeaways {
  background: var(--sun);
  color: #1c1a17;
  border: var(--bw) solid #1c1a17;
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: 5px 5px 0 #1c1a17;
}
.takeaways--alt { background: var(--grape); color: #fff; border-color: #1c1a17; }
.takeaways__title { font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .8em; }
.takeaways ul { margin: 0; padding-left: 1.15rem; }
.takeaways li { margin-bottom: .5rem; }
.takeaways li::marker { content: "→ "; font-weight: 800; }
.takeaways .btn { margin-top: .6rem; background: #fff; color: #1c1a17; border-color: #1c1a17; box-shadow: 3px 3px 0 #1c1a17; }

/* --------------------------------------------------------- games -------- */

.game-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.game-card { display: flex; flex-direction: column; }
.game-card__link {
  display: flex; flex-direction: column; flex: 1;
  background: var(--surface);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.game-card__link:hover { transform: translate(-3px, -3px) rotate(-.5deg); box-shadow: var(--shadow-lg); }
.game-card:nth-child(2n) .thumb--emoji { background: color-mix(in srgb, var(--sun) 45%, var(--surface)); }
.game-card:nth-child(3n) .thumb--emoji { background: color-mix(in srgb, var(--coral) 30%, var(--surface)); }
.game-card__body { display: flex; flex-direction: column; flex: 1; padding: 1.15rem 1.3rem 1.3rem; }
.game-card__title { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.game-card__tagline { color: var(--muted); font-size: .95rem; margin: .3rem 0 .9rem; }
.game-card__go { margin-top: auto; font-weight: 700; color: var(--accent); }

/* --------------------------------------------------------- game stage --- */

.stage {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 420px;
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: .75rem;
}
.stage__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage--empty { display: grid; place-items: center; }
.stage__note { font-size: .9rem; color: var(--muted); margin-bottom: 2rem; }
@media (max-width: 700px) { .stage { aspect-ratio: 3 / 4; min-height: 0; } }

/* --------------------------------------------------------- pager -------- */

.pager {
  max-width: var(--wrap);
  margin: 1rem auto 3rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  display: grid; gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 620px) { .pager { grid-template-columns: 1fr; } }
.pager__link {
  display: block;
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.2rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.pager__link:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); background: var(--tint); }
.pager__link--next { text-align: right; }
.pager__dir { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pager__title { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }

/* --------------------------------------------------------- next step ---- */

.nextstep {
  margin-top: 2.5rem;
  padding: 1.75rem;
  text-align: center;
  border: var(--bw) dashed var(--border);
  border-radius: var(--radius);
}
.nextstep__label { font-weight: 700; color: var(--muted); margin-bottom: .8rem; }

/* --------------------------------------------------------- footer ------- */

.site-foot {
  border-top: var(--bw) solid var(--border);
  margin-top: 2rem;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
  text-align: center;
  background: var(--surface);
}
.site-foot__mark { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin-bottom: .2rem; }
.site-foot__nav { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: center; margin: 1.25rem 0; font-weight: 600; }
