/* Joule's Way Home: landing page. Colours, type and the chunky buttons come from the app (src/ui/worlds.ts, kit.tsx). */
@font-face { font-family: 'BagelFatOne_400Regular'; src: url('/assets/fonts/BagelFatOne_400Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Red Hat Text'; src: url('/assets/fonts/RedHatText_400Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Red Hat Text'; src: url('/assets/fonts/RedHatText_500Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Red Hat Text'; src: url('/assets/fonts/RedHatText_700Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Red Hat Mono'; src: url('/assets/fonts/RedHatMono_500Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }

:root {
  /* night: the space world */
  --night: #1b1530; --night-2: #2a2147; --night-3: #3a2f61; --moon: #f4eede; --lilac: #aaa2c8;
  --gold: #ffc24a; --gold-lip: #a87a1f; --mint: #7fe3c4; --coral: #ff7a66;
  /* day: the desert world */
  --sand: #f3e2c2; --paper: #fbf0da; --dune: #ecd3a4; --bark: #3b2a1a; --clay: #6e5840; --rust: #d9480f; --rust-lip: #8f3209; --rust-ink: #a33a0c;
  --display: 'BagelFatOne_400Regular', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Red Hat Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Red Hat Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 22px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--sand); color: var(--bark); font: 400 1.0625rem/1.6 var(--body); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 10px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; letter-spacing: 0.005em; hyphens: auto; overflow-wrap: break-word; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a, summary, .btn { touch-action: manipulation; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--night); padding: 10px 16px; border-radius: 12px; z-index: 10; font-weight: 700; }
.skip:focus { left: 8px; }

/* ---------- buttons (the app's chunky buttons: a face and a darker lip below) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 24px;
  border-radius: 16px; font: 700 1.0625rem/1.2 var(--body); text-decoration: none; border: 2px solid transparent;
  transition: transform 0.08s ease, box-shadow 0.08s ease; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); }
.btn-go { background: var(--gold); color: var(--night); box-shadow: 0 4px 0 var(--gold-lip); }
.btn-go:active { box-shadow: 0 1px 0 var(--gold-lip); }
.btn-ghost { color: var(--moon); border-color: #5a4f86; box-shadow: 0 4px 0 #5a4f86; }
.btn-ghost:active { box-shadow: 0 1px 0 #5a4f86; }
.soon { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 4px; color: var(--moon); font-weight: 500; }
.soon svg { width: 22px; height: 22px; color: var(--gold); flex: none; }

/* ---------- header ---------- */
.night { background: var(--night); color: var(--moon); position: relative; overflow: hidden; }
.stars { position: absolute; inset: 0; pointer-events: none; background-image:
  radial-gradient(2px 2px at 12% 18%, #fff8 50%, transparent 51%), radial-gradient(1.5px 1.5px at 28% 62%, #fff6 50%, transparent 51%),
  radial-gradient(2px 2px at 46% 12%, #fff7 50%, transparent 51%), radial-gradient(1.5px 1.5px at 64% 78%, #fff5 50%, transparent 51%),
  radial-gradient(2px 2px at 82% 30%, #fff8 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 70%, #fff6 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 6% 84%, #fff5 50%, transparent 51%), radial-gradient(2px 2px at 54% 46%, #fff4 50%, transparent 51%); }
.top { display: flex; align-items: center; gap: 16px; padding-top: 18px; padding-bottom: 18px; position: relative; z-index: 2; }
.brand { font-family: var(--display); font-size: 1.5rem; text-decoration: none; line-height: 1; white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; }
.brand b { font-weight: 400; color: var(--gold); }
.nav { display: flex; gap: 22px; margin-left: auto; font-weight: 500; }
.nav a { text-decoration: none; opacity: 0.86; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border: 2px solid #5a4f86; border-radius: 14px; font: 500 0.875rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary svg { width: 18px; height: 18px; }
.lang ul { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 8px; list-style: none; min-width: 180px;
  background: var(--night-2); border: 2px solid #5a4f86; border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); z-index: 5; }
.lang li a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.lang li a:hover, .lang li a[aria-current] { background: var(--night-3); }
.lang li a[aria-current]::after { content: ' ✓'; color: var(--mint); }
.page-light .night .top { padding-bottom: 18px; }
/* Legal pages: the dark band is only as tall as the top bar, so it must not clip the open language menu,
   and it sits above the page so the menu covers the text below. */
.page-light .night { overflow: visible; z-index: 3; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(24px, 5vw, 64px); align-items: center;
  padding-top: clamp(24px, 5vw, 56px); padding-bottom: clamp(56px, 8vw, 104px); position: relative; z-index: 1; }
.platforms { margin-top: 18px; color: var(--lilac); font: 500 0.9375rem/1.4 var(--mono); }
.hero h1 { font-size: clamp(2.5rem, 6.2vw, 4.75rem); margin: 0 0 20px; }
.hero h1 span { display: block; }
.hero h1 span + span { color: var(--gold); }
.hero p.lede { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); color: #d9d3ea; max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero-art { position: relative; justify-self: center; width: min(100%, 460px); }
.hero-art .board { border-radius: 28px; overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 10px var(--night-2); transform: rotate(-3deg); }

/* ---------- sections ---------- */
section { scroll-margin-top: 12px; }
.band { padding: clamp(64px, 9vw, 112px) 0; }
.band-paper { background: var(--paper); }
#worlds { padding-top: clamp(48px, 6vw, 72px); }
.head { max-width: 40em; margin-bottom: clamp(32px, 4vw, 48px); }
.head h2 { font-size: clamp(2.125rem, 4.6vw, 3.25rem); text-wrap: balance; }
.head p { margin-top: 14px; font-size: 1.125rem; color: var(--clay); }

/* how it plays */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; list-style: none; margin: 0; padding: 0; }
.step { display: flex; flex-direction: column; gap: 14px; }
.step .art { border-radius: 18px; background: var(--paper); border: 2px solid var(--dune); height: 148px; display: grid; place-items: center; padding: 14px; }
.step .art > div { width: 100%; height: 100%; display: grid; place-items: center; }
.step .art svg { width: 100%; height: 100%; max-height: 120px; }
.step h3 { font-size: 1.375rem; display: flex; gap: 10px; align-items: baseline; }
.step h3::before { counter-increment: step; content: counter(step); font: 700 0.875rem/1 var(--mono); color: var(--paper); background: var(--rust-ink);
  border-radius: 8px; padding: 5px 7px; transform: translateY(-2px); }
.step p { color: var(--clay); font-size: 0.98rem; }

/* worlds */
/* Flex instead of grid so a short last row sits centred. */
.worlds { --per: 7; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.world { flex: 0 0 calc((100% - (var(--per) - 1) * 12px) / var(--per)); border-radius: 18px; padding: 12px 8px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.world svg { width: 76%; height: auto; }
.world span { font: 500 0.875rem/1.25 var(--body); }

/* features */
.features { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: clamp(32px, 5vw, 72px); max-width: 980px; }
.feature { display: grid; grid-template-columns: 28px 1fr; gap: 16px; padding: 24px 0; border-top: 2px solid var(--dune); }
.feature .ico { width: 28px; height: 28px; color: var(--rust-ink); margin-top: 2px; }
.feature h3 { font-size: 1.375rem; margin-bottom: 6px; }
.feature p { color: var(--clay); max-width: 36em; }

/* pricing */
.plans { display: grid; grid-template-columns: 1fr 1.15fr; gap: 20px; align-items: stretch; max-width: 900px; }
.plan { border-radius: 26px; padding: 30px; display: flex; flex-direction: column; gap: 18px; border: 2px solid var(--dune); background: var(--paper); }
.plan h3 { font-size: 1.75rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plan .tag { font: 500 0.8125rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 9px; border-radius: 8px; background: var(--gold); color: var(--night); }
.price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price strong { font: 400 3.25rem/1 var(--display); }
.price small { font: 500 0.95rem/1.2 var(--mono); opacity: 0.8; }
.plan .yearly { font-weight: 700; margin-top: -8px; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li svg { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.plan-plus { background: var(--night); color: var(--moon); border-color: var(--night); box-shadow: 0 6px 0 var(--night-3); }
.plan-plus .yearly { color: var(--gold); }
.fine { margin-top: 22px; color: var(--clay); font-size: 0.9rem; max-width: 52em; }

/* help */
.help { display: grid; grid-template-columns: 1.3fr 0.9fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.faq details { border-bottom: 2px solid var(--dune); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 40px 18px 0; position: relative; font: 700 1.125rem/1.35 var(--body); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 6px; top: 12px; font: 400 1.75rem/1 var(--display); color: var(--rust-ink); transition: transform 0.15s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--clay); }
.support { background: var(--night); color: var(--moon); border-radius: 26px; padding: 30px; position: sticky; top: 20px; overflow: hidden; }
.support h3 { font-size: 1.875rem; margin-bottom: 12px; }
.support p { color: #d9d3ea; margin-bottom: 24px; }
.support .joule { position: absolute; width: 120px; right: -12px; bottom: -14px; opacity: 0.95; }
.support .btn { position: relative; z-index: 1; }
.support .mail { display: block; margin-top: 14px; font: 500 0.875rem/1.3 var(--mono); color: var(--lilac); position: relative; z-index: 1; }

/* footer */
.foot { padding: 36px 0 44px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.foot .brand { font-size: 1.25rem; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-left: auto; }
.foot nav a { text-decoration: none; opacity: 0.86; min-height: 44px; display: inline-flex; align-items: center; }
.foot nav a:hover { opacity: 1; text-decoration: underline; }
.foot small { width: 100%; color: var(--lilac); font-size: 0.875rem; }

/* legal pages */
.legal { max-width: 700px; padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(64px, 8vw, 96px); }
.legal h1 { font-size: clamp(2rem, 7vw, 3.5rem); margin-bottom: 20px; }
.legal h2 { font: 700 1.3rem/1.3 var(--body); margin: 36px 0 10px; }
.legal h3 { font: 700 1.0625rem/1.4 var(--body); margin: 22px 0 6px; }
.legal p { margin: 0 0 12px; color: #4a3826; }
.legal .lead { font-size: 1.15rem; color: var(--bark); background: var(--paper); border: 2px solid var(--dune); border-radius: 18px; padding: 18px 20px; margin: 18px 0 8px; }
.legal .updated, .legal .note { font: 500 0.875rem/1.4 var(--mono); color: var(--clay); }
.legal .address { background: var(--paper); border-radius: 14px; padding: 14px 18px; border: 2px solid var(--dune); }
.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; font-weight: 700; text-decoration: none; color: var(--rust-ink); min-height: 44px; }

/* 404 */
.lost { text-align: center; padding: 72px 0 96px; display: grid; justify-items: center; gap: 18px; position: relative; z-index: 1; }
.lost h1 { font-size: clamp(2.5rem, 7vw, 4rem); }
.lost svg { width: 140px; }

/* ---------- narrower windows ---------- */
@media (max-width: 1020px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .worlds { --per: 4; }
}
@media (max-width: 820px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { width: min(86%, 380px); margin-top: 8px; }
  .plans, .help { grid-template-columns: 1fr; }
  .support { position: relative; top: auto; }
}
@media (max-width: 560px) {
  .brand { font-size: 1.25rem; }
  .steps, .features { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: stretch; }
  .soon { justify-content: center; }
  .step .art { height: 112px; padding: 10px; }
  .worlds { --per: 3; }
  .cta .btn { width: 100%; }
  .plan { padding: 24px; }
  .foot nav { margin-left: 0; }
}
