@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@500;600;700&family=Lato:wght@300;400;700&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --muted: #475569;
  --border: #E2E8F0;
  --primary: #1E3A8A;
  --primary-hover: #1E40AF;
  --accent: #B45309;
  --accent-hover: #92400E;
  --accent-ink: #FFFFFF;
  --focus-ring: #1E3A8A;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220;
    --surface: #111827;
    --surface-2: #0F172A;
    --text: #F1F5F9;
    --muted: #94A3B8;
    --border: #1F2937;
    --primary: #7EA6F0;
    --primary-hover: #A9C4F5;
    --accent: #F5A524;
    --accent-hover: #FBBF24;
    --accent-ink: #1A1200;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #111827;
  --surface-2: #0F172A;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --border: #1F2937;
  --primary: #7EA6F0;
  --primary-hover: #A9C4F5;
  --accent: #F5A524;
  --accent-hover: #FBBF24;
  --accent-ink: #1A1200;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  transition: background-color 200ms ease, color 200ms ease;
}

h1, h2, h3 {
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
a:hover { color: var(--primary-hover); }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

svg { display: block; }

/* ── Skip link (a11y) ──────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  z-index: 100;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}

header.site .inner {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}
.brand span { color: var(--accent); }

nav.top {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav.top a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  transition: background-color 150ms ease, color 150ms ease;
}
nav.top a:hover { color: var(--text); background: var(--surface-2); }
nav.top a.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  nav.top {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    box-shadow: var(--shadow);
    display: none;
  }
  nav.top.open { display: flex; }
  nav.top a { padding: 12px 14px; }
}

/* ── Hero (index) ──────────────────────────────────────────────────────── */
.hero {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 88px 24px 64px;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}

.hero h1 { font-size: clamp(30px, 5vw, 42px); margin: 0 0 16px; }
.hero p.lead { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 36px; }

.links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 56px; }

.links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
  cursor: pointer;
}

.links a.primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: var(--shadow);
}
.links a.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); transform: translateY(-1px); }

.links a.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.links a.secondary:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

/* Trust badge row */
.trust-row {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 96px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.trust-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: left;
  box-shadow: var(--shadow);
}

.trust-card .icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.trust-card h3 { font-size: 15.5px; margin: 0 0 6px; font-family: 'Lato', sans-serif; font-weight: 700; }
.trust-card p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.55; }

@media (max-width: 720px) {
  .trust-row { grid-template-columns: 1fr; }
}

/* ── Document layout (privacy / terms) ────────────────────────────────── */
.doc {
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 24px 100px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

@media (max-width: 900px) {
  .doc { grid-template-columns: 1fr; gap: 24px; }
}

/* Table of contents */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.toc li { margin: 0; }

.toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: color 150ms ease, border-color 150ms ease;
}

.toc a:hover { color: var(--text); }
.toc a.active { color: var(--primary); border-left-color: var(--primary); }

.toc-mobile { display: none; }

@media (max-width: 900px) {
  .toc-desktop { display: none; }
  .toc-mobile {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 16px;
  }
  .toc-mobile summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 0;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile .toc { position: static; padding-bottom: 12px; }
}

/* Document body */
.doc-body h1 { font-size: 32px; margin: 0 0 6px; }
.doc-body .updated {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-body > p { max-width: 68ch; }

.doc-body h2 {
  font-size: 20px;
  margin: 44px 0 14px;
  padding-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 16px);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.doc-body h2 .num {
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 2px 9px;
  border-radius: 999px;
  flex: none;
}

.doc-body p, .doc-body li { max-width: 68ch; color: var(--text); font-size: 15.5px; }
.doc-body ul { padding-left: 22px; }
.doc-body li { margin-bottom: 8px; }
.doc-body code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13.5px;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 20px 0;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
}
.callout .icon { color: var(--primary); flex: none; margin-top: 2px; }
.callout p { margin: 0; max-width: none; }
.callout.warn { border-left-color: var(--accent); }
.callout.warn .icon { color: var(--accent); }

.contact-card {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.contact-card h2 { margin-top: 0; }
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer.site {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
}
footer.site .inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13.5px;
}
footer.site a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
}
footer.site a:hover { color: var(--primary); }

/* ── Back to top ───────────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
  z-index: 30;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-hover); }

/* ── Print ─────────────────────────────────────────────────────────────── */
@media print {
  header.site, .back-to-top, .toc-desktop, .toc-mobile, footer.site .links, .nav-toggle { display: none !important; }
  .doc { grid-template-columns: 1fr; padding: 0; }
  body { background: #fff; color: #000; }
}
