/* Word Atlas website - one stylesheet for every page.
   Colours mirror src/ui/tokens.ts (candy buttons with a darker "lip", cream paper panels, ink text).
   No scripts. Fredoka is loaded from Google Fonts with display=swap; the system font is the fallback. */

:root {
  --gold: #FFC93C; --gold-light: #FFE08A; --gold-dark: #E09A12; --gold-lip: #B36F00; --gold-text: #5A3500;
  --green: #4CD964; --green-lip: #148A2C;
  --blue: #3EA6FF; --blue-dark: #1F7FE0; --blue-lip: #1259A8;
  --purple: #9B6BFF; --purple-lip: #5129B0;
  --red: #FF5A5F; --red-lip: #A81F25;
  --pink: #EC4899;

  --ink: #1B1530;
  --text: #2A2245;
  --muted: #6A5F80;
  --bg: #FFF4DF;
  --panel: #FFF8EC;
  --panel-edge: #EAD9BC;
  --panel-text: #4A3A28;
  --line: #EAD9BC;
  --link: #1F7FE0;
  --hero-from: #7DD3FC;
  --hero-to: #3EA6FF;
  --hero-ink: #10243F;
  --shadow: 0 10px 30px rgba(27, 21, 48, 0.10);

  --display: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 22px;
  --wrap: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #F4EEFF;
    --muted: #B9AED0;
    --bg: #1B1530;
    --panel: #2A2245;
    --panel-edge: #3B3160;
    --panel-text: #EDE4FF;
    --line: #3B3160;
    --link: #7CC6FF;
    --hero-from: #2A2245;
    --hero-to: #1259A8;
    --hero-ink: #FFFFFF;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --text: #F4EEFF; --muted: #B9AED0; --bg: #1B1530; --panel: #2A2245; --panel-edge: #3B3160;
  --panel-text: #EDE4FF; --line: #3B3160; --link: #7CC6FF; --hero-from: #2A2245; --hero-to: #1259A8;
  --hero-ink: #FFFFFF; --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, .brand, .btn, .badge { font-family: var(--display); }
h1, h2, h3 { line-height: 1.2; color: var(--text); }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 700; margin: 0 0 .4em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 600; margin: 2.2em 0 .6em; }
h3 { font-size: 1.2rem; font-weight: 600; margin: 1.6em 0 .4em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--gold); color: var(--gold-text); padding: 8px 14px; border-radius: 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
header.site { padding: 14px 0; }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.35rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(160deg, var(--gold-light), var(--gold) 55%, var(--gold-dark)); box-shadow: 0 3px 0 var(--gold-lip); display: grid; place-items: center; color: var(--gold-text); font-size: 1.1rem; font-weight: 700; }
nav.site ul, footer.site ul, .langs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
nav.site a { color: var(--text); text-decoration: none; font-weight: 600; font-family: var(--display); }
nav.site a[aria-current="page"], nav.site a:hover { color: var(--link); }
.langs { gap: 4px; font-family: var(--display); font-size: .9rem; }
.langs a { display: inline-block; padding: 2px 8px; border-radius: 999px; color: var(--muted); text-decoration: none; border: 1px solid transparent; }
.langs a[aria-current="true"] { color: var(--text); border-color: var(--line); background: var(--panel); }

/* Hero */
.hero { background: linear-gradient(165deg, var(--hero-from), var(--hero-to)); color: var(--hero-ink); padding: 8px 0 56px; border-radius: 0 0 36px 36px; position: relative; overflow: hidden; }
.hero header.site .brand, .hero nav.site a, .hero .langs a { color: var(--hero-ink); }
.hero .langs a[aria-current="true"] { background: rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.5); }
.hero-grid { display: grid; gap: 32px; align-items: center; padding-top: 24px; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.1fr 0.9fr; padding-top: 40px; } }
.hero h1 { color: var(--hero-ink); }
.hero .lead { font-size: clamp(1.05rem, 2.6vw, 1.3rem); max-width: 34em; margin: 0 0 1.4em; }
.eyebrow { display: inline-block; font-family: var(--display); font-weight: 600; font-size: .95rem; background: rgba(255, 255, 255, 0.28); border: 1px solid rgba(255, 255, 255, 0.5); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }

/* Candy buttons and store badges */
.badges { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 14px; }
.badge { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 18px; border-radius: 16px; background: #000; color: #fff; text-decoration: none; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); transition: transform .12s ease, box-shadow .12s ease; }
.badge:hover { transform: translateY(-1px); }
.badge:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.badge svg { width: 26px; height: 26px; flex: none; fill: currentColor; }
.badge small { display: block; font-size: .7rem; line-height: 1; opacity: .85; font-weight: 500; }
.badge strong { display: block; font-size: 1.15rem; line-height: 1.15; font-weight: 600; }
.soon { font-size: .92rem; opacity: .9; margin: 0; }

.btn { display: inline-block; font-weight: 600; text-decoration: none; padding: 12px 22px; border-radius: 16px; background: var(--gold); color: var(--gold-text); box-shadow: 0 4px 0 var(--gold-lip); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-lip); }

/* CSS-only letter wheel illustration (no image needed) */
.wheel-stage { display: grid; place-items: center; }
.wheel { --size: min(78vw, 340px); width: var(--size); height: var(--size); border-radius: 50%; background: #fff; box-shadow: 0 8px 0 rgba(18, 89, 168, 0.35), var(--shadow); position: relative; }
.wheel::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff, #EEF6FF); }
.wheel span { --r: calc(var(--size) * 0.33); position: absolute; left: 50%; top: 50%; width: calc(var(--size) * 0.2); height: calc(var(--size) * 0.2); margin: calc(var(--size) * -0.1) 0 0 calc(var(--size) * -0.1); border-radius: 50%; display: grid; place-items: center; font: 700 calc(var(--size) * 0.11) / 1 var(--display); color: #1E3A5F; background: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); transform: rotate(var(--a)) translate(0, calc(var(--r) * -1)) rotate(calc(var(--a) * -1)); }
.wheel span.on { background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-lip); }
.wheel svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wheel .word { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); background: var(--panel); color: var(--panel-text); border: 2px solid var(--panel-edge); padding: 4px 16px; border-radius: 14px; font: 700 1.2rem/1.3 var(--display); letter-spacing: .12em; white-space: nowrap; }

/* Panels / cards */
.card { background: var(--panel); color: var(--panel-text); border: 2px solid var(--panel-edge); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card a { color: var(--link); }
.features { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 600px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature h3 { margin: 10px 0 6px; color: var(--panel-text); }
.feature p { margin: 0; }
.icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; }
.icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.i-blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-lip); }
.i-green { background: var(--green); box-shadow: 0 4px 0 var(--green-lip); }
.i-purple { background: var(--purple); box-shadow: 0 4px 0 var(--purple-lip); }
.i-red { background: var(--red); box-shadow: 0 4px 0 var(--red-lip); }
.i-gold { background: var(--gold); color: var(--gold-text); box-shadow: 0 4px 0 var(--gold-lip); }
.i-pink { background: var(--pink); box-shadow: 0 4px 0 #9D174D; }

/* Screenshots: background images, so a missing file shows the gradient + caption instead of a broken image */
.shots { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 62%); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 2px 18px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
@media (min-width: 720px) { .shots { grid-auto-columns: minmax(200px, 1fr); grid-auto-flow: column; } }
.shot { margin: 0; scroll-snap-align: start; aspect-ratio: 9 / 19.5; border-radius: 30px; border: 6px solid var(--ink); background-size: cover, cover; background-position: center, center; display: flex; align-items: flex-end; box-shadow: var(--shadow); overflow: hidden; }
.shot figcaption { width: 100%; padding: 12px 14px; font: 600 1rem/1.3 var(--display); color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.45)); }
.shot.s1 { background-image: url("screenshots/01.webp"), linear-gradient(160deg, #7DD3FC, #1F7FE0); }
.shot.s2 { background-image: url("screenshots/02.webp"), linear-gradient(160deg, #FDE68A, #D97706); }
.shot.s3 { background-image: url("screenshots/03.webp"), linear-gradient(160deg, #FBCFE8, #DB2777); }
.shot.s4 { background-image: url("screenshots/04.webp"), linear-gradient(160deg, #BBF7D0, #16A34A); }
.shot.s5 { background-image: url("screenshots/05.webp"), linear-gradient(160deg, #DDD6FE, #7646E8); }

/* Language chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 10px 0 0; list-style: none; }
.chips li { font-family: var(--display); font-weight: 600; font-size: .95rem; padding: 4px 12px; border-radius: 999px; background: var(--panel); border: 2px solid var(--panel-edge); color: var(--panel-text); }
.chips li.main { background: var(--gold); border-color: var(--gold-dark); color: var(--gold-text); }

/* FAQ */
details { background: var(--panel); color: var(--panel-text); border: 2px solid var(--panel-edge); border-radius: 18px; padding: 0 18px; margin: 10px 0; }
summary { cursor: pointer; font: 600 1.08rem/1.35 var(--display); padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--gold-dark); }
details[open] summary::after { content: "\2212"; }
details > :not(summary) { margin-top: 0; }
details p:last-child { padding-bottom: 14px; margin-bottom: 0; }

/* Legal / document pages */
main.doc { max-width: 820px; padding-bottom: 48px; }
main.doc h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-top: .6em; }
main.doc h2 { font-size: clamp(1.3rem, 3.4vw, 1.6rem); margin-top: 1.8em; scroll-margin-top: 16px; }
.meta { color: var(--muted); margin-top: -0.4em; }
.toc { columns: 2 220px; padding-left: 1.2em; }
.table-wrap { overflow-x: auto; margin: 12px 0; border-radius: 14px; border: 2px solid var(--panel-edge); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .95rem; background: var(--panel); color: var(--panel-text); }
th, td { border-bottom: 1px solid var(--panel-edge); padding: 10px 12px; text-align: left; vertical-align: top; }
th { font-family: var(--display); font-weight: 600; background: rgba(255, 201, 60, 0.18); }
tr:last-child td { border-bottom: 0; }
code { font-size: .92em; background: rgba(127, 127, 127, 0.14); padding: 1px 5px; border-radius: 6px; }
.note { font-size: .95rem; color: var(--muted); }

section.block { padding: 8px 0; }
.center { text-align: center; }
.cta-band { margin: 48px 0 0; text-align: center; background: linear-gradient(160deg, var(--gold-light), var(--gold)); color: var(--gold-text); border-radius: 28px; padding: 28px 16px; box-shadow: 0 6px 0 var(--gold-lip); }
.cta-band h2 { color: var(--gold-text); margin: 0 0 .4em; }
.cta-band .badges { justify-content: center; }

/* Footer */
footer.site { margin-top: 56px; padding: 28px 0 36px; border-top: 2px solid var(--line); color: var(--muted); font-size: .95rem; }
footer.site .wrap { display: grid; gap: 12px; }
footer.site a { color: var(--muted); }
footer.site p { margin: 0; }
