/* ==========================================================================
   SONICLINE MEDIA — site styles
   Static, dependency-free. Organized as: fonts → tokens → base → layout →
   components (header, hero, sections, services, work, game, about, contact,
   footer, secondary pages) → motion → reduced motion.
   ========================================================================== */

/* Fonts (self-hosted, SIL OFL — see assets/fonts/OFL.txt) ----------------- */
@font-face {
  font-family: "Instrument Sans";
  src: url("assets/fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("assets/fonts/dm-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("assets/fonts/dm-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Theme properties are registered so a light ↔ deep-teal scene change can
   interpolate. Browsers without @property simply switch without easing. */
@property --bg      { syntax: "<color>"; inherits: true; initial-value: #f8f9f6; }
@property --fg      { syntax: "<color>"; inherits: true; initial-value: #062a35; }
@property --fg-2    { syntax: "<color>"; inherits: true; initial-value: #46636c; }
@property --rule    { syntax: "<color>"; inherits: true; initial-value: rgba(6, 42, 53, 0.14); }
@property --rule-2  { syntax: "<color>"; inherits: true; initial-value: rgba(6, 42, 53, 0.4); }
@property --accent  { syntax: "<color>"; inherits: true; initial-value: #2c758b; }
@property --surface { syntax: "<color>"; inherits: true; initial-value: #edf3f0; }

/* Tokens ------------------------------------------------------------------ */
:root {
  /* Palette */
  --paper: #f8f9f6;        /* warm off-white */
  --ink: #062a35;          /* very deep petrol */
  --petrol: #083b4b;       /* deep petrol teal */
  --teal: #114959;         /* primary teal */
  --teal-2: #2c758b;       /* lighter teal */
  --mint: #a6ddd2;         /* pale mint/aqua accent */
  --slate: #46636c;        /* muted text on light (6.1:1) */
  --fog: #9fb8bc;          /* muted text on dark (7.2:1) */

  /* Scene: light (default) */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-2: var(--slate);
  --rule: rgba(6, 42, 53, 0.14);
  --rule-2: rgba(6, 42, 53, 0.4);
  --accent: var(--teal-2);
  --surface: #edf3f0;

  /* Type */
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.9375rem;
  --fs-base: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --fs-md: clamp(1.125rem, 1rem + 0.55vw, 1.4375rem);
  --fs-lg: clamp(1.375rem, 1.1rem + 0.9vw, 1.875rem);
  --fs-xl: clamp(1.75rem, 1.25rem + 1.9vw, 3rem);
  --fs-2xl: clamp(2rem, 1.2rem + 3.1vw, 4.25rem);
  --fs-display: clamp(3rem, 1.1rem + 7.6vw, 8.75rem);
  --fs-hero: clamp(3.375rem, 0.9rem + 10.5vw, 8.5rem);

  --lh-display: 0.9;
  --lh-snug: 1.12;
  --lh-body: 1.55;
  --tr-display: -0.045em;
  --tr-tight: -0.025em;
  --tr-label: 0.08em;

  /* Space & layout */
  --max: 85rem;                                   /* 1360px content */
  --gutter: clamp(1.25rem, 0.6rem + 3.2vw, 4rem);
  --gap: clamp(1rem, 0.5rem + 1.6vw, 2rem);
  --section-y: clamp(5rem, 2.75rem + 6.6vw, 9.25rem);
  --header-h: 4rem;
  --bleed: min(var(--gutter), 2.5rem);
  --node: 7px;

  /* Borders */
  --hair: 1px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 0.8, 0.24, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 180ms;
  --dur-2: 340ms;
  --dur-3: 760ms;
  --dur-4: 1150ms;
  --dur-scene: 720ms;
  --stagger: 70ms;
}

@media (min-width: 900px) {
  :root { --header-h: 4.5rem; }
}

/* Scene: deep teal. Static fallback colors each dark section on its own;
   with scripting and motion allowed ("flow"), the whole page eases between
   scenes as sections cross the middle of the viewport. */
html:not(.flow) [data-scene="dark"],
html.flow[data-scene="dark"] {
  --bg: var(--ink);
  --fg: var(--paper);
  --fg-2: var(--fog);
  --rule: rgba(248, 249, 246, 0.14);
  --rule-2: rgba(248, 249, 246, 0.4);
  --accent: var(--mint);
  --surface: #0b3642;
}

/* The background eases through the full duration; foreground tones swap
   quickly around its midpoint so text never fades into the background. */
html.flow {
  --fg-swap: calc(var(--dur-scene) * 0.14);
  --fg-delay: calc(var(--dur-scene) * 0.5 - var(--fg-swap) * 0.5);
  transition:
    --bg var(--dur-scene) var(--ease-io),
    --surface var(--dur-scene) var(--ease-io),
    --fg var(--fg-swap) linear var(--fg-delay),
    --fg-2 var(--fg-swap) linear var(--fg-delay),
    --rule var(--fg-swap) linear var(--fg-delay),
    --rule-2 var(--fg-swap) linear var(--fg-delay),
    --accent var(--fg-swap) linear var(--fg-delay);
}
html.flow.flow-instant { transition: none; }

/* Base -------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }

[data-scene] { background: var(--bg); color: var(--fg); }
html.flow [data-scene] { background: transparent; }

::selection { background: var(--mint); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 100;
  padding: 0.75rem 1.1rem;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }
main:focus { outline: none; }

/* Layout ------------------------------------------------------------------ */
.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

/* Shared typographic pieces ----------------------------------------------- */
.kicker,
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg-2);
}

/* Kicker: a node on a short line, then the label — the site's signal motif */
.kicker {
  display: flex;
  align-items: center;
  align-self: start;
  gap: 0.8rem;
}
.kicker::before {
  content: "";
  flex: none;
  width: 2.25rem;
  height: var(--node);
  background:
    radial-gradient(circle closest-side, var(--accent) 94%, transparent) 0 50% / var(--node) var(--node) no-repeat,
    linear-gradient(var(--accent), var(--accent)) var(--node) 50% / calc(100% - var(--node)) 1px no-repeat;
}
.kicker__idx { margin-right: 0.5em; color: var(--fg); font-weight: 500; }

.sec-rule {
  height: var(--hair);
  background: var(--rule-2);
  transform-origin: 0 50%;
}

.sec-head {
  display: grid;
  gap: 1.5rem;
  padding-top: 1.35rem;
  margin-bottom: clamp(3.5rem, 2rem + 4.5vw, 7rem);
}

.sec-title {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  text-wrap: balance;
}
.sec-title--l { font-size: clamp(2.75rem, 1.2rem + 5.2vw, 6.5rem); }

.sec-lead {
  max-width: 40rem;
  font-size: var(--fs-md);
  line-height: 1.42;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

@media (min-width: 1024px) {
  .sec-head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    row-gap: 2.25rem;
    padding-top: 1.6rem;
  }
  .sec-head .kicker { grid-column: 1 / 4; grid-row: 1; align-self: start; padding-top: 0.35rem; }
  .sec-head .sec-title { grid-column: 4 / 13; grid-row: 1; }
  .sec-head .sec-lead { grid-column: 4 / 11; }
}

/* Arrow link (secondary actions) */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg);
}
.ring {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--rule-2);
  border-radius: 50%;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.ring svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
  transition: transform var(--dur-2) var(--ease-out);
}
@media (hover: hover) {
  .link-arrow:hover .ring { background: var(--fg); border-color: var(--fg); color: var(--bg); }
  .link-arrow:hover .ring svg { transform: translateY(2px); }
}

/* Header ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) and (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
  }
}
.site-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--hair);
  background: var(--rule);
  opacity: 0;
  transition: opacity var(--dur-2) ease;
}
.site-header.is-scrolled::after,
.site-header.is-open::after { opacity: 1; }

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand__mark {
  width: 2.125rem;
  height: auto;
  color: var(--accent);
  overflow: visible;
}
.brand__mark path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand__mark circle { fill: var(--fg); }
.brand__word b { font-weight: 600; }
.brand__word span { font-weight: 400; }

.nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}
.nav__list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  color: var(--fg);
}
.nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.55rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--dur-2) var(--ease-out);
}
.nav__list a.is-active::after { transform: scaleX(1); }
@media (hover: hover) {
  .nav__list a:hover::after { transform: scaleX(1); }
}
.nav__num { display: none; }

.nav__toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin-right: -0.5rem;
  padding: 0 0.5rem;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
}
.nav__toggle-icon {
  position: relative;
  width: 1.25rem;
  height: 0.5rem;
}
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--dur-2) var(--ease-out);
}
.nav__toggle-icon::before { top: 0; }
.nav__toggle-icon::after { bottom: 0; }
.is-open .nav__toggle-icon::before { transform: translateY(0.1875rem) rotate(45deg); }
.is-open .nav__toggle-icon::after { transform: translateY(-0.1875rem) rotate(-45deg); }

@media (min-width: 900px) {
  .nav__list { gap: 0 clamp(1.5rem, 2.4vw, 2.5rem); }
}

@media (max-width: 899.98px) {
  /* Without scripting the links simply wrap beside the wordmark. */
  html:not(.js) .header__inner { flex-wrap: wrap; padding-block: 0.5rem; }
  html:not(.js) .nav__list a { font-size: 0.875rem; }

  .js .nav__toggle { display: inline-flex; }
  .js .nav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
    padding: 0.5rem var(--gutter) 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), visibility 0s linear var(--dur-2);
  }
  .js .site-header.is-open .nav__list {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
  }
  .js .nav__list a {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    width: 100%;
    padding-block: 0.85rem;
    border-top: 1px solid var(--rule);
    font-size: var(--fs-lg);
    letter-spacing: var(--tr-tight);
  }
  .js .nav__list li:first-child a { border-top: 0; }
  .js .nav__list a::after { display: none; }
  .js .nav__num {
    display: inline;
    min-width: 1.75rem;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: var(--tr-label);
    color: var(--fg-2);
  }
}

/* Hero -------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(2rem, 0.5rem + 4.2vw, 4.75rem);
  padding-bottom: clamp(0.5rem, 2vw, 2rem);
}

.hero__grid {
  display: grid;
  gap: 2rem;
}

.hero__title {
  font-size: var(--fs-hero);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.052em;
  margin-left: -0.04em;
}
.hero__title span { display: block; }

.hero__aside {
  display: grid;
  gap: 1.75rem;
  max-width: 28rem;
}
.hero__lead {
  font-size: var(--fs-md);
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

@media (min-width: 1024px) {
  .hero__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    row-gap: clamp(2rem, 3vw, 3rem);
    align-items: end;
  }
  .hero__kicker { grid-column: 1 / -1; }
  .hero__title { grid-column: 1 / 9; }
  .hero__aside { grid-column: 9 / 13; padding-bottom: 0.4rem; }
}

/* Signal composition: source node, sampled transient, the line itself */
.signal {
  position: relative;
  margin-top: clamp(2.25rem, 1rem + 3vw, 3.75rem);
}
.signal::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -100vw;
  right: -100vw;
  height: 1px;
  background: var(--rule-2);
}
.signal__stage {
  position: relative;
  width: max(100%, 40rem);
  aspect-ratio: 1200 / 240;
}
.signal__layer {
  position: absolute;
  inset: 0;
}
.signal__svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.signal__head {
  border-right: 1px solid var(--accent);
  opacity: 0;
}

.sig-ticks,
.sig-stems {
  fill: none;
  stroke: var(--rule-2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.sig-curve {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.25;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.sig-dots circle { fill: var(--accent); }
.sig-ring {
  fill: none;
  stroke: var(--rule-2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.sig-ring:nth-of-type(2) { stroke: var(--accent); }
.sig-node { fill: var(--fg); }
.sig-bracket {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.sig-pick {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

/* Services ---------------------------------------------------------------- */
.groups {
  display: grid;
  gap: clamp(4rem, 2.5rem + 5vw, 7.5rem);
}

.group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: clamp(1.25rem, 0.8rem + 1.4vw, 2.25rem);
}
.group__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
}
.group__title::before {
  content: "";
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  background: var(--accent);
}
.group--own .group__title::before { border-radius: 0; background: var(--fg); }
.group__note {
  font-size: var(--fs-sm);
  color: var(--fg-2);
}

.svc {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.5rem 0.75rem;
  padding-block: 1.5rem 1.6rem;
  border-top: 1px solid var(--rule);
}
.svc:last-child { border-bottom: 1px solid var(--rule); }
.svc__num {
  grid-row: span 2;
  padding-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-2);
}
.svc__name {
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-tight);
}
.svc__name br { display: none; }
.svc__desc {
  max-width: 34rem;
  color: var(--fg-2);
  text-wrap: pretty;
}

@media (min-width: 700px) and (max-width: 1199.98px) {
  .svc {
    grid-template-columns: 3.5rem minmax(0, 1fr) minmax(0, 1.15fr);
    column-gap: var(--gap);
    align-items: baseline;
    padding-block: 1.9rem 2rem;
  }
  .svc__num { grid-row: auto; padding-top: 0; }
}

@media (min-width: 1200px) {
  .svc-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: var(--gap);
  }
  .svc {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    gap: 0;
    padding: 1.35rem 0 0;
  }
  .svc:last-child { border-bottom: 0; }
  .svc::before {
    content: "";
    position: absolute;
    top: calc(var(--node) / -2 - 0.5px);
    left: 0;
    width: var(--node);
    height: var(--node);
    border-radius: 50%;
    background: var(--accent);
  }
  .svc__num { grid-row: auto; padding-top: 0; margin-bottom: clamp(3rem, 4.5vw, 5rem); }
  .svc__name { font-size: clamp(1.375rem, 0.7rem + 1.05vw, 1.75rem); min-height: 2.3em; }
  .svc__name br { display: inline; }
  .svc__desc { margin-top: 1.1rem; font-size: var(--fs-sm); line-height: 1.55; }
}

/* Original games (in-house) band */
.own {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule-2);
}
.own::before {
  content: "";
  position: absolute;
  top: calc(var(--node) / -2 - 0.5px);
  left: 0;
  width: var(--node);
  height: var(--node);
  background: var(--fg);
}
.own__num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-2);
}
.own__name {
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.own__desc {
  max-width: 34rem;
  color: var(--fg-2);
  text-wrap: pretty;
}
.own .link-arrow { margin-top: 0.5rem; }

@media (min-width: 1024px) {
  .own {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    row-gap: 0;
    align-items: start;
    padding-top: 1.35rem;
  }
  .own__num { grid-column: 1 / 4; padding-top: 0.2rem; }
  .own__name { grid-column: 4 / 9; }
  .own__body { grid-column: 9 / 13; display: grid; gap: 1.25rem; justify-items: start; padding-top: 0.45rem; }
  .own .link-arrow { margin-top: 0; }
}

/* Selected work ----------------------------------------------------------- */
.work__note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}
.work__note::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  margin-top: 0.36em;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}
.work__note strong { font-weight: 500; }

.credits {
  display: grid;
  border-bottom: 1px solid var(--rule-2);
}

.credit__inner {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  height: 100%;
  padding-block: 1.75rem 1.5rem;
  border-top: 1px solid var(--rule-2);
}
.credit__inner::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(var(--bleed) * -1);
  background: var(--surface);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}

.credit__index {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  color: var(--fg);
}
.credit__trace {
  position: relative;
  flex: none;
  width: 3.5rem;
  height: var(--node);
}
.credit__trace::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--rule-2);
  transform: scaleX(0.3);
  transform-origin: 0 50%;
  transition: transform var(--dur-2) var(--ease-out), background-color var(--dur-2) ease;
}
.credit__trace::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(calc(3.5rem * 0.3 - var(--node) / 2));
  transition: transform var(--dur-2) var(--ease-out);
}

.credit__title {
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
  transition: transform var(--dur-2) var(--ease-out);
}
.credit__desc {
  max-width: 36rem;
  color: var(--fg-2);
  text-wrap: pretty;
}

.credit__meta {
  display: grid;
  align-content: start;
  margin-top: 0.25rem;
}
.credit__meta > div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding-block: 0.55rem;
  border-top: 1px solid var(--rule);
}
.credit__meta > div:first-child { border-top: 0; padding-top: 0; }
.credit__meta dt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg-2);
}
.credit__meta dd { line-height: 1.4; }

.credit__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg);
}
/* The whole row is a target; the link keeps its own accessible name. */
.credit__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.credit__link:focus-visible { outline: none; }
.credit__link:focus-visible .ring { outline: 2px solid var(--accent); outline-offset: 3px; }
.credit__inner:focus-within::before { opacity: 1; }
.credit__link .ring svg { transition: transform var(--dur-2) var(--ease-out); }

@media (hover: hover) {
  .credit__inner:hover::before { opacity: 1; }
  .credit__inner:hover .credit__title { transform: translateX(0.4rem); }
  .credit__inner:hover .credit__trace::before { transform: scaleX(1); background: var(--fg); }
  .credit__inner:hover .credit__trace::after { transform: translateX(calc(3.5rem - var(--node))); }
  .credit__inner:hover .ring { background: var(--fg); border-color: var(--fg); color: var(--bg); }
  .credit__inner:hover .ring svg { transform: translate(2px, -2px); }
}
.credit__inner:focus-within .credit__trace::before { transform: scaleX(1); background: var(--fg); }
.credit__inner:focus-within .credit__trace::after { transform: translateX(calc(3.5rem - var(--node))); }

@media (min-width: 700px) {
  .credits { grid-auto-rows: 1fr; }
  .credit__inner {
    grid-template-columns: 5rem minmax(0, 1fr) minmax(0, 17.5rem);
    grid-template-rows: auto 1fr auto;
    column-gap: var(--gap);
    row-gap: 1.1rem;
    padding-block: clamp(2rem, 1.2rem + 2vw, 3rem);
  }
  .credit__index { grid-column: 1; grid-row: 1 / 4; align-self: start; flex-direction: column; align-items: flex-start; gap: 0.9rem; padding-top: 0.55rem; }
  .credit__trace { width: 2.5rem; }
  .credit__trace::after { transform: translateX(calc(2.5rem * 0.3 - var(--node) / 2)); }
  .credit__title { grid-column: 2 / 4; grid-row: 1; }
  .credit__desc { grid-column: 2; grid-row: 2 / 4; }
  .credit__meta { grid-column: 3; grid-row: 2; margin-top: 0; }
  .credit__link { grid-column: 3; grid-row: 3; align-self: end; justify-content: flex-start; border-top: 0; padding-top: 0.5rem; }
  .credit__meta > div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  @media (hover: hover) {
    .credit__inner:hover .credit__trace::after { transform: translateX(calc(2.5rem - var(--node))); }
  }
  .credit__inner:focus-within .credit__trace::after { transform: translateX(calc(2.5rem - var(--node))); }
}

@media (min-width: 1200px) {
  .credit__inner {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    row-gap: 1.25rem;
  }
  .credit__index { grid-column: 1 / 4; flex-direction: row; align-items: center; gap: 0.85rem; padding-top: 0.9rem; }
  .credit__trace { width: 3.5rem; }
  .credit__trace::after { transform: translateX(calc(3.5rem * 0.3 - var(--node) / 2)); }
  .credit__title { grid-column: 4 / 9; }
  .credit__desc { grid-column: 4 / 9; grid-row: 2 / 4; align-self: start; }
  .credit__meta { grid-column: 9 / 13; grid-row: 1 / 3; padding-top: 0.55rem; }
  .credit__meta > div { grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; }
  .credit__link { grid-column: 9 / 13; }
  @media (hover: hover) {
    .credit__inner:hover .credit__trace::after { transform: translateX(calc(3.5rem - var(--node))); }
  }
  .credit__inner:focus-within .credit__trace::after { transform: translateX(calc(3.5rem - var(--node))); }
}

/* Original game ----------------------------------------------------------- */
.game__grid {
  display: grid;
  gap: 1.5rem;
  padding-top: 1.35rem;
}
.game__lead {
  max-width: 32rem;
  font-size: var(--fs-md);
  line-height: 1.42;
  text-wrap: pretty;
}
.game__art {
  width: 100%;
  max-width: 34rem;
  aspect-ratio: 1 / 1;
  margin: 1rem auto;
}
@media (max-width: 699.98px) {
  .game__art { width: 86%; }
}

.spec {
  display: grid;
  max-width: 30rem;
  border-bottom: 1px solid var(--rule);
}
.spec > div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding-block: 0.8rem;
  border-top: 1px solid var(--rule);
}
.spec dt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg-2);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.status::before {
  content: "";
  width: var(--node);
  height: var(--node);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.game-art__svg { width: 100%; height: 100%; overflow: visible; }
.ga-crops { fill: none; stroke: var(--fg-2); stroke-width: 1.5; }
.ga-lattice circle { fill: var(--fg-2); }
.ga-axis { fill: none; stroke: var(--rule-2); stroke-width: 1; }
.ga-ring { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-dasharray: 1 1; }
.ga-square { fill: none; stroke: var(--fg); stroke-width: 1.75; stroke-dasharray: 1 1; }
.ga-cell { fill: var(--accent); }
.ga-node { fill: var(--fg); }
.ga-node-ring { fill: none; stroke: var(--fg-2); stroke-width: 1.25; }

@media (min-width: 1024px) {
  .game__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto auto 1fr;
    column-gap: var(--gap);
    row-gap: 2rem;
    padding-top: 1.6rem;
  }
  .game__grid > .kicker { grid-column: 1 / 7; grid-row: 1; }
  .game__title { grid-column: 1 / 7; grid-row: 2; margin-top: 1rem; }
  .game__lead { grid-column: 1 / 6; grid-row: 3; }
  .game__grid .spec { grid-column: 1 / 6; grid-row: 4; align-self: end; width: 100%; }
  .game__art { grid-column: 7 / 13; grid-row: 1 / 5; justify-self: end; margin: 0; }
}

/* About ------------------------------------------------------------------- */
.about__grid {
  display: grid;
  gap: 2rem;
  padding-top: 1.35rem;
}
.about__statement {
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}
.about__detail {
  display: grid;
  gap: 3rem;
  margin-top: clamp(1.5rem, 1rem + 3vw, 4rem);
}
.founder { display: grid; gap: 0.75rem; align-content: start; }
.founder__name {
  font-size: var(--fs-xl);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.035em;
}
.founder__role { color: var(--fg); }
.founder__note { max-width: 26rem; color: var(--fg-2); font-size: var(--fs-sm); margin-top: 0.5rem; }
.founder__note a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--rule-2);
}
.founder__note a:hover { text-decoration-color: currentColor; }

@media (min-width: 1024px) {
  .about__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    padding-top: 1.6rem;
  }
  .about__grid > .kicker { grid-column: 1 / 4; padding-top: 0.35rem; }
  .about__statement { grid-column: 4 / 13; }
  .about__detail {
    grid-column: 4 / 13;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    column-gap: var(--gap);
  }
  .founder { grid-column: 1 / 5; }
  .about__detail .spec { grid-column: 6 / 10; align-self: start; }
}

/* Contact ----------------------------------------------------------------- */
.contact { overflow: hidden; }
.contact .wrap { position: relative; z-index: 1; }
.contact__grid {
  display: grid;
  gap: 2rem;
  padding-top: 1.35rem;
}
.contact__intro {
  max-width: 34rem;
  font-size: var(--fs-md);
  line-height: 1.42;
  text-wrap: pretty;
}
.contact__line {
  max-width: 100%;
  font-size: clamp(1.75rem, 0.6rem + 4.6vw, 4.75rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.04em;
}
.contact__email {
  padding-bottom: 0.06em;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 100% / 0% 2px no-repeat,
    linear-gradient(var(--rule-2), var(--rule-2)) 0 100% / 100% 1px no-repeat;
  transition: background-size var(--dur-3) var(--ease-out);
}
.contact__email .nowrap { white-space: nowrap; }
.contact__arrow {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-left: 0.2em;
  vertical-align: 0.08em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: transform var(--dur-2) var(--ease-out);
}
@media (hover: hover) {
  .contact__email:hover { background-size: 100% 2px, 100% 1px; }
  .contact__email:hover .contact__arrow { transform: translate(0.06em, -0.06em); }
}
.contact__email:focus-visible { background-size: 100% 2px, 100% 1px; }

.contact__meta {
  display: grid;
  gap: 2.25rem;
  margin-top: clamp(1rem, 0.5rem + 2vw, 2.5rem);
}
.contact__meta .label { margin-bottom: 0.9rem; }
.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0;
  max-width: 44rem;
  font-size: var(--fs-md);
  line-height: 1.35;
}
.topics li:not(:last-child)::after {
  content: "/";
  margin-inline: 0.5em;
  color: var(--fg-2);
}
.contact__place { font-size: var(--fs-md); line-height: 1.35; }

.contact__rings {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: min(62vw, 40rem);
  height: auto;
  pointer-events: none;
}
.contact__rings circle { fill: none; stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.contact__rings .contact__node { fill: var(--accent); stroke: none; }

@media (min-width: 1024px) {
  .contact__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
    row-gap: 2.5rem;
    padding-top: 1.6rem;
  }
  .contact__grid > .kicker { grid-column: 1 / 4; padding-top: 0.35rem; }
  .contact__intro { grid-column: 4 / 11; }
  .contact__line { grid-column: 4 / 13; }
  .contact__meta { grid-column: 4 / 13; grid-template-columns: repeat(9, minmax(0, 1fr)); column-gap: var(--gap); }
  .contact__topics { grid-column: 1 / 7; }
  .contact__where { grid-column: 7 / 10; }
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  padding-block: 0 2rem;
  font-size: var(--fs-sm);
}
.footer__grid {
  display: grid;
  gap: 2rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule-2);
}
.footer__org { color: var(--fg-2); line-height: 1.6; }
.footer__org strong { color: var(--fg); font-weight: 500; }
.footer__links { display: grid; gap: 0; justify-items: start; }
.footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  text-decoration-color: var(--rule-2);
  transition: text-decoration-color var(--dur-1) ease;
}
.footer__links a:hover { text-decoration-color: currentColor; }
.footer__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: clamp(3rem, 2rem + 4vw, 6rem);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--fg-2);
}

.site-footer--page { padding-top: clamp(2.75rem, 1.5rem + 3.5vw, 5rem); }
.site-footer--page .footer__grid { padding-top: 0; border-top: 0; }

@media (min-width: 900px) {
  .footer__grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
  .footer__grid > .brand { grid-column: 1 / 5; align-self: start; }
  .footer__org { grid-column: 5 / 9; }
  .footer__links { grid-column: 9 / 13; }
}

/* Secondary pages (privacy, 404) ----------------------------------------- */
.page {
  padding-block: clamp(3rem, 1.5rem + 6vw, 7.5rem) var(--section-y);
}
.page__head {
  display: grid;
  gap: 1.5rem;
  padding-top: 1.35rem;
  margin-bottom: clamp(3rem, 2rem + 4vw, 6rem);
}
.page__title {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}
.page__meta { color: var(--fg-2); }

.prose {
  display: grid;
  gap: clamp(2.25rem, 1.5rem + 2vw, 3.5rem);
  max-width: 44rem;
}
.prose section { display: grid; gap: 0.9rem; }
.prose h2 {
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-tight);
}
.prose p,
.prose li { color: var(--fg-2); text-wrap: pretty; }
.prose strong { color: var(--fg); font-weight: 500; }
.prose ul { display: grid; gap: 0.45rem; }
.prose li {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
}
.prose li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-top: 0.68em;
  border-radius: 50%;
  background: var(--accent);
}
.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--rule-2);
}
.prose a:hover { text-decoration-color: currentColor; }

@media (min-width: 1024px) {
  .page__head,
  .page__body {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
  }
  .page__head { row-gap: 2rem; padding-top: 1.6rem; }
  .page__head .kicker { grid-column: 1 / 4; grid-row: 1; padding-top: 0.35rem; }
  .page__title { grid-column: 4 / 13; grid-row: 1; }
  .page__meta { grid-column: 4 / 13; }
  .prose { grid-column: 4 / 11; }
}

.nf {
  overflow: hidden;
  padding-block: clamp(3rem, 1.5rem + 6vw, 7rem) clamp(4rem, 2rem + 6vw, 8rem);
}
.nf__code {
  font-size: clamp(5.5rem, 2rem + 16vw, 16rem);
  font-weight: 500;
  line-height: 0.85;
  letter-spacing: -0.06em;
  margin-left: -0.05em;
}
.nf__body { display: grid; gap: 1.75rem; max-width: 30rem; margin-top: 2rem; }
.nf__text { font-size: var(--fs-md); line-height: 1.42; }
.nf .kicker { margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem); }
.nf .signal { margin-top: clamp(2.5rem, 1.5rem + 4vw, 5rem); }

/* Motion ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: the source pings, a playhead scans the line and reveals the
     sampled transient, then the selection bracket settles. Runs once. */
  .hero .sig-ring {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: sl-ping 1s var(--ease-out) calc(0.1s + var(--r, 0) * 90ms) both;
  }
  .hero .signal__wave,
  .nf .signal__wave {
    animation: sl-sweep 1.7s var(--ease-io) 0.4s both;
  }
  .hero .signal__head,
  .nf .signal__head {
    animation: sl-head 1.7s var(--ease-io) 0.4s both;
  }
  .hero .sig-bracket,
  .hero .sig-pick {
    animation: sl-fade 0.6s var(--ease-out) 1.85s both;
  }

  /* Scroll reveals (enabled by script; content is visible without it) */
  .js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 1.25rem, 0);
    transition:
      opacity var(--dur-3) var(--ease-out),
      transform var(--dur-3) var(--ease-out);
    transition-delay: calc(var(--d, 0) * var(--stagger));
  }
  .js [data-reveal="line"] {
    opacity: 1;
    transform: scaleX(0);
    transition: transform var(--dur-4) var(--ease-io);
  }
  .js [data-reveal="mask"] {
    opacity: 1;
    transform: none;
    overflow: hidden;
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
  }
  .js [data-reveal="mask"] > span {
    display: block;
    transform: translate3d(0, 105%, 0);
    transition: transform 0.95s var(--ease-out);
    transition-delay: calc(var(--d, 0) * var(--stagger));
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  .js [data-reveal="mask"].is-in > span { transform: none; }

  /* Original game artwork draws once when it enters */
  .js .game__art .ga-ring,
  .js .game__art .ga-square {
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.6s var(--ease-io) 0.2s;
  }
  .js .game__art .ga-square { transition-delay: 0.55s; transition-duration: 1.2s; }
  .js .game__art .ga-cell,
  .js .game__art .ga-node,
  .js .game__art .ga-node-ring {
    opacity: 0;
    transition: opacity 0.7s var(--ease-out) 1.3s;
  }
  .js .game__art.is-in .ga-ring,
  .js .game__art.is-in .ga-square { stroke-dashoffset: 0; }
  .js .game__art.is-in .ga-cell,
  .js .game__art.is-in .ga-node,
  .js .game__art.is-in .ga-node-ring { opacity: 1; }
  .js .game__art[data-reveal] { opacity: 1; transform: none; }
}

@keyframes sl-ping {
  from { opacity: 0; transform: scale(0.55); }
}
@keyframes sl-sweep {
  from { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); }
  to { -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); }
}
@keyframes sl-head {
  from { transform: translate3d(-100%, 0, 0); opacity: 1; }
  88% { opacity: 1; }
  to { transform: translate3d(0, 0, 0); opacity: 0; }
}
@keyframes sl-fade {
  from { opacity: 0; }
}

/* Reduced motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
