:root {
  --bg: oklch(0.16 0.03 300);
  --bg-dot: oklch(0.215 0.035 300);
  --bg-deep: oklch(0.12 0.03 300);
  --panel: oklch(0.21 0.035 300);
  --panel-2: oklch(0.26 0.04 300);
  --ink: oklch(0.08 0.02 300);
  --text: oklch(0.92 0.03 90);
  --muted: oklch(0.76 0.03 300);
  --rule: oklch(0.32 0.04 300);
  --ember: oklch(0.68 0.17 45);
  --cyan: oklch(0.85 0.11 200);
  --red: oklch(0.66 0.2 25);
  --pixel: 'VT323', monospace;
  --display: 'Pirata One', serif;
  --sans: 'Atkinson Hyperlegible', sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* Anchor jumps land below the sticky nav */
html { scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--pixel);
  font-size: 22px;
  line-height: 1.35;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1px, transparent 1.3px);
  background-size: 4px 4px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; transition: color 150ms ease; }
a, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
::selection { background: var(--ember); color: var(--bg); }
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--ember); }
}
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 400; line-height: 1; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

/* max-width excludes padding (content-box), as in the design */
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.eyebrow { font-size: 20px; letter-spacing: .08em; color: var(--ember); }
.section-head { display: flex; flex-direction: column; gap: 8px; }
.h2 { font-size: clamp(44px, 6vw, 64px); text-shadow: 3px 3px 0 var(--ember); }
.muted { color: var(--muted); }

/* Two columns that stack below ~880px */
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 48px; align-items: center; }
/* Single column below 936px (2 × 420px + 48px gap + 48px padding): keep picture above its text */
@media (max-width: 935px) { .split--flip > .shot { order: -1; } }
/* Three columns, jumps straight to one below 760px */
.grid-3 { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(clamp(calc((100% - 56px) / 3), (760px - 100%) * 999, 100%), 1fr)); }
/* Four columns, jumps to two below 900px */
.grid-4 { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(clamp(calc((100% - 66px) / 4), (900px - 100%) * 999, calc((100% - 22px) / 2)), 1fr)); }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

/* Nav */
.nav { position: sticky; top: 0; z-index: 5; background: oklch(0.16 0.03 300 / .94); border-bottom: 3px solid var(--ink); }
.nav .wrap { padding-top: 10px; padding-bottom: 10px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.logo { font-family: var(--display); font-size: 34px; line-height: 1; text-shadow: 2px 2px 0 var(--ember); }
.nav-links { display: flex; gap: 24px; flex-wrap: wrap; font-size: 20px; margin-left: auto; }
@media (max-width: 700px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}
.nav-cta {
  min-height: 44px; box-sizing: border-box; display: flex; align-items: center; padding: 0 16px;
  background: var(--ember); color: var(--bg); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 20px;
}
.nav-cta:hover { color: var(--bg); }

/* App Store badge */
.store {
  min-height: 60px; box-sizing: border-box; display: flex; align-items: center; padding: 0 20px;
  background: #000; color: #fff; border: 3px solid var(--text); box-shadow: 5px 5px 0 var(--ember); font-family: var(--sans);
}
.store:hover { color: #fff; }
.store span { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.store small { font-size: 12px; }
.store b { font-size: 24px; }
.store--lg { min-height: 64px; padding: 0 24px; }
.store--lg b { font-size: 26px; }

/* Blurred screenshot backdrops */
.backdrop { position: relative; overflow: hidden; }
.backdrop > img { position: absolute; inset: -24px; width: calc(100% + 48px); height: calc(100% + 48px); object-fit: cover; }

/* Hero */
.hero { border-bottom: 3px solid var(--ink); }
.hero > img { filter: blur(10px) brightness(.45); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, oklch(0.12 0.03 300 / .95) 0%, oklch(0.12 0.03 300 / .75) 45%, oklch(0.12 0.03 300 / .2) 100%); }
.hero .split { position: relative; z-index: 1; padding-top: 88px; padding-bottom: 96px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.hero-copy { display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.hero h1 { font-size: clamp(64px, 9vw, 112px); line-height: .9; text-shadow: 5px 5px 0 var(--ember); }
.hero-copy p { font-size: 26px; line-height: 1.3; max-width: 520px; }
.cta-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.platforms { font-size: 20px; color: var(--muted); }
.hero-shot { position: relative; justify-self: center; width: 100%; max-width: 600px; }
.listening {
  position: absolute; left: -14px; bottom: -26px; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 16px;
  background: oklch(0.19 0.04 270); border: 3px solid var(--cyan); box-shadow: 4px 4px 0 var(--ink);
}
.listening .bars { display: flex; gap: 3px; align-items: center; }
.listening .bars i { width: 5px; background: var(--cyan); }
.listening .label { color: var(--cyan); }
.listening .word { font-family: var(--sans); font-weight: 700; font-size: 20px; }

/* Screenshot frames (image slots in the design) */
.shot { position: relative; border: 3px solid var(--text); box-shadow: 8px 8px 0 var(--ember); aspect-ratio: 16/10; overflow: hidden; background: #000; }
.shot--cyan { box-shadow: 8px 8px 0 var(--cyan); }
.shot--ink { box-shadow: 6px 6px 0 var(--ink); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* iPhone/iPad screens aren't 16:10: letterbox rather than crop */
.shot img.fit { object-fit: contain; }

/* How it works */
.how { padding-top: 96px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 36px; }
.step { background: var(--panel); border: 3px solid var(--text); box-shadow: 6px 6px 0 var(--ink); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.step-num { width: 56px; height: 56px; box-sizing: border-box; display: grid; place-items: center; background: var(--ember); color: var(--bg); border: 3px solid var(--ink); font-size: 32px; }
.step h3 { font-size: 34px; }
.step--cyan { border-color: var(--cyan); }
.step--cyan .step-num { background: var(--cyan); }
.step--cyan h3 { color: var(--cyan); }

/* Features */
.features { padding-top: 72px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 56px; }
.feature-copy { display: flex; flex-direction: column; gap: 14px; }
.feature-copy h3 { font-size: 44px; }
.feature-copy p { font-size: 24px; }
.tile { background: var(--panel-2); border: 3px solid var(--text); box-shadow: 4px 4px 0 var(--ink); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.tile strong { font-weight: 400; font-size: 26px; }

/* Languages */
.languages { border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); background: var(--panel); }
.languages .split { padding-top: 80px; padding-bottom: 80px; }
.languages p { font-size: 24px; }
.langs { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; list-style: none; }
.langs li {
  min-height: 52px; box-sizing: border-box; display: flex; align-items: center; padding: 0 18px;
  background: var(--panel-2); border: 3px solid var(--text); box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--sans); font-weight: 700; font-size: 22px;
}
.langs li.on { background: var(--ember); color: var(--bg); border-color: var(--ink); }
.count { display: inline-block; min-width: 2ch; text-align: right; }
.langs-note { font-size: 20px; color: var(--muted); padding-top: 20px; }

/* Platforms */
.devices { padding-top: 88px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 32px; }
.device { display: flex; flex-direction: column; gap: 10px; }
.device strong { font-weight: 400; font-size: 26px; }

/* FAQ */
.faq { max-width: 900px; padding-top: 88px; padding-bottom: 88px; display: flex; flex-direction: column; gap: 24px; }
.faq details { border-bottom: 3px solid var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 26px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq details p { margin: 0 0 18px; font-family: var(--sans); font-size: 18px; line-height: 1.55; color: oklch(0.86 0.02 90); max-width: 720px; }

/* Download */
.download { border-top: 3px solid var(--ink); }
.download > img { filter: blur(12px) brightness(.35); }
.download::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, oklch(0.82 0.15 70 / .22), transparent 60%); }
.download .inner { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 110px 24px; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.torches { display: flex; align-items: flex-end; gap: clamp(16px, 4vw, 48px); }
.torches img {
  width: 72px; height: 207px; flex: none; image-rendering: pixelated;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
  filter: drop-shadow(0 0 18px oklch(0.8 0.15 65 / .7));
}
/* The flame is a cut-out sprite (flame-*.png, wall transparent) laid over the torch; its base sits at row 40/115 */
.torch { position: relative; flex: none; }
.torch::before {
  content: ""; position: absolute; left: 50%; top: 22%; width: 180px; height: 180px; translate: -50% -50%; z-index: -1;
  background: radial-gradient(circle, oklch(0.8 0.15 65 / .45), transparent 65%);
}
.torches .flame { position: absolute; inset: 0; filter: none; transform-origin: 50% 35%; }
.torches h2 { font-size: clamp(52px, 8vw, 96px); line-height: .95; text-shadow: 5px 5px 0 var(--ember); }
.download p { font-size: 26px; max-width: 560px; }

/* Footer */
.footer { border-top: 3px solid var(--ink); background: var(--bg-deep); }
.footer .wrap { padding-top: 28px; padding-bottom: 28px; display: flex; gap: 24px; flex-wrap: wrap; align-items: center; font-size: 20px; color: var(--muted); }
.footer .logo { font-size: 28px; text-shadow: none; color: var(--text); }
.footer nav { margin-left: auto; display: flex; gap: 22px; flex-wrap: wrap; }

/* Legal pages (privacy.html, impressum.html): long text in Atkinson for readability, game type for structure */
.legal { max-width: 760px; padding-top: 56px; padding-bottom: 96px; }
.legal .back { display: inline-block; margin-bottom: 28px; font-size: 20px; color: var(--muted); }
.legal h1 { font-size: clamp(48px, 8vw, 72px); line-height: .95; text-shadow: 4px 4px 0 var(--ember); }
.legal .eff { margin: 14px 0 36px; font-family: var(--pixel); font-size: 20px; letter-spacing: .08em; color: var(--ember); }
.legal h2 { margin: 44px 0 12px; font-size: 34px; text-shadow: 2px 2px 0 var(--ember); }
.legal p, .legal li { font-family: var(--sans); font-size: 18px; line-height: 1.6; color: oklch(0.86 0.02 90); }
.legal p + p { margin-top: 12px; }
.legal strong { color: var(--text); }
.legal p a { color: var(--ember); text-decoration: underline; text-underline-offset: 3px; }
.legal ul { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.legal li { display: flex; gap: 12px; }
.legal li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: .6em; background: var(--ember); }
.legal .lead, .legal .block { background: var(--panel); border: 3px solid var(--text); box-shadow: 6px 6px 0 var(--ink); padding: 20px 22px; }
.legal .lead { color: var(--text); font-size: 19px; }
.legal .block p { margin: 0; }
.footer a.logo:hover { color: var(--text); }
.footer [aria-current="page"] { color: var(--ember); }

/* ---------- Motion ---------- */
/* Game UI moves in pixel steps (typing, hops, CRT, menu cursor); magic moves smoothly (headings).
   Effects are declared with data-fx in the markup and started by main.js. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Hidden until revealed, only when JS is there to reveal it */
.js [data-fx]:not([data-visible]) { opacity: 0; }

/* rise: supporting copy */
.js [data-fx="rise"][data-visible] { animation: rise 600ms var(--ease-out) var(--delay, 0ms) backwards; }

/* type: VT323 labels typed out behind a block cursor */
@keyframes type {
  0% { opacity: 0; }
  1% { opacity: 1; background: var(--text); color: transparent; }
}
.js [data-fx="type"][data-visible] .ch { animation: type 70ms steps(1, end) backwards; animation-delay: calc(var(--delay, 0ms) + var(--i) * 28ms); }

/* words: headings come into focus word by word */
@keyframes materialize { from { opacity: 0; filter: blur(12px); transform: translateY(0.3em); } }
.js [data-fx="words"] .w { display: inline-block; }
.js [data-fx="words"][data-visible] .w { animation: materialize 800ms var(--ease-out) backwards; animation-delay: calc(var(--delay, 0ms) + var(--i) * 80ms); }

/* hop: cards land in four sprite frames, then their details fire */
@keyframes hop { from { opacity: 0; transform: translateY(24px); } }
@keyframes stamp { from { opacity: 0; transform: scale(1.8); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.6); } }
@keyframes beat { 15%, 45% { transform: scale(1.35); } 30% { transform: none; } }
.js [data-fx="hop"][data-visible] > * { animation: hop 320ms steps(4, end) backwards; animation-delay: calc(var(--i) * 90ms); }
.js [data-fx="hop"][data-visible] .step-num { animation: stamp 240ms steps(3, end) backwards; animation-delay: calc(var(--i) * 90ms + 300ms); }
.ic { display: inline-block; }
.js [data-visible] .ic-rune { animation: spin 640ms steps(8, end) 380ms; }
.js [data-visible] .ic-heal { animation: pulse 280ms steps(2, end) 470ms 2; }
.js [data-visible] .ic-heart { animation: beat 800ms var(--ease-out) 560ms; }
.js [data-visible] .ic-type .ch { animation: type 110ms steps(1, end) backwards; animation-delay: calc(650ms + var(--i) * 110ms); }

/* crt: screens power on (dot → line → picture) inside a frame that rises in */
@keyframes crt-on {
  0% { opacity: 0; }
  1% { opacity: 1; transform: scale(0.04, 0.006); filter: brightness(6); }
  30% { transform: scale(1, 0.006); filter: brightness(6); }
  65% { transform: none; filter: brightness(2); }
  100% { opacity: 1; transform: none; filter: none; }
}
.js [data-fx="crt"][data-visible] { animation: rise 500ms var(--ease-out) var(--delay, 0ms) backwards; }
.js [data-fx="crt"][data-visible] img { animation: crt-on 750ms var(--ease-out) calc(var(--delay, 0ms) + 250ms) backwards; }
.js .device [data-fx="crt"][data-visible] { animation: none; } /* the card already hops */

/* Buttons press into their pixel shadow; quick press, slower release */
.store, .nav-cta { transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .store:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ember); }
  .nav-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
}
.store:active, .nav-cta:active { transition-duration: 100ms; }
.store:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ember); }
.nav-cta:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

/* FAQ: + folds into − while the answer opens; browsers without ::details-content just snap */
.pm { position: relative; flex: none; width: 16px; height: 16px; }
.pm::before, .pm::after { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 4px; background: var(--ember); }
.pm::after { transform: rotate(90deg); transition: transform 240ms var(--ease-out); }
.faq details[open] .pm::after { transform: rotate(180deg); }
@supports (interpolate-size: allow-keywords) {
  .faq { interpolate-size: allow-keywords; }
  .faq details::details-content {
    height: 0;
    overflow: clip;
    opacity: 0;
    transition: height 200ms var(--ease-out), opacity 200ms var(--ease-out), content-visibility 200ms allow-discrete;
  }
  .faq details[open]::details-content { height: auto; opacity: 1; }
}

/* Ambient loops: the mic listening, firelight, and a slow drift through the crypt */
@keyframes eq { to { transform: scaleY(0.35); } }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  18% { opacity: .82; }
  22% { opacity: .95; }
  47% { opacity: .78; }
  53% { opacity: 1; }
  76% { opacity: .88; }
}
/* Sprite-rate flame (~8fps): licks upward and sways from its base, never shrinks below the static flame */
@keyframes flame {
  0% { transform: none; opacity: 1; }
  14% { transform: scale(1.04, 1.14) skewX(-3deg); opacity: .9; }
  28% { transform: scale(1.01, 1.05) skewX(2deg); opacity: 1; }
  42% { transform: scale(1.03, 1.18); opacity: .85; }
  57% { transform: scale(1, 1.07) skewX(-2deg); opacity: 1; }
  71% { transform: scale(1.05, 1.12) skewX(3deg); opacity: .92; }
  85% { transform: scale(1, 1.03); opacity: 1; }
}
@keyframes glow {
  0% { opacity: 1; transform: scale(1); }
  20% { opacity: .7; transform: scale(.94); }
  45% { opacity: .95; transform: scale(1.04); }
  65% { opacity: .6; transform: scale(.92); }
  85% { opacity: .85; transform: scale(1); }
}
@keyframes drift { to { transform: scale(1.08) translate(-1.5%, -1%); } }

@media (prefers-reduced-motion: no-preference) {
  .listening .bars i { animation: eq 700ms var(--ease-in-out) infinite alternate; }
  .listening .bars i:nth-child(2) { animation-duration: 560ms; animation-delay: -200ms; }
  .listening .bars i:nth-child(3) { animation-duration: 820ms; animation-delay: -450ms; }
  .listening .bars i:nth-child(4) { animation-duration: 640ms; animation-delay: -100ms; }
  .listening .bars i:nth-child(5) { animation-duration: 760ms; animation-delay: -350ms; }
  .download::after { animation: flicker 4s linear infinite; }
  .torches .flame { animation: flame 900ms steps(1, end) infinite; }
  .torch::before { animation: glow 1300ms steps(1, end) infinite; }
  .torch:last-child .flame { animation-duration: 1100ms; animation-delay: -400ms; }
  .torch:last-child::before { animation-duration: 1500ms; animation-delay: -700ms; }
  .hero > img { animation: drift 30s var(--ease-in-out) infinite alternate; }
}

/* Reduced motion: everything still arrives, as a plain fade; no movement, no loops */
@media (prefers-reduced-motion: reduce) {
  .js [data-fx][data-visible] { animation: fade 400ms var(--ease-out) backwards; }
  .js [data-fx][data-visible] :is(.w, .ch, .step-num, .ic, img),
  .js [data-fx="hop"][data-visible] > * { animation: none; }
  .faq details::details-content { transition-property: opacity, content-visibility; }
  .pm::after { transition: none; }
  .store:hover, .nav-cta:hover, .store:active, .nav-cta:active { transform: none; }
}
