/* Hare & Shell — site styles. Palette and type follow the game (HANDOFF §6). */

/* Web fonts (woff2, subset by scripts/fonts.py; licences next to the files).
   Latin faces cover EN/ES/PT/FR/DE/VI. The CJK faces are subset to the
   characters the ja/ko pages use, with unicode-range so other pages never
   download them; anything missing falls back to the system font. */
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("../fonts/baloo2-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "M PLUS Rounded 1c"; src: url("../fonts/mplusrounded1c-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+3000-30FF, U+3400-4DBF, U+4E00-9FFF, U+FF00-FFEF; }
@font-face { font-family: "M PLUS Rounded 1c"; src: url("../fonts/mplusrounded1c-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; unicode-range: U+3000-30FF, U+3400-4DBF, U+4E00-9FFF, U+FF00-FFEF; }
/* Jua has one weight that already reads bold: map 400-800 to it so headings are not faux-bolded. */
@font-face { font-family: "Jua"; src: url("../fonts/jua-400.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7AF; }
@font-face { font-family: "Gothic A1"; src: url("../fonts/gothica1-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7AF; }
@font-face { font-family: "Gothic A1"; src: url("../fonts/gothica1-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7AF; }

:root {
  --orange: #f08a2b;
  --orange-deep: #8a3f26;
  --green: #42b88e;
  --gold: #f3c25b;
  --violet: #b48cff;
  --ink: #15213a;
  --ink-soft: #3b4763;
  --paper: #fff6e4;
  --paper-2: #f7e9cc;
  --clay: #c9643f;
  --meadow: #4c8a5e;
  --radius: 18px;
  --shadow: 0 5px 0 rgba(21, 33, 58, 0.12);
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1080px;
}

/* Per-locale type. Fredoka has no Vietnamese glyphs; a per-glyph fallback looks
   patchy, so VI headings use Baloo 2 (the game's Vietnamese display face). Japanese and Korean get rounded
   faces that sit well next to Fredoka. The Latin-only brand keeps Fredoka. */
:lang(vi) { --display: "Baloo 2", "Nunito", system-ui, sans-serif; }
:lang(ja) {
  --display: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --body: "M PLUS Rounded 1c", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
}
:lang(ko) {
  --display: "Jua", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --body: "Gothic A1", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
:lang(ja) body, :lang(ko) body { line-height: 1.75; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ko) h1, :lang(ko) h2, :lang(ko) h3 { letter-spacing: 0; line-break: strict; word-break: keep-all; }
/* Japanese has no spaces: break between phrases (Chrome/Edge), never mid-word, and balance short lines. */
:lang(ja) :is(h1, h2, h3, .tagline, summary, figcaption) { word-break: auto-phrase; }
h1, h2, h3, .tagline { text-wrap: balance; }
:lang(ko) :is(p, li, td, th, summary, figcaption) { word-break: keep-all; overflow-wrap: anywhere; }
/* Language names in the menu use their own script's font. */
.lang-menu [lang] { font-family: var(--body); }

* { 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;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--clay); text-underline-offset: 3px; }
a:hover { color: var(--orange-deep); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; z-index: 10; }
.skip:focus { left: 12px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.eyebrow { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.85rem; color: var(--clay); margin-bottom: 0.4em; }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(21, 33, 58, 0.92);
  backdrop-filter: blur(8px);
  color: var(--paper);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin-right: auto; }
.brand img { width: 38px; height: 38px; border-radius: 10px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--paper); text-decoration: none; font-weight: 700; padding: 8px 12px; border-radius: 999px; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: rgba(255, 246, 228, 0.12); color: var(--gold); }
.lang-menu { position: relative; }
.lang-menu summary {
  display: flex; align-items: center; gap: 6px; list-style: none;
  font: 700 0.9rem var(--body);
  color: var(--ink); background: var(--paper);
  border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
  box-shadow: 0 3px 0 var(--gold); white-space: nowrap;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary svg { fill: currentColor; flex: none; }
.lang-menu summary:hover, .lang-menu[open] summary { background: var(--gold); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 20; margin: 0; padding: 8px; list-style: none;
  min-width: 190px; background: var(--paper); border-radius: 16px; box-shadow: 0 10px 30px rgba(21, 33, 58, 0.35), 0 4px 0 var(--gold);
}
.lang-menu li a {
  display: block; padding: 9px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; min-height: 40px;
}
.lang-menu li a:hover { background: var(--paper-2); color: var(--ink); }
.lang-menu li a[aria-current="true"] { background: var(--ink); color: var(--paper); }
@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; padding-block: 8px; gap: 8px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav a { padding: 6px 8px; font-size: 0.9rem; }
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative; overflow: hidden; color: var(--paper);
  background: linear-gradient(180deg, #2b2f5c 0%, #6b4f86 38%, #e38a6a 70%, #f3c25b 100%);
  padding: clamp(48px, 9vw, 96px) 0 0;
}
.hero .wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center; }
.hero h1 { color: var(--paper); text-shadow: 0 5px 0 var(--orange-deep); margin-bottom: 0.15em; }
.hero .tagline { font-family: var(--display); font-weight: 600; font-size: clamp(1.25rem, 3vw, 1.7rem); color: #ffe9b3; margin-bottom: 0.9em; }
.hero .lede { font-size: 1.1rem; max-width: 34em; color: #fff1d6; }
.hero-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18); margin-bottom: 18px; }
.hero-art { border-radius: 22px; box-shadow: 0 10px 0 rgba(21, 33, 58, 0.25); transform: rotate(-2deg); border: 6px solid var(--paper); }
.hero-hills { position: relative; z-index: 1; display: block; width: 100%; height: clamp(90px, 14vw, 170px); margin-top: clamp(32px, 6vw, 64px); }
.sun { position: absolute; z-index: 0; right: 8%; top: 18%; width: clamp(120px, 18vw, 220px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #ffe08a 0 58%, rgba(255, 224, 138, 0.35) 59% 70%, transparent 71%); }
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { transform: none; }
  /* Keep the sun clear of the text on phones: tucked into the corner, behind the art. */
  .sun { top: auto; bottom: 230px; right: -40px; width: 150px; opacity: 0.85; }
}

.badges { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  border-radius: 14px; padding: 10px 16px; min-height: 52px; min-width: 190px;
  border: 2px solid rgba(255, 246, 228, 0.35);
}
.badge svg { width: 26px; height: 26px; flex: none; fill: currentColor; }
.badge small { display: block; font-size: 0.72rem; opacity: 0.8; line-height: 1.1; }
.badge strong { display: block; font-family: var(--display); font-size: 1.1rem; line-height: 1.15; }
.badge[aria-disabled="true"] { cursor: default; opacity: 0.88; }
.soon { display: inline-block; margin-left: 6px; font-size: 0.7rem; background: var(--gold); color: var(--ink); border-radius: 999px; padding: 1px 8px; font-weight: 700; vertical-align: middle; }

/* ------------------------------------------------------------------ sections */
section { padding: clamp(48px, 8vw, 88px) 0; }
.band-ink { background: var(--ink); color: var(--paper); }
.band-ink .eyebrow { color: var(--gold); }
.band-paper2 { background: var(--paper-2); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 820px) { .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: #fffaf0; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
}
.card .dot { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; }
.card .dot svg { width: 30px; height: 30px; }
.c-orange .dot { background: var(--orange); }
.c-green .dot { background: var(--green); }
.c-violet .dot { background: var(--violet); }
.c-gold .dot { background: var(--gold); }
.band-ink .card { background: #1e2c4b; color: var(--paper); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25); }

.gesture { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.gesture .key {
  flex: none; font-family: var(--display); font-weight: 700; font-size: 0.95rem;
  background: var(--paper); color: var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: 0 3px 0 var(--gold);
}

/* Screenshots: swipeable strip. */
.gallery {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(82%, 560px); gap: 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 22px;
  overscroll-behavior-x: contain;
}
.gallery figure { margin: 0; scroll-snap-align: start; }
.gallery img { border-radius: 16px; border: 5px solid #fffaf0; box-shadow: var(--shadow); background: var(--ink); }
.gallery figcaption { font-size: 0.92rem; color: var(--ink-soft); margin-top: 8px; padding-inline: 6px; }

.cta {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 1.05rem var(--display);
  background: var(--orange); color: var(--ink); text-decoration: none;
  border-radius: 999px; padding: 12px 24px; min-height: 48px;
  box-shadow: 0 5px 0 var(--orange-deep);
}
.cta:hover { color: var(--ink); transform: translateY(1px); box-shadow: 0 4px 0 var(--orange-deep); }
.cta.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }

/* ------------------------------------------------------------------ doc pages */
.page-head {
  background: linear-gradient(180deg, #2b2f5c 0%, #4f4a82 100%);
  color: var(--paper); padding: 48px 0 0; position: relative; overflow: hidden;
}
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--paper); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); }
.page-head p { color: #f3e6ff; max-width: 40em; }
.page-head .hero-hills { height: clamp(60px, 9vw, 110px); margin-top: 24px; }

.doc { padding: 40px 0 72px; }
.doc .wrap { max-width: 780px; }
.doc h2 { font-size: 1.5rem; margin-top: 1.8em; }
.doc h3 { margin-top: 1.4em; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 0.4em; }
.doc table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: 0.95rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid #e8d7b3; }
.doc th { font-family: var(--display); font-weight: 600; background: var(--paper-2); }
.table-scroll { overflow-x: auto; }
.updated { display: inline-block; font-size: 0.9rem; background: var(--paper); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.note {
  background: #fffaf0; border-left: 6px solid var(--green); border-radius: 12px;
  padding: 16px 18px; margin: 1.2em 0; box-shadow: var(--shadow);
}
.note.violet { border-color: var(--violet); }
.note.gold { border-color: var(--gold); }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 52px; margin-bottom: 18px !important; min-height: 38px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font: 700 1.1rem var(--display); background: var(--orange); color: var(--ink); box-shadow: 0 3px 0 var(--orange-deep);
}

details.faq { background: #fffaf0; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
details.faq summary { cursor: pointer; padding: 16px 20px; font-family: var(--display); font-weight: 600; font-size: 1.1rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--clay); }
details.faq[open] summary::after { content: "–"; }
details.faq > div { padding: 0 20px 16px; }

/* Invite code. */
.code-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  background: var(--ink); color: var(--paper); border-radius: 22px; padding: 22px 24px; margin: 18px 0 26px;
  box-shadow: 0 6px 0 rgba(21, 33, 58, 0.25);
}
.code-box .code { font: 700 clamp(2rem, 9vw, 3.2rem) var(--display); letter-spacing: 0.14em; color: var(--gold); word-break: break-all; }
.code-box button {
  font: 700 1rem var(--body); border: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; cursor: pointer;
  background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 var(--gold);
}

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--ink); color: #cfd6e6; padding: 40px 0 28px; font-size: 0.95rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.site-footer a { color: var(--paper); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; align-content: flex-start; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgba(255, 246, 228, 0.12); padding-top: 16px; font-size: 0.85rem; color: #9aa6c2; }
@media (max-width: 640px) { .site-footer .wrap { grid-template-columns: 1fr; } .site-footer .links { justify-content: flex-start; } }

/* 404 */
.lost { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 48px 20px; }
.lost-title { font-size: 2rem; }
.after-steps { margin-top: 28px; }
.footer-brand { font-size: 1.1rem; color: var(--paper); }
.legal-note { margin-bottom: 28px; }
.lost .big { font: 700 clamp(5rem, 20vw, 9rem) var(--display); color: var(--violet); line-height: 1; text-shadow: 0 6px 0 var(--ink); }

/* The brand is Latin-only and always Fredoka, whatever the page language
   (kept last so the per-locale --display stacks above can't override it). */
.site-header .brand, #hero-title, .code-box .code, .footer-brand { font-family: "Fredoka", "Nunito", system-ui, sans-serif; }
