/* ═══════════════════════════════════════════════════════════════════════════
   OwnHealth.FIT — Shared styles for /privacy and /terms legal pages
   Loaded by: privacy.html, terms.html (after marketing.css)

   Pattern: the legal pages use the marketing chrome (marketing.css variables,
   nav + footer) but lay out the document body differently — a 2-column grid
   with a sticky table of contents on the left and the article content on the
   right. Collapses to one column on mobile with an accordion TOC.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page wrapper ─────────────────────────────────────────────────────────── */
.legal-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  position: relative;
  z-index: 1;
}

/* ── Hero (title + last-updated) ─────────────────────────────────────────── */
.legal-hero {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.legal-hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: var(--text);
}
.legal-hero .last-updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0;
}
.legal-hero .legal-intro {
  margin-top: 18px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 720px;
}

/* ── Body grid: TOC + content ─────────────────────────────────────────────── */
.legal-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 56px;
  align-items: start;
}

/* ── Table of contents ────────────────────────────────────────────────────── */
.legal-toc {
  position: sticky;
  top: 88px;       /* clears sticky nav */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 18px 0 18px 14px;
  border-left: 1px solid var(--border);
}
.legal-toc-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.legal-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}
.legal-toc li {
  counter-increment: toc-counter;
  margin: 0;
}
.legal-toc a {
  display: block;
  padding: 6px 10px 6px 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.legal-toc a::before {
  content: counter(toc-counter) '.';
  display: inline-block;
  min-width: 22px;
  color: var(--text-dim, #6b7290);
  font-variant-numeric: tabular-nums;
}
.legal-toc a:hover {
  color: var(--text);
}
.legal-toc a.active {
  color: var(--accent-light, #6b74cc);
  border-left-color: var(--accent-light, #6b74cc);
  font-weight: 600;
}
.legal-toc a:focus-visible {
  outline: 2px solid var(--accent-light, #6b74cc);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Mobile: TOC becomes a collapsible accordion at the top of the page */
.legal-toc-toggle {
  display: none;
}
.legal-toc-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.legal-toc-toggle .chev { display: inline-block; transition: transform 0.15s; margin-right: 4px; }

/* ── Article content ──────────────────────────────────────────────────────── */
.legal-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 720px;
}
.legal-content section {
  padding-top: 14px;
  margin-bottom: 40px;
  scroll-margin-top: 88px; /* so anchor links don't hide under sticky nav */
}
.legal-content section:first-of-type { padding-top: 0; }
.legal-content h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 0 0 14px;
  color: var(--text);
}
.legal-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--text);
}
.legal-content p {
  margin: 0 0 16px;
  color: var(--text);
}
.legal-content p + p { margin-top: 0; }
.legal-content strong { font-weight: 700; color: var(--text); }
.legal-content em { font-style: italic; }
.legal-content a {
  color: var(--accent-light, #6b74cc);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.legal-content a:hover { color: var(--accent, #4c5199); }

.legal-content ul,
.legal-content ol {
  margin: 0 0 18px;
  padding-left: 26px;
}
.legal-content ul li,
.legal-content ol li {
  margin-bottom: 8px;
  padding-left: 4px;
}
.legal-content ul li::marker {
  color: var(--text-muted);
}

/* Highlighted blocks (e.g. medical disclaimer, reminder notices) */
.legal-content .legal-callout {
  background: rgba(76, 81, 153, 0.08);
  border-left: 3px solid var(--accent-light, #6b74cc);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 1rem;
  line-height: 1.7;
}
.legal-content .legal-callout.warn {
  background: rgba(224, 92, 92, 0.08);
  border-left-color: var(--danger, #e05c5c);
}
.legal-content .legal-callout p:last-child { margin-bottom: 0; }

/* Placeholder text (e.g. [LEGAL ENTITY NAME]) before counsel review */
.legal-content .legal-placeholder {
  background: rgba(240, 165, 0, 0.12);
  color: #f0a500;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
}

/* ── Footer CTA (Questions? ...) ──────────────────────────────────────────── */
.legal-footer-cta {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text-muted);
  text-align: center;
}
.legal-footer-cta a {
  color: var(--accent-light, #6b74cc);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .legal-page { padding: 36px 22px 64px; }
  .legal-body {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .legal-toc {
    position: static;
    max-height: none;
    padding: 12px 0;
    border-left: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .legal-toc-inner {
    display: none;
  }
  .legal-toc.open .legal-toc-inner {
    display: block;
    padding-top: 8px;
  }
  .legal-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 0;
    cursor: pointer;
  }
  .legal-toc-label { display: none; }
  .legal-toc a { font-size: 0.9rem; padding: 8px 10px; }
  .legal-content h2 { font-size: 1.4rem; }
  .legal-content { font-size: 1rem; }
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .lp-nav,
  .nav-mobile-overlay,
  .legal-toc,
  .lp-footer,
  .legal-footer-cta { display: none !important; }
  .legal-page { padding: 0; max-width: 100%; }
  .legal-body { display: block; }
  .legal-content {
    color: #000;
    font-size: 11pt;
    max-width: 100%;
  }
  .legal-content h2 { font-size: 14pt; color: #000; page-break-after: avoid; }
  .legal-content h3 { font-size: 12pt; color: #000; page-break-after: avoid; }
  .legal-content a { color: #000; text-decoration: none; }
  .legal-content section { page-break-inside: avoid; }
  .legal-hero { border-bottom: 1px solid #000; margin-bottom: 20pt; }
  .legal-hero h1 { color: #000; }
  .legal-content .legal-callout { border: 1pt solid #666; background: transparent; }
}
