/* Shared "Ink & Steel" theme for the secondary pages (legal, 404, patch notes).
   index.html inlines its own copy of the :root tokens below (single-request homepage);
   keep the two blocks in sync when a token changes.
   The @font-face declarations stay inline in each page so the fonts start
   loading before this file arrives. */
:root {
  --ink: #0a0706; --ink-2: #0c0908; --slab: #120e0d; --slab-live: #171110;
  --bone: #f2e8d5; --gold: #d9a13b; --gold-hi: #f7c960; --cta-ink: #140d08;
  --green: #7ec95f; --red: #c8322b; --discord: #5865f2;
  --text: var(--bone); --text-dim: rgba(242,232,213,0.72); --text-mid: rgba(242,232,213,0.6);
  --text-low: rgba(242,232,213,0.56);
  --rule: rgba(242,232,213,0.09); --rule-soft: rgba(242,232,213,0.07); --rule-strong: rgba(242,232,213,0.18);
  --shadow-hard: 5px 6px 0 rgba(0,0,0,0.5); --skew: -10deg;
  --font-disp: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --page-max: 1440px;
  --gutter: max(clamp(18px, 3.1vw, 44px), calc((100vw - var(--page-max)) / 2 + 44px));
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ink-2); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html, body { margin: 0; }
body {
  position: relative; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--ink-2); color: var(--text);
  font-family: var(--font-disp); font-weight: 600; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/ui/pat_asanoha_soft.png") 0 0 / 520px 520px repeat; opacity: 0.035;
}
a { color: var(--gold); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--gold-hi); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px 36px; flex-wrap: wrap;
  padding: 18px var(--gutter); border-bottom: 1px solid var(--rule);
}
.topbar-left { display: flex; align-items: center; gap: 36px; }
.brand { display: block; line-height: 0; }
.brand img { display: block; width: 118px; height: auto; }
.topnav { display: flex; align-items: center; gap: 28px; margin: 0; padding: 0; list-style: none; }
.topnav a {
  display: inline-block; padding: 6px 0 4px; border-bottom: 2px solid transparent;
  font-weight: 700; font-size: 12px; letter-spacing: 2.6px; text-transform: uppercase; line-height: 1;
  color: var(--text-low); text-decoration: none; transition: color 120ms ease;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--bone); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--gold); }
.topbar-note { font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: rgba(242,232,213,.58); }
@media (max-width: 720px) {
  .topbar-note { display: none; }
  .topbar-left { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 14px 18px; }
  .topnav { gap: 18px; }
  .topnav a { font-size: 11px; letter-spacing: 2.2px; }
}

/* Page head (kicker + headline + lead) */
.doc { flex: 1; position: relative; display: flex; flex-direction: column; }
.doc-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap;
  padding: clamp(36px, 4vw, 52px) var(--gutter) 34px;
}
.doc-head-copy { display: flex; flex-direction: column; gap: 10px; }
.kicker { margin: 0; font-weight: 700; font-size: 11px; letter-spacing: 3.4px; text-transform: uppercase; color: var(--gold); line-height: 1; }
.kicker.red { color: var(--red); }
h1 {
  margin: 0; font-weight: 900; font-size: clamp(42px, 5vw, 64px); line-height: 0.96;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--bone);
}
.updated { margin: 0; font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: rgba(242,232,213,.58); }
.lead { margin: 0; max-width: 520px; font-weight: 600; font-size: 15px; line-height: 1.5; color: rgba(242,232,213,.58); text-wrap: pretty; }

/* Documents: 680px measure inside the shared frame, sticky rail at right */
.doc-body { padding: 0 var(--gutter) 56px; display: flex; align-items: flex-start; justify-content: space-between; gap: 40px 64px; }
.doc-inner { flex: 1 1 auto; max-width: 680px; min-width: 0; }
.doc-inner > .intro { font-size: 18px; line-height: 1.6; color: rgba(242,232,213,.78); }
h2 {
  margin: 34px 0 10px; font-weight: 900; font-size: 22px; line-height: 1.1;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--bone);
}
h2[id] { scroll-margin-top: 28px; }
p, li { font-weight: 600; font-size: 15px; line-height: 1.65; color: rgba(242,232,213,.64); text-wrap: pretty; }
p { margin: 0 0 14px; }
strong { color: var(--text); font-weight: 700; }
ul { padding-left: 18px; margin: 10px 0 16px; }
li { margin: 6px 0; }
.card {
  margin: 22px 0; padding: 14px 0 4px; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong);
  font-size: 14px; color: var(--text-low);
}
.card p { font-size: 14px; }
.backrow { margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.backrow a, .link-gold { font-weight: 700; font-size: 12px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--gold); }
.backrow a:hover, .link-gold:hover { color: var(--gold-hi); text-decoration: none; }

/* Right rail ("On this page", numbers, help) */
.doc-side { flex: 0 0 300px; position: sticky; top: 28px; display: flex; flex-direction: column; gap: 30px; padding-top: 6px; }
.side-title { display: block; margin: 0 0 12px; font-weight: 700; font-size: 10px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--text-mid); }
.side-block { padding-top: 26px; border-top: 1px solid var(--rule); }
.side-block:first-child { padding-top: 0; border-top: 0; }
.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 5px 0 5px 12px; border-left: 2px solid rgba(242,232,213,.1);
  font-weight: 700; font-size: 13px; line-height: 1.3; letter-spacing: .3px; color: var(--text-mid); text-decoration: none;
  transition: color 120ms ease, border-color 120ms ease;
}
.toc a:hover, .toc a:focus-visible { color: var(--bone); border-left-color: rgba(242,232,213,.4); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--bone); border-left-color: var(--gold); }
.side-kv { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.side-kv li { margin: 0; padding: 7px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 13px; color: rgba(242,232,213,.66); }
.side-kv b { font-family: var(--font-mono); font-weight: 700; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: var(--bone); }
.side-note { margin: 10px 0 0; font-family: var(--font-mono); font-weight: 600; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: rgba(242,232,213,.42); }
.side-block p { font-size: 14px; line-height: 1.5; margin: 0 0 10px; }
@media (max-width: 960px) {
  .doc-body { flex-direction: column; }
  /* Rail dissolves: the table of contents leads, the other blocks follow the article */
  .doc-side { display: contents; }
  .doc-side .side-block:first-child { order: -1; border-top: 0; padding: 0 0 24px; border-bottom: 1px solid var(--rule-strong); }
  .doc-side .side-block { padding-top: 22px; }
  .toc { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
}

/* Buttons */
.btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 28px; border: 0; background: transparent; cursor: pointer;
  font: 900 16px/1 var(--font-disp); letter-spacing: 2.8px; text-transform: uppercase;
  color: var(--cta-ink); text-decoration: none; white-space: nowrap;
}
.btn:hover { color: var(--cta-ink); text-decoration: none; }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--gold); transform: skewX(var(--skew)); box-shadow: var(--shadow-hard); transition: background 120ms ease; }
.btn:hover::before, .btn:focus-visible::before { background: var(--gold-hi); }
.btn.ghost { color: var(--bone); }
.btn.ghost::before { background: transparent; border: 1px solid rgba(242,232,213,.5); box-shadow: none; }
.btn.ghost:hover, .btn.ghost:focus-visible { color: var(--gold-hi); }
.btn.ghost:hover::before, .btn.ghost:focus-visible::before { border-color: var(--gold-hi); }

/* 404 */
.lost { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; min-height: calc(100dvh - 78px); }
.lost::before {
  content: ""; position: absolute; left: calc(var(--gutter) + 420px); top: 50%; width: 640px; height: 640px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(200,50,43,.14), rgba(12,9,8,0) 70%); pointer-events: none;
}
.lost .kanji {
  position: absolute; left: calc(var(--gutter) + 420px); top: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-jp); font-weight: 700; font-size: clamp(180px, 30vw, 300px); line-height: 1;
  color: rgba(200,50,43,.12); pointer-events: none; user-select: none;
}
.lost-body { position: relative; box-sizing: content-box; margin: 0; padding: 40px var(--gutter) 60px; display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.lost h1 { font-size: clamp(44px, 7vw, 64px); }
.lost p { margin: 0; font-size: 16px; line-height: 1.5; color: rgba(242,232,213,.62); }
.lost .actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 14px; }
@media (max-width: 720px) {
  .lost::before, .lost .kanji { left: 70%; }
}

/* Patch notes */
.doc-head .lead { align-self: center; }
.pn { display: flex; align-items: flex-start; padding: 0 0 48px; }
.pn-side { flex: 0 0 calc(var(--gutter) + 172px); position: sticky; top: 24px; padding: 4px 24px 40px var(--gutter); display: flex; flex-direction: column; gap: 14px; }
.pn-side-title { font-weight: 700; font-size: 10px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--text-mid); }
.pn-side ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pn-side li { margin: 0; }
.pn-side a {
  display: flex; align-items: baseline; gap: 10px; padding: 2px 0 2px 12px; border-left: 2px solid rgba(242,232,213,.1); white-space: nowrap;
  color: var(--text-mid); text-decoration: none; transition: color 120ms ease, border-color 120ms ease;
}
.pn-side a b { font-family: var(--font-mono); font-weight: 700; font-size: 15px; line-height: 1.2; letter-spacing: 1px; }
.pn-side a small { font-weight: 600; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: rgba(242,232,213,.5); }
.pn-side a:hover, .pn-side a:focus-visible { color: var(--bone); border-left-color: rgba(242,232,213,.4); }
.pn-side a[aria-current="true"] { color: var(--bone); border-left-color: var(--gold); }
.pn-main { flex: 1; min-width: 0; padding: 0 var(--gutter) 0 0; display: flex; flex-direction: column; gap: 40px; }
.pn-status { margin: 0; font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: .6px; color: var(--text-mid); }
.pn-status.error { color: #f0a08a; }
.releases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 48px; }
.release { display: flex; flex-direction: column; gap: 4px; scroll-margin-top: 24px; }
.release-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--rule-strong);
}
.release-title { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.release-version { font-family: var(--font-mono); font-weight: 900; font-size: clamp(34px, 3.5vw, 46px); line-height: 1; letter-spacing: 2px; color: var(--bone); }
.release h2 { margin: 0; font-size: 26px; letter-spacing: 1px; line-height: 1; color: var(--gold); }
.release-meta { display: flex; align-items: center; gap: 14px; }
.release-date { font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: rgba(242,232,213,.62); }
.tag-live { padding: 5px 9px; background: var(--green); font-weight: 700; font-size: 10px; letter-spacing: 1.8px; line-height: 1; text-transform: uppercase; color: #0c1a0c; }
.release .summary { margin: 14px 0 6px; max-width: 900px; font-size: 18px; line-height: 1.5; color: rgba(242,232,213,.82); }
.changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.changes li {
  margin: 0; padding: 15px 0; border-bottom: 1px solid var(--rule-soft);
  display: grid; grid-template-columns: 68px minmax(180px, 300px) 1fr; align-items: baseline; gap: 18px;
  font-size: 14px; line-height: 1.5; color: rgba(242,232,213,.62);
}
.changes .n { font-family: var(--font-mono); font-weight: 700; font-size: 11px; letter-spacing: 1.4px; color: var(--gold); }
.changes .name { font-weight: 900; font-size: 15px; letter-spacing: 1px; line-height: 1.3; text-transform: uppercase; color: var(--bone); }
.changes li.plain { grid-template-columns: 68px 1fr; }
.changes li.plain .note { font-size: 15px; color: rgba(242,232,213,.74); }
.changes li.hidden { display: none; }
.release-more { align-self: flex-start; margin-top: 14px; padding: 0; border: 0; background: none; cursor: pointer; font-family: var(--font-disp); }
.release.older .release-head { padding-bottom: 12px; border-bottom-color: rgba(242,232,213,.14); }
.release.older .release-version { font-size: 32px; }
.release.older h2 { font-size: 20px; color: rgba(217,161,59,.85); }
.release.older .changes li { padding: 12px 0; }
.release.older .changes .name { font-size: 14px; color: rgba(242,232,213,.86); }
@media (max-width: 860px) {
  .pn { flex-direction: column; }
  .pn-side { position: static; flex: none; width: 100%; padding: 0 var(--gutter) 28px; }
  .pn-side ol { flex-direction: row; flex-wrap: wrap; gap: 10px 18px; }
  .pn-main { padding: 0 var(--gutter); }
  .release-head { align-items: flex-start; flex-direction: column; }
  .changes li, .changes li.plain { grid-template-columns: 40px 1fr; }
  .changes .note { grid-column: 2; }
}

/* Footer */
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
  padding: 24px var(--gutter) 30px; border-top: 1px solid var(--rule);
}
.foot-copy { font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-low); }
.foot-links { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.foot-links a { font-weight: 700; font-size: 11px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--text-mid); text-decoration: none; transition: color 120ms ease; }
.foot-links a:hover, .foot-links a:focus-visible { color: var(--gold-hi); text-decoration: none; }
.foot-quiet { flex-basis: 100%; margin: 0; font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: .4px; color: rgba(242,232,213,.5); }
.foot-quiet a { color: rgba(242,232,213,.7); }
.foot-quiet a:hover { color: var(--gold-hi); text-decoration: none; }
