:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #17171a;
  --surface2: #222226;
  --text: #f2f2ef;
  --copy: #d9d9d4;
  --muted: #86857e;
  --accent: #c6f24e;
  --border: rgba(242, 242, 239, 0.1);
  --accent-rgb: 198, 242, 78;
}

[data-theme="mono-light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface2: #eaecef;
  --text: #16181d;
  --copy: #383c44;
  --muted: #676c76;
  --accent: #73ac10;
  --border: rgba(18, 22, 30, 0.1);
  --accent-rgb: 115, 172, 16;
}

[data-theme="ink"] {
  --bg: #13151e;
  --surface: #1a1d29;
  --surface2: #232739;
  --text: #e9e8f2;
  --copy: #cbc9d8;
  --muted: #787ca0;
  --accent: #e0975c;
  --border: rgba(233, 232, 242, 0.09);
  --accent-rgb: 224, 151, 92;
}

[data-theme="paper"] {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface2: #ece7db;
  --text: #221f1a;
  --copy: #484238;
  --muted: #8b8574;
  --accent: #b5573a;
  --border: rgba(34, 31, 26, 0.1);
  --accent-rgb: 181, 87, 58;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 82%);
  opacity: 0.45;
}

body::after {
  content: "";
  position: fixed;
  z-index: -1;
  top: -20rem;
  left: 50%;
  width: 54rem;
  height: 40rem;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.09), transparent 68%);
  filter: blur(44px);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 0.8rem;
  transform: translateY(-150%);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.site-header-inner {
  width: min(100% - 2rem, 68rem);
  min-height: 4.25rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand:hover { text-decoration: none; }
.brand img { width: auto; height: 1.25rem; }
.logo-light { display: none; }
[data-theme="mono-light"] .logo-dark,
[data-theme="paper"] .logo-dark { display: none; }
[data-theme="mono-light"] .logo-light,
[data-theme="paper"] .logo-light { display: block; }

.page-label,
.kicker,
.updated,
.toc-title,
.legal-footer {
  font-family: "JetBrains Mono", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.not-found-shell {
  width: min(100% - 2rem, 46rem);
  margin: auto;
  padding: 3rem 0;
}
.not-found-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font: 0.7rem "JetBrains Mono", Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.not-found-status { display: flex; align-items: center; gap: 0.5rem; }
.not-found-status::before { content: ""; width: 0.45rem; height: 0.45rem; background: var(--accent); }
.not-found-content { padding: clamp(2rem, 7vw, 4.5rem); }
.not-found-code {
  margin: 0 0 1.25rem;
  color: var(--accent);
  font: 700 clamp(4rem, 16vw, 8rem)/0.8 "JetBrains Mono", Consolas, monospace;
  letter-spacing: -0.09em;
}
.not-found h1 { font-size: clamp(1.7rem, 5vw, 2.8rem); line-height: 1.05; letter-spacing: -0.045em; }
.not-found-copy { max-width: 33rem; margin: 1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.not-found-request {
  margin: 1.75rem 0 0;
  padding: 0.8rem 1rem;
  overflow: hidden;
  background: var(--surface2);
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font: 0.72rem/1.5 "JetBrains Mono", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.not-found-request strong { color: var(--text); font-weight: 400; }
.not-found-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.not-found-button {
  min-height: 2.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: 600 0.8rem "Space Grotesk", Inter, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.not-found-button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.not-found-button:hover { transform: translateY(-1px); border-color: var(--accent); text-decoration: none; }
.not-found-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page-label { color: var(--muted); font-size: 0.68rem; }

.legal-shell {
  width: min(100% - 2rem, 68rem);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) 0 5rem;
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.toc {
  position: sticky;
  top: 6.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}
.toc-title { margin: 0 0 0.8rem; color: var(--accent); font-size: 0.66rem; }
.toc a { display: block; padding: 0.3rem 0; color: var(--muted); font-size: 0.78rem; }
.toc a:hover { color: var(--text); text-decoration: none; }

.document {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}
.document::before,
.document::after {
  content: "";
  position: absolute;
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}
.document::before { top: 0.8rem; left: 0.8rem; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.document::after { right: 0.8rem; bottom: 0.8rem; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }

.document-head,
.document-body { padding: clamp(1.5rem, 5vw, 3.5rem); }
.document-head { border-bottom: 1px solid var(--border); }
.kicker { margin: 0 0 0.75rem; color: var(--accent); font-size: 0.68rem; }
h1 { margin: 0; font-size: clamp(2.25rem, 7vw, 4.25rem); line-height: 0.95; letter-spacing: -0.06em; }
.updated { margin: 1rem 0 0; color: var(--muted); font-size: 0.66rem; }
.lead { max-width: 43rem; margin: 1.6rem 0 0; color: var(--copy); font-size: 1rem; }

.document-body section + section { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
h2 { margin: 0 0 0.8rem; font-size: 1.15rem; letter-spacing: -0.025em; }
p, li { color: var(--copy); font-size: 0.94rem; }
p { margin: 0.8rem 0; }
ul { margin: 0.8rem 0; padding-left: 1.3rem; }
li { margin: 0.5rem 0; padding-left: 0.2rem; }
li::marker { color: var(--accent); }
strong { color: var(--text); }

.provider-card {
  margin: 1.25rem 0;
  padding: 1rem 1.2rem;
  background: var(--surface2);
  border-left: 2px solid var(--accent);
}
.provider-card ul { margin: 0; }

.document-actions {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.back { color: var(--text); font-weight: 700; }
.switch-page { color: var(--muted); font-size: 0.85rem; }

.legal-footer {
  width: min(100% - 2rem, 68rem);
  margin: 0 auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.62rem;
}

@media (max-width: 48rem) {
  .brand img { height: 1rem; }
  .legal-shell { grid-template-columns: 1fr; }
  .toc { display: none; }
  .page-label { display: none; }
  .document-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 32rem) {
  .not-found-actions { flex-direction: column; }
  .not-found-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
