:root {
  --bg: #07080A; --surface: #0E1014; --ivory: #EDEAE4; --stone: #98958E; --dim: #6B6862; --gold: #C6A76E;
  --line: rgba(237, 234, 228, 0.09); --line-strong: rgba(237, 234, 228, 0.2);
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 4.5vw, 56px);
  --pad-l: max(var(--gutter), env(safe-area-inset-left));
  --pad-r: max(var(--gutter), env(safe-area-inset-right));
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  background: var(--bg); color: var(--ivory); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scrollbar-color: #2A2C31 var(--bg); scrollbar-width: thin; scroll-padding-top: 96px;
}
::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #24262B; border-radius: 10px; border: 2px solid var(--bg); }
::selection { background: rgba(198, 167, 110, 0.32); }
body { background: var(--bg); font-size: 16px; line-height: 1.7; overflow-x: clip; min-height: 100vh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 70% 40% at 50% -10%, rgba(198, 167, 110, 0.06), transparent 70%); }
a { color: inherit; }
:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-left: var(--pad-l); padding-right: var(--pad-r); position: relative; z-index: 1; }

.site-header {
  position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top);
  background: rgba(7, 8, 10, 0.8); -webkit-backdrop-filter: saturate(140%) blur(18px); backdrop-filter: saturate(140%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.brand img { width: 30px; height: 30px; display: block; }
.brand span { font-size: 11.5px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase; white-space: nowrap; }
.back > span[aria-hidden] { margin-right: 8px; }
.back { display: inline-flex; align-items: center; gap: 0; min-height: 44px; font-size: 13.5px; color: var(--stone); text-decoration: none; transition: color .25s ease; white-space: nowrap; }
.back:hover { color: var(--ivory); }

main { flex: 1; }
.doc { max-width: 760px; padding: clamp(56px, 9vw, 120px) 0 clamp(72px, 10vw, 140px); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 20px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 6.4vw, 76px); line-height: 1.02; letter-spacing: -0.02em; margin-bottom: 20px; text-wrap: balance; }
.intro { font-size: clamp(16px, 1.4vw, 18px); font-weight: 300; color: var(--stone); max-width: 60ch; }
.updated { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.toc { margin-top: 40px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; columns: 2 260px; column-gap: 32px; list-style: none; }
.toc a { display: block; padding: 7px 0; font-size: 14px; color: var(--stone); text-decoration: none; }
.toc a:hover { color: var(--ivory); }
section.clause { padding-top: clamp(40px, 5vw, 56px); }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 32px); line-height: 1.15; margin-bottom: 14px; }
h2 .num { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--gold); margin-right: 12px; vertical-align: 0.35em; }
.doc p, .doc li { font-size: 15.5px; font-weight: 300; color: var(--stone); max-width: 68ch; }
.doc p + p { margin-top: 14px; }
.doc strong { color: var(--ivory); font-weight: 400; }
.doc ul { margin-top: 12px; padding-left: 0; list-style: none; }
.doc ul li { position: relative; padding-left: 22px; margin-top: 10px; }
.doc ul li::before { content: ""; position: absolute; left: 2px; top: 0.8em; width: 8px; height: 1px; background: var(--gold); }
.doc a { color: var(--ivory); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; overflow-wrap: anywhere; }
.doc a:hover { text-decoration-color: var(--gold); }
.doc .toc li { padding-left: 0; margin-top: 0; break-inside: avoid; }
.doc .toc li::before { content: none; }
.doc .toc a { color: var(--stone); text-decoration: none; min-height: 40px; display: flex; align-items: center; }
.doc .toc a:hover { color: var(--ivory); }

.site-footer { border-top: 1px solid var(--line); padding: 36px 0 calc(40px + env(safe-area-inset-bottom)); position: relative; z-index: 1; }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px; }
.foot span, .foot a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.foot nav a { padding: 12px 0; display: inline-block; transition: color .25s ease; }
.foot nav a:hover, .foot nav a[aria-current="page"] { color: var(--ivory); }

/* 404 */
.lost { min-height: calc(100svh - 64px - 120px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 72px 0; }
.lost img { width: 64px; height: 64px; margin-bottom: 36px; }
.lost .intro { margin-bottom: 36px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 14px 26px; border-radius: 999px;
  background: var(--ivory); color: #07080A; border: 1px solid var(--ivory); font-size: 14.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: transform .35s var(--ease), background-color .25s ease;
}
.btn:hover { background: #fff; transform: translateY(-2px); }

@media (max-width: 380px) {
  .brand span { font-size: 10.5px; letter-spacing: 0.22em; }
  .brand img { width: 26px; height: 26px; }
  .brand { gap: 9px; }
}
@media (max-width: 340px) { .back .long { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
