/* ───────── tokens ───────── */
:root {
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* warm dark by default */
  --bg: #1f1b19;
  --fg: #f2eee9;
  --fg-2: #a59d96;
  --fg-3: #6f6762;
  --line: rgba(255, 245, 235, 0.09);
  --hover: rgba(255, 245, 235, 0.035);
  --chip-line: rgba(255, 245, 235, 0.14);
  --panel: #26211f;
  --live: #4ade80;
}
/* light, only when the system asks for it */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf8f6;
    --fg: #1c1917;
    --fg-2: #6f6862;
    --fg-3: #a8a09a;
    --line: rgba(28, 25, 23, 0.1);
    --hover: rgba(28, 25, 23, 0.035);
    --chip-line: rgba(28, 25, 23, 0.14);
    --panel: #ffffff;
    --live: #16a34a;
  }
}
:root[data-theme="light"] {
  --bg: #faf8f6;
  --fg: #1c1917;
  --fg-2: #6f6862;
  --fg-3: #a8a09a;
  --line: rgba(28, 25, 23, 0.1);
  --hover: rgba(28, 25, 23, 0.035);
  --chip-line: rgba(28, 25, 23, 0.14);
  --panel: #ffffff;
  --live: #16a34a;
}

/* ───────── base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fg-2); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 20px; } }

/* ───────── top bar (scrolls away, like the reference) ───────── */
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 96px; }
@media (min-width: 768px) { .topbar-inner { height: 160px; } }
.badge {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 9px;
  border: 2px solid var(--fg); color: var(--fg);
  font-weight: 600; font-size: 19px; line-height: 1; text-decoration: none;
  transition: background .2s, color .2s;
}
.badge:hover { background: var(--fg); color: var(--bg); }
.nav {
  display: flex; align-items: center; gap: 14px;
  text-transform: uppercase; letter-spacing: .02em; font-size: 16px; font-weight: 400;
}
@media (min-width: 768px) { .nav { font-size: 20px; gap: 18px; } }
.nav a { text-decoration: none; color: var(--fg-2); transition: color .15s; }
.nav a:hover, .nav a.is-active { color: var(--fg); font-weight: 500; }
.nav span { color: var(--fg-3); font-size: .8em; }

/* ───────── text ───────── */
.page { padding-bottom: 40px; }
.page + .page { padding-top: 120px; }

.lede {
  margin: 0;
  font-size: 22px; font-weight: 400; line-height: 1.4; letter-spacing: -0.005em;
  text-wrap: pretty;
}
@media (min-width: 768px) { .lede { font-size: 38px; line-height: 1.36; } }
.lede strong { font-weight: 600; }

.block { padding-top: 80px; }
@media (min-width: 768px) { .block { padding-top: 104px; } }
.intro + .block { padding-top: 64px; }
@media (min-width: 768px) { .intro + .block { padding-top: 96px; } }

.label {
  margin: 0 0 20px;
  font-size: 14px; font-weight: 600; line-height: 1;
  font-stretch: 87.5%;
  text-transform: uppercase; letter-spacing: .03em;
}
@media (min-width: 768px) { .label { font-size: 21px; margin-bottom: 28px; } }

.prose .lede + .lede { margin-top: 22px; }
@media (min-width: 768px) { .prose .lede + .lede { margin-top: 30px; } }

.chip {
  display: inline;
  padding: .065em .4em .075em .32em; margin: 0 .04em;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--chip-line);
  font-weight: 500; white-space: nowrap;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.ico {
  display: inline-grid; place-items: center;
  width: 1em; height: 1em; margin-right: .3em; vertical-align: .02em;
  border-radius: .22em; background: var(--fg); color: var(--bg);
}
.ico svg { width: .66em; height: .66em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.ed {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: .2em;
  text-decoration-color: var(--fg-2);
  transition: text-decoration-color .15s;
}
.ed:hover { text-decoration-color: var(--fg); }

/* ───────── repo-style list ───────── */
.repo-list, .post-list { list-style: none; margin: 40px -16px 0; padding: 0; }
@media (min-width: 768px) { .repo-list, .post-list { margin: 52px -20px 0; } }
.repo {
  display: flex; align-items: center; gap: 0;
  height: 52px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 14px; text-transform: uppercase; letter-spacing: .03em;
  transition: background .12s;
}
@media (min-width: 768px) { .repo { height: 56px; padding: 0 20px; font-size: 19px; } }
.repo:hover { background: var(--hover); }
.repo:last-of-type { border-bottom: 0; }
.mono-ico {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 22px; height: 22px; margin-right: 14px; border-radius: 6px;
  background: var(--c, var(--fg-3)); color: var(--t, #fff);
  font-family: var(--sans); font-size: 12px; font-weight: 700; text-transform: none;
}
@media (min-width: 768px) { .mono-ico { width: 24px; height: 24px; margin-right: 16px; } }
.repo-org { color: var(--fg-2); white-space: nowrap; }
.repo-sep { color: var(--fg-2); margin: 0 .5em; }
.repo-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-meta { margin-left: auto; padding-left: 16px; color: var(--fg-2); font-size: .82em; white-space: nowrap; }
.repo[hidden] { display: none; }

.more {
  display: block; width: 100%; height: 52px; padding: 0 16px;
  border: 0; border-top: 1px solid var(--line); background: var(--hover);
  font-family: var(--mono); font-size: 14px; text-transform: uppercase; letter-spacing: .03em; text-align: left;
  cursor: pointer; transition: background .12s;
}
@media (min-width: 768px) { .more { height: 56px; padding: 0 20px; font-size: 19px; } }
.more:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }

/* ───────── tile grid (like the client-logo grid) ───────── */
.tile-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  margin: 40px -16px 0; border-top: 1px solid var(--line);
}
@media (min-width: 768px) { .tile-grid { grid-template-columns: repeat(4, 1fr); margin: 52px -20px 0; } }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  height: 120px; padding: 16px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 17px; font-weight: 600; letter-spacing: -.01em; text-align: center;
  transition: background .15s;
}
@media (min-width: 768px) { .tile { height: 160px; font-size: 22px; } }
.tile:hover { background: var(--hover); }
.tile svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 768px) { .tile svg { width: 44px; height: 44px; } }
.tile:nth-child(2n) { border-right: 0; }
@media (min-width: 768px) {
  .tile:nth-child(2n) { border-right: 1px solid var(--line); }
  .tile:nth-child(4n) { border-right: 0; }
}

.cta-link { display: block; margin-top: 40px; text-decoration: none; }
@media (min-width: 768px) { .cta-link { margin-top: 52px; } }
.cta-muted, .cta-strong { display: block; font-size: 22px; line-height: 1.3; }
@media (min-width: 768px) { .cta-muted, .cta-strong { font-size: 38px; } }
.cta-muted { color: var(--fg-2); }
.cta-strong { font-weight: 600; color: var(--fg-2); transition: color .2s; }
.cta-link:hover .cta-strong { color: var(--fg); }
.arrow { display: inline-block; font-weight: 400; transition: transform .25s; }
.cta-link:hover .arrow { transform: translateX(6px); }

/* ───────── posts ───────── */
.post {
  display: flex; align-items: center; gap: 0;
  min-height: 70px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 18px; transition: background .12s;
}
@media (min-width: 768px) { .post { padding: 16px 20px; font-size: 30px; } }
.post:hover { background: var(--hover); }
.post:last-child { border-bottom: 0; }
.post-title { flex: 1; min-width: 0; line-height: 1.3; text-wrap: pretty; }
.post-meta { padding-left: 16px; color: var(--fg-2); font-size: .8em; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) { .post-meta { font-size: 13px; } }
.post-meta.live::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%;
  background: var(--live); vertical-align: .15em;
}

/* ───────── thank-you footer game ───────── */
.thanks { padding: 120px 0 140px; }
@media (min-width: 768px) { .thanks { padding: 200px 0 220px; } }
.thanks-inner {
  --aw: clamp(14px, 2.2vw, 30px);   /* arrow width */
  --ag: clamp(8px, 2vw, 24px);      /* arrow gap */
  width: fit-content; max-width: 100%; margin: 0 auto;
}
.stage { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--ag); }
.reel-window {
  --rh: .78em;
  font-family: "Silkscreen", var(--mono); font-weight: 400;
  font-size: clamp(34px, 12.4vw, 116px); line-height: var(--rh);
  height: calc(var(--rh) * 5); overflow: hidden;
}
/* the reel is a drum: rows are placed in 3D around a horizontal axis */
.reel-window {
  position: relative;
  perspective: 20em;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
}
.reel { position: relative; height: 100%; transform-style: preserve-3d; }
.reel-row {
  position: absolute; left: 0; right: 0; top: calc(50% - var(--rh) / 2);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.reel-row.reel-sizer { position: static; height: 0; overflow: hidden; visibility: hidden; }
.reel-row {
  height: var(--rh); white-space: nowrap; letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 1.2px var(--fg);
}
@media (min-width: 768px) { .reel-row { -webkit-text-stroke-width: 1.6px; } }
.reel-row.solid { color: var(--fg); -webkit-text-stroke: 0; }
.thanks.won .reel-row.solid { animation: blink .14s steps(1) 6; }
@keyframes blink { 50% { opacity: 0; } }

/* pixel arrows built from a clipped square grid */
.pix-arrow {
  flex-shrink: 0; width: var(--aw); aspect-ratio: 3 / 5;
  background: var(--fg-3);
  clip-path: polygon(0 0, 33% 0, 33% 20%, 66% 20%, 66% 40%, 100% 40%, 100% 60%, 66% 60%, 66% 80%, 33% 80%, 33% 100%, 0 100%);
  transition: background .2s;
}
.pix-right { transform: scaleX(-1); }
.thanks.playing .pix-left { animation: nudge-l .5s steps(1) infinite; }
.thanks.playing .pix-right { animation: nudge-r .5s steps(1) infinite; }
.thanks.won .pix-arrow { background: var(--fg); }
@keyframes nudge-l { 50% { transform: translateX(5px); } }
@keyframes nudge-r { 50% { transform: scaleX(-1) translateX(5px); } }

.thanks-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 28px; padding: 0 calc(var(--aw) + var(--ag));
}
.play {
  display: grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--chip-line); background: transparent; cursor: pointer;
  transition: background .15s;
}
.play:hover { background: var(--hover); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play .i-stop, .thanks.playing .play .i-play { display: none; }
.thanks.playing .play .i-stop { display: block; }
.game-msg {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-2);
}
@media (min-width: 768px) { .game-msg { font-size: 15px; } }
.thanks.won .game-msg { color: var(--fg); }
.nice-day { margin-left: auto; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
@media (min-width: 768px) { .nice-day { font-size: 32px; } }

/* ───────── bottom fade + controls ───────── */
.fade {
  position: fixed; left: 0; right: 0; bottom: 0; height: 120px; z-index: 10; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.controls {
  position: fixed; right: 16px; bottom: 16px; z-index: 30;
  display: flex; flex-direction: column; padding: 6px 8px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.45);
}
.ctrl {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 6px; border: 0; background: transparent; cursor: pointer; text-align: left;
  font-size: 16px; color: var(--fg);
}
.ctrl svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ctrl-label { flex: 1; white-space: nowrap; }
.ctrl-div { height: 1px; margin: 0 4px; background: var(--line); }
.ctrl[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.switch {
  position: relative; width: 34px; height: 20px; flex-shrink: 0; margin-left: 12px;
  border-radius: 999px; background: var(--fg-3); transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); transition: transform .2s;
}
.ctrl[aria-pressed="true"] .switch { background: var(--fg); }
.ctrl[aria-pressed="true"] .switch::after { transform: translateX(14px); }
.bars { display: flex; align-items: flex-end; gap: 3px; width: 34px; height: 20px; justify-content: flex-end; margin-left: 12px; }
.bars i { display: block; width: 6px; border-radius: 1px; background: var(--fg-3); transition: background .2s; }
.bars i:nth-child(1) { height: 6px; }
.bars i:nth-child(2) { height: 12px; }
.bars i:nth-child(3) { height: 18px; }
.ctrl[data-speed="1"] .bars i:nth-child(-n+1),
.ctrl[data-speed="2"] .bars i:nth-child(-n+2),
.ctrl[data-speed="3"] .bars i { background: var(--fg); }

/* phones: icon-only pill */
@media (max-width: 767px) {
  .controls { flex-direction: row; padding: 4px; right: 12px; bottom: 12px; }
  .ctrl { width: auto; padding: 7px; }
  .ctrl-label, .switch, .ctrl-div { display: none; }
  .bars { width: auto; margin-left: 2px; height: 16px; }
  .bars i { width: 4px; }
  .bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 10px; } .bars i:nth-child(3) { height: 15px; }
  .ctrl[aria-pressed="false"] svg { opacity: .4; }
}

/* ───────── motion ───────── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
