/* Legal pages — shared stylesheet.
   Mirrors the Hero / TMS Gateway palette and typography. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

:root {
  --bg: #fafafa;
  --bg-2: #ffffff;
  --ink: #0a0a0a;
  --ink-0: #171717;
  --ink-1: #2a2a2a;
  --ink-2: #525252;
  --ink-3: #737373;
  --line: #e5e5e5;
  --line-2: #d4d4d4;
  --card: #ffffff;
  --accent: oklch(0.66 0.12 185);
  --accent-soft: oklch(0.94 0.04 185);
  --accent-ink: oklch(0.32 0.08 185);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --ink: #fafafa;
  --ink-0: #fafafa;
  --ink-1: #ededed;
  --ink-2: #a3a3a3;
  --ink-3: #8a8a8a;
  --line: #1f1f1f;
  --line-2: #2a2a2a;
  --card: #0f0f0f;
  color-scheme: dark;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01" on, "cv11" on;
}

/* ----- Nav ----- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 6px;
  border-radius: 3.5px;
  background: var(--bg);
}
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.nav-back:hover { color: var(--ink); background: var(--line); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-1);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease;
  padding: 0;
}
.theme-toggle:hover { background: var(--card); border-color: var(--line-2); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ----- Layout ----- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 28px 96px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  align-items: start;
}
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; gap: 36px; padding: 32px 22px 72px; }
}

/* ----- TOC ----- */
.toc {
  position: sticky;
  top: 96px;
  font-size: 13px;
}
.toc-lbl {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.toc li a {
  display: block;
  padding: 6px 12px;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.4;
  border-left: 1px solid transparent;
  margin-left: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.toc li a:hover { color: var(--ink); }
.toc li a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
@media (max-width: 900px) {
  .toc { position: static; display: none; }
}

/* ----- Other docs nav (mobile) ----- */
.doc-picker {
  display: none;
}
@media (max-width: 900px) {
  .doc-picker {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
  }
  .doc-picker a {
    font-size: 12px; padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    text-decoration: none;
  }
  .doc-picker a.current {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
  }
  html[data-theme="dark"] .doc-picker a.current {
    background: color-mix(in oklab, var(--accent) 18%, transparent);
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* ----- Related docs (desktop, in TOC) ----- */
.related {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.related .toc-lbl { margin-bottom: 8px; }
.related ul { list-style: none; padding: 0; margin: 0; border: none; }
.related li a {
  display: block;
  padding: 5px 0;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
}
.related li a:hover { color: var(--ink); }
.related li a.current { color: var(--ink); font-weight: 500; }

/* ----- Content ----- */
.content {
  max-width: 760px;
  min-width: 0;
}
.content .kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 14px;
}
html[data-theme="dark"] .content .kicker { color: var(--accent); }
.content h1 {
  font-size: clamp(34px, 4.5vw, 48px);
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0 0 14px;
  font-weight: 800;
}
.content .subtitle {
  font-size: 18px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 28px;
  max-width: 64ch;
}
.meta-row {
  display: flex;
  gap: 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 14px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}

.content h2 {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  font-weight: 700;
  color: var(--ink);
  scroll-margin-top: 96px;
}
.content h2:first-of-type { margin-top: 0; }
.content h3 {
  font-size: 16px;
  margin: 28px 0 10px;
  font-weight: 600;
  color: var(--ink-1);
}
.content h4 {
  font-size: 14px;
  margin: 20px 0 8px;
  font-weight: 600;
  color: var(--ink-1);
}
.content p {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-1);
  margin: 0 0 14px;
}
.content ul {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-1);
}
.content ul li {
  font-size: 15.5px;
  line-height: 1.7;
  margin-bottom: 6px;
}
.content ul li::marker { color: var(--ink-3); }
.content a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 50%, transparent);
  text-underline-offset: 2px;
}
html[data-theme="dark"] .content a { color: var(--accent); }

/* Page-end "last updated" and prev/next */
.page-end {
  margin-top: 60px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
}
.page-end .updated {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.page-end .contact a { color: var(--ink-1); text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 1px; font-size: 14px; }
.page-end .contact a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }
html[data-theme="dark"] .page-end .contact a:hover { color: var(--accent); }

/* ----- Footer ----- */
footer.site-foot {
  border-top: 1px solid var(--line);
  padding: 32px 28px;
  background: var(--bg-2);
}
html[data-theme="dark"] footer.site-foot { background: transparent; }
.foot-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.foot-inner .links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-inner .links a { color: var(--ink-2); text-decoration: none; }
.foot-inner .links a:hover { color: var(--ink); }
