/* GripCue legal pages. Brand tokens ("Warm Precision", same as the app's
   src/constants/theme.ts and website/index.html): emerald accent, paper and
   ink neutrals, Hanken Grotesk. */
:root {
  --brand: #1E9160;
  --brand-dark: #167A50;   /* text links and buttons: 5.3:1 on white (WCAG AA) */
  --brand-deep: #116341;   /* hover */
  --brand-tint: #DEF1E8;
  --brand-tint-border: #B9DFCB;
  --text-primary: #221D17;
  --text-secondary: #4A4438;
  --text-muted: #6B6153;   /* deeper than the app's #847A6C so small text passes AA on paper */
  --border: #ECE5D9;
  --surface: #FFFFFF;
  --page-bg: #F6F2EB;
  --note-bg: #FBEAD1;
  --note-border: #EFC98F;
  --note-text: #6E3F0C;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: rgba(246,242,235,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; color: var(--text-primary); }
.brand:hover { text-decoration: none; }
.mark { width: 28px; height: 28px; display: block; }
.doc-nav { display: flex; gap: 0.25rem; overflow-x: auto; margin-left: auto; }
.doc-nav a { padding: 0.375rem 0.75rem; border-radius: 999px; font-size: 0.875rem; color: var(--text-secondary); white-space: nowrap; }
.doc-nav a:hover { background: var(--border); text-decoration: none; }
.doc-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; }

/* Layout */
.layout { max-width: 1040px; margin: 0 auto; padding: 2.5rem 1rem 4rem; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 3rem; align-items: start; }
.layout.single { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.doc { max-width: 720px; min-width: 0; }
.doc h1 { font-size: 2rem; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.875rem; color: var(--text-muted); padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.meta .sep { color: var(--text-muted); }
.doc h2 { font-size: 1.1875rem; font-weight: 700; margin: 2.25rem 0 0.75rem; line-height: 1.35; }
.doc p, .doc ul, .doc ol { margin-bottom: 1rem; color: var(--text-primary); }
.doc ul, .doc ol { padding-left: 1.5rem; }
.doc li { margin-bottom: 0.375rem; }
.crumb { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* Table of contents: sticky sidebar on desktop, collapsible block on mobile */
.toc { position: sticky; top: 88px; font-size: 0.875rem; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc-title { font-weight: 600; margin-bottom: 0.5rem; }
.toc ol, .toc-mobile ol { list-style: none; counter-reset: s; }
.toc li, .toc-mobile li { counter-increment: s; margin: 0; }
.toc a, .toc-mobile a { display: block; padding: 0.3rem 0.5rem; color: var(--text-secondary); border-left: 2px solid var(--border); }
.toc a::before, .toc-mobile a::before { content: counter(s) ". "; color: var(--text-muted); }
.toc a:hover, .toc-mobile a:hover { color: var(--brand-dark); border-left-color: var(--brand); text-decoration: none; }
.toc-mobile { display: none; }

/* Archived-version banner */
.banner { background: var(--note-bg); border: 1px solid var(--note-border); color: var(--note-text); border-radius: 10px; padding: 0.875rem 1rem; font-size: 0.9375rem; margin-bottom: 1.5rem; }
.banner.current { background: var(--brand-tint); border-color: var(--brand-tint-border); color: var(--brand-deep); }
.banner.current a { color: var(--brand-deep); }
.banner a { color: var(--note-text); text-decoration: underline; font-weight: 600; }

/* Version history */
.history { list-style: none; padding: 0 !important; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-top: 1.5rem; }
.history li { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); margin: 0 !important; }
.history li:last-child { border-bottom: 0; }
.history a { font-weight: 600; }
.badge { font-size: 0.75rem; font-weight: 600; background: var(--brand-tint); color: var(--brand-deep); padding: 0.125rem 0.5rem; border-radius: 999px; }
.range { font-size: 0.875rem; color: var(--text-muted); }

/* Subprocessor table */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; vertical-align: top; padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); background: var(--page-bg); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* Help pages (delete-account) */
.lead { font-size: 1.0625rem; color: var(--text-secondary); margin: 0.75rem 0 1.5rem !important; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.action { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.125rem; }
.action p { margin-bottom: 0.75rem; }
.action p:last-child { margin-bottom: 0; }
.action-label { font-weight: 700; }
.button { display: inline-block; background: var(--brand-dark); color: #fff; font-weight: 600; font-size: 0.9375rem; padding: 0.5rem 1rem; border-radius: 8px; }
.button:hover { background: var(--brand-deep); text-decoration: none; }

.fine { font-size: 0.9375rem; color: var(--text-secondary); margin-bottom: 0.5rem !important; }

/* Footer */
.foot { border-top: 1px solid var(--border); }
.foot-inner { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; font-size: 0.8125rem; color: var(--text-muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0.5rem; }

/* Mobile */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-top: 1.5rem; }
  .toc { display: none; }
  .toc-mobile { display: block; font-size: 0.9375rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem; }
  .toc-mobile summary { font-weight: 600; cursor: pointer; }
  .toc-mobile[open] summary { margin-bottom: 0.5rem; }
  .doc h1 { font-size: 1.625rem; }
  .actions { grid-template-columns: 1fr; }
  .doc-nav { margin-left: 0; width: 100%; }
  /* Table becomes stacked cards */
  .table-wrap { border: 0; background: none; }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 0.75rem; padding: 0.25rem 0; }
  td { border: 0; padding: 0.375rem 1rem; white-space: normal !important; }
  td::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
}

@media print {
  .top, .toc, .toc-mobile, .foot, .banner a { display: none; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
}
