/* VoxelStrike engine notes -- the write-up's whole look. Edit freely: index.html holds only content. */

:root {
  --bg: #0d1013;
  --surface: #141a1f;
  --surface-2: #1a2229;
  --ink: #dde3e8;
  --ink-strong: #f4f7f9;
  --muted: #8d99a5;
  --rule: #26313b;
  --accent: #f0a73a;        /* amber: section marks, links */
  --accent-ink: #1b1204;
  --hud: #7fd48e;           /* HUD green: numbers that got better */
  --warn: #ef6b5b;
  --code-bg: #0a0d10;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --measure: 46rem;
  --wide: 70rem;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ece7dc;
  --ink: #23292f;
  --ink-strong: #0e1215;
  --muted: #5f6a74;
  --rule: #d8d1c3;
  --accent: #b86a00;
  --accent-ink: #fffaf0;
  --hud: #1f7a33;
  --warn: #b3261e;
  --code-bg: #efe9dd;
  --shadow: 0 8px 24px rgba(40, 30, 10, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.68 "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
strong { color: var(--ink-strong); font-weight: 600; }
code, pre, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
code { font-size: .86em; background: var(--surface-2); padding: .08em .35em; border-radius: 3px; }
h1, h2, h3 {
  font-family: "Barlow Condensed", "IBM Plex Sans", sans-serif;
  color: var(--ink-strong);
  letter-spacing: .01em;
  line-height: 1.08;
}

/* ---------------------------------------------------------------- the hero */
.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: flex;
  align-items: flex-end;
  background: #06080a center / cover no-repeat;
  border-bottom: 1px solid var(--rule);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 8, 10, .15) 0%, rgba(6, 8, 10, .35) 45%, rgba(6, 8, 10, .92) 100%);
}
.hero-inner { position: relative; width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem 3.2rem; }
.kicker {
  font: 500 .78rem/1 "IBM Plex Mono", monospace;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  margin: .7rem 0 .9rem;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  max-width: 16ch;
}
.hero .dek { max-width: 44rem; color: #d3dae0; font-size: 1.12rem; margin: 0; }
.hero .meta { margin-top: 1.3rem; font: .8rem/1.5 "IBM Plex Mono", monospace; color: #9aa6b1; }
.theme-btn {
  position: absolute; top: 1rem; right: 1rem; z-index: 2;
  font: 500 .75rem "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase;
  color: #e9eef2; background: rgba(10, 13, 16, .55); border: 1px solid rgba(255, 255, 255, .25);
  padding: .45rem .7rem; border-radius: 4px; cursor: pointer; backdrop-filter: blur(4px);
}

/* --------------------------------------------------------------- the stats */
.stats {
  max-width: var(--wide); margin: -1px auto 0; padding: 0 1.25rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-top: 0;
}
.stat { background: var(--surface); padding: 1.1rem 1.1rem 1.2rem; }
.stat b {
  display: block;
  font: 700 2.3rem/1 "Barlow Condensed", sans-serif;
  color: var(--hud);
}
.stat span { display: block; margin-top: .45rem; font-size: .86rem; line-height: 1.45; color: var(--muted); }

/* ------------------------------------------------------------ the layout */
.layout {
  max-width: var(--wide); margin: 0 auto; padding: 3rem 1.25rem 5rem;
  display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3.5rem;
}
.toc { position: sticky; top: 1.5rem; align-self: start; max-height: calc(100vh - 3rem); overflow: auto; }
.toc h2 {
  font: 500 .72rem "IBM Plex Mono", monospace; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .8rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc -1; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 2rem 1fr; padding: .3rem 0 .3rem .6rem;
  border-left: 2px solid var(--rule);
  color: var(--muted); text-decoration: none; font-size: .88rem; line-height: 1.35;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font: .74rem/1.9 "IBM Plex Mono", monospace; color: var(--rule); }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink-strong); border-left-color: var(--accent); }
.toc a.on::before { color: var(--accent); }

article { min-width: 0; }
article > section { max-width: var(--measure); margin: 0 0 4.5rem; }
article > section.wide-sec { max-width: none; }
article h2 {
  font-size: 2.35rem; font-weight: 700; text-transform: uppercase;
  margin: 0 0 1.2rem; padding-top: .9rem; border-top: 1px solid var(--rule);
}
article h2 .n { display: block; margin-bottom: .45rem; font: 500 .78rem "IBM Plex Mono", monospace; letter-spacing: .2em; color: var(--accent); }
article h3 { font-size: 1.45rem; font-weight: 600; margin: 2.2rem 0 .6rem; }
article p, article li { max-width: var(--measure); }
article ul, article ol { padding-left: 1.2rem; }
article li { margin: .35rem 0; }
.lede { font-size: 1.14rem; color: var(--ink-strong); }

/* --------------------------------------------------------------- figures */
figure { margin: 2rem 0; }
figure img, figure video { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
figcaption { margin-top: .6rem; font-size: .86rem; line-height: 1.5; color: var(--muted); }
figcaption b { color: var(--ink); font-weight: 600; }
.bleed { max-width: none !important; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin: 1.5rem 0 0; }
.gallery figure { margin: 0; }
.gallery img { aspect-ratio: 16 / 9; object-fit: cover; cursor: zoom-in; }
.gallery figcaption { font-size: .8rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pair img { cursor: zoom-in; }
.pair .tag {
  display: inline-block; margin-top: .45rem; font: 500 .72rem "IBM Plex Mono", monospace;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.row4 img { aspect-ratio: 1; object-fit: contain; background: var(--surface-2); box-shadow: none; }
.row4.maps img { object-fit: cover; }

/* ------------------------------------------------------------ callouts */
.note {
  margin: 1.8rem 0; padding: 1rem 1.2rem; background: var(--surface);
  border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 3px;
}
.note .label { display: block; margin-bottom: .35rem; font: 500 .72rem "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.note p { margin: .4rem 0; }
.note.bug { border-left-color: var(--warn); }
.note.bug .label { color: var(--warn); }

pre {
  margin: 1.6rem 0; padding: 1rem 1.1rem; overflow: auto;
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 4px;
  font-size: .82rem; line-height: 1.6; color: var(--ink);
}
pre .c { color: var(--muted); }
pre .k { color: var(--accent); }

/* ---------------------------------------------------------------- tables */
.tbl { overflow-x: auto; margin: 1.6rem 0; border: 1px solid var(--rule); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; padding: .65rem .8rem; background: var(--surface-2);
  font: 500 .7rem "IBM Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
td { padding: .6rem .8rem; border-top: 1px solid var(--rule); vertical-align: top; }
td.num { font-family: "IBM Plex Mono", monospace; white-space: nowrap; }
td.after { color: var(--hud); }
.chip {
  display: inline-block; padding: .12rem .45rem; border-radius: 3px;
  font: 600 .68rem "IBM Plex Mono", monospace; letter-spacing: .1em; white-space: nowrap;
}
.chip.keep { background: var(--hud); color: #07130a; }
.chip.improve { background: var(--accent); color: var(--accent-ink); }
.chip.only { background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule); }
.chip.skip { background: var(--warn); color: #fff; }

/* --------------------------------------------------------- video loops */
figure.loop video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 4px; background: #000; box-shadow: var(--shadow); }
.pair.loops { align-items: start; margin: 2rem 0; }
.pair.loops figure { margin: 0; }
.maps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin: 1.2rem 0; }
.maps figure { margin: 0; }
.maps img { aspect-ratio: 1; object-fit: cover; box-shadow: none; }
.maps figcaption { margin-top: .3rem; font: .72rem "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; text-align: center; }

/* ------------------------------------------------------------- tidbits */
.tidbit {
  margin: 1.8rem 0; padding: 1rem 1.2rem; border-radius: 4px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--hud) 9%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--hud) 35%, var(--rule));
}
.tidbit .label { display: block; margin-bottom: .35rem; font: 500 .72rem "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--hud); }
.tidbit p { margin: .3rem 0; }

/* -------------------------------------------------------------- diagrams */
.diagram { margin: 2rem 0; padding: 1.2rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram svg text { font-family: "IBM Plex Mono", monospace; fill: var(--ink); }
.diagram svg .t-muted { fill: var(--muted); }
.diagram svg .t-acc { fill: var(--accent); }
.diagram svg .box { fill: var(--surface-2); stroke: var(--rule); }
.diagram svg .box-acc { fill: none; stroke: var(--accent); }
.diagram svg .line { stroke: var(--muted); fill: none; }
.diagram svg .line-acc { stroke: var(--accent); fill: none; }
.diagram svg .fill-hud { fill: var(--hud); }
.diagram svg .fill-acc { fill: var(--accent); }

/* ------------------------------------------------------------- lessons */
.lessons { list-style: none; padding: 0; counter-reset: les; }
.lessons li { counter-increment: les; position: relative; padding: .9rem 0 .9rem 3rem; border-top: 1px solid var(--rule); margin: 0; }
.lessons li::before {
  content: counter(les, decimal-leading-zero); position: absolute; left: 0; top: .95rem;
  font: 600 1.05rem "Barlow Condensed", sans-serif; color: var(--accent);
}

footer.foot { max-width: var(--wide); margin: 0 auto; padding: 2rem 1.25rem 4rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem; }

/* ------------------------------------------------------------- lightbox */
.lb { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(4, 6, 8, .93); padding: 2rem; cursor: zoom-out; }
.lb.open { display: flex; }
.lb img { max-width: 100%; max-height: 88vh; border-radius: 4px; }
.lb p { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; margin: 0; text-align: center; color: #c9d1d8; font-size: .9rem; }

/* ------------------------------------------------------------- narrow */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; margin-bottom: 3rem; padding: 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pair, .row4, .maps { grid-template-columns: 1fr 1fr; }
  .pair.loops { grid-template-columns: 1fr; }
  article h2 { font-size: 1.9rem; }
  .hero { min-height: 78vh; }
  .diagram { overflow-x: auto; padding: .8rem; }
  .diagram svg { min-width: 600px; }
  .tbl table { min-width: 560px; }
}
@media (max-width: 460px) {
  .pair { grid-template-columns: 1fr; }
}
