*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

img, canvas { max-width: 100%; display: block; }
img { height: auto; }
/* Pixel art is never smoothed: every canvas and image scales with nearest-neighbour. */
canvas, .pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

.pixel-font { font-family: var(--font-pixel); }

:focus-visible {
  outline: var(--px) solid var(--firefly);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 12px 16px;
  background: var(--firefly);
  color: var(--bg-0);
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(100% - var(--gutter) * 2, var(--max));
  margin-inline: auto;
}

/* ---------- pixel primitives ---------- */

/* Notched "pixel" border built from stepped box-shadows (no blur, no radius). */
.px-box {
  --px-color: var(--line);
  --px-drop: var(--shadow);
  background: var(--surface);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--px-color),
    0 var(--px) 0 0 var(--px-color),
    calc(var(--px) * -1) 0 0 0 var(--px-color),
    var(--px) 0 0 0 var(--px-color),
    0 calc(var(--px) * 3) 0 0 var(--px-drop);
}

.btn {
  --btn-bg: var(--firefly);
  --btn-fg: var(--bg-0);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transform: translateY(0);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--btn-bg),
    0 var(--px) 0 0 var(--btn-bg),
    calc(var(--px) * -1) 0 0 0 var(--btn-bg),
    var(--px) 0 0 0 var(--btn-bg),
    0 calc(var(--px) * 2 + 2px) 0 0 rgba(0, 0, 0, 0.55);
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2), filter 0.2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active {
  transform: translateY(3px);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--btn-bg),
    0 var(--px) 0 0 var(--btn-bg),
    calc(var(--px) * -1) 0 0 0 var(--btn-bg),
    var(--px) 0 0 0 var(--btn-bg),
    0 0 0 0 transparent;
}
.btn--ghost {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  outline: 0;
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(var(--px) * -1) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line),
    0 calc(var(--px) * 2 + 2px) 0 0 rgba(0, 0, 0, 0.55);
}

.badge {
  display: inline-block;
  padding: 6px 8px;
  background: var(--accent, var(--firefly));
  color: var(--bg-0);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  line-height: 1.2;
  text-transform: uppercase;
}
.tag {
  padding: 4px 8px;
  border: 2px solid var(--line);
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* ---------- sections ---------- */

.section {
  --sec-bg: var(--bg-1);
  position: relative;
  padding: clamp(96px, 14vw, 160px) 0 clamp(72px, 10vw, 120px);
  background: var(--sec-bg);
}
.section--alt { --sec-bg: var(--bg-2); }

/* Dithered pixel-wipe that eases the previous section into this one. */
.section::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -24px;
  height: 24px;
  --c: var(--sec-bg);
  background:
    linear-gradient(var(--c), var(--c)) 0 16px / 100% 8px no-repeat,
    conic-gradient(var(--c) 25%, transparent 0 50%, var(--c) 0 75%, transparent 0) 0 8px / 8px 8px repeat-x,
    conic-gradient(var(--c) 25%, transparent 0) 0 0 / 8px 8px repeat-x;
  pointer-events: none;
}

.section__head { margin-bottom: clamp(36px, 6vw, 64px); max-width: 720px; }
.eyebrow {
  display: block;
  margin-bottom: 16px;
  color: var(--moon);
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section__title {
  font-family: var(--font-pixel);
  font-size: clamp(1.1rem, 3vw, 1.75rem);
  line-height: 1.5;
  text-shadow: 0 var(--px) 0 var(--shadow);
}
.section__lead { margin-top: 20px; color: var(--text-dim); }

/* ---------- scroll reveal (only when JS is on) ---------- */

/* Uses the individual `translate` property so it never fights a component's own `transform` (tilt, hover). */
.js .reveal {
  opacity: 0;
  translate: 0 16px;
  transition:
    opacity 0.6s var(--ease-out) var(--d, 0ms),
    translate 0.5s steps(4, end) var(--d, 0ms),
    transform 0.25s var(--ease-out);
}
.js .reveal.is-in { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; translate: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
