/* The modding guide's look: Crystal's dark palette, wide margins, pictures that breathe. */
:root {
  --bg: #14161a; --panel: #1b1e24; --line: #2b3038; --ink: #d7dbe2; --dim: #8b93a1;
  --accent: #6ea8fe; --gold: #d7b96a; --good: #6ac48a; --warn: #d9a441;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font: 13px/1.4 Consolas, "Cascadia Mono", monospace; background: #232830; border-radius: 4px; padding: 1px 5px; color: #e6e9ef; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }
pre { background: #0f1115; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow: auto; font: 13px/1.5 Consolas, "Cascadia Mono", monospace; }
pre code { background: none; padding: 0; }

/* Layout: a fixed nav on the left, the page on the right. */
.wrap { display: flex; min-height: 100vh; }
nav.side { flex: 0 0 240px; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav.side .brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-weight: 700; font-size: 17px; margin-bottom: 6px; white-space: nowrap; }
nav.side .brand span { color: var(--dim); font-weight: 400; font-size: 12px; flex-basis: 100%; }
nav.side h4 { margin: 18px 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
nav.side a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--ink); font-size: 14px; }
nav.side a:hover { background: #232c3a; text-decoration: none; }
nav.side a.on { background: #232c3a; color: #fff; border-left: 3px solid var(--accent); padding-left: 5px; }
main { flex: 1; min-width: 0; padding: 28px 48px 80px; max-width: 1080px; }
main > h1 { font-size: 30px; margin: 0 0 6px; }
main > h1 + p.lead { color: var(--dim); font-size: 17px; margin: 0 0 24px; }
h2 { font-size: 21px; margin: 40px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
h3 { font-size: 16px; margin: 26px 0 8px; color: var(--accent); }
p { margin: 8px 0; }
ul, ol { padding-left: 24px; }
li { margin: 4px 0; }

/* Steps: numbered, each a short line, the picture under it. */
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 8px 0 8px 44px; margin: 0; border-left: 2px solid var(--line); margin-left: 14px; }
ol.steps > li::before { content: counter(step); position: absolute; left: -15px; top: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #0b1220; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
ol.steps > li > b { color: #fff; }

figure { margin: 14px 0 20px; }
figure img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; background: #000; }
figure img.small { max-width: 520px; }
figure img.medium { max-width: 760px; }
figcaption { color: var(--dim); font-size: 13px; margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row2 figure { margin: 6px 0; }
img.zoomable { cursor: zoom-in; }

/* The top bar and the drawer: hidden on a desktop, the way in on a phone. */
.topbar { display: none; position: sticky; top: 0; z-index: 30; align-items: center; gap: 10px; height: 48px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .menu { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: none; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 8px; cursor: pointer; }
.topbar .menu span { display: block; height: 2px; background: var(--ink); border-radius: 1px; }
.topbar .title { color: #fff; font-weight: 700; }
.topbar .where { color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.veil { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
nav.side .sections { margin: 2px 0 6px 10px; border-left: 1px solid var(--line); }
nav.side .sections a { font-size: 13px; color: var(--dim); padding: 3px 8px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); }
.pager a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

@media (max-width: 900px) {
  html, body { font-size: 15px; }
  .row2 { grid-template-columns: 1fr; }
  .topbar { display: flex; }
  .wrap { display: block; }
  nav.side { position: fixed; top: 0; left: 0; height: 100vh; width: min(82vw, 320px); transform: translateX(-102%); transition: transform .2s ease; z-index: 50; box-shadow: 4px 0 24px rgba(0,0,0,0.5); }
  body.drawer nav.side { transform: none; }
  body.drawer .veil { display: block; }
  body.drawer { overflow: hidden; }
  main { padding: 16px 14px 60px; max-width: none; }
  main > h1 { font-size: 24px; }
  main > h1 + p.lead { font-size: 15px; }
  h2 { font-size: 19px; margin-top: 30px; }
  figure img, figure img.small, figure img.medium { max-width: 100%; }
  ol.steps > li { padding-left: 34px; margin-left: 10px; }
  ol.steps > li::before { width: 24px; height: 24px; left: -13px; font-size: 12px; }
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table td, table th { white-space: normal; min-width: 120px; }
  pre { font-size: 12px; }
  .hero .over { position: static; margin: 0; border-radius: 0; font-size: 13px; }
  .cards { grid-template-columns: 1fr; }
  .get .button { flex: 1 1 auto; text-align: center; }
}

/* The lightbox: fit the screen, or full size with panning and pinching. */
.lightbox { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 12, 0.96); overflow: hidden; touch-action: pinch-zoom; }
.lightbox.open { display: block; }
.lightbox img { position: absolute; inset: 0; margin: auto; max-width: 100vw; max-height: 100vh; width: auto; height: auto; cursor: zoom-in; }
.lightbox.full { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.lightbox.full img { position: static; max-width: none; max-height: none; width: auto; height: auto; display: block; cursor: zoom-out; }
.lightbox .hint { position: fixed; left: 0; right: 0; bottom: 10px; text-align: center; color: var(--dim); font-size: 12px; pointer-events: auto; }
.lightbox .close { position: fixed; top: 8px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20,22,26,0.85); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
body.lit { overflow: hidden; }

/* Callouts. */
.note, .tip, .warn { border-left: 4px solid var(--accent); background: #1b2230; padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 14px 0; font-size: 14px; }
.tip { border-color: var(--good); background: #182419; }
.warn { border-color: var(--warn); background: #2a2417; }
.note b, .tip b, .warn b { color: #fff; }

/* Cards on the index. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; font-size: 15px; margin-bottom: 4px; color: #fff; }
.card span { color: var(--dim); font-size: 13px; }
.card.game b::before { content: "▶ "; color: var(--good); }
.card.editor b::before { content: "◆ "; color: var(--accent); }
.card.mod b::before { content: "▣ "; color: var(--gold); }

/* Reference tables. */
table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0 18px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
td code { white-space: nowrap; }
.hero { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin: 10px 0 22px; }
.hero img { display: block; width: 100%; }
.hero .over { position: absolute; left: 24px; bottom: 20px; background: rgba(12,14,18,0.78); padding: 10px 16px; border-radius: 8px; font-size: 14px; color: #fff; }
/* The landing page's download row. */
.get { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; }
.get .button { display: inline-block; background: var(--accent); color: #0b1220; font-weight: 600; padding: 8px 16px; border-radius: 8px; }
.get .button:hover { text-decoration: none; filter: brightness(1.1); }
.get .button.quiet { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.get span { color: var(--dim); font-size: 13px; }
footer { margin-top: 60px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
