/* Matrix Workshop — site styles
   Palette comes from the mods themselves: the page is the Wastelands storm sky (#1a1a1a / #242424),
   the hero is the code (pure black + phosphor), buttons use the roadmap's teal→lime,
   and machine red marks crashes. */

:root {
  --code-black: #000000;
  --sky: #1a1a1a;          /* wastelands sky_color */
  --fog: #242424;          /* wastelands fog_color */
  --raised: #2c302d;
  --line: #3a413c;
  --bone: #e8ece9;
  --dust: #a6afa9;
  --phosphor: #39ff7a;
  --teal: #0fa3a3;
  --lime: #8be05a;
  --amber: #ffb020;
  --machine-red: #ff4d4d;

  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --wrap: 1160px;
  --gutter: 16px;
  --radius-s: 6px;
  --radius-m: 12px;
}
@media (min-width: 760px) { :root { --gutter: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--bone);
  font: 400 17px/1.6 var(--font-body);
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--phosphor); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 3px; border-radius: 3px; }
code { font: 400 0.88em var(--font-code); background: var(--raised); padding: 0.1em 0.4em; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; color: #fff; }
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--phosphor); color: #000; padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--dust); }
.small { font-size: 0.88rem; }
.lede { font-size: 1.15rem; color: var(--dust); max-width: 62ch; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(8px); border-bottom: 1px solid #1d211e; }
.topbar__inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.logo { font: 700 1.15rem var(--font-display); color: var(--phosphor); text-decoration: none; letter-spacing: 0.04em; white-space: nowrap; }
.nav { display: none; gap: 20px; flex: 1; }
.nav a, .menu__panel a { color: var(--dust); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current] { color: #fff; }
.nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--phosphor); }
.topbar .btn--small { display: none; }
.menu { margin-left: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; color: var(--bone); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 12px; font-weight: 500; }
.menu summary::-webkit-details-marker { display: none; }
.menu__panel { position: absolute; right: 0; top: calc(100% + 10px); background: #000; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px; display: grid; min-width: 210px; }
.menu__panel a { padding: 10px 12px; border-radius: var(--radius-s); }
.menu__panel a:hover { background: var(--fog); color: #fff; }
@media (min-width: 900px) {
  .nav { display: flex; }
  .menu { display: none; }
  .topbar .btn--small { display: inline-flex; }
}

/* ── Buttons, pills, bars ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 10px 20px; font: 600 0.95rem var(--font-body); text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.btn--primary { background: linear-gradient(90deg, var(--teal), var(--lime)); color: #03140b; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { color: var(--phosphor); border-color: currentColor; background: transparent; }
.btn--ghost:hover { background: rgba(57, 255, 122, 0.08); }
.btn--big { padding: 13px 26px; font-size: 1.02rem; }
.btn--small { padding: 7px 15px; font-size: 0.88rem; }
.btn--disabled { background: var(--raised); color: var(--dust); cursor: default; filter: none; }

.pill { display: inline-block; vertical-align: middle; border-radius: 999px; padding: 2px 10px; font: 600 0.78rem var(--font-body); white-space: nowrap; }
.pill--ok { background: rgba(57, 255, 122, 0.14); color: var(--phosphor); }
.pill--warn { background: rgba(255, 176, 32, 0.15); color: var(--amber); }
.pill--bad { background: rgba(255, 77, 77, 0.16); color: #ff8a8a; }
.pill--mute { background: var(--raised); color: var(--dust); }

.bar { height: 8px; border-radius: 99px; background: #0d0f0e; overflow: hidden; margin: 10px 0 8px; border: 1px solid #262b28; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--lime)); }

/* ── Ads ─────────────────────────────────────────────────────────────────── */
.ad { margin-top: 28px; margin-bottom: 28px; }
.ad--placeholder { display: flex; align-items: center; justify-content: center; color: #6e746f; font: 500 0.75rem var(--font-body); letter-spacing: 0.06em; border: 1px dashed #4a504c; border-radius: var(--radius-s); background: rgba(0, 0, 0, 0.18); }
.ad--leaderboard.ad--placeholder { height: 90px; }
.ad--in_article.ad--placeholder { height: 120px; }
.ad--rectangle.ad--placeholder { height: 250px; max-width: 300px; }

/* ── Hero (the code) ─────────────────────────────────────────────────────── */
.hero { position: relative; background: var(--code-black); overflow: hidden; border-bottom: 1px solid #1d211e; }
.hero__rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.5) 45%, rgba(0,0,0,0) 80%), linear-gradient(0deg, var(--code-black) 0%, transparent 25%); pointer-events: none; }
.hero__inner { position: relative; z-index: 1; padding-top: clamp(72px, 14vw, 150px); padding-bottom: clamp(64px, 10vw, 120px); }
.hero h1 { font-size: clamp(2.5rem, 7.4vw, 5.2rem); line-height: 0.98; letter-spacing: -0.02em; margin-bottom: 0.35em; text-shadow: 0 0 40px rgba(0, 0, 0, 0.9); }
.hero__lede { font-size: clamp(1.05rem, 2vw, 1.25rem); max-width: 54ch; color: #c9d3cc; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 22px; }
.hero__meta { color: var(--dust); font-size: 0.9rem; margin: 0; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { margin-top: 56px; margin-bottom: 56px; }
.section__head { margin-bottom: 26px; }
.section__head p { color: var(--dust); max-width: 62ch; }
.page-head { padding-top: 48px; padding-bottom: 8px; }
.crumbs { color: var(--dust); font-size: 0.92rem; margin-bottom: 14px; }
.crumbs a { color: var(--dust); }
.more { font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
@media (min-width: 900px) { .split { grid-template-columns: 1.15fr 1fr; } }
.prose p, .prose li { max-width: 68ch; }
.panel { background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; margin-bottom: 18px; }
.panel__title { font-size: 1.05rem; margin-bottom: 10px; }
.empty { color: var(--dust); padding: 30px; border: 1px dashed var(--line); border-radius: var(--radius-m); }

/* ── Phase cards (the roadmap is a real sequence, so the numbers stay) ───── */
.phases { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .phases { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .phases { grid-template-columns: repeat(4, 1fr); } }
.phase { position: relative; display: flex; flex-direction: column; align-items: flex-start; background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px 20px 20px; text-decoration: none; color: var(--bone); overflow: hidden; }
.phase:hover { border-color: var(--teal); }
.phase__num { position: absolute; right: 10px; top: -18px; font: 700 7.5rem/1 var(--font-display); color: rgba(255, 255, 255, 0.045); pointer-events: none; }
.phase__name { color: var(--lime); font: 600 0.9rem var(--font-display); margin-bottom: 4px; }
.phase h3 { font-size: 1.35rem; margin: 0 0 10px; }
.phase p { font-size: 0.95rem; color: var(--dust); margin: 12px 0 0; flex: 1; }
.phase .bar { width: 100%; margin-top: 16px; }
.phase .phase__count { flex: 0; font-size: 0.82rem; margin: 0; }
.phase--rebuilding { border-color: rgba(255, 77, 77, 0.35); }

/* ── Cards (wiki lists) ─────────────────────────────────────────────────── */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 26px; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.cards--compact { grid-template-columns: 1fr !important; }
.card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; color: var(--bone); }
.card:hover { border-color: var(--teal); }
.card__icon { flex: none; width: 54px; height: 54px; display: grid; place-items: center; }
.card__text { display: grid; gap: 2px; min-width: 0; }
.card__text strong { font: 600 1.02rem var(--font-display); color: #fff; }
.card__mod { font-size: 0.8rem; color: var(--lime); }
.card__sum { font-size: 0.9rem; color: var(--dust); line-height: 1.45; }
.glyph { font: 700 1.25rem var(--font-code); color: var(--phosphor); }
.swatch { width: 40px; height: 40px; border-radius: 8px; background-size: auto, 14px 14px; image-rendering: pixelated; border: 1px solid var(--line); }

.cats { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .cats { grid-template-columns: repeat(3, 1fr); } }
.cat { display: grid; gap: 2px; padding: 18px; background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; color: var(--bone); }
.cat:hover { border-color: var(--teal); }
.cat strong { font: 600 1.2rem var(--font-display); color: #fff; }
.cat span { color: var(--lime); font-size: 0.85rem; }
.cat .cat__blurb { color: var(--dust); font-size: 0.9rem; margin-top: 4px; }

.search { display: block; max-width: 620px; margin-top: 22px; }
.search input { width: 100%; font: 400 1.05rem var(--font-body); color: #fff; background: #000; border: 1px solid var(--line); border-radius: 999px; padding: 14px 22px; }
.search input:focus { border-color: var(--phosphor); outline: none; box-shadow: 0 0 0 3px rgba(57, 255, 122, 0.18); }
.search__empty { color: var(--dust); margin-top: 14px; }

/* ── 3D block (built from the mod's own textures) ───────────────────────── */
.cube-wrap { --s: 120px; width: calc(var(--s) * 1.75); height: calc(var(--s) * 1.75); display: grid; place-items: center; perspective: none; }
.card__icon .cube-wrap { width: 54px; height: 54px; }
.cube { position: relative; width: var(--s); height: var(--s); transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(45deg); }
.cube__face { position: absolute; inset: 0; background-size: 100% 100%; image-rendering: pixelated; backface-visibility: hidden; }
.cube__face i { position: absolute; inset: 0; background-size: 100% 100%; image-rendering: pixelated; mix-blend-mode: screen; filter: brightness(1.6); }
.cube__face--top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube__face--front { transform: translateZ(calc(var(--s) / 2)); filter: brightness(0.8); }
.cube__face--back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.8); }
.cube__face--left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.62); }
.cube__face--right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); filter: brightness(0.62); }
.flat-wrap { --s: 120px; width: calc(var(--s) * 1.4); height: calc(var(--s) * 1.4); display: grid; place-items: center; }
.card__icon .flat-wrap { width: 54px; height: 54px; }
.flat { width: var(--s); height: var(--s); image-rendering: pixelated; object-fit: contain; }
.render { display: block; width: 100%; height: auto; border-radius: var(--radius-s); }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.biome-view { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-s); overflow: hidden; }
.biome-view span { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background-size: 32px 32px; image-rendering: pixelated; box-shadow: inset 0 18px 30px rgba(0, 0, 0, 0.45); }

/* ── Mod page ───────────────────────────────────────────────────────────── */
.mod-hero { position: relative; background: #000; border-bottom: 1px solid #1d211e; overflow: hidden; }
.mod-hero__cover { position: absolute; inset: 0; background-size: 64px 64px; image-rendering: pixelated; opacity: 0.16; }
.mod-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #000 20%, rgba(0, 0, 0, 0.55)); }
.mod-hero__inner { position: relative; z-index: 1; padding-top: 44px; padding-bottom: 44px; }
.mod-hero__logo { width: min(520px, 100%); height: auto; display: block; margin: 4px 0 18px; }
.mod-hero__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.with-rail__aside { padding-top: 56px; }
@media (min-width: 980px) { .with-rail { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; } }

.facts { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts th { color: var(--dust); font-weight: 500; padding-right: 14px; width: 42%; }
.facts td code { word-break: break-all; }

.feats, .issues, .changelog, .cmds { list-style: none; margin: 0; padding: 0; }
.feat { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feat h4 { margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.feat p { margin: 0; color: var(--dust); font-size: 0.95rem; }
.feat__mark { width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--line); }
.feat--done .feat__mark { background: var(--phosphor); border-color: var(--phosphor); box-shadow: 0 0 10px rgba(57, 255, 122, 0.45); }
.feat--partial .feat__mark { border-color: var(--amber); background: linear-gradient(90deg, var(--amber) 50%, transparent 50%); }

.issue { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 16px; margin-bottom: 10px; background: var(--fog); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius-s); }
.issue--crash { border-left-color: var(--machine-red); }
.issue--bug { border-left-color: var(--amber); }
.issue h4 { margin: 0 0 4px; }
.issue p { margin: 0 0 4px; color: var(--dust); font-size: 0.95rem; }
.issue__status { font-size: 0.82rem !important; color: var(--bone) !important; }

.changelog > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.changelog time { font: 500 0.9rem var(--font-code); color: var(--lime); margin-right: 6px; }
.changelog ul { margin: 6px 0 0; padding-left: 20px; color: var(--dust); }

/* ── Wiki entry ─────────────────────────────────────────────────────────── */
.entry__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 18px; }
@media (min-width: 900px) { .entry__grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; } .infobox { order: 2; } }
.infobox { align-self: start; background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; }
.infobox__view { display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #313733, #151716 70%); border-radius: var(--radius-s); margin-bottom: 12px; min-height: 160px; overflow: hidden; }
.infobox .ad--rectangle { margin: 20px auto 0; }
.notice { border: 1px solid rgba(255, 176, 32, 0.4); background: rgba(255, 176, 32, 0.08); color: #ffd58a; border-radius: var(--radius-s); padding: 12px 16px; }
.gallery { display: flex; flex-wrap: wrap; gap: 14px; }
.gallery .flat { width: 96px; height: 96px; border-radius: 4px; }
.cmds li { margin-bottom: 18px; }
.cmd { display: flex; gap: 10px; align-items: stretch; background: #000; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 10px 10px 14px; }
.cmd code { flex: 1; min-width: 0; background: none; padding: 0; color: var(--phosphor); align-self: center; overflow-x: auto; white-space: nowrap; }
.cmd__copy { flex: none; font: 600 0.82rem var(--font-body); color: var(--bone); background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 4px 12px; cursor: pointer; }
.cmd__copy:hover { border-color: var(--phosphor); }
.cmds p { margin: 6px 0 0; color: var(--dust); }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 8px; }

/* ── Roadmap page ───────────────────────────────────────────────────────── */
.road { display: grid; grid-template-columns: 56px 1fr; gap: 18px; padding: 40px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) { .road { grid-template-columns: 110px 1fr; gap: 30px; } }
.road__num { font: 700 clamp(3.4rem, 9vw, 6rem)/0.9 var(--font-display); color: transparent; -webkit-text-stroke: 1.5px var(--teal); }
.road__phase { color: var(--lime); font: 600 0.95rem var(--font-display); margin-bottom: 4px; }
.road h2 a { color: #fff; text-decoration: none; }
.road h2 a:hover { color: var(--phosphor); }
.road h2 .pill { margin-left: 8px; }

/* ── Video ──────────────────────────────────────────────────────────────── */
.video { aspect-ratio: 16 / 9; border-radius: var(--radius-m); overflow: hidden; background: #000; border: 1px solid var(--line); margin-bottom: 14px; }
.video__play { width: 100%; height: 100%; border: 0; cursor: pointer; background-size: cover; background-position: center; display: grid; place-items: center; }
.video__play span { background: rgba(0, 0, 0, 0.75); color: #fff; padding: 10px 18px; border-radius: 999px; font: 600 0.95rem var(--font-body); }
.video iframe { width: 100%; height: 100%; border: 0; }
.video--empty { display: grid; place-items: center; padding: 24px; text-align: center; color: var(--dust); background: radial-gradient(circle, #0a1f12, #000 70%); }
.devlogs { display: grid; gap: 28px; }
@media (min-width: 800px) { .devlogs { grid-template-columns: 1fr 1fr; } }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer { margin-top: 80px; background: #000; border-top: 1px solid #1d211e; padding: 40px 0 28px; }
.footer__inner { display: grid; gap: 24px; }
@media (min-width: 800px) { .footer__inner { grid-template-columns: 1fr auto; align-items: start; } }
.footer p { color: var(--dust); font-size: 0.92rem; margin: 8px 0 0; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer__links a { color: var(--dust); text-decoration: none; font-size: 0.92rem; }
.footer__links a:hover { color: #fff; }
.footer__legal { margin-top: 28px !important; font-size: 0.8rem !important; color: #7d857f !important; }
.notfound { min-height: 46vh; }

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

/* Release countdown (home hero) */
.count { margin: 26px 0 0; }
.count__title { color: #c9d3cc; font-size: 0.98rem; margin-bottom: 10px; }
.count__title time { color: #fff; font-weight: 600; }
.count__units { display: flex; gap: 10px; flex-wrap: wrap; }
.count__unit { min-width: 76px; padding: 10px 12px 8px; background: rgba(0, 0, 0, 0.72); border: 1px solid #1f3a28; border-radius: var(--radius-s); text-align: center; }
.count__num { display: block; font: 700 clamp(1.7rem, 5vw, 2.4rem)/1 var(--font-display); color: var(--phosphor); font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(57, 255, 122, 0.35); }
.count__label { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--dust); }
.count--done .count__title { font: 600 1.3rem var(--font-display); color: var(--phosphor); }
@media (max-width: 420px) { .count__units { gap: 6px; } .count__unit { min-width: 0; flex: 1; padding: 8px 4px 6px; } }

/* Ko-fi shop cards */
.shops { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .shops { grid-template-columns: 1.4fr 1fr; } }
.shop { display: flex; flex-direction: column; background: var(--fog); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.shop--main { border-color: #2d6b4a; }
.shop__img { display: block; aspect-ratio: 16 / 9; background: #000; }
.shop__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shop__body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.shop__body p { color: var(--dust); flex: 1; }
.shop__body .btn { align-self: flex-start; white-space: normal; text-align: center; }
