/* ─────────────────────────────────────────────────────────────────────────────
   Legal pages — Read mode.
   A long document nobody wants to read is read anyway when it goes wrong, so
   this optimises for finding a clause: a real measure, visible headings, and
   numbered sections that can be cited.
   ──────────────────────────────────────────────────────────────────────────── */

.lg {
  --lg-muted: #64748B;
  --lg-ink: #0369A1;
  margin: 0;
  background: var(--crm-card-bg);
  color: var(--crm-text);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
.lg *, .lg *::before, .lg *::after { box-sizing: border-box; }

.lg-shell { width: min(820px, 100% - 40px); margin-inline: auto; }

.lg-head {
  border-bottom: 1px solid var(--crm-border);
  background: var(--crm-card-bg);
  position: sticky; top: 0; z-index: 20;
}
.lg-head-in { display: flex; align-items: center; gap: 16px; height: 62px; }
.lg-mark {
  font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  color: var(--crm-text); text-decoration: none;
}
.lg-mark span { color: var(--lg-ink); }
.lg-head nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
.lg-head nav a, .lg-foot nav a {
  font-size: 13.5px; color: var(--crm-text-secondary); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.lg-head nav a:hover, .lg-foot nav a:hover { color: var(--lg-ink); }

/* ── Document ──────────────────────────────────────────────────────────── */

.lg-doc { padding: 44px 0 72px; }

.lg-doc h1 {
  font-family: Archivo, Inter, sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.08;
  margin: 0 0 10px; text-wrap: balance;
}
.lg-meta {
  margin: 0 0 8px; font-size: 13.5px; color: var(--lg-muted);
  display: flex; flex-wrap: wrap; gap: 6px 18px;
}
.lg-lede {
  margin: 22px 0 0; font-size: 1.05rem; line-height: 1.65;
  color: var(--crm-text-secondary);
}

/* A standing warning is not decoration: these documents are drafts until a
   lawyer in each jurisdiction has read them. */
.lg-draft {
  margin: 26px 0 0; padding: 16px 18px;
  border: 1px solid var(--crm-warning);
  border-radius: var(--radius-md);
  background: #FFFBEB;
  font-size: 13.5px; line-height: 1.6; color: #713F12;
}
.lg-draft b { display: block; margin-bottom: 4px; }

.lg-doc h2 {
  font-family: Archivo, Inter, sans-serif;
  font-size: 1.32rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 52px 0 14px; padding-top: 22px;
  border-top: 1px solid var(--crm-border);
  scroll-margin-top: 78px;
}
.lg-doc h3 {
  font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em;
  margin: 30px 0 8px;
}
.lg-doc p, .lg-doc li {
  font-size: 15px; line-height: 1.72; color: var(--crm-text-secondary);
  max-width: 72ch;
}
.lg-doc p { margin: 0 0 14px; }
.lg-doc strong { color: var(--crm-text); font-weight: 600; }
.lg-doc ul, .lg-doc ol { margin: 0 0 16px; padding-left: 22px; }
.lg-doc li { margin-bottom: 7px; }
.lg-doc a { color: var(--lg-ink); }

.lg-doc code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; background: var(--crm-raised-bg);
  padding: 1px 5px; border-radius: 4px; color: var(--crm-text);
}

/* Fill-in markers a human must replace before this is published. */
.lg-todo {
  background: #FEF3C7; color: #713F12;
  padding: 1px 6px; border-radius: 4px;
  font-weight: 600; font-size: 0.92em;
  border: 1px dashed #D97706;
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.lg-table {
  width: 100%; border-collapse: collapse; margin: 0 0 20px;
  font-size: 14px;
}
.lg-table th, .lg-table td {
  text-align: left; vertical-align: top;
  padding: 10px 12px; border: 1px solid var(--crm-border);
  line-height: 1.55;
}
.lg-table th {
  background: var(--crm-raised-bg);
  font-weight: 600; font-size: 13px; color: var(--crm-text);
}
.lg-table td { color: var(--crm-text-secondary); }
.lg-table-wrap { overflow-x: auto; }

/* ── In short ──────────────────────────────────────────────────────────────
   The security page answers the owner's questions before the detail. A
   definition list rather than cards: each question and its answer share one
   row, so the page still reads top to bottom as a document. */

.lg-brief { margin: 34px 0 0; border-top: 2px solid var(--crm-text); }
.lg-brief > div {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 6px 32px; padding: 20px 0;
  border-bottom: 1px solid var(--crm-border);
}
.lg-brief dt {
  font-family: Archivo, Inter, sans-serif;
  font-size: 1.06rem; font-weight: 700; letter-spacing: 0;
  line-height: 1.3; color: var(--crm-text); text-wrap: balance;
}
/* The list closes on its own hairline, so the first numbered section does not
   draw a second one fifty pixels further down. */
.lg-brief + h2 { border-top: 0; padding-top: 0; margin-top: 56px; }
.lg-brief dd {
  margin: 0; font-size: 15px; line-height: 1.7;
  color: var(--crm-text-secondary); max-width: 62ch;
}

/* ── Table of contents ─────────────────────────────────────────────────── */

.lg-toc {
  margin: 30px 0 0; padding: 18px 20px;
  background: var(--crm-raised-bg);
  border-radius: var(--radius-lg);
}
.lg-toc h2 {
  margin: 0 0 10px; padding: 0; border: none;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--lg-muted);
  font-family: Inter, sans-serif;
}
.lg-toc ol { margin: 0; padding-left: 20px; }
.lg-toc li { margin-bottom: 5px; font-size: 14px; }
.lg-toc a { color: var(--crm-text-secondary); text-decoration: none; }
.lg-toc a:hover { color: var(--lg-ink); text-decoration: underline; }

.lg-foot {
  border-top: 1px solid var(--crm-border);
  padding: 22px 0 40px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 13px; color: var(--lg-muted);
}
.lg-foot nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }

.lg a:focus-visible {
  outline: 2px solid var(--lg-ink); outline-offset: 3px; border-radius: 4px;
}

@media (max-width: 620px) {
  /* Four links and the mark do not fit one 350px row. A fixed-height sticky
     bar made them spill over the document and cover the heading an anchor had
     just scrolled to, so on a phone the bar stops following and the links take
     their own row under the mark. */
  .lg-head { position: static; }
  .lg-head-in { height: auto; flex-wrap: wrap; column-gap: 16px; padding: 8px 0 2px; }
  .lg-head nav { margin-left: 0; flex-basis: 100%; gap: 0 16px; }
  .lg-mark { white-space: nowrap; }
  .lg-doc h2 { margin-top: 40px; }
  .lg-brief > div { grid-template-columns: 1fr; gap: 4px; }
}
