@font-face { font-family: "Figtree"; src: url(../assets/fonts/figtree-var.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(../assets/fonts/plexmono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #0b0c0a;
  --panel: #121410;
  --line: #262a22;
  --ink: #dfe4d2;      /* phosphor cream from the hero video */
  --dim: #8d937f;
  --accent: #c3d37a;
  --sans: "Figtree", system-ui, "Segoe UI", sans-serif;
  --mono: "Plex Mono", ui-monospace, Consolas, monospace;
  --gut: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.65 var(--sans); -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none; }
img { -webkit-user-drag: none; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
code { font: 0.88em var(--mono); background: var(--panel); border: 1px solid var(--line); padding: 0 .3em; border-radius: 3px; overflow-wrap: anywhere; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.015em; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 6px 10px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.top { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 16px var(--gut); font: 500 .875rem var(--sans); background: color-mix(in srgb, var(--bg) 96%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.top nav { display: flex; gap: clamp(14px, 3vw, 28px); }
.top a { text-decoration: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.hotbar { display: flex; gap: 4px; padding: 4px; background: color-mix(in srgb, var(--bg) 80%, transparent); border: 1px solid var(--line); border-radius: 6px; }
.mods-slots { display: flex; gap: 4px; }
.slot { position: relative; width: 36px; height: 36px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--dim); font: 500 .875rem var(--sans); transition: border-color .15s, color .15s; }
.slot img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.slot:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.slot[aria-current="page"] { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.slot::after { content: attr(data-name); position: absolute; top: calc(100% + 8px); left: 0; padding: 2px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; font: 400 .75rem var(--sans); color: var(--ink); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.slot:hover::after, .slot:focus-visible::after { opacity: 1; }

/* ---------- hero ---------- */
/* phones get an animated WebP: iOS Safari (low power mode) refuses to autoplay background video */
.hero-narrow { display: none; }
@media (max-width: 800px) { .hero-wide { display: none; } .hero-narrow { display: contents; } }
.hero { position: relative; min-height: max(600px, 100svh); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero-video { position: absolute; inset: 0 0 0 auto; width: 100%; height: 100%; object-fit: cover; object-position: 90% 50%; z-index: -2; }
.hero-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 38%, transparent 70%), linear-gradient(0deg, var(--bg) 0%, transparent 35%); }
.hero-text { padding: 0 var(--gut) clamp(40px, 9vh, 96px); max-width: 760px; }
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.25rem); letter-spacing: -0.02em; text-wrap: balance; }
.lede { color: color-mix(in srgb, var(--ink) 82%, var(--bg)); font-size: 1.125rem; max-width: 56ch; margin: 20px 0 0; }
.counters { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 40px; margin: 36px 0 0; justify-content: start; }
.counters div { display: flex; flex-direction: column-reverse; }
.counters dt { font: .8125rem var(--sans); color: var(--dim); }
.counters dd { margin: 0; font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 500; font-variant-numeric: tabular-nums; min-width: 6ch; }
.note { color: var(--dim); font-size: .8125rem; margin-top: 20px; }

/* ---------- home blocks ---------- */
.block { padding: clamp(56px, 9vw, 110px) var(--gut) 0; max-width: 1180px; margin: 0 auto; }
.kicker { font-size: 1.5rem; font-weight: 600; color: var(--ink); margin-bottom: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 56px 1fr 96px; gap: 20px; align-items: center; padding: 16px 12px; border-bottom: 1px solid var(--line); text-decoration: none; border-left: 2px solid transparent; transition: background-color .2s, border-color .2s; }
.row:hover, .row:focus-visible { background: color-mix(in srgb, var(--accent) 7%, transparent); border-left-color: var(--accent); color: inherit; }
.row-logo img, .glyph { width: 56px; height: 56px; object-fit: contain; display: grid; place-items: center; }
.glyph { font: 500 1.5rem var(--sans); color: var(--accent); border: 1px solid var(--line); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-name { font-size: 1.3rem; font-weight: 600; }
.row:hover .row-name { color: var(--accent); }
.row-tag { color: var(--dim); font-size: .98rem; }
.row-num { text-align: right; display: flex; flex-direction: column; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.row-num small { font-size: .72rem; color: var(--dim); }

.chip code { -webkit-user-select: all; user-select: all; white-space: nowrap; }

.foot { max-width: 1180px; margin: 80px auto 0; padding: 28px var(--gut) 40px; border-top: 1px solid var(--line); font-size: .95rem; }
.foot p { margin: 4px 0; }
.foot .mono { font-size: .75rem; }

/* ---------- wiki ---------- */
.wiki { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); max-width: 1180px; margin: 0 auto; padding: 96px var(--gut) 0; }
.side { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font: .875rem/1.5 var(--sans); }
.side p { margin: 0 0 6px; font-size: .75rem; }
.side ol, .side ul { list-style: none; margin: 0 0 28px; padding: 0; }
.side li a { display: block; padding: 3px 0 3px 12px; border-left: 1px solid var(--line); text-decoration: none; color: var(--dim); }
.side li a:hover { color: var(--ink); border-left-color: var(--accent); }
.side a[aria-current="page"] { color: var(--accent); border-left: 2px solid var(--accent); }

.page { max-width: 780px; }
.phead { display: flex; gap: 24px; align-items: flex-start; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.plogo { width: 96px; height: 96px; object-fit: contain; flex: none; }
.crumbs { font-size: .8125rem; color: var(--dim); margin: 0 0 6px; }
.crumbs a { color: var(--dim); }
.phead h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); color: var(--accent); }
.phead .lede { margin-top: 10px; }
.pmeta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8125rem; color: var(--dim); margin: 16px 0 0; }
.pmeta b { color: var(--ink); font-weight: 500; }
.btn { display: inline-block; margin-top: 8px; padding: 8px 16px; font: 500 .875rem var(--sans); text-decoration: none; color: var(--bg); background: var(--accent); border-radius: 3px; }
.btn:hover { color: var(--bg); filter: brightness(1.1); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; padding: 28px 0 8px; }
.facts { margin: 0; font-size: .8125rem; border: 1px solid var(--line); background: var(--panel); padding: 16px; align-self: start; }
.facts div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.facts div:last-child { border: 0; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; }

.wsec { padding-top: 40px; }
.wsec h2 { font-size: 1.6rem; margin-bottom: 16px; display: flex; gap: 12px; align-items: baseline; }
.wsec h2::before { content: "§"; font: 400 1rem var(--sans); color: var(--accent); }
.wsec p { margin: 0 0 16px; max-width: 68ch; }
figure { margin: 20px 0; }
figure img { border: 1px solid var(--line); display: block; }
figcaption { font: .8125rem var(--sans); color: var(--dim); margin-top: 8px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 44px; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: .1em; font: 500 .8125rem var(--sans); color: var(--bg); background: var(--accent); padding: 1px 5px; border-radius: 2px; }
.list { padding-left: 1.2em; }
.list li { margin-bottom: 6px; }
.list li::marker { color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 20px 0; }
.card { background: var(--panel); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.card header { display: flex; gap: 12px; align-items: center; }
.card h3 { font-size: 1.1rem; }
.card p { font-size: .95rem; margin: 0; }
.icon { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; flex: none; background: var(--bg); border: 1px solid var(--line); padding: 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: auto 0 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .75rem; }
.stats dt { color: var(--dim); }
.stats dd { margin: 0; color: var(--ink); }

.tablewrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 .75rem var(--sans); color: var(--dim); background: var(--panel); }
tr:last-child td { border-bottom: 0; }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
summary { font-weight: 600; list-style: none; display: flex; gap: 10px; }
summary::-webkit-details-marker { display: none; }
summary { justify-content: space-between; cursor: pointer; }
.chev { flex: none; color: var(--accent); transition: rotate .2s; }
details[open] .chev { rotate: 180deg; }
details p { margin: 10px 0 0 calc(1ch + 10px); }

/* ---------- tech text (vue-bits Tech Text): a hovered letter turns into a dashed outline with its size ---------- */
.tech .ch { display: inline-block; position: relative; transition: color .2s, -webkit-text-stroke-color .2s; }
.tech .ch:hover { color: transparent; -webkit-text-stroke: 1px var(--ink); outline: 1px dashed color-mix(in srgb, var(--ink) 45%, transparent); outline-offset: 2px; }
.tech .ch:hover::after { content: attr(data-dim); position: absolute; left: 0; bottom: 100%; margin-bottom: 6px; padding: 0 4px; background: var(--bg); font: 400 .6875rem var(--sans); color: var(--dim); white-space: nowrap; -webkit-text-stroke: 0; z-index: 1; }
.tech .ch:hover::before { content: ""; position: absolute; left: -4px; bottom: -4px; width: 5px; height: 5px; border: 1px solid var(--ink); background: var(--bg); }

/* ---------- branched toc (vue-bits Branched Menu): trunk line, rounded branches, active branch lit by scroll spy ---------- */
.toc ol { position: relative; margin-left: 4px; padding-left: 0; }
.toc ol::before { content: ""; position: absolute; left: 0; top: 0; bottom: 12px; width: 1px; background: var(--line); }
.toc li { position: relative; }
.toc li a { border-left: 0; padding: 4px 0 4px 24px; transition: color .2s; }
.toc li::before { content: ""; position: absolute; left: 0; top: 0; width: 14px; height: 16px; border-left: 1px solid transparent; border-bottom: 1px solid var(--line); border-bottom-left-radius: 8px; transition: border-color .2s; }
.toc li.on::before { border-color: var(--accent); }
.toc li.on a { color: var(--ink); }

/* ---------- copy chip (vue-bits Call Chip) ---------- */
.chip { display: inline-flex; align-items: center; gap: 8px; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: copy; }
.chip code { transition: border-color .2s; }
.chip:hover code { border-color: var(--accent); }
.chip-state { font-size: .75rem; color: var(--dim); min-width: 6ch; text-align: left; }
.chip.done .chip-state { color: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  html { scroll-padding-top: 136px; }
  /* the hotbar is the mod switcher on touch screens: it scrolls sideways instead of hiding */
  .top { gap: 12px; }
  .hotbar { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .hotbar::-webkit-scrollbar { display: none; }
  .slot { flex: none; }
  .slot::after { display: none; }
  .top nav[aria-label="Main"] { flex: none; }
  .wiki { grid-template-columns: minmax(0, 1fr); padding-top: 78px; gap: 0; }
  /* "on this page" becomes a sticky row of chips under the top bar; the mod list is in the hotbar */
  .side { min-width: 0; position: sticky; top: 78px; z-index: 15; max-height: none; overflow: visible; margin: 0 calc(var(--gut) * -1); padding: 8px var(--gut); background: color-mix(in srgb, var(--bg) 96%, transparent); border-bottom: 1px solid var(--line); }
  .side nav[aria-label="All mods"], .toc p { display: none; }
  .toc ol { display: flex; gap: 8px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc ol::before, .toc li::before { display: none; }
  .toc li a { white-space: nowrap; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
  .toc li.on a { border-color: var(--accent); color: var(--ink); }
  .page { padding-top: 24px; }
  .intro { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero-shade { background: linear-gradient(0deg, var(--bg) 40%, transparent 64%); }
  .hero-video { height: 62%; object-position: 50% 50%; } /* phones: the portal sits above the headline, not under it */
  .counters { grid-template-columns: 1fr 1fr; gap: 16px 24px; }
  .row { grid-template-columns: 44px 1fr 64px; gap: 12px; padding: 14px 4px; }
  .row-logo img, .glyph { width: 44px; height: 44px; }
  .phead { flex-direction: column; }
  .plogo { width: 72px; height: 72px; }
  .tablewrap table { min-width: 600px; }
  .top nav[aria-label="Main"] a:not(:last-child) { display: none; } /* home slot covers Mods */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .row, .card { transition: none; }
}
@media (min-width: 1100px) { .hero-video { width: 58%; } .hero-shade { background: linear-gradient(90deg, var(--bg) 42%, transparent 62%), linear-gradient(0deg, var(--bg) 0%, transparent 30%); } .hero-text { max-width: 700px; } }
.notfound { min-height: 60vh; padding-top: 160px; }
.notfound h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 16px; }

/* ---------- split-flap counters ---------- */
.flap { display: inline-block; min-width: .68em; text-align: center; padding: 0 .04em; margin-right: 2px; background: linear-gradient(var(--panel) 50%, color-mix(in srgb, var(--panel) 70%, #000) 50%); border-radius: 3px; position: relative; }
.flap::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--bg); }
.flap.sep { background: none; min-width: 0; margin-right: 0; }
.flap.sep::after { display: none; }
.flap.tick { animation: flap .11s ease-out; }
@keyframes flap { from { transform: perspective(200px) rotateX(70deg); } to { transform: none; } }

/* ---------- decrypting headline ---------- */
.tech .ch.dec { text-align: center; color: var(--accent); }

/* ---------- dock hotbar ---------- */
.slot { width: calc(36px * var(--dock, 1)); height: calc(36px * var(--dock, 1)); transition: width .12s ease-out, height .12s ease-out, border-color .15s, color .15s; }
.slot img { width: 72%; height: 72%; }
.hotbar { align-items: flex-start; }

/* ---------- tilted cards with glare ---------- */
.card { position: relative; overflow: hidden; transition: border-color .2s, transform .15s ease-out; will-change: transform; }
.card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%); opacity: 0; transition: opacity .2s; }
.card:hover::after { opacity: 1; }

/* ---------- star border on the download button ---------- */
.btn { position: relative; overflow: hidden; padding: 2px; background: color-mix(in srgb, var(--accent) 35%, var(--bg)); border-radius: 5px; }
.btn > span { position: relative; z-index: 1; display: block; padding: 8px 16px; background: var(--accent); border-radius: 3px; }
.btn::before, .btn::after { content: ""; position: absolute; width: 300%; height: 50%; border-radius: 50%; background: radial-gradient(circle, #fff, transparent 12%); opacity: .8; }
.btn::before { bottom: -12px; right: -250%; animation: star-bottom 5s linear infinite alternate; }
.btn::after { top: -12px; left: -250%; animation: star-top 5s linear infinite alternate; }
@keyframes star-bottom { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-100%); opacity: 0; } }
@keyframes star-top { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ---------- click sparks + scroll reveal ---------- */
.sparks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }
.rv { opacity: 0; translate: 0 16px; transition: opacity .55s ease-out, translate .55s ease-out; }
.rv.in { opacity: 1; translate: 0 0; }
.card.rv { transition: opacity .55s ease-out, translate .55s ease-out, border-color .2s, transform .15s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .btn::before, .btn::after { animation: none; }
  .slot { transition: none; }
}

/* ---------- looping ASCII scenes (swamp strip; the portal loop is the hero) ---------- */
.scene { position: relative; aspect-ratio: 4 / 1; margin-top: clamp(56px, 9vw, 110px); overflow: hidden; background: var(--bg); }
.scene video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; -webkit-mask-image: linear-gradient(transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(transparent, #000 8%, #000 92%, transparent); }
.cta { position: relative; margin-top: clamp(56px, 9vw, 110px); }
.cta-text { display: flex; flex-direction: column; align-items: flex-start; padding: 0 var(--gut); }
.cta-text h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
.cta-text p { margin: 12px 0 20px; max-width: 36ch; color: color-mix(in srgb, var(--ink) 82%, var(--bg)); }
@media (max-width: 800px) {
  .scene { aspect-ratio: 16 / 9; }
}

/* ---------- Lucide icons ---------- */
.ico { flex: none; vertical-align: -3px; }
.btn > span { display: inline-flex; align-items: center; gap: 8px; }
.chip .ico { color: var(--dim); }
.chip:hover .ico { color: var(--accent); }

/* ---------- touch targets >= 44px on touch screens (UI UX Pro Max checklist) ---------- */
@media (pointer: coarse) {
  .slot { width: 44px; height: 44px; }
  .chip, summary { min-height: 44px; align-items: center; }
  .btn > span { padding: 12px 18px; }
  .top nav[aria-label="Main"] a { display: inline-flex; align-items: center; min-height: 44px; }
  .toc li a { padding-block: 11px; }
}
