:root {
  --bg: #050505;
  --bg-2: #0d0d0d;
  --line: #1f1f1f;
  --text: #d8d8d8;
  --dim: #7a7a7a;
  --acid: #c6ff00;
  --red: #ff2a3d;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --head: 'Chakra Petch', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 var(--mono);
  overflow-x: hidden;
}
::selection { background: var(--acid); color: #000; }
a { color: var(--acid); }
code { font-family: var(--mono); color: var(--acid); }

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(5,5,5,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 20px var(--head); color: #fff; text-decoration: none; letter-spacing: .08em; }
.brand span { color: var(--red); }
.nav nav { display: flex; gap: 22px; align-items: center; }
.nav nav a { color: var(--dim); text-decoration: none; font-size: 13px; text-transform: lowercase; }
.nav nav a:hover { color: #fff; }
.nav .nav-cta { color: #000; background: var(--acid); padding: 6px 12px; font-weight: 700; }
.nav .nav-cta:hover { color: #000; background: #fff; }

/* hero */
.hero {
  position: relative;
  min-height: calc(100vh - 60px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 80px clamp(16px, 6vw, 96px) 60px;
  overflow: hidden;
}
.hero-grid {
  position: absolute; inset: -50% -10% 0; z-index: -1;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 60px 60px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 60px 60px;
  transform: perspective(600px) rotateX(55deg);
  transform-origin: center bottom;
  mask-image: linear-gradient(to top, #000 10%, transparent 70%);
  animation: grid 6s linear infinite;
}
@keyframes grid { to { background-position: 0 60px, 0 0; } }

.kicker { color: var(--dim); font-size: 13px; text-transform: uppercase; letter-spacing: .15em; margin: 0 0 18px; }
.kicker b { color: var(--red); font-weight: 700; }
.blink { color: var(--red); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

h1, h2, h3 { font-family: var(--head); margin: 0; color: #fff; }

.glitch {
  position: relative;
  font-size: clamp(44px, 10vw, 136px);
  line-height: .92;
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  overflow: hidden;
}
.glitch::before { color: var(--red); transform: translate(-3px, 0); clip-path: inset(0 0 60% 0); animation: g1 3.2s infinite steps(1); mix-blend-mode: screen; }
.glitch::after  { color: var(--acid); transform: translate(3px, 0); clip-path: inset(55% 0 0 0); animation: g2 2.7s infinite steps(1); mix-blend-mode: screen; }
@keyframes g1 {
  0%, 88%, 100% { clip-path: inset(0 0 100% 0); }
  90% { clip-path: inset(10% 0 60% 0); transform: translate(-6px, 2px); }
  94% { clip-path: inset(40% 0 30% 0); transform: translate(5px, -1px); }
  97% { clip-path: inset(70% 0 5% 0);  transform: translate(-3px, 0); }
}
@keyframes g2 {
  0%, 84%, 100% { clip-path: inset(100% 0 0 0); }
  86% { clip-path: inset(50% 0 20% 0); transform: translate(6px, -2px); }
  91% { clip-path: inset(15% 0 70% 0); transform: translate(-4px, 1px); }
  95% { clip-path: inset(80% 0 2% 0);  transform: translate(3px, 0); }
}

.tagline { font: 700 clamp(22px, 3.2vw, 38px)/1.15 var(--head); color: #fff; margin: 28px 0 12px; text-transform: uppercase; }
.tagline em { font-style: normal; color: var(--acid); }
.sub { max-width: 620px; color: var(--dim); margin: 0 0 34px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* buttons */
.btn {
  display: inline-flex; flex-direction: column; justify-content: center;
  padding: 14px 22px;
  text-decoration: none;
  border: 1px solid var(--acid);
  font-family: var(--head);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: transform .12s, background .12s, color .12s;
}
.btn:hover { transform: translate(-2px, -2px); }
.btn:active { transform: translate(1px, 1px); }
.btn-label { font-weight: 700; font-size: 17px; letter-spacing: .06em; }
.btn-meta { font: 12px var(--mono); opacity: .75; }
.btn-primary { background: var(--acid); color: #000; box-shadow: 0 0 40px rgba(198,255,0,.25); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { color: var(--acid); background: transparent; }
.btn-ghost:hover { background: rgba(198,255,0,.08); }
.btn-disabled { border-color: var(--dim); color: var(--dim); }
.btn-wide { width: 100%; align-items: center; margin-top: 22px; }
.btn-wide .btn-label { font-size: clamp(13px, 2.4vw, 17px); word-break: break-all; text-align: center; }

.console {
  margin: 48px 0 0; padding: 14px 16px;
  max-width: 560px; min-height: 132px;
  background: rgba(13,13,13,.8);
  border: 1px solid var(--line);
  border-left: 2px solid var(--acid);
  font-size: 12.5px; color: var(--dim);
  white-space: pre-wrap;
}
.console .ok { color: var(--acid); }
.console .bad { color: var(--red); }

/* sections */
.section { padding: 100px clamp(16px, 6vw, 96px); border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(30px, 5vw, 56px); text-transform: uppercase; margin-bottom: 40px; }
.idx { color: var(--red); font-size: .45em; vertical-align: super; margin-right: 10px; font-family: var(--mono); }
.big { font: 700 clamp(22px, 3vw, 34px)/1.25 var(--head); color: #fff; }
mark { background: var(--red); color: #000; padding: 0 6px; }

.premise { padding-top: 0; overflow: hidden; }
.tape {
  display: flex; width: max-content;
  margin: 0 calc(-1 * clamp(16px, 6vw, 96px)) 80px;
  background: var(--red); color: #000;
  font: 700 14px var(--head); letter-spacing: .2em;
  transform: rotate(-1.5deg) translateY(14px);
  animation: tape 30s linear infinite;
}
.tape span { padding: 8px 0; white-space: nowrap; }
@keyframes tape { to { transform: rotate(-1.5deg) translate(-50%, 14px); } }
.premise-body { max-width: 820px; }
.premise-body p:not(.big) { color: var(--dim); }

/* cards */
/* 3 / 2 / 1 columns: 6 cards always fill every row, so no empty cell shows the grid background */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.card { position: relative; background: var(--bg); padding: 30px 26px 34px; transition: background .2s; }
.card:hover { background: var(--bg-2); }
.card::after { content: ''; position: absolute; left: 0; top: 0; height: 2px; width: 0; background: var(--acid); transition: width .3s; }
.card:hover::after { width: 100%; }
.card-n { color: var(--red); font-size: 12px; }
.card h3 { font-size: 24px; margin: 8px 0 10px; letter-spacing: .04em; }
.card p { margin: 0; color: var(--dim); font-size: 14px; }

/* modes */
.modes { list-style: none; margin: 0; padding: 0; }
.modes li { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 24px; padding: 20px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.modes strong { font: 700 22px var(--head); color: #fff; }
.modes li:hover strong { color: var(--acid); }
.modes span { color: var(--dim); }

/* patch */
.patch { border-left: 2px solid var(--line); padding-left: 24px; max-width: 860px; }
.patch-row { padding: 10px 0; }
.patch-tag { color: var(--acid); font-weight: 700; }
.patch-row p { margin: 2px 0 0; color: var(--dim); }

/* download */
.download { background: radial-gradient(ellipse at top, rgba(198,255,0,.06), transparent 60%); }
.dl-box { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.dl-main, .dl-steps { background: var(--bg); padding: clamp(22px, 4vw, 40px); margin: 0; }
.dl-label { margin: 0; color: var(--red); letter-spacing: .2em; font-size: 12px; }
.dl-version { margin: 4px 0 18px; font: 700 clamp(48px, 8vw, 88px)/1 var(--head); color: var(--acid); text-shadow: 0 0 30px rgba(198,255,0,.35); }
.dl-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.dl-meta dt { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.dl-meta dd { margin: 0; color: #fff; }
.dl-notes { color: var(--dim); margin: 18px 0 0; }
.hash { margin: 14px 0 0; font-size: 11px; color: var(--dim); word-break: break-all; }
.hash code { color: var(--dim); }
.dl-steps { counter-reset: s; list-style: none; }
.dl-steps li { counter-increment: s; position: relative; padding: 0 0 18px 40px; color: var(--dim); }
.dl-steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; color: var(--red); font-weight: 700; }
.dl-steps b { color: #fff; }
.dl-steps .warn { font-size: 12.5px; border-top: 1px dashed var(--line); padding-top: 16px; }
.dl-steps .warn::before { content: '!!'; top: 16px; }

.older { margin-top: 28px; color: var(--dim); }
.older summary { cursor: pointer; }
.older ul { list-style: none; padding: 0; }
.older li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.older li span { font-size: 12px; margin-left: 10px; }

.nav nav a.active { color: var(--acid); }

/* docs */
.docs { padding: 56px clamp(16px, 6vw, 96px) 100px; }
.docs-head h1 { font-size: clamp(38px, 7vw, 84px); line-height: .95; }
.docs-head h1 span { color: var(--acid); }
.doc-tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 34px 0 48px; border-bottom: 1px solid var(--line); }
.doc-tabs a {
  padding: 12px 20px; margin-bottom: -1px;
  color: var(--dim); text-decoration: none;
  font: 700 15px var(--head); letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid transparent; border-bottom: 2px solid transparent;
}
.doc-tabs a:hover { color: #fff; }
.doc-tabs a.active { color: var(--acid); border-color: var(--line); border-bottom: 2px solid var(--acid); background: var(--bg-2); }

.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; align-items: start; }
.toc { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 13px; }
.toc summary { color: var(--red); text-transform: uppercase; letter-spacing: .15em; font-size: 11px; cursor: pointer; margin-bottom: 10px; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 4px 0 4px 14px; color: var(--dim); text-decoration: none; border-left: 2px solid transparent; margin-left: -1px; }
.toc li.lvl3 a { padding-left: 28px; font-size: 12px; }
.toc li a:hover, .toc li a.current { color: var(--acid); border-left-color: var(--acid); }

.prose { max-width: 860px; }
.doc-title { margin: 0 0 8px; color: var(--red); font-size: 12px; text-transform: uppercase; letter-spacing: .15em; }
.prose h2 { font-size: clamp(24px, 3.4vw, 34px); text-transform: uppercase; margin: 56px 0 16px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.prose h2:first-of-type { margin-top: 12px; }
.prose h3 { font-size: 21px; margin: 36px 0 12px; color: var(--acid); scroll-margin-top: 80px; }
.prose h4 { font-size: 17px; margin: 28px 0 8px; scroll-margin-top: 80px; }
.anchor { color: var(--red); text-decoration: none; margin-right: 10px; opacity: .5; font-family: var(--mono); font-size: .7em; }
.anchor:hover { opacity: 1; }
.prose p, .prose li { color: #b4b4b4; }
.prose strong { color: #fff; }
.prose em { color: #e6e6e6; }
.prose del { color: var(--dim); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose ul li::marker { color: var(--acid); content: '› '; }
.prose ol li::marker { color: var(--red); font-weight: 700; }
.prose :not(pre) > code { background: #121212; border: 1px solid var(--line); padding: 1px 5px; font-size: .9em; }
.prose pre {
  position: relative; margin: 18px 0;
  padding: 18px 18px 16px; overflow-x: auto;
  background: #0a0a0a; border: 1px solid var(--line); border-left: 2px solid var(--acid);
  font-size: 13px; line-height: 1.55;
}
.prose pre code { color: #e0e0e0; }
.prose pre[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 0; right: 0;
  padding: 2px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: #000; background: var(--acid);
}
.prose blockquote { margin: 18px 0; padding: 10px 16px; border-left: 2px solid var(--red); background: var(--bg-2); color: var(--dim); }
.table-wrap { overflow-x: auto; margin: 18px 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.prose th, .prose td { text-align: left; padding: 9px 14px; border: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--acid); background: var(--bg-2); font-weight: 700; }
.prose td { color: #b4b4b4; }

@media (max-width: 960px) {
  .docs-layout { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); padding: 12px 14px; }
  .toc summary { margin: 0; }
  .toc details[open] summary { margin-bottom: 10px; }
}

/* footer */
.foot { padding: 40px clamp(16px, 6vw, 96px); border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.foot p { margin: 0 0 4px; }
.foot .fine { opacity: .6; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .cards { grid-template-columns: 1fr; }
  .nav nav a:not(.nav-cta):not(.nav-docs) { display: none; }
  .nav nav { gap: 16px; }
  .modes li { grid-template-columns: 1fr; gap: 4px; }
  .dl-box { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 60px; }
}

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