/* Pollars. Black and white; colour lives only in the dots. */

:root {
  --ground: #000;
  --ink: #fff;
  --soft: #9b9b9b;
  --tone-1: #0d0d0d;
  --tone-2: #141414;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-display: clamp(2rem, 6vw, 5.5rem);

  --margin: 24px;
  --gutter: 24px;
  --section: clamp(120px, 11vw, 168px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 320ms;
  --stagger: 75ms;
}
@media (max-width: 640px) {
  :root { --margin: 16px; --gutter: 16px; --section: 96px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--step-body) / 1.5 var(--font);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--ground); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--margin); top: 8px; z-index: 20;
  padding: 10px 16px; background: var(--ink); color: var(--ground); text-decoration: none;
  clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap;
}
.skip:focus-visible { clip-path: none; width: auto; height: auto; overflow: visible; }

/* ---------- controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--ink); color: var(--ground);
  border: 2px solid var(--ink); border-radius: 0;
  font: 600 var(--step-body) / 1.1 var(--font);
  text-decoration: none; white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.button:active { transform: scale(0.97); }
.button:focus-visible { background: var(--ground); color: var(--ink); }
.link {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.25em;
  text-decoration-color: var(--soft);
  display: inline-flex; align-items: center; min-height: 44px;
  transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease;
}
.link:active { color: var(--soft); }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ground); color: var(--ink); }
  .link:hover { text-decoration-color: var(--ink); }
}
.note { color: var(--soft); font-size: var(--step-small); }

/* ---------- header ---------- */
.site-header {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 12px var(--margin);
}
.site-header--page { position: relative; }
.site-header a {
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--t-hover) ease, opacity var(--t-press) ease;
}
.site-header a:active { opacity: 0.6; }
.site-header a[aria-current="page"] { text-decoration-color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .site-header a:hover { text-decoration-color: var(--ink); }
}
.brand { font-weight: 700; }
.nav { display: flex; gap: 28px; }
@media (max-width: 640px) {
  .nav { gap: 20px; }
  .nav__wide { display: none !important; }
}

/* load sequence: hidden only while the intro runs, and only with motion allowed */
@media (prefers-reduced-motion: no-preference) {
  .js [data-intro] {
    transition: opacity 600ms var(--ease-out) var(--d, 0ms), transform 700ms var(--ease-out) var(--d, 0ms);
  }
  .js.intro [data-intro] { opacity: 0; transform: translateY(18px); transition: none; }
}

/* ---------- hero ---------- */
.hero { position: relative; height: 100svh; }
@media (prefers-reduced-motion: no-preference) {
  .js .hero { height: 170svh; }
}
.hero__stage {
  position: sticky; top: 0; height: 100svh; min-height: 520px;
  overflow: hidden; background: var(--ground);
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; -webkit-tap-highlight-color: transparent; }
.hero-live .hero__canvas { display: block; }
.hero__slot { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hero__title { line-height: 0; max-width: 100%; max-height: 100%; }
.hero__fallback { width: min(76.6svh, 91.5vw); height: auto; max-height: 100%; }
.hero-live .hero__fallback, .js.intro .hero__fallback { visibility: hidden; }
.hero__ring {
  position: absolute; display: none; border-radius: 50%; pointer-events: none;
}
.hero-live .hero__ring { display: block; }
.hero__ring:focus-visible { outline-offset: 10px; }
.hero__copy {
  position: absolute; right: var(--margin); bottom: 40px; z-index: 2;
  max-width: 30ch; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end; gap: 20px;
}
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 24px; }
@media (max-width: 899px) {
  .hero__stage { display: flex; flex-direction: column; }
  .hero__slot { position: relative; inset: auto; flex: 1; min-height: 0; margin-top: 68px; }
  .hero__copy {
    position: relative; right: auto; bottom: auto; max-width: 34rem;
    text-align: left; align-items: flex-start; gap: 16px;
    padding: 16px var(--margin) 24px;
  }
  .hero__actions { justify-content: flex-start; }
}

/* ---------- dot headings ---------- */
[data-dots] { --dot: 11px; font-weight: 700; font-size: var(--step-display); line-height: 1; letter-spacing: -0.02em; text-transform: uppercase; }
[data-dots].has-dots { font-size: 0; line-height: 0; letter-spacing: 0; }
.dots { display: block; }
.dots__svg { overflow: visible; }
.dots__svg circle { fill: var(--ink); transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .dots.is-pending circle { opacity: 0; transform: scale(0.2); }
  .dots.is-in:not(.is-done) circle { animation: dot-pop 420ms var(--ease-out) var(--d, 0ms) both; }
}
@keyframes dot-pop { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { [data-dots] { --dot: 7px; } }

/* ---------- section entrances ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(24px); }
  .js [data-reveal].is-in {
    opacity: 1; transform: none;
    transition: opacity 700ms var(--ease-out) calc(var(--i, 0) * var(--stagger)), transform 900ms var(--ease-expo) calc(var(--i, 0) * var(--stagger));
  }
}

/* ---------- about: side facts, wide paragraph ---------- */
.about {
  display: grid;
  grid-template-columns: calc(34vw - var(--margin)) minmax(0, 56vw);
  grid-template-areas: "head text" "facts text";
  grid-template-rows: auto 1fr;
  row-gap: 40px;
  padding: var(--section) var(--margin) 0;
}
.about__title { grid-area: head; }
.about__text { grid-area: text; font-size: var(--step-lead); line-height: 1.4; max-width: 46ch; padding-top: 4px; }
.facts { grid-area: facts; display: grid; gap: 20px; align-content: start; font-size: var(--step-small); }
.facts dt { color: var(--soft); }
.facts dd { color: var(--ink); }
@media (max-width: 900px) {
  .about { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "text" "facts"; row-gap: 28px; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); }
}
@media (max-width: 640px) {
  .about__text { font-size: 1.1875rem; }
  .facts { grid-template-columns: 1fr 1fr; }
}

/* ---------- games: oversized visual, small cluster ---------- */
.games { padding-top: var(--section); }
.games__title { padding: 0 var(--margin); margin-bottom: 64px; }
.game {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: center; padding: 0 var(--margin);
}
.game + .game { margin-top: 140px; }
.game__visual { grid-row: 1; aspect-ratio: 1200 / 750; background: var(--tone-1); overflow: clip; }
.game__visual img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.game--everheim .game__visual { grid-column: 1 / 8; margin-left: calc(-1 * var(--margin)); }
.game--everheim .game__cluster { grid-column: 9 / 13; }
.game--snake .game__visual { grid-column: 6 / 13; margin-right: calc(-1 * var(--margin)); }
.game--snake .game__cluster { grid-column: 1 / 5; grid-row: 1; }
.game__cluster { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.game__cluster > p { max-width: 40ch; }
.game__title { --dot: 9px; margin-bottom: 8px; width: 100%; }
.game__action { margin-top: 8px; }
.snake { width: 100%; height: 100%; touch-action: pan-y; cursor: crosshair; }
.cast { display: flex; align-items: flex-end; gap: 4px; margin-top: 12px; }
.cast img { width: auto; height: 120px; }
.cast .cast__dragon { height: 192px; margin-left: -8px; }
@media (hover: hover) and (pointer: fine) {
  .cast img { transition: transform var(--t-ui) var(--ease-out); transform-origin: 50% 100%; }
  .cast img:hover { transform: translateY(-6px); }
}
@media (max-width: 900px) {
  .game { grid-template-columns: 1fr; row-gap: 32px; }
  .game + .game { margin-top: 96px; }
  .game .game__visual, .game--snake .game__visual { grid-column: 1; grid-row: 1; margin: 0 calc(-1 * var(--margin)); }
  .game .game__cluster, .game--snake .game__cluster { grid-column: 1; grid-row: 2; }
  .game__title { --dot: 8px; }
}
@media (max-width: 640px) {
  .game__title { --dot: 7px; }
  .cast img { height: 92px; }
  .cast .cast__dragon { height: 147px; }
}

/* ---------- footer: one small, quiet row ---------- */
.footer {
  margin-top: var(--section);
  padding: 20px var(--margin) 24px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 32px;
  background: var(--tone-1); color: var(--soft);
  font-size: var(--step-small);
}
.footer__links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 28px; }
.footer__links a {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em;
  text-decoration-color: transparent; transition: text-decoration-color var(--t-hover) ease;
}
.footer__links a:active { opacity: 0.6; }
@media (hover: hover) and (pointer: fine) {
  .footer__links a:hover { text-decoration-color: currentColor; }
}
@media (max-width: 640px) {
  .footer { flex-direction: column; align-items: flex-start; gap: 0; padding: 20px var(--margin) 12px; }
  .footer__links { gap: 0 20px; }
}

/* ---------- legal pages ---------- */
.legal {
  display: grid;
  grid-template-columns: calc(34vw - var(--margin)) minmax(0, 1fr);
  grid-template-areas: "head head" "toc body";
  column-gap: var(--gutter); row-gap: 72px;
  padding: 96px var(--margin) 0;
}
.legal__head { grid-area: head; display: grid; gap: 20px; }
.legal__head [data-dots] { --dot: 12px; }
.legal__toc { grid-area: toc; align-self: start; position: sticky; top: 32px; font-size: var(--step-small); }
.legal__toc ul { list-style: none; padding: 0; display: grid; }
.legal__toc a {
  display: inline-flex; align-items: center; min-height: 36px; color: var(--soft); text-decoration: none;
  transition: color var(--t-hover) ease;
}
.legal__toc a:hover, .legal__toc a:focus-visible { color: var(--ink); }
.legal__body { grid-area: body; max-width: 68ch; font-size: var(--step-body); line-height: 1.6; }
.legal__body > * + * { margin-top: 1em; }
.legal__body h2 { font-size: var(--step-lead); line-height: 1.25; font-weight: 700; margin-top: 2.4em; scroll-margin-top: 24px; }
.legal__body h2:first-child { margin-top: 0; }
.legal__body h2 + * { margin-top: 0.7em; }
.legal__body ul, .legal__body ol { padding-left: 1.3em; }
.legal__body li + li { margin-top: 0.6em; }
.legal__body li::marker { color: var(--soft); }
.legal__body a:not(.button) {
  text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; text-decoration-color: var(--soft);
  transition: text-decoration-color var(--t-hover) ease;
}
.legal__body a:not(.button):hover { text-decoration-color: var(--ink); }
.legal__body .button { margin-top: 1.6em; }
.legal__body .button + * { margin-top: 2.4em; }
@media (max-width: 900px) {
  .legal { grid-template-columns: 1fr; grid-template-areas: "head" "body"; row-gap: 48px; padding-top: 48px; }
  .legal__toc { display: none; }
  .legal__head [data-dots] { --dot: 8px; }
}

/* ---------- 404 ---------- */
.lost { min-height: calc(100svh - 68px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 32px; padding: 48px var(--margin) 96px; }
.lost [data-dots] { --dot: 32px; align-self: stretch; }
@media (max-width: 640px) { .lost [data-dots] { --dot: 18px; } }
