:root {
  color-scheme: dark;
  --bg: #18110d;
  --panel: #291c16;
  --line: #3e2b22;
  --fg: #f5e6da;
  --body: #d8c8bc;
  --muted: #a8968a;
  --gold: #f8d770;
  --green: #58db71;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font: 16px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; }

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: #86ec98; }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

/* Header */
.site-header { background: var(--panel); border-bottom: 4px solid #000; }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; text-decoration: none; }
.brand img { image-rendering: pixelated; border-radius: 4px; }
.site-header nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 15px; }
.site-header nav a { color: var(--body); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--fg); border-bottom-color: var(--line); }
.site-header nav a[aria-current="page"] { color: var(--gold); border-bottom-color: var(--gold); }

/* Document pages */
main { flex: 1; padding-top: 40px; padding-bottom: 56px; }
h1 { margin: 0 0 4px; color: var(--gold); font-size: clamp(26px, 5vw, 34px); line-height: 1.25; }
h2 { margin: 0 0 12px; color: var(--gold); font-size: 20px; line-height: 1.35; }
.meta { margin: 0 0 28px; color: var(--muted); font-size: 14px; }

.toc { margin: 0 0 40px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.toc h2 { margin: 0 0 8px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 0; padding-left: 22px; columns: 2 260px; column-gap: 32px; font-size: 15px; line-height: 1.9; }
.toc li { break-inside: avoid; }

.doc section { padding: 28px 0 4px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.doc section > :last-child { margin-bottom: 24px; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 24px; }
.doc li { margin-bottom: 6px; }
.doc strong { color: var(--fg); }
.doc a { overflow-wrap: anywhere; }

/* Home */
.home { text-align: center; padding-top: 56px; }
.hero-icon { image-rendering: pixelated; border-radius: 8px; border: 4px solid #000; }
.home h1 { margin-top: 20px; }
.lead { margin: 8px auto 32px; max-width: 34em; font-size: 18px; }
.cards { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; text-align: left; }
.cards a { display: block; height: 100%; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--body); text-decoration: none; }
.cards a:hover { border-color: var(--gold); }
.cards strong { display: block; margin-bottom: 4px; color: var(--gold); font-size: 18px; }
.cards span { font-size: 15px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: 14px; }
.site-footer p { margin: 0 0 6px; }
.site-footer .fine { color: var(--muted); font-size: 13px; }

@media (max-width: 480px) {
  main { padding-top: 28px; }
  .toc ol { columns: 1; }
}
