:root {
  --c-bg: 10 10 11;
  --c-surface: 20 20 19;
  --c-line: 32 30 27;
  --c-accent: 196 154 108;
  --c-fg: 240 236 230;
  --c-muted: 122 117 112;
  --c-ink: 176 170 162;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: rgb(var(--c-bg));
  color: rgb(var(--c-fg));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

::selection {
  background: rgb(var(--c-accent));
  color: rgb(var(--c-bg));
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  transition: background 500ms ease, border-color 500ms ease, backdrop-filter 500ms ease;
  border-bottom: 1px solid transparent;
}

.site-nav.is-scrolled {
  background: rgb(var(--c-bg) / 0.82);
  border-bottom-color: rgb(var(--c-line) / 0.55);
  backdrop-filter: blur(18px);
}

.nav-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 0;
  color: rgb(var(--c-fg));
}

.brand-mark {
  width: 24px;
  height: 24px;
  color: rgb(var(--c-accent));
}

.brand-cursor {
  color: rgb(var(--c-accent));
  animation: blink 1.2s steps(2, start) infinite;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgb(var(--c-muted));
}

.nav-links a {
  transition: color 200ms ease;
}

.nav-links a:hover,
.brand:hover {
  color: rgb(var(--c-accent));
}

.brand:focus-visible,
.footer-loop-button:focus-visible,
.loop-game button:focus-visible {
  outline: 1px solid rgb(var(--c-accent));
  outline-offset: 4px;
}

.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: 112px 0 56px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(40px, 8vw, 96px);
  align-items: center;
}

.eyebrow,
.meta,
.post-kicker,
.series-count {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgb(var(--c-muted) / 0.76);
}

.eyebrow {
  margin-bottom: 26px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

h1,
h2,
h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 800px;
  font-size: clamp(4rem, 10vw, 8.25rem);
  line-height: 0.9;
}

.hero-copy {
  max-width: 560px;
  margin-top: 32px;
  color: rgb(var(--c-ink));
  font-size: clamp(1.05rem, 2vw, 1.24rem);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 44px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgb(var(--c-accent) / 0.42);
  color: rgb(var(--c-fg));
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: rgb(var(--c-accent) / 0.08);
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.button:hover {
  background: rgb(var(--c-accent) / 0.14);
  border-color: rgb(var(--c-accent) / 0.72);
  transform: translateY(-1px);
}

.text-link {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgb(var(--c-muted));
  transition: color 200ms ease;
}

.text-link:hover {
  color: rgb(var(--c-accent));
}

.feature-post {
  border-top: 1px solid rgb(var(--c-line) / 0.52);
  border-bottom: 1px solid rgb(var(--c-line) / 0.45);
  padding: 72px 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}

.post-art {
  overflow: hidden;
  border: 1px solid rgb(var(--c-line) / 0.78);
  background: rgb(var(--c-surface));
}

.post-art img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.diagram-art img,
.post-cover img,
.article-figure img {
  object-fit: contain;
  background: #eee6d8;
}

.post-kicker {
  color: rgb(var(--c-accent));
  margin-bottom: 18px;
}

.feature-post h2,
.series-header h1,
.post-hero h1 {
  font-size: clamp(2.7rem, 6vw, 5.5rem);
  line-height: 0.96;
}

.feature-post p,
.series-intro,
.post-dek {
  margin-top: 22px;
  color: rgb(var(--c-ink));
  font-size: 1.06rem;
  line-height: 1.75;
}

.series-section {
  padding: 84px 0 96px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.section-heading h2 {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1;
}

.series-list {
  border-top: 1px solid rgb(var(--c-line) / 0.58);
}

.series-item {
  min-height: 82px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid rgb(var(--c-line) / 0.48);
  color: rgb(var(--c-muted));
}

.series-item.is-live {
  color: rgb(var(--c-fg));
}

.series-item:hover .series-title {
  color: rgb(var(--c-accent));
}

.series-index,
.series-state {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.series-title {
  font-size: clamp(1.12rem, 2vw, 1.38rem);
  transition: color 200ms ease;
}

.series-state {
  color: rgb(var(--c-muted) / 0.72);
}

.site-footer {
  border-top: 1px solid rgb(var(--c-line) / 0.42);
}

.footer-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: rgb(var(--c-muted) / 0.82);
  font-size: 13px;
}

.footer-loop-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  color: rgb(var(--c-muted) / 0.82);
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: color 200ms ease;
}

.footer-loop-button span {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.footer-loop-button:hover {
  color: rgb(var(--c-accent));
}

.loop-game {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.loop-game.is-open {
  opacity: 1;
  pointer-events: auto;
}

.loop-game-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.72);
  backdrop-filter: blur(10px);
}

.loop-game-panel {
  position: relative;
  width: min(100%, 720px);
  border: 1px solid rgb(var(--c-line) / 0.82);
  background: rgb(var(--c-bg));
  box-shadow: 0 24px 90px rgb(0 0 0 / 0.45);
}

.loop-game-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 0;
}

.loop-game-kicker,
.loop-game-hud,
.loop-game-footer {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.loop-game-kicker {
  margin-bottom: 8px;
  color: rgb(var(--c-accent));
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.loop-game h2 {
  font-size: clamp(2.1rem, 8vw, 4rem);
  line-height: 0.95;
}

.loop-game-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgb(var(--c-line) / 0.7);
  color: rgb(var(--c-muted));
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.loop-game-close:hover {
  color: rgb(var(--c-accent));
  border-color: rgb(var(--c-accent) / 0.7);
}

.loop-game-shell {
  position: relative;
  margin: 22px 24px 0;
  border: 1px solid rgb(var(--c-line) / 0.82);
  background: rgb(var(--c-surface));
}

.loop-canvas {
  display: block;
  width: 100%;
  height: clamp(260px, 56vh, 440px);
  touch-action: none;
}

.loop-game-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgb(var(--c-fg));
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  pointer-events: none;
}

.loop-game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px 24px;
}

.loop-game-footer p {
  max-width: 480px;
  color: rgb(var(--c-muted));
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.loop-game button {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.loop-restart {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgb(var(--c-accent) / 0.46);
  padding: 0 14px;
  color: rgb(var(--c-fg));
  background: rgb(var(--c-accent) / 0.08);
  cursor: pointer;
  font-size: 12px;
}

.loop-restart:hover {
  border-color: rgb(var(--c-accent));
}

.post-hero {
  padding: 136px 0 48px;
}

.post-hero-inner {
  max-width: 840px;
}

.post-dek {
  max-width: 680px;
}

.post-cover {
  margin-top: 46px;
  border: 1px solid rgb(var(--c-line) / 0.72);
  background: rgb(var(--c-surface));
}

.post-cover img {
  width: 100%;
  aspect-ratio: 16 / 8;
}

.article-figure {
  margin: 34px 0;
  border: 1px solid rgb(var(--c-line) / 0.72);
  background: #eee6d8;
}

.article-figure img {
  width: 100%;
  aspect-ratio: 16 / 8;
}

.article-wrap {
  border-top: 1px solid rgb(var(--c-line) / 0.42);
}

.article {
  max-width: 760px;
  padding: 64px 0 92px;
}

.article p,
.article li {
  color: rgb(var(--c-ink));
  font-size: 1.06rem;
  line-height: 1.85;
}

.article p + p,
.article p + ul,
.article p + ol,
.article pre + p,
.article ul + p {
  margin-top: 22px;
}

.article h2 {
  margin-top: 54px;
  margin-bottom: 18px;
  font-size: 2.2rem;
}

.article ul,
.article ol {
  padding-left: 22px;
}

.article li + li {
  margin-top: 8px;
}

.article strong {
  color: rgb(var(--c-fg));
  font-weight: 600;
}

.article code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  color: rgb(var(--c-accent));
}

pre {
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid rgb(var(--c-line) / 0.78);
  background: rgb(var(--c-surface) / 0.82);
}

pre code {
  display: block;
  min-width: max-content;
  padding: 20px;
  color: rgb(var(--c-fg));
  font-size: 13px;
  line-height: 1.75;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid rgb(var(--c-line) / 0.52);
}

@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 860px) {
  .hero-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 128px;
  }

  .hero-visual {
    max-width: 620px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .nav-inner {
    height: 64px;
  }

  .brand span:first-of-type {
    display: none;
  }

  .brand .brand-cursor {
    display: none;
  }

  .nav-links {
    gap: 12px;
    font-size: 11px;
  }

  .hero h1,
  .post-hero h1,
  .series-header h1 {
    font-size: clamp(3.2rem, 18vw, 5.6rem);
  }

  .series-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .series-state {
    display: none;
  }

  .footer-inner,
  .article-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .loop-game-footer,
  .loop-game-hud {
    flex-direction: column;
    align-items: flex-start;
  }
}
