@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/SpaceGrotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #12161d;
  --surface-raised: #171c25;
  --border: rgba(247, 245, 240, 0.1);
  --border-strong: rgba(247, 245, 240, 0.18);
  --text: #f7f5f0;
  --text-secondary: #c4c9d2;
  --text-muted: #8c94a2;
  --iris: #8b96ff;
  --iris-soft: rgba(108, 124, 255, 0.14);
  --code-bg: #0a0d12;
  --font-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f7f5f0;
    --surface: #fffefa;
    --surface-raised: #ffffff;
    --border: rgba(14, 17, 22, 0.1);
    --border-strong: rgba(14, 17, 22, 0.18);
    --text: #0e1116;
    --text-secondary: #3e4652;
    --text-muted: #6c7481;
    --iris: #4f5fe8;
    --iris-soft: rgba(82, 100, 255, 0.1);
    --code-bg: #f1eee7;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: var(--border);
}

html {
  min-width: 320px;
  background: var(--bg);
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--iris);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 20;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--iris);
  color: #0e1116;
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  transform: translateY(0);
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 64px;
}

.brand {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  font-weight: 500;
}

.top-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--text);
}

.top-nav .lang {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--text-secondary);
}

.page {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 96px;
}

.page-head {
  max-width: 760px;
  margin-bottom: 44px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--iris);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.lede {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.55;
}

.updated {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.page-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 92px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.toc-title {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toc ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: flex;
  gap: 10px;
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
}

.toc a:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.toc a span {
  color: var(--iris);
  font-family: var(--font-mono);
  font-size: 10px;
  padding-top: 1px;
}

.toc-contact {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.toc-contact p {
  margin: 0 0 6px;
}

.legal-body {
  min-width: 0;
  max-width: 720px;
}

.legal-section {
  padding: 0 0 28px;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 92px;
}

.legal-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h3 {
  margin: 24px 0 10px;
  font-size: 17px;
  font-weight: 600;
}

p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--text-secondary);
}

li {
  margin: 0 0 8px;
  padding-left: 4px;
}

li::marker {
  color: var(--iris);
}

strong {
  color: var(--text);
  font-weight: 600;
}

code {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--code-bg);
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-raised);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

td {
  color: var(--text-secondary);
}

.legal-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-index li {
  margin: 0;
  padding: 0;
}

.legal-index a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 20px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.legal-index a:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  transform: translateY(-1px);
}

.card-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.card-desc {
  grid-column: 1 / 2;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.card-arrow {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--iris);
  font-size: 20px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 44px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer-inner p {
  margin: 0 0 6px;
  color: var(--text-muted);
}

.footer-brand {
  color: var(--text) !important;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.footer-copy {
  margin-top: 18px !important;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

@media (max-width: 860px) {
  .page-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .toc {
    position: static;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 16px;
  }

  .toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legal-index {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .header-inner,
  .page,
  .footer-inner {
    width: min(100% - 28px, 1080px);
  }

  .page {
    padding-top: 36px;
  }

  .top-nav {
    gap: 10px;
  }

  .top-nav a:not(.lang) {
    display: none;
  }

  .toc ol {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 21px;
  }

  .legal-section {
    padding-bottom: 22px;
    margin-bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --text: #000000;
    --text-secondary: #1a1a1a;
    --text-muted: #444444;
    --border: #cccccc;
    --iris: #000000;
    --code-bg: #f4f4f4;
  }

  .site-header,
  .toc-contact,
  .site-footer,
  .skip {
    display: none !important;
  }

  .page {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .page-grid {
    display: block;
  }

  .toc {
    position: static;
    border: 0;
    padding: 0 0 20px;
  }

  .legal-body {
    max-width: none;
  }

  .legal-section {
    break-inside: avoid;
  }

  a {
    color: #000000;
  }
}
