/*
  Home page (spec EV-10, decisions 016 and 038; design/screens/kid-mode/homepage-prototype.dc.html):
  hero · Pick a badge. Or spin. · For the kids · Thursday email.
  Loads after fonts.css, tokens.css and base.css (topic colors are in base.css, topic badges in badges.css).
  The badge section is .topic-pick: base.css already uses .pick for the filter pills.
  No inline styles anywhere: the Content Security Policy blocks style="" attributes.
*/

/* ---------- 1 · Hero ---------- */
.hero { padding-block: var(--wc-space-8) var(--wc-space-12); }
.hero__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.hero__kicker { margin: 0; color: var(--wc-text-muted); }
.hero__title {
  margin: 0;
  font-size: clamp(3.25rem, 7.4vw, 5.5rem); /* 52 → 88 px */
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero__title mark {
  background: none;
  color: inherit;
  white-space: nowrap;
  box-shadow: inset 0 -0.17em 0 var(--wc-lantern); /* decorative */
}
/* The line under the headline, set like a dictionary entry: it sits closer to the headline
   than the lede does, so it reads as the punchline, not a second paragraph. */
.hero__head { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.hero__def {
  margin: 0;
  font-family: var(--wc-font-label);
  font-size: clamp(0.9375rem, 1.5vw, 1.25rem); /* 15 → 20 px */
  line-height: 1.4;
  color: var(--wc-text-muted);
  text-wrap: balance;
}
.hero__def b,
.hero__said { color: var(--wc-text); }
.hero__said { white-space: nowrap; } /* the kid's words stay on one line; phones break before them */
.hero__lede { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.hero__lede .lede { margin: 0; font-size: clamp(1.125rem, 1.6vw, 1.375rem); line-height: 1.45; text-wrap: pretty; }
.hero__actions { width: 100%; display: flex; flex-wrap: wrap; gap: 10px; }
/* Phones: the two buttons share the row at equal width (they may wrap their words at 320 px) */
.hero__actions .btn { flex: 1 1 0; min-width: 0; padding-inline: var(--wc-space-3); white-space: normal; text-align: center; }

/* Wide: one centred column, a cover band above the left-aligned sections. The lede caps
   at 45rem (about 65 characters a line) so the band spans the page without long lines. */
@media (min-width: 48rem) {
  .hero { padding-block: 88px 8px; }
  .hero__inner { align-items: center; text-align: center; }
  .hero__head { gap: 12px; }
  .hero__lede { max-width: 45rem; align-items: center; }
  .hero__actions { width: auto; justify-content: center; }
  .hero__actions .btn { flex: 0 0 auto; padding-inline: var(--wc-space-6); white-space: nowrap; }
}

/* ---------- 2 · Pick a badge. Or spin. ---------- */
.topic-pick { padding-block: var(--wc-space-12) 0; scroll-margin-top: var(--wc-space-4); }
.topic-pick__inner { display: flex; flex-direction: column; gap: 18px; }
.topic-pick__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.topic-pick__title { margin: 0; font-size: clamp(2.125rem, 3.6vw, 2.75rem); line-height: 1; letter-spacing: -0.03em; }
.topic-pick__spin { margin: 0; }
.spin-btn { font-family: var(--wc-font-display); font-weight: 800; font-size: 1.25rem; }
.spin-btn[disabled] { opacity: 1; cursor: progress; }
.spin-btn[aria-busy="true"] svg { animation: home-turn 600ms linear infinite; } /* only while spinning, about 2 s */

/* Badge grid above the results panel (decision 053: ten badges) */
.topic-pick__body { position: relative; display: flex; flex-wrap: wrap; align-items: stretch; gap: 20px; }
.badge-grid {
  flex: 999 1 35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.badge-grid > li { display: flex; }
/* An odd last badge spans the row on phones instead of sitting alone (ten today, so none) */
.badge-grid > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.badge {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 12px;
  border: var(--wc-border-width) solid var(--wc-border);
  border-radius: var(--wc-radius-card);
  background: var(--wc-surface);
  color: var(--wc-text);
  text-decoration: none;
  box-shadow: 0 3px 0 var(--wc-border);
  transition: transform 160ms cubic-bezier(.3, 1.6, .5, 1), background-color 120ms, box-shadow 120ms;
}
.badge:hover { color: var(--wc-text); box-shadow: 0 5px 0 var(--wc-border); transform: translateY(-2px); }
.badge:focus-visible { outline: var(--wc-focus-ring); outline-offset: var(--wc-focus-offset); }
.badge__scene { width: 56px; height: 56px; } /* the smallest scene (decision 056); hover or focus plays its move (.tb-hover) */
.badge__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.badge__line { font-weight: 700; font-size: var(--wc-size-small); line-height: 1.2; }
.badge__topic { font-family: var(--wc-font-label); font-weight: 700; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--wc-text-muted); }

/* Selected (the topic in the panel) and the spin highlight that runs across the badges */
.badge[aria-current="true"] { background: var(--t-tint); box-shadow: 0 0 0 3px var(--wc-bunsen), 0 4px 0 var(--wc-border); transform: rotate(-1deg); }
.badge.is-hot { background: var(--wc-status); box-shadow: 0 4px 0 var(--wc-border); transform: scale(1.06) rotate(-2deg); color: var(--wc-on-status); }
.badge.is-hot .badge__topic { color: var(--wc-on-status); }
/* The badge a spin or a tap lands on is stamped down while its scene plays (spinner.js) */
.badge.is-landed { animation: home-stamp 520ms cubic-bezier(.3, 1.6, .5, 1); }

/* Results panel */
.picks-panel {
  flex: 1 1 21rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: var(--wc-border-width) solid var(--wc-border);
  border-radius: var(--wc-radius-panel);
  background: var(--wc-surface);
}
.picks-panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.picks-panel__title { margin: 0; font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; }
.picks-panel__all { display: inline-flex; align-items: center; min-height: var(--wc-touch-min); font-weight: 700; font-size: var(--wc-size-small); }
.picks-panel__list { flex: 1; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.picks-panel__list > li { display: flex; }
.picks-panel__empty { margin: 0; }
.picks-panel.is-loading .picks-panel__list, .picks-panel.is-loading .picks-panel__empty { opacity: 0.4; }

.mini-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: var(--wc-border-width) solid var(--wc-border);
  border-radius: 16px;
  background: var(--wc-bg);
}
.mini-card p { margin: 0; }
.mini-card__meta { font-family: var(--wc-font-label); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
.mini-card__title { margin: 0; font-family: var(--wc-font-body); font-weight: 700; font-size: 1.125rem; line-height: 1.2; }
.mini-card__title a { color: inherit; text-decoration: none; }
.mini-card__title a:hover { text-decoration: underline; }
.mini-card__place { font-size: var(--wc-size-small); color: var(--wc-text-muted); }

/* New results are dealt in after a swap (spinner.js adds .is-new) */
.picks-panel.is-new .mini-card { animation: home-deal 380ms ease-out both; }
.picks-panel.is-new li:nth-child(2) .mini-card { animation-delay: 60ms; }
.picks-panel.is-new li:nth-child(3) .mini-card { animation-delay: 120ms; }

/* Confetti when Spin lands (decision 056). spinner.js sets data-topic and --cx/--cy (the landed
   badge's centre, in the layer's coordinates) and replays .is-bursting. The layer reaches up
   into the heading row so pieces from the top row aren't cut off; it clips sideways, so a burst
   near the edge never widens the page. Each piece's path is fixed below: no random numbers. */
.land-confetti { position: absolute; inset: -64px 0 0; overflow: hidden; pointer-events: none; z-index: 2; }
.land-confetti__burst { position: absolute; left: var(--cx, 50%); top: var(--cy, 50%); width: 0; height: 0; }
.land-confetti i { position: absolute; left: -4px; top: -6px; width: 8px; height: 12px; border: 2px solid var(--wc-border); border-radius: 2px; opacity: 0; background: var(--t-bg); }
.land-confetti i:nth-child(3n + 2) { background: var(--wc-lantern); border-radius: 50%; width: 10px; height: 10px; } /* decorative */
.land-confetti i:nth-child(3n) { background: var(--wc-bunsen); } /* decorative */
.land-confetti.is-bursting i { animation: home-confetti 900ms cubic-bezier(.2, .6, .4, 1) both; }
.land-confetti i:nth-child(1)  { --dx: 69px;   --dy: 50px;  --r: 420deg; }
.land-confetti i:nth-child(2)  { --dx: 87px;   --dy: 80px;  --r: -520deg; }
.land-confetti i:nth-child(3)  { --dx: 84px;   --dy: 120px; --r: 640deg; }
.land-confetti i:nth-child(4)  { --dx: 24px;   --dy: 93px;  --r: 420deg; }
.land-confetti i:nth-child(5)  { --dx: 0px;    --dy: 120px; --r: -520deg; }
.land-confetti i:nth-child(6)  { --dx: -44px;  --dy: 138px; --r: 640deg; }
.land-confetti i:nth-child(7)  { --dx: -45px;  --dy: 83px;  --r: 420deg; }
.land-confetti i:nth-child(8)  { --dx: -87px;  --dy: 80px;  --r: -520deg; }
.land-confetti i:nth-child(9)  { --dx: -128px; --dy: 58px;  --r: 640deg; }
.land-confetti i:nth-child(10) { --dx: -69px;  --dy: 30px;  --r: 420deg; }
.land-confetti i:nth-child(11) { --dx: -87px;  --dy: 0px;   --r: -520deg; }
.land-confetti i:nth-child(12) { --dx: -84px;  --dy: -40px; --r: 640deg; }
.land-confetti i:nth-child(13) { --dx: -24px;  --dy: -13px; --r: 420deg; }
.land-confetti i:nth-child(14) { --dx: 0px;    --dy: -40px; --r: -520deg; }
.land-confetti i:nth-child(15) { --dx: 44px;   --dy: -58px; --r: 640deg; }
.land-confetti i:nth-child(16) { --dx: 45px;   --dy: -3px;  --r: 420deg; }
.land-confetti i:nth-child(17) { --dx: 87px;   --dy: 0px;   --r: -520deg; }
.land-confetti i:nth-child(18) { --dx: 128px;  --dy: 22px;  --r: 640deg; }

@media (min-width: 64rem) {
  /* Ten badges: five by two across the full width, the picks panel below with its picks
     three across (decision 053; supersedes 043's three by three beside the panel) */
  .badge-grid { flex-basis: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .badge-grid > li:last-child:nth-child(odd) { grid-column: auto; }
  .badge { flex-direction: column; justify-content: center; text-align: center; padding: 14px 10px; }
  .badge__scene { width: 88px; height: 88px; }
  .badge__text { flex: none; }
  .picks-panel { flex-basis: 100%; }
  .picks-panel__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 3 · For the kids ---------- */
.kids { padding-block: var(--wc-space-12) var(--wc-space-12); }
.kids__inner { display: flex; flex-direction: column; gap: 18px; }
.kids__title { margin: 0; font-size: clamp(2.125rem, 3.6vw, 2.75rem); line-height: 1; letter-spacing: -0.03em; }
.kids__cards { display: flex; flex-wrap: wrap; align-items: stretch; gap: 20px; }
.kid-card {
  flex: 1 1 21rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: var(--wc-border-width) solid var(--wc-border);
  border-radius: 24px;
}
.kid-card--play { background: var(--wc-spy-pond); color: var(--wc-graph-paper); border-color: var(--wc-spy-pond); }
.kid-card--passport { background: var(--wc-status-tint); color: var(--wc-on-status); }
.kid-card__head { display: flex; align-items: center; gap: 14px; }
.kid-card__curio .curio { display: block; animation: home-bob 2.8s ease-in-out infinite; }
.kid-card__kicker { margin: 0 0 4px; color: var(--wc-lantern); }
.kid-card__title { margin: 0; font-size: 2rem; line-height: 1; letter-spacing: -0.02em; }
.kid-card__text { margin: 0; font-size: 1.0625rem; line-height: 1.45; }
.kid-card--play .kid-card__text { color: var(--wc-graph-paper); }
.kid-card__cta { align-self: flex-start; margin-top: auto; }
.kid-card--play .kid-card__cta { border-color: var(--wc-graph-paper); font-family: var(--wc-font-display); font-weight: 800; font-size: 1.25rem; }
/* Same height for both headers so the titles line up: the stamps row matches the Curio row */
.postmark--orange { color: var(--wc-link); }
.kid-card--passport .postmark--orange { color: var(--wc-bunsen-deep); }
.kid-card__stamps .postmark:nth-child(2) { rotate: 14deg; }
.kid-card__stamps .postmark:nth-child(3) { rotate: 5deg; }
.kid-card__stamps .postmark:nth-child(4) { rotate: 17deg; }
.kid-card__stamps .postmark:nth-child(5) { rotate: 1deg; }
.kid-card__stamps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 76px; }
.kid-card__stamps .postmark { width: 3.25rem; height: 3.25rem; font-size: 0.75rem; } /* five fit on one row at 375 px */


/* ---------- Thursday sign-up ---------- */
.thursday { padding-bottom: 72px; }
.signup-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px 56px;
  padding: clamp(28px, 4vw, 56px);
  background: var(--wc-spy-pond);
  color: var(--wc-graph-paper);
  border-radius: 28px;
}
.signup-card__text { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.signup-card__text p { color: var(--wc-mist); max-width: 30em; }
.signup-card__title { font-size: clamp(2.125rem, 4vw, 3.25rem); line-height: 1.02; letter-spacing: -0.03em; }
.signup-card__form { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.signup-card__names { display: flex; flex-wrap: wrap; gap: 12px; }
.signup-card__names .field { flex: 1 1 140px; min-width: 0; }
.signup-card__honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.signup-card .field label { font-size: var(--wc-size-small); }
.signup-card .input { min-height: 52px; border-color: var(--wc-graph-paper); }

.sticker {
  display: inline-block;
  padding: 6px 16px;
  background: var(--wc-status);
  color: var(--wc-on-status);
  border: 3px solid var(--wc-on-status);
  outline: 2px solid var(--wc-status);
  border-radius: var(--wc-radius-pill);
  font-family: var(--wc-font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  rotate: -3deg;
}

/* ---------- Dark mode touches ---------- */
@media (prefers-color-scheme: dark) {
  .kid-card--play { background: var(--wc-surface); border-color: var(--wc-border); }
  .kid-card--passport { background: var(--wc-surface); color: var(--wc-text); }
  .kid-card--passport .postmark--orange { color: var(--wc-link); }
  .signup-card { background: var(--wc-surface); }
}

/* ---------- Keyframes and reduced motion ---------- */
@keyframes home-deal  { from { opacity: 0; transform: translateY(14px) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes home-stamp { 0% { transform: scale(1.3) rotate(-10deg); } 60% { transform: scale(.95) rotate(2deg); } 100% { transform: rotate(-1deg); } }
@keyframes home-turn  { to { transform: rotate(360deg); } }
@keyframes home-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes home-confetti {
  0%   { opacity: 1; transform: none; }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  .badge, .badge.is-hot, .badge[aria-current="true"] { transition: none; transform: none; }
  .picks-panel.is-new .mini-card, .kid-card__curio .curio { animation: none; }
  .land-confetti { display: none; }
  .badge.is-landed, .spin-btn[aria-busy="true"] svg { animation: none; }
}
