/* ============================================================
   legal.css — shared styles for /legal-*.html and /waiver.html
   Uses Vitrapep tokens (tokens.css?v=4) and the .lg-* prefix
   for page-local components. Light, readable, single-column
   reading layout with a sticky sidebar TOC on desktop and a
   top-of-page anchor list on mobile.
   ============================================================ */

.lg-page {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: clip;
}
.lg-nav-rule {
  border: 0;
  height: 1px;
  background: var(--hairline);
  margin: 0;
}

/* ---------- Hero ---------- */
.lg-hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 40px 36px;
  box-sizing: border-box;
}
.lg-hero__eyebrow {
  font-family: var(--font-meta);
  font-weight: 600; font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--slate-2);
  margin: 0 0 14px;
}
.lg-hero__h {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.2vw, 54px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 18px;
  max-width: 22ch;
  text-wrap: balance;
}
.lg-hero__meta {
  font-family: var(--font-meta);
  font-size: 13px;
  color: var(--slate-2);
  letter-spacing: 0.04em;
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.lg-hero__meta b { color: var(--ink); font-weight: 600; }

/* ---------- Grid: sticky sidebar TOC + content column ----------
   The content column uses `minmax(0, 1fr)` (not bare `1fr`) so wide
   children — GDPR/CCPA legal tables, callout boxes, code blocks —
   stay scrollable inside their own wrappers instead of pushing the
   whole page wider than the viewport on mobile. (CSS grid's default
   `auto` min-track expands the column to fit min-content of children,
   which broke horizontal layout on every legal page <980px.) */
.lg-grid {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 40px 96px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* Sidebar TOC — sticky on desktop, anchored to top of viewport
   below the chrome.js floating .sp-pill nav (which sits at the top
   of the page when the user scrolls down). Bumped down to 96px so
   the TOC's top edge clears the pill instead of being covered. */
.lg-toc {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 0;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.lg-toc__lbl {
  font-family: var(--font-meta);
  font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--slate-2);
  margin: 0 0 10px;
}
.lg-toc__group {
  font-family: var(--font-meta);
  font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--slate-2);
  margin: 16px 0 6px;
}

/* .lg-toc__part <details>/<summary> accordion styles live in
   styles/accordion.css (sitewide dotted-list pattern). First part
   is still rendered with [open] in the HTML so the user lands with
   at least one part visible. */
.lg-toc__link {
  display: block;
  padding: 6px 10px;
  color: var(--slate);
  text-decoration: none;
  border-radius: 4px;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.lg-toc__link:hover { background: var(--surface); color: var(--ink); }
.lg-toc__link--sub {
  padding-left: 22px;
  font-size: 12.5px;
  color: var(--slate-2);
}

/* ---------- Content column ---------- */
.lg-content {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--slate);
}
/* scroll-margin-top matches the .lg-toc top offset so anchor-link
   jumps land below the floating .sp-pill nav with breathing room. */
.lg-content > * { scroll-margin-top: 100px; }
.lg-content p {
  margin: 0 0 18px;
}
.lg-content p:first-of-type { color: var(--ink); }
.lg-content strong, .lg-content b { color: var(--ink); font-weight: 600; }
.lg-content em, .lg-content i { color: var(--ink); font-style: italic; }
.lg-content a {
  color: var(--blurple);
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 107, 85, 0.35);
  transition: color .15s, border-color .15s;
}
.lg-content a:hover { color: var(--electric); border-bottom-color: var(--electric); }

.lg-content ul, .lg-content ol {
  margin: 0 0 22px;
  padding-left: 22px;
}
.lg-content li {
  margin: 0 0 8px;
  line-height: 1.65;
}
.lg-content li::marker { color: var(--slate-2); }

.lg-content hr {
  border: 0;
  height: 1px;
  background: var(--hairline);
  margin: 44px 0;
}

/* Headings */
.lg-h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.18;
  color: var(--ink);
  margin: 56px 0 18px;
  text-wrap: balance;
}
.lg-h2:first-child { margin-top: 0; }
.lg-h3 {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.9vw, 21px);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 36px 0 14px;
}
.lg-h4 {
  font-family: var(--font-meta);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 28px 0 10px;
  text-transform: uppercase;
}

/* "Part X — Title" major dividers (used in terms + privacy multi-part docs) */
.lg-part {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin: 80px 0 24px;
  padding-top: 32px;
  border-top: 2px solid var(--ink);
  scroll-margin-top: 100px;
}
.lg-part:first-of-type { margin-top: 0; }

/* ---------- Callout — ALL-CAPS legal warning boxes ---------- */
.lg-callout {
  background: var(--surface);
  border-left: 3px solid var(--blurple);
  border-radius: 0 4px 4px 0;
  padding: 22px 26px;
  margin: 28px 0;
}
.lg-callout p {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.005em;
}
.lg-callout p:last-child { margin-bottom: 0; }

/* ---------- Placeholder token — yellow highlight ----------
   Wraps things like [DATE], [Vitrapep US LLC], [Cayman company
   number]. Bright yellow so legal counsel can scan-find every
   token to fill in before launch. */
.lg-placeholder {
  background: #FFE15D;
  color: #6b4f00;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 500;
  letter-spacing: 0;
  /* Long sentence-style placeholders (e.g. "[Replace with actual
     processor list before launch]") need to wrap on mobile — keeping
     nowrap pushed them past the viewport edge and forced horizontal
     scroll on every legal page <500px wide. */
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- Tables (GDPR purpose/legal-basis matrices etc.) ---------- */
.lg-table-wrap {
  margin: 0 0 24px;
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  -webkit-overflow-scrolling: touch;
}
.lg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}
.lg-table th, .lg-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}
.lg-table thead th {
  background: var(--surface);
  font-family: var(--font-meta);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-2);
}
.lg-table tbody tr:last-child th,
.lg-table tbody tr:last-child td { border-bottom: 0; }
.lg-table td { color: var(--slate); }
.lg-table td strong, .lg-table th strong { color: var(--ink); font-weight: 600; }

/* ---------- Contact / closing block ---------- */
.lg-contact {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 24px 28px;
  margin: 48px 0 0;
}
.lg-contact h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 10px;
}
.lg-contact p { font-size: 14.5px; color: var(--slate); margin: 0 0 8px; }
.lg-contact p:last-child { margin-bottom: 0; }

/* ---------- Closing meta — "Effective: ... · Last updated: ..." ---------- */
.lg-meta-row {
  margin: 48px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-meta);
  font-size: 12.5px;
  color: var(--slate-2);
  letter-spacing: 0.04em;
}
.lg-meta-row b { color: var(--ink); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .lg-hero { padding: 40px 24px 24px; }
  .lg-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding: 8px 24px 64px;
  }
  .lg-toc {
    position: static;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    padding: 18px 0;
    max-height: none;
  }
  .lg-content { max-width: none; font-size: 15.5px; }
  .lg-callout { padding: 18px 20px; margin: 22px 0; }
  .lg-callout p { font-size: 13.5px; }
}
@media (max-width: 599px) {
  .lg-hero { padding: 32px 20px 20px; }
  .lg-grid { padding: 8px 20px 48px; }
  .lg-content p { margin: 0 0 14px; }
  .lg-h2 { margin: 40px 0 14px; }
  .lg-h3 { margin: 28px 0 12px; }
  .lg-part { margin: 56px 0 18px; padding-top: 24px; }
}
