/* =========================================================================
   Ungodly Diplomacy AI: installation guide
   by StixsworldHD (StixsmasterHD4k)

   Palette lifted from the mod's own F8 window: slate panels, amber where you
   act, green for "you should now see", red for "this goes wrong".
   Generic content rules use :where() so component classes always win.
   ========================================================================= */

@font-face { font-family: "Grenze Gotisch"; src: url("../fonts/grenze-gotisch-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --night: #121821;
  --night-deep: #0d1219;
  --panel: #1a2230;
  --panel-raised: #222c3c;
  --rule: #2b3646;
  --rule-strong: #3d4b60;
  --vellum: #ece4d3;
  --vellum-dim: #cfc7b6;
  --muted: #a3adba;
  --ember: #f2a72e;
  --ember-hover: #ffbd52;
  --ember-ink: #1c1406;
  --blood: #d0463f;
  --blood-text: #f28c84;
  --banner: #3fae5a;
  --banner-text: #86d596;

  --f-display: "Grenze Gotisch", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --f-text: "Alegreya Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 72ch;
  --r-small: 4px;
  --r-button: 6px;
  --header-h: 4.25rem;

  --i-folder: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h4.3l1.4 1.6h7.3v8.4h-13z' fill='none' stroke='%23f2a72e' stroke-width='1.25' stroke-linejoin='round'/%3E%3C/svg%3E");
  --i-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 1.5h6l3 3v10h-9z M9.5 1.5v3h3' fill='none' stroke='%23a3adba' stroke-width='1.25' stroke-linejoin='round'/%3E%3C/svg%3E");
  --i-zoom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.6' fill='none' stroke='%23ece4d3' stroke-width='1.6'/%3E%3Cpath d='M10 10l4.4 4.4M6.5 4.6v3.8M4.6 6.5h3.8' stroke='%23ece4d3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --i-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.9' fill='none' stroke='%2386d596' stroke-width='1.5'/%3E%3Cpath d='M4.9 8.3l2.1 2.1 4.2-4.5' fill='none' stroke='%2386d596' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.9l6.5 11.8h-13z' fill='none' stroke='%23f28c84' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M8 6.3v3.4' stroke='%23f28c84' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.7' r='.95' fill='%23f28c84'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1.25rem); background: var(--night); }
html.lb-open { overflow: hidden; }
body { margin: 0; background: var(--night); color: var(--vellum); font: 400 1.125rem/1.6 var(--f-text); overflow-wrap: break-word; font-kerning: normal; font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
::selection { background: rgba(242, 167, 46, .32); color: var(--vellum); }
a { color: var(--ember); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--ember-hover); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }
strong { font-weight: 700; }
code, kbd, pre { font-family: var(--f-mono); }
code { font-size: .84em; padding: .08em .38em; border: 1px solid var(--rule); border-radius: 3px; background: var(--panel); color: var(--vellum); overflow-wrap: anywhere; }
kbd { display: inline-block; font: 700 .86em/1.25 var(--f-text); padding: .02em .45em .06em; border: 1px solid var(--rule-strong); border-bottom-width: 3px; border-radius: 5px; background: var(--panel-raised); color: var(--vellum); white-space: nowrap; }
q { quotes: "\201C" "\201D"; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .96rem; color: var(--muted); }
.wrap { max-width: 1320px; margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; font-weight: 700; color: var(--ember-ink); background: var(--ember); border-radius: var(--r-button); text-decoration: none; }
.skip:focus { top: 1rem; color: var(--ember-ink); }

/* ---------- masthead ---------- */
.masthead { position: sticky; top: 0; z-index: 30; background: rgba(18, 24, 33, .95); border-bottom: 1px solid var(--rule); }
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .masthead { background: rgba(18, 24, 33, .82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.masthead__inner { max-width: 1320px; min-height: var(--header-h); margin: 0 auto; padding: .6rem var(--gutter); display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: baseline; gap: .55rem; margin-right: auto; color: var(--vellum); text-decoration: none; }
.brand:hover { color: var(--vellum); }
.brand__mark { width: 32px; height: 32px; flex: none; align-self: center; }
.brand__mark rect { fill: var(--panel-raised); }
.brand__mark path { fill: none; stroke: var(--ember); stroke-width: 4; stroke-linecap: round; }
.brand__impact { fill: var(--ember); }
.brand__origin { fill: var(--vellum); }
.brand__name { font: 700 1.6rem/1 var(--f-display); letter-spacing: .01em; }
.brand__ver { font-size: .92rem; color: var(--muted); }
.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .2rem; }
.mainnav a { display: block; padding: .5rem .8rem; border-radius: var(--r-button); color: var(--vellum-dim); font-weight: 700; font-size: 1.02rem; text-decoration: none; white-space: nowrap; }
.mainnav a:hover { color: var(--vellum); background: var(--panel); }
.mainnav a[aria-current] { color: var(--vellum); background: var(--panel); box-shadow: inset 0 -2px 0 var(--ember); }
.mainnav__item--cta a, .mainnav__item--cta a[aria-current] { color: var(--ember-ink); background: var(--ember); }
.mainnav__item--cta a:hover { color: var(--ember-ink); background: var(--ember-hover); }
.mainnav__item--cta a[aria-current] { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .35); }

/* ---------- page layouts ---------- */
.layout { max-width: 1320px; margin: 0 auto; padding: 2.75rem var(--gutter) 4.5rem; display: grid; align-items: start; column-gap: clamp(2rem, 3.6vw, 3.75rem); }
.layout--guide { grid-template-columns: 196px minmax(0, 1fr) 206px; grid-template-areas: "rail main toc"; }
.layout--doc { grid-template-columns: minmax(0, 1fr) 216px; grid-template-areas: "main toc"; }
.content { grid-area: main; min-width: 0; }
.layout--guide .content { max-width: 820px; }
.rail { grid-area: rail; position: sticky; top: calc(var(--header-h) + 1.5rem); }
.toc { grid-area: toc; position: sticky; top: calc(var(--header-h) + 1.5rem); max-height: calc(100vh - var(--header-h) - 3rem); overflow-y: auto; }

:where(.content) h2 { font: 600 clamp(1.75rem, 3vw, 2.15rem)/1.1 var(--f-display); margin: 3rem 0 1rem; letter-spacing: .005em; }
:where(.content) h3 { font: 700 1.15rem/1.3 var(--f-text); margin: 1.9rem 0 .55rem; }
:where(.content) p, :where(.content) li { max-width: var(--measure); }
:where(.content) ul, :where(.content) ol { padding-left: 1.35rem; }
:where(.content) li + li { margin-top: .45rem; }

/* ---------- headings of guide and reference pages ---------- */
.part-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(1rem, 2.4vw, 1.8rem); align-items: start; }
.part-head__num { padding-top: .06em; font: 700 clamp(4.6rem, 9vw, 7.2rem)/.78 var(--f-display); color: var(--ember); }
.part-head h1, .doc-head h1 { margin: 0; font: 700 clamp(2.4rem, 4.8vw, 3.5rem)/1 var(--f-display); letter-spacing: .005em; }
.lead { margin: 1rem 0 0; max-width: 62ch; font-size: 1.2rem; line-height: 1.55; color: var(--vellum-dim); }
.doc-head { margin-bottom: 1.2rem; }

/* ---------- route rail (guide pages) ---------- */
.rail__list { position: relative; list-style: none; margin: 0; padding: 0; }
.rail__list::before { content: ""; position: absolute; left: 1.2rem; top: 1.4rem; bottom: 1.4rem; width: 1px; background: var(--rule-strong); }
.rail__item { margin: 0; }
.rail__item a { position: relative; display: flex; align-items: center; gap: .8rem; padding: .4rem 0; color: var(--muted); font-weight: 700; text-decoration: none; }
.rail__num { width: 2.4rem; height: 2.4rem; flex: none; display: grid; place-items: center; background: var(--night); border: 1px solid var(--rule-strong); border-radius: 50%; font: 600 1.3rem/1 var(--f-display); color: var(--muted); }
.rail__item.is-before a { color: var(--vellum-dim); }
.rail__item.is-before .rail__num { color: var(--vellum-dim); border-color: var(--vellum-dim); }
.rail__item.is-current a { color: var(--vellum); }
.rail__item.is-current .rail__num { color: var(--ember-ink); background: var(--ember); border-color: var(--ember); }
.rail__item a:hover { color: var(--vellum); }
.rail__item a:hover .rail__num { border-color: var(--ember); }

/* ---------- on-this-page list ---------- */
.toc__title { margin: 0 0 .6rem; font-size: .92rem; font-weight: 700; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li { margin: 0; }
.toc a { display: block; margin-left: -1px; padding: .3rem 0 .3rem .9rem; border-left: 2px solid transparent; color: var(--vellum-dim); font-size: .98rem; line-height: 1.35; text-decoration: none; }
.toc a:hover { color: var(--vellum); }
.toc a.is-active { color: var(--ember); border-left-color: var(--ember); }

/* ---------- numbered steps ---------- */
.steps { list-style: none; counter-reset: step; margin: 2.75rem 0 0; padding: 0; }
.step { counter-increment: step; position: relative; max-width: none; margin: 0 0 0 1.45rem; padding: 0 0 2.9rem 2.9rem; border-left: 1px solid var(--rule-strong); }
.step:last-child { padding-bottom: .5rem; border-left-color: transparent; }
.step::before { content: counter(step); position: absolute; left: -1.45rem; top: -.3rem; width: 2.9rem; height: 2.9rem; display: grid; place-items: center; background: var(--night); border: 1px solid var(--ember); border-radius: 50%; color: var(--ember); font: 600 1.6rem/1 var(--f-display); }
.step--optional::before { color: var(--muted); border-color: var(--rule-strong); border-style: dashed; }
.step__title { margin: 0 0 .9rem; font: 600 clamp(1.6rem, 2.8vw, 2.05rem)/1.12 var(--f-display); letter-spacing: .005em; }
.step__title code, .step__title kbd { font-size: .6em; vertical-align: .2em; }
.step > :last-child { margin-bottom: 0; }

/* ---------- facts about a file ---------- */
.filecard { display: flex; flex-wrap: wrap; gap: 1px; margin: 2rem 0 0; padding: 0; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-small); overflow: hidden; }
.filecard > div { flex: 1 1 200px; min-width: 0; padding: .75rem 1rem .85rem; background: var(--panel); }
.filecard > div:has(.copyable) { flex-basis: 100%; }
.filecard dt { font-size: .84rem; font-weight: 700; color: var(--muted); }
.filecard dd { margin: .2rem 0 0; overflow-wrap: anywhere; }

/* ---------- callouts ---------- */
.callout { margin: 1.5rem 0; padding: .95rem 1.2rem 1.05rem; background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong); border-radius: 0 var(--r-small) var(--r-small) 0; }
.callout p { margin: .45rem 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout__title { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--vellum); }
.callout--warn { border-left-color: var(--blood); }
.callout--warn .callout__title { color: var(--blood-text); }
.callout--check { border-left-color: var(--banner); }
.callout--check .callout__title { color: var(--banner-text); }
.callout--warn .callout__title::before, .callout--check .callout__title::before { content: ""; width: 1.05em; height: 1.05em; flex: none; background: center / contain no-repeat; }
.callout--warn .callout__title::before { background-image: var(--i-warn); }
.callout--check .callout__title::before { background-image: var(--i-tick); }

/* ---------- screenshots ---------- */
.shot { margin: 1.6rem 0; }
.shot__link { position: relative; display: block; line-height: 0; background: #000; border: 1px solid var(--rule-strong); border-radius: var(--r-small); overflow: hidden; cursor: zoom-in; }
.shot__link:hover, .shot__link:focus-visible { border-color: var(--ember); }
.shot__link img { display: block; width: 100%; height: auto; }
.shot__hint { position: absolute; right: .6rem; bottom: .6rem; display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .7rem .34rem .55rem; font: 700 .84rem/1.2 var(--f-text); color: var(--vellum); background: rgba(13, 18, 25, .88); border: 1px solid var(--rule-strong); border-radius: 999px; pointer-events: none; }
.shot__hint::before { content: ""; width: 1rem; height: 1rem; background: var(--i-zoom) center / contain no-repeat; }
.shot__link:hover .shot__hint { border-color: var(--ember); }
.shot__dims { font-weight: 400; color: var(--muted); }
.shot figcaption { margin-top: .6rem; max-width: var(--measure); font-size: .98rem; line-height: 1.5; color: var(--muted); }
.shot--pixelated .shot__link { display: inline-block; max-width: 100%; }
.shot--pixelated img { width: auto; max-width: 100%; image-rendering: pixelated; }

/* ---------- folder trees ---------- */
.tree { margin: 1.3rem 0; padding: .9rem 1.15rem; background: var(--night-deep); border: 1px solid var(--rule); border-radius: var(--r-small); font: 400 .88rem/1.8 var(--f-mono); overflow-x: auto; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { margin-left: .5rem; padding-left: 1.25rem; border-left: 1px dashed var(--rule-strong); }
.tree li { max-width: none; margin: 0; white-space: nowrap; }
.tree__name { display: inline-flex; align-items: center; gap: .45rem; color: var(--vellum-dim); }
.tree__name::before { content: ""; width: 1em; height: 1em; flex: none; background: center / contain no-repeat; }
.tree__item--dir > .tree__name::before { background-image: var(--i-folder); }
.tree__item--file > .tree__name::before { background-image: var(--i-file); }
.tree__item.is-key > .tree__name { color: var(--vellum); font-weight: 700; }
.tree__note { margin-left: .45rem; font: italic 400 .86rem/1 var(--f-text); color: var(--muted); }
.tag { display: inline-block; margin-left: .45rem; padding: 0 .55rem; border-radius: 999px; font: 700 .76rem/1.6 var(--f-text); vertical-align: .08em; }
.tag--bepinex { color: var(--ember); border: 1px solid rgba(242, 167, 46, .5); }
.tag--first-run { color: var(--muted); border: 1px solid var(--rule-strong); }
.tag--mod { color: #0f1f10; background: var(--banner); border: 1px solid var(--banner); }
.tag--mod-cfg { color: var(--banner-text); border: 1px solid rgba(63, 174, 90, .6); }
.tag--wrong { color: #fff; background: var(--blood); border: 1px solid var(--blood); }
.callout .tree { background: var(--night); }

/* ---------- tables ---------- */
.table-wrap { margin: 1.2rem 0; overflow-x: auto; }
.table-wrap > table { margin: 0; }
table { width: 100%; margin: 1.2rem 0; border-collapse: collapse; font-size: 1.02rem; font-variant-numeric: lining-nums tabular-nums; }
th, td { padding: .62rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
thead th { font-size: .88rem; color: var(--muted); white-space: nowrap; border-bottom-color: var(--rule-strong); }
tbody th { font-weight: 700; }
tr.is-right > :first-child { box-shadow: inset 3px 0 0 var(--banner); }
tr.is-wrong > :first-child { box-shadow: inset 3px 0 0 var(--blood); }
.choices td:first-child, .contents td:first-child { white-space: nowrap; }
.setgroup { margin-top: 3.2rem; }
.setgroup h2 { margin-bottom: .3rem; }
.setgroup__meta { margin: 0 0 1rem; color: var(--muted); }
table.settings { font-size: 1rem; }
table.settings th[scope="row"] { width: 17%; min-width: 9.5rem; color: var(--vellum); }
table.settings td:nth-child(2) { width: 8%; white-space: nowrap; font-weight: 700; color: var(--vellum); }
table.settings td:nth-child(3) { width: 19%; color: var(--vellum-dim); }
table.settings td:nth-child(4) { color: var(--vellum-dim); }
table.settings tbody tr:hover { background: rgba(255, 255, 255, .025); }

/* ---------- code, checksums, copy buttons ---------- */
.code { margin: 1.1rem 0; background: var(--night-deep); border: 1px solid var(--rule); border-radius: var(--r-small); overflow: hidden; }
.code__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 2.35rem; padding: .3rem .45rem .3rem .9rem; background: var(--panel); border-bottom: 1px solid var(--rule); }
.code__label { font-size: .86rem; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
.code pre { margin: 0; padding: .85rem .95rem; overflow-x: auto; font-size: .84rem; line-height: 1.65; color: var(--vellum); tab-size: 4; }
.code pre code { padding: 0; font-size: 1em; background: none; border: 0; overflow-wrap: normal; }
.copyable { word-break: break-all; }
.copy-btn { display: inline-flex; align-items: center; margin-left: .45rem; padding: .36rem .6rem; vertical-align: .05em; font: 700 .8rem/1 var(--f-text); color: var(--vellum); background: var(--panel-raised); border: 1px solid var(--rule-strong); border-radius: 4px; cursor: pointer; }
.copy-btn:hover { border-color: var(--ember); }
.copy-btn.is-done { color: var(--banner-text); border-color: var(--banner); }
.code__bar .copy-btn { margin-left: auto; }

/* ---------- buttons, downloads ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; max-width: none; margin: 1.2rem 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: .7rem 1.15rem; font: 700 1.02rem/1.2 var(--f-text); color: var(--vellum); text-decoration: none; overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--r-button); }
.btn:hover { color: var(--vellum); border-color: var(--ember); }
.btn--primary { color: var(--ember-ink); background: var(--ember); border-color: var(--ember); }
.btn--primary:hover { color: var(--ember-ink); background: var(--ember-hover); border-color: var(--ember-hover); }
.btn--big { padding: .85rem 1.45rem; font-size: 1.08rem; }
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 1rem; max-width: none; margin: 1rem 0 0; }
.source { min-width: 0; padding: 1rem 1.15rem 1.1rem; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-small); }
.source__name { margin: 0; font: 600 1.45rem/1.15 var(--f-display); color: var(--vellum); }
.source__note { margin: .3rem 0 0; font-size: .98rem; color: var(--muted); }
.source .btn-row { margin: .85rem 0 0; }
.trust { margin: 1.5rem 0; padding: 1.05rem 1.25rem 1.1rem; background: var(--panel); background: color-mix(in srgb, var(--panel) 93%, var(--ember)); border: 1px solid rgba(242, 167, 46, .38); border-radius: var(--r-small); }
.trust p { max-width: var(--measure); margin: .45rem 0; }
.trust p:first-child { margin-top: 0; }
.trust p:last-child { margin-bottom: 0; }
.trust__title { font-weight: 700; color: var(--ember); }
.trust__sig { font-style: italic; color: var(--muted); }
.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 1rem; margin: 1.3rem 0; }
.howto > div { padding: .95rem 1.15rem 1rem; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-small); }
.howto h3 { margin: 0 0 .5rem; }
.howto ol { margin: 0; }
.needs li::marker { color: var(--ember); }
.fine { font-size: 1rem; color: var(--vellum-dim); }
.tools { list-style: none; padding: 0; }
.tools li { margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--rule); }

/* ---------- troubleshooting and asides ---------- */
.trouble { margin-top: 2.6rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.trouble:first-of-type { margin-top: 1.5rem; padding-top: 0; border-top: 0; }
.trouble h2, .aside-block h2 { margin-top: 0; }
.symptom { padding: .7rem 1rem; color: var(--vellum); background: var(--panel); border-left: 3px solid var(--blood); border-radius: 0 var(--r-small) var(--r-small) 0; }
.causes li::marker { font-weight: 700; color: var(--ember); }
.aside-block { margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); }

/* ---------- previous / next ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.2rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); }
.pager__link { display: block; padding: .9rem 1.15rem 1rem; color: var(--vellum); text-decoration: none; border: 1px solid var(--rule-strong); border-radius: var(--r-small); }
.pager__link:hover { color: var(--vellum); border-color: var(--ember); }
.pager__link--next { grid-column: 2; text-align: right; }
.pager__dir { display: block; font-size: .86rem; font-weight: 700; color: var(--muted); }
.pager__title { display: block; margin-top: .2rem; font: 600 1.35rem/1.2 var(--f-display); }

/* ---------- overview page ---------- */
.hero { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(2rem, 4.5vw, 4.5rem); align-items: center; padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: clamp(2rem, 4vw, 3.5rem); }
.hero__title { margin: 0; font: 700 clamp(3.6rem, 8vw, 6.9rem)/.84 var(--f-display); letter-spacing: -.004em; }
.hero__tagline { max-width: 38ch; margin: 1.35rem 0 0; font-size: clamp(1.12rem, 1.5vw, 1.3rem); font-style: italic; line-height: 1.45; color: var(--ember); }
.hero__lead { max-width: 56ch; margin: 1.1rem 0 0; color: var(--vellum-dim); }
.hero .btn-row { margin-top: 1.9rem; }
.hero__shot .shot { margin: 0; }
.hero__shot figcaption { font-size: .92rem; }
.section-title { margin: 0 0 .45rem; font: 600 clamp(1.9rem, 3.4vw, 2.5rem)/1.08 var(--f-display); letter-spacing: .005em; }
.section-lead { max-width: 62ch; margin: 0 0 1.4rem; color: var(--muted); }
.route { padding-top: clamp(2rem, 4vw, 3rem); padding-bottom: .5rem; }
.route__map { margin-top: .5rem; }
.route__arcs { display: block; width: 100%; height: auto; overflow: visible; }
.arc { fill: none; stroke: var(--ember); stroke-width: 2.2; stroke-linecap: round; opacity: .85; }
.impacts circle { fill: var(--night); stroke: var(--ember); stroke-width: 2.2; }
.route__parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 .5rem; list-style: none; margin: -.15rem 0 0; padding: 0; }
.route__part { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .35rem .75rem 1rem; text-align: center; color: var(--vellum); text-decoration: none; border-radius: var(--r-small); }
.route__part:hover { color: var(--vellum); background: var(--panel); }
.route__num { font: 700 2.5rem/1 var(--f-display); color: var(--ember); }
.route__name { font: 600 1.45rem/1.1 var(--f-display); }
.route__blurb { max-width: 26ch; font-size: 1rem; line-height: 1.45; color: var(--muted); }
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 4.5vw, 4.5rem); padding-top: clamp(2.5rem, 5vw, 3.75rem); }
.home-cols p { max-width: var(--measure); }
.systems { margin: 1rem 0 1.2rem; }
.systems > div { padding: .85rem 0 .9rem; border-top: 1px solid var(--rule); }
.systems dt { font: 600 1.4rem/1.15 var(--f-display); }
.systems dd { margin: .3rem 0 0; color: var(--vellum-dim); }
.facts { padding-top: clamp(2.5rem, 5vw, 3.75rem); padding-bottom: clamp(3rem, 6vw, 4.5rem); }
.facts-table { max-width: 980px; }
.facts-table th { width: 10rem; font-weight: 700; color: var(--muted); }

/* ---------- footer ---------- */
.colophon { font-size: .98rem; color: var(--muted); background: var(--night-deep); border-top: 1px solid var(--rule); }
.colophon__inner { max-width: 1320px; margin: 0 auto; padding: 2.3rem var(--gutter) 2.7rem; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2rem; }
.colophon p { max-width: 62ch; margin: 0 0 .55rem; }
.colophon__name { font: 700 1.5rem/1.1 var(--f-display); color: var(--vellum); }

/* ---------- full-size image viewer ---------- */
.lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; color: var(--vellum); background: rgba(9, 12, 17, .97); border: 0; overflow: hidden; }
.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lb::backdrop { background: rgba(9, 12, 17, .7); }
.lb__bar { display: flex; align-items: center; gap: .9rem; min-width: 0; padding: .55rem .75rem .55rem 1rem; background: var(--panel); border-bottom: 1px solid var(--rule-strong); }
.lb__caption { flex: 1 1 auto; min-width: 0; margin: 0; font-size: .95rem; color: var(--vellum-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb__meta { flex: none; font-size: .88rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb__actions { flex: none; display: flex; gap: .4rem; }
.lb__btn { display: inline-flex; align-items: center; min-height: 2.25rem; padding: .35rem .8rem; font: 700 .9rem/1 var(--f-text); color: var(--vellum); text-decoration: none; background: var(--panel-raised); border: 1px solid var(--rule-strong); border-radius: var(--r-button); cursor: pointer; }
.lb__btn:hover { color: var(--vellum); border-color: var(--ember); }
.lb__btn[hidden] { display: none; }
.lb__btn--close { color: var(--ember-ink); background: var(--ember); border-color: var(--ember); }
.lb__btn--close:hover { color: var(--ember-ink); background: var(--ember-hover); }
.lb__stage { position: relative; display: grid; grid-template-columns: minmax(100%, max-content); grid-template-rows: minmax(100%, max-content); overflow: auto; overscroll-behavior: contain; }
.lb__stage:focus-visible { outline-offset: -3px; }
.lb__img { display: block; max-width: none; margin: auto; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.lb.can-pan .lb__img { cursor: grab; }
.lb.can-pan .lb__stage.is-dragging .lb__img { cursor: grabbing; }
.lb.is-fit .lb__img { cursor: zoom-in; }
.lb.is-loading .lb__img { opacity: 0; }
.lb__nav { position: absolute; top: 50%; z-index: 2; width: 3rem; height: 4.5rem; display: grid; place-items: center; font: 400 2.4rem/1 var(--f-text); color: var(--vellum); background: rgba(26, 34, 48, .9); border: 1px solid var(--rule-strong); border-radius: var(--r-button); transform: translateY(-50%); cursor: pointer; }
.lb__nav:hover { color: var(--ember); border-color: var(--ember); }
.lb__nav--prev { left: .75rem; }
.lb__nav--next { right: .75rem; }
.lb__nav[hidden] { display: none; }

/* ---------- motion (one orchestrated moment: the route arcs) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .arc { stroke-dasharray: 1; stroke-dashoffset: 1; animation: arc-draw .75s cubic-bezier(.25, .1, .3, 1) forwards; }
  .arc--1 { animation-delay: .15s; }
  .arc--2 { animation-delay: .8s; }
  .arc--3 { animation-delay: 1.45s; }
  .impacts circle { transform-box: fill-box; transform-origin: center; animation: impact .5s ease-out both; }
  .impacts circle:nth-child(1) { animation-delay: .05s; }
  .impacts circle:nth-child(2) { animation-delay: .85s; }
  .impacts circle:nth-child(3) { animation-delay: 1.5s; }
  .impacts circle:nth-child(4) { animation-delay: 2.15s; }
}
@keyframes arc-draw { to { stroke-dashoffset: 0; } }
@keyframes impact { 0% { transform: scale(0); opacity: 0; } 55% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout--guide { grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: "rail rail" "main toc"; }
  .rail { position: static; margin-bottom: 2.2rem; }
  .rail__list { display: flex; justify-content: space-between; max-width: 820px; }
  .rail__list::before { left: 1.4rem; right: 1.4rem; top: 1.6rem; bottom: auto; width: auto; height: 1px; }
  .rail__item a { flex-direction: column; gap: .35rem; font-size: .95rem; text-align: center; }
}
@media (max-width: 1000px) {
  .hero, .home-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --header-h: 0rem; }
  html { scroll-padding-top: 1rem; }
  .masthead { position: static; }
  .masthead__inner { flex-wrap: wrap; row-gap: .35rem; }
  .mainnav { flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { padding: .42rem .7rem; font-size: .98rem; }
  .layout { padding-top: 1.8rem; }
  .layout--guide, .layout--doc { grid-template-columns: minmax(0, 1fr); }
  .layout--guide { grid-template-areas: "rail" "toc" "main"; }
  .layout--doc { grid-template-areas: "toc" "main"; }
  .toc { position: static; max-height: none; margin-bottom: 1.8rem; overflow: visible; }
  .toc ol { display: flex; gap: .4rem; padding-bottom: .35rem; overflow-x: auto; border: 0; scrollbar-width: thin; }
  .toc a { margin: 0; padding: .35rem .75rem; font-size: .92rem; white-space: nowrap; border: 1px solid var(--rule-strong); border-radius: 999px; }
  .toc a.is-active { border-color: var(--ember); }
}
@media (max-width: 760px) {
  .route__arcs { display: none; }
  .route__parts { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0 0 0 1.1rem; border-left: 1px solid var(--rule-strong); }
  .route__part { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .9rem; align-items: baseline; margin-left: -1.2rem; padding: .55rem .5rem .75rem 0; text-align: left; }
  .route__num { grid-row: span 2; font-size: 1.9rem; text-align: center; background: var(--night); }
  .route__blurb { grid-column: 2; max-width: none; }
  .colophon__inner { grid-template-columns: minmax(0, 1fr); }
  :is(table.settings, table.stack) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  :is(table.settings, table.stack), :is(table.settings, table.stack) :is(tbody, tr, th, td) { display: block; width: 100% !important; }
  :is(table.settings, table.stack) tr { margin-bottom: .8rem; padding: .45rem .85rem .6rem; border: 1px solid var(--rule); border-radius: var(--r-small); }
  :is(table.settings, table.stack) :is(th, td) { padding: .3rem 0; border: 0; white-space: normal !important; }
  :is(table.settings, table.stack) td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 700; color: var(--muted); }
  :is(table.settings, table.stack) tr.is-right, :is(table.settings, table.stack) tr.is-wrong { box-shadow: none; }
  table.stack tr.is-right { border-left: 3px solid var(--banner); }
  table.stack tr.is-wrong { border-left: 3px solid var(--blood); }
  table.stack tr > :first-child { box-shadow: none; }
  .lb__caption { display: none; }
  .lb__meta { margin-right: auto; }
  .lb__nav { width: 2.5rem; height: 3.5rem; }
}
@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .brand__name { font-size: 1.4rem; }
  .part-head { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .part-head__num { font-size: 4rem; }
  .step { margin-left: 1.15rem; padding-left: 1.9rem; }
  .step::before { left: -1.15rem; width: 2.3rem; height: 2.3rem; font-size: 1.3rem; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager__link--next { grid-column: auto; }
  .lb__btn { padding: .35rem .6rem; }
}

/* ---------- two mods ---------- */
.mods { padding-top: clamp(2rem, 4vw, 3rem); }
.modcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: clamp(1rem, 2.5vw, 2rem); }
.modcard { min-width: 0; padding: 1.3rem 1.4rem 1.2rem; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-small); }
.modcard__title { margin: 0; font: 600 clamp(1.7rem, 2.6vw, 2.1rem)/1.1 var(--f-display); }
.modcard__meta { margin: .35rem 0 .8rem; color: var(--muted); }
.modcard > p { max-width: var(--measure); }
.modcard .shot { margin: 1.1rem 0 .4rem; }
.modcard .btn-row { margin-bottom: 0; }
.modhead { margin: 1.6rem 0 .2rem; font: 600 1.45rem/1.15 var(--f-display); }
.modhead:first-of-type { margin-top: 1.1rem; }
.dl-mod { margin-top: 2.6rem; }
.contents td[data-label="Where it goes"] code { white-space: nowrap; }
.tag--mod-ai, .tag--mod-research { color: #0f1f10; background: var(--banner); border: 1px solid var(--banner); }
.tag--cfg-ai, .tag--cfg-research { color: var(--banner-text); border: 1px solid rgba(63, 174, 90, .6); }
.facts-table--two th[scope="row"] { width: 9rem; }
.facts-table--two thead th { color: var(--vellum); font-size: .95rem; white-space: normal; }
.pager__pair { grid-column: 2; display: grid; gap: .75rem; }
var { font-style: italic; font-family: var(--f-text); }
@media (max-width: 1180px) {
  :root { --header-h: 6.6rem; }
  .masthead__inner { flex-wrap: wrap; row-gap: .35rem; }
  .mainnav { flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
}
@media (max-width: 700px) {
  .brand__ver { display: none; }
}
@media (max-width: 560px) {
  .pager__pair { grid-column: auto; }
}

/* ---------- print ---------- */
@media print {
  :root { --night: #fff; --night-deep: #fff; --panel: #fff; --panel-raised: #fff; --vellum: #111; --vellum-dim: #222; --muted: #444; --rule: #ccc; --rule-strong: #999; --ember: #8a5a00; }
  .masthead, .rail, .toc, .pager, .skip, .shot__hint, .copy-btn, .lb { display: none !important; }
  .layout--guide, .layout--doc { display: block; }
}
