/* ============================================================================
   Shared styling for the standalone legal documents (privacy.html, terms.html).
   Tokens mirror index.html / access.html so the pages read as the same site.
   Kept in one file — the two documents are long and must not drift apart.
   ========================================================================== */

:root {
  --ink: #060709;
  --paper: #f5f6f7;
  --muted: rgba(245, 246, 247, 0.62);
  --faint: rgba(245, 246, 247, 0.42);
  --line: rgba(245, 246, 247, 0.14);
  --line-soft: rgba(245, 246, 247, 0.08);
  --accent: #7CE29E;
  --serif: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --pad: clamp(1.25rem, 4vw, 3rem);
}
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* same restrained backdrop as the access page — content stays the focus */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(36,58,99,0.30) 0%, rgba(6,7,9,0) 55%),
    radial-gradient(90% 60% at 50% 120%, rgba(10,40,52,0.22) 0%, rgba(6,7,9,0) 60%);
  background-attachment: fixed;
}

/* ---------- chrome shared with the rest of the site ---------- */
header.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(1rem, 2.4vw, 1.6rem) var(--pad);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  font-family: var(--serif); font-weight: 500; font-size: 1.18rem;
  letter-spacing: 0.01em; display: inline-flex; align-items: center;
  gap: 0.55em; color: var(--paper); text-decoration: none;
}
.brand .mark {
  height: 1.55em; width: 1.55em; flex: 0 0 auto;
  background-image: url("agonic-mark.png");
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.brand .word { line-height: 1; }
.nav-back { color: var(--muted); text-decoration: none; font-size: 0.88rem; transition: color 0.25s ease; }
.nav-back:hover { color: var(--paper); }

footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem var(--pad);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.8rem; font-size: 0.8rem; color: var(--muted);
}
footer .brand { font-size: 1rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: center; }
.foot-links a { color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.foot-links a:hover { color: var(--paper); }
.foot-links a[aria-current="page"] { color: var(--paper); }

/* ---------- page shell: prose column + sticky contents rail ---------- */
main.legal {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) var(--pad) 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
}
@media (min-width: 1000px) {
  main.legal { grid-template-columns: 15.5rem minmax(0, 1fr); }
  .toc { order: -1; }
}

.doc-head { margin-bottom: 2.5rem; }
.doc-kicker {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 0.9rem;
}
.doc-head h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08;
  letter-spacing: -0.025em; margin-bottom: 1rem;
}
.doc-dates {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem;
  font-size: 0.84rem; color: var(--muted);
  padding-bottom: 1.6rem; border-bottom: 1px solid var(--line);
}
.doc-dates b { font-weight: 500; color: var(--paper); }

/* the plain-English preamble box */
.summary {
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(245,246,247,0.03);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  margin: 2rem 0 2.5rem;
}
.summary h2 {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint); font-weight: 400;
  margin-bottom: 1rem;
}
.summary ul { list-style: none; display: grid; gap: 0.7rem; }
.summary li { position: relative; padding-left: 1.4rem; font-size: 0.95rem; line-height: 1.6; color: var(--muted); }
.summary li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 0.42rem; height: 0.42rem; border-radius: 50%;
  background: var(--accent); opacity: 0.85;
}
.summary li b { color: var(--paper); font-weight: 500; }
.summary .caveat {
  margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line-soft);
  font-size: 0.86rem; line-height: 1.55; color: var(--faint);
}

/* ---------- table of contents ---------- */
.toc { font-size: 0.86rem; }
@media (min-width: 1000px) {
  .toc-inner { position: sticky; top: 2rem; max-height: calc(100vh - 4rem); overflow-y: auto; padding-right: 0.5rem; }
  .toc-inner::-webkit-scrollbar { width: 6px; }
  .toc-inner::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
}
.toc h2 {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint); font-weight: 400;
  margin-bottom: 1rem;
}
.toc ol { list-style: none; counter-reset: toc; display: grid; gap: 0.15rem; }
.toc li { counter-increment: toc; }
.toc a {
  display: block; padding: 0.34rem 0.5rem 0.34rem 2.1rem;
  color: var(--muted); text-decoration: none; line-height: 1.4;
  border-radius: 7px; position: relative;
  transition: color 0.18s ease, background 0.18s ease;
}
.toc a::before {
  content: counter(toc) ".";
  position: absolute; left: 0.5rem; top: 0.34rem;
  font-family: var(--mono); font-size: 0.72rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.toc a:hover { color: var(--paper); background: rgba(245,246,247,0.04); }

/* on narrow screens the TOC collapses into a disclosure */
.toc-toggle {
  display: none; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(245,246,247,0.03); color: var(--paper);
  font-family: var(--sans); font-size: 0.9rem; font-weight: 400;
  padding: 0.9em 1.1em; cursor: pointer;
}
@media (max-width: 999px) {
  .toc-toggle { display: block; }
  .toc-inner { display: none; padding-top: 1rem; }
  .toc[data-open="true"] .toc-inner { display: block; }
}

/* ---------- prose ---------- */
.doc-body { max-width: 74ch; }
.doc-body section { margin-bottom: 2.75rem; scroll-margin-top: 1.5rem; }
.doc-body h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.25rem, 2.6vw, 1.55rem); line-height: 1.25;
  letter-spacing: -0.015em; margin-bottom: 1rem;
  padding-top: 0.4rem;
}
.doc-body h2 .num {
  font-family: var(--mono); font-size: 0.8em; color: var(--faint);
  font-weight: 400; margin-right: 0.6em; font-variant-numeric: tabular-nums;
}
.doc-body h3 {
  font-family: var(--sans); font-weight: 500; font-size: 1rem;
  color: var(--paper); margin: 1.8rem 0 0.7rem; letter-spacing: 0.005em;
}
.doc-body p { font-size: 0.95rem; line-height: 1.68; color: var(--muted); margin-bottom: 1rem; }
.doc-body p:last-child, .doc-body ul:last-child, .doc-body ol:last-child { margin-bottom: 0; }
.doc-body b, .doc-body strong { color: var(--paper); font-weight: 500; }
.doc-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(124,226,158,0.3); }
.doc-body a:hover { border-bottom-color: var(--accent); }
.doc-body ul, .doc-body ol { margin: 0 0 1rem 0; padding-left: 1.35rem; display: grid; gap: 0.55rem; }
.doc-body li { font-size: 0.95rem; line-height: 1.62; color: var(--muted); }
.doc-body li::marker { color: var(--faint); }
.doc-body ul ul, .doc-body ol ol { margin: 0.55rem 0 0; }

/* defined terms and inline code-ish bits */
.doc-body .term { color: var(--paper); font-weight: 500; }
.doc-body code {
  font-family: var(--mono); font-size: 0.86em;
  background: rgba(245,246,247,0.06); border-radius: 5px; padding: 0.12em 0.4em;
  color: var(--paper);
}

/* callout for the clauses users most need to actually notice */
.notice {
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: 10px; background: rgba(124,226,158,0.045);
  padding: 1.05rem 1.2rem; margin: 1.4rem 0;
}
.notice p { margin-bottom: 0.7rem; }
.notice p:last-child { margin-bottom: 0; }
.notice .label {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 0.6rem;
}

/* legal-emphasis blocks (disclaimers, liability caps) — conventionally set apart */
.legalese {
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(245,246,247,0.025);
  padding: 1.05rem 1.2rem; margin: 1.2rem 0;
}
.legalese p { font-size: 0.88rem; line-height: 1.6; color: var(--faint); text-transform: uppercase; letter-spacing: 0.01em; }

/* ---------- tables (sub-processors, retention, CCPA categories) ---------- */
.table-wrap { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 0.875rem; }
thead th {
  text-align: left; font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--faint);
  font-weight: 400; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: rgba(245,246,247,0.025);
}
tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line-soft); color: var(--muted); line-height: 1.55; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--paper); font-weight: 400; }

/* ---------- back-to-top ---------- */
.to-top {
  display: inline-flex; align-items: center; gap: 0.4em;
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  width: 100%;
  font-size: 0.84rem; color: var(--muted); text-decoration: none;
  transition: color 0.2s ease;
}
.to-top:hover { color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; background-image: none; }
  header.nav, footer, .toc, .to-top { display: none; }
  main.legal { display: block; max-width: none; padding: 0; }
  .doc-body { max-width: none; }
  .doc-body p, .doc-body li, tbody td { color: #222; }
  .doc-body h2, .doc-body h3, .doc-body b { color: #000; }
  .summary, .notice, .legalese, .table-wrap { border-color: #bbb; background: none; }
  .doc-body a { color: #000; border-bottom: 0; }
  .doc-body section { break-inside: avoid-page; }
}
