/* Worbles: one stylesheet for every page. Colours are the game's night
   palette (Design/characters/tokens.json, contexts.dark). No third-party
   requests: the only font is self-hosted Nunito Black (SIL OFL). */

@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-black.woff") format("woff");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
  /* the font is subset to these (tools/fontkit.py SITE_RANGES); anything else falls back */
  unicode-range: U+0020-007E, U+00A0-00FF, U+2010-2027, U+2122;
}

:root {
  color-scheme: dark;
  --bg: #1A1433;
  --bg-deep: #120E24;
  --board: #221B42;
  --cell: #2C2452;
  --line: #3A3170;
  --text: #FFFFFF;
  --muted: #C9C2E8;
  --soft: #B8B0DB;
  --ink: #1C1530;
  --sunny: #FFD34D;
  --sunny-deep: #9E8333;
  --teal: #4FD1C5;
  --pink: #FF7AB6;
  --lilac: #A78BFA;
  --green: #7EE081;
  --orange: #FF9F43;
  --display: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --body: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 22px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;
  --spring-land: linear(0, 0.025, 0.091, 0.186, 0.298, 0.418, 0.539, 0.655, 0.761, 0.854, 0.934, 0.998, 1.048, 1.084, 1.108, 1.122, 1.126, 1.124, 1.116, 1.104, 1.09, 1.075, 1.06, 1.045, 1.031, 1.019, 1.009, 1.001, 0.994, 0.99, 0.987, 0.985, 0.984, 0.984, 0.985, 0.987, 0.988, 0.99, 0.992, 0.994, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-deep);
  background-image: linear-gradient(180deg, var(--bg-deep) 0, var(--bg) 640px);
  color: var(--text);
  font: 500 1.0625rem/1.6 var(--body);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
svg .r { stroke-linecap: round; stroke-linejoin: round; }
img { height: auto; display: block; }
a { color: var(--sunny); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { color: #FFE598; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; line-height: 1.15; letter-spacing: 0.005em; margin: 0 0 0.5em; text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--sunny); color: var(--ink); padding: 8px 14px; border-radius: 12px; font-weight: 800; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header and footer ---------- */
.site-header { position: relative; z-index: 2; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 900 1.35rem/1 var(--display); }
.brand img { width: 34px; height: 34px; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: clamp(12px, 2.4vw, 28px); list-style: none; margin: 0; padding: 0; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 700; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 719px) { .nav .wide { display: none; } }

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 36px 0 44px; color: var(--soft); background: var(--bg-deep); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--muted); font-weight: 700; text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer p { margin: 0; font-size: 0.95rem; }

/* ---------- store badge ---------- */
.store { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.store-soon {
  display: inline-flex; align-items: center; gap: 12px; margin: 0;
  min-height: 60px; padding: 10px 22px 10px 14px;
  border-radius: 16px; border: 2px solid rgba(255,255,255,0.85);
  background: #000000; color: #FFFFFF; text-align: left;
  font: 600 0.95rem/1.3 var(--body);
}
.store-soon .icon { width: 36px; height: 36px; flex: none; }
.store-soon strong { font-family: var(--display); font-weight: 900; }
.store-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.store-badges img { display: block; height: 50px; width: auto; }
.store-note { color: var(--soft); font-size: 0.95rem; margin: 0; }

/* ---------- hero ---------- */
.hero { position: relative; text-align: center; padding-top: clamp(8px, 2vw, 24px); }
.hero-copy { position: relative; z-index: 1; }
.wordmark { display: flex; justify-content: center; gap: clamp(3px, 0.8vw, 10px); margin: clamp(8px, 2vw, 20px) auto 6px; padding: 0 var(--gutter); }
.wordmark .tile { width: clamp(38px, 10.6vw, 112px); height: auto; aspect-ratio: 100 / 104; overflow: visible; }
.tagline { font: 900 clamp(1.6rem, 1.1rem + 2.6vw, 2.75rem)/1.15 var(--display); margin: 14px 0 8px; }
.lede { color: var(--muted); max-width: 36em; margin: 0 auto 22px; font-size: clamp(1.02rem, 0.98rem + 0.25vw, 1.15rem); }
.scene-frame { position: relative; margin-top: clamp(4px, 1.5vw, 16px); height: clamp(240px, 29vw, 470px); }
.scene-frame .scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- sections ---------- */
section { padding: clamp(48px, 7vw, 88px) 0 0; }
.section-head { max-width: 40em; margin-bottom: 28px; }
.section-head p { color: var(--muted); }
.eyebrow { display: inline-block; font: 900 0.85rem/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); margin-bottom: 12px; }

.card { background: var(--board); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin-bottom: 0.3em; }
.card p { color: var(--muted); margin: 0; }
.card .joke { margin-top: 10px; color: var(--text); font-weight: 700; }
.card .art { background: radial-gradient(ellipse at 50% 70%, #2E2560 0, var(--board) 70%); border-radius: 16px; margin: -6px -6px 16px; padding: 12px; display: flex; align-items: center; justify-content: center; height: 200px; }
.card .art img { width: 100%; height: 100%; object-fit: contain; }

.cast { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cast { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cast .card.wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px 28px; align-items: center; }
.cast .card.wide .art { margin: 0; height: 240px; }
.cast .card.foreman .art { height: 300px; }
@media (max-width: 719px) { .cast .card.wide { grid-template-columns: 1fr; } .cast .card.wide .art { height: 190px; } .cast .card.foreman .art { height: 260px; } }

.steps { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: step; }
.steps .art { height: 190px; }
.steps h3::before { content: counter(step); display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin-right: 0.45em; border-radius: 10px; background: var(--sunny); color: var(--ink); font-size: 0.85em; vertical-align: 0.08em; }
.big-wobble { margin-top: 18px; display: flex; gap: 18px; align-items: center; background: linear-gradient(90deg, #3A2A66, var(--board)); }
.big-wobble img { width: min(340px, 40%); flex: none; }
@media (max-width: 599px) { .big-wobble { flex-direction: column; align-items: stretch; } .big-wobble img { width: 100%; max-width: 340px; margin: 0 auto; } }
.big-wobble p { color: var(--text); font-size: 1.08rem; }
.big-wobble strong { color: var(--sunny); }

.modes { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.modes .art { height: 180px; }
.mode-tag { display: inline-block; font: 900 0.8rem/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--teal); padding: 6px 10px; border-radius: 999px; margin-bottom: 10px; }
.modes .card:nth-child(1) .mode-tag { background: var(--sunny); }
.modes .card:nth-child(3) .mode-tag { background: var(--pink); }

/* ---------- teaser ---------- */
.teaser { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg-deep); aspect-ratio: 16 / 9; }
.teaser img, .teaser video { width: 100%; height: 100%; object-fit: cover; display: block; }
.teaser-soon { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); background: rgba(18, 14, 36, 0.82); color: var(--text); font: 900 0.95rem/1 var(--display); letter-spacing: 0.04em; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.teaser-play { position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--sunny); color: var(--ink); cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.teaser-play svg { width: 34px; height: 34px; margin-left: 5px; }

.closing { text-align: center; }
.closing .card { padding: clamp(28px, 5vw, 48px) 22px; background: radial-gradient(ellipse at 50% 0, #3A2A66 0, var(--board) 70%); }
.closing h2 { margin-bottom: 0.3em; }
.closing p { color: var(--muted); }
.closing .store { margin-top: 18px; }

/* ---------- prose pages ---------- */
.page { padding-top: clamp(16px, 4vw, 40px); }
.prose { max-width: 46rem; }
.prose h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
.prose h2 { font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem); margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; font-size: 1.15rem; }
.prose p, .prose li { color: #E7E2F7; }
.prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { color: var(--text); }
.meta { color: var(--soft); font-size: 0.95rem; }
.summary { background: var(--board); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 20px 0 8px; }
.summary ul { margin: 0; }
.summary h2 { margin-top: 0; }
.prose code { font-size: 0.92em; background: var(--cell); padding: 0.1em 0.35em; border-radius: 6px; }

.faq details { background: var(--board); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 12px; }
.faq summary { cursor: pointer; padding: 16px 20px; font: 900 1.1rem/1.35 var(--display); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--sunny); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 20px 6px; }
.notice { font-size: 0.92rem; line-height: 1.55; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 4px; overflow-wrap: anywhere; }
.notice p { margin: 0 0 0.9em; color: #E7E2F7; }

.lost { text-align: center; padding-top: 24px; }
.lost img { width: min(420px, 100%); margin: 0 auto 8px; }
.lost h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }
.lost p { color: var(--muted); }
.button { display: inline-block; background: var(--sunny); color: var(--ink); font: 900 1.05rem/1 var(--display); padding: 15px 24px; border-radius: 16px; text-decoration: none; }
.button:hover { color: var(--ink); background: #FFE598; }

/* ---------- motion (all of it skipped with Reduce Motion) ----------
   SVG user units: 1px = 1 tile unit. Squash and stretch move the jelly and
   face only; the letter rides along (translate) and is never scaled. */
.wordmark .jelly, .wordmark .face, .wordmark .glyph { transform-box: view-box; transform-origin: 50px 100px; }
@keyframes wmHop { 0%, 30%, 100% { transform: none; } 9% { transform: translateY(-14%); } 16% { transform: none; } }
@keyframes wmSquash { 0%, 30%, 100% { transform: scale(1, 1); } 4% { transform: scale(1.08, 0.92); } 9% { transform: scale(0.95, 1.05); } 16% { transform: scale(1.12, 0.88); } 21% { transform: scale(0.97, 1.03); } 25% { transform: scale(1.02, 0.98); } }
@keyframes wmGlyph { 0%, 30%, 100% { transform: none; } 4% { transform: translateY(3.84px); } 9% { transform: translateY(-2.4px); } 16% { transform: translateY(5.76px); } 21% { transform: translateY(-1.44px); } 25% { transform: translateY(0.96px); } }
@media (prefers-reduced-motion: no-preference) {
.wordmark .tile { animation: wmHop 5.2s ease-in-out calc(1s + var(--i) * 90ms) infinite; }
.wordmark .jelly, .wordmark .face { animation: wmSquash 5.2s ease-in-out calc(1s + var(--i) * 90ms) infinite; }
.wordmark .glyph { animation: wmGlyph 5.2s ease-in-out calc(1s + var(--i) * 90ms) infinite; }

.scene .bob, .scene .sigh, .scene .rattle { transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-1deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 18% { transform: translateY(-14px) rotate(1.5deg); } 34% { transform: translateY(0); } 44% { transform: translateY(-6px) rotate(-1deg); } 56% { transform: translateY(0); } }
@keyframes bigJump { 0%, 62%, 100% { transform: translateY(0); } 70% { transform: translateY(-22px); } 78% { transform: translateY(0); } 84% { transform: translateY(-5px); } 90% { transform: translateY(0); } }
/* The sheet is drawn in scene units, the conductor at 2.05x: his 22-unit jump is 45 here. */
@keyframes sheetJump { 0%, 62%, 100% { transform: translateY(0); } 70% { transform: translateY(-45px); } 78% { transform: translateY(0); } 84% { transform: translateY(-10px); } 90% { transform: translateY(0); } }
@keyframes noteHop { 0%, 100% { transform: translateY(0); } 12% { transform: translateY(-5px); } 24% { transform: translateY(0); } }
/* The hum rattles the Grumble during the Big Wobble (model sheet: 14 Hz, small). */
@keyframes rattle { 0%, 62%, 92%, 100% { transform: translate(0, 0) rotate(0); } 64%, 68%, 72%, 76%, 80%, 84%, 88% { transform: translate(-2px, 0) rotate(-1.2deg); } 66%, 70%, 74%, 78%, 82%, 86%, 90% { transform: translate(2px, 0) rotate(1.2deg); } }
@keyframes sigh { 0%, 44% { transform: scale(1, 1); } 52% { transform: scale(0.98, 1.04); } 65% { transform: scale(1.035, 0.955); } 76%, 100% { transform: scale(1, 1); } }
@keyframes ripple { 0% { transform: scale(0.55); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1.12); opacity: 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.25; } }
.scene .ripple { transform-box: fill-box; transform-origin: center; }
.scene .hop { animation: hop 2.6s ease-in-out var(--d, 0s) infinite; }
.scene .big { animation: bigJump 5.2s cubic-bezier(.3, .7, .4, 1) infinite; }
.scene .sigh { animation: sigh 7s ease-in-out var(--d, 0s) infinite; }
.scene .rattle { animation: rattle 5.2s linear infinite; }
.scene .sheet-jump { animation: sheetJump 5.2s cubic-bezier(.3, .7, .4, 1) infinite; }
.scene .note-hop { animation: noteHop 1.3s ease-in-out calc(var(--i) * 80ms) infinite; }
.scene .ripple { animation: ripple 5.2s ease-out calc(3.9s + var(--i) * 0.22s) infinite; opacity: 0; }
.scene .twinkle { animation: twinkle 3.4s ease-in-out infinite; }
.scene .twinkle:nth-of-type(2n) { animation-delay: 1.3s; }
}
.paused .scene *, .paused .wordmark * , .paused .wordmark .tile { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
