/* ===================================================
   TaskMasters — legal pages (Privacy Policy, Terms of Service,
   CostMaster Terms) · v2 Quiet Ledger. Layout: assets/Components/legal-page.php.
   A navy title band, then a sticky "On this page" list beside a single
   readable column of text.
   =================================================== */

.tm-legal-page {
  /* Same frame as the nav (navbar.css .tm-nav__container: 1440px wide,
     --nav-px side padding), so the page lines up with the logo on the left
     and the Login button on the right. */
  --tm-legal-px: clamp(16px, 3.5vw, 56px);
  background: var(--tm-cream);
  color: var(--tm-ink-700);
  /* Bootstrap resets the body font on v2 pages — re-assert Inter. */
  font-family: var(--tm-font-body);
}

.tm-legal-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--tm-legal-px);
}

/* ── Title band ── */
.tm-legal-hero {
  background: var(--tm-navy);
  /* The nav is sticky and already takes its own space above this band. */
  padding: 56px 0;
}

.tm-legal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 20px;
  font-size: 0.82rem;
}

.tm-legal-breadcrumb a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 150ms ease;
}

.tm-legal-breadcrumb a:hover { color: rgba(255, 255, 255, 0.9); }
.tm-legal-breadcrumb .bi { font-size: 0.62rem; color: rgba(255, 255, 255, 0.3); }
.tm-legal-breadcrumb span { color: rgba(255, 255, 255, 0.75); }

.tm-legal-hero__heading {
  margin: 0 0 12px;
  color: var(--tm-cream);
  font-family: var(--tm-font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.tm-legal-hero__meta {
  margin: 0;
  color: rgba(250, 250, 245, 0.65);
  font-size: 0.9rem;
}

/* ── Contents + text ── */
.tm-legal-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 64px;
  padding-top: 56px;
  padding-bottom: 96px;
}

.tm-legal-toc {
  position: sticky;
  top: calc(var(--tm-nav-h, 72px) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--tm-nav-h, 72px) - 48px);
  overflow-y: auto;
}

.tm-legal-toc__title {
  margin: 0 0 12px;
  color: var(--tm-ink-500);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tm-legal-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--tm-line-200);
}

.tm-legal-toc a {
  display: block;
  margin-left: -2px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid transparent;
  color: var(--tm-ink-700);
  font-size: 0.86rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease;
}

.tm-legal-toc a:hover { color: var(--tm-navy); border-left-color: var(--tm-line-300); }

/* The section the reader is in (legal-page.php's scroll script). */
.tm-legal-toc a.is-active {
  color: var(--tm-navy);
  font-weight: 600;
  border-left-color: var(--tm-emerald);
}

.tm-legal-body {
  font-size: 1rem;
  line-height: 1.7;
}

.tm-legal-body p { margin: 0 0 16px; }

.tm-legal-body a { color: var(--tm-emerald-deep); text-decoration: underline; text-underline-offset: 2px; }
.tm-legal-body a:hover { color: var(--tm-navy); }

.tm-legal-body ul,
.tm-legal-body ol { margin: 0 0 16px; padding-left: 1.3rem; }
.tm-legal-body li { margin-bottom: 6px; }

.tm-legal-body strong { color: var(--tm-navy); }

.tm-legal-section {
  /* Clear the fixed nav when jumped to from the contents list. */
  scroll-margin-top: calc(var(--tm-nav-h, 72px) + 24px);
  padding-top: 32px;
}

.tm-legal-section h2 {
  margin: 0 0 14px;
  color: var(--tm-navy);
  font-family: var(--tm-font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
}

.tm-legal-body table {
  width: 100%;
  margin: 0 0 20px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

.tm-legal-body th,
.tm-legal-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--tm-line-200);
  text-align: left;
  vertical-align: top;
}

.tm-legal-body th {
  background: var(--tm-warm);
  color: var(--tm-navy);
  font-weight: 600;
}

.tm-legal-table-wrap { overflow-x: auto; }

/* Draft notice + placeholders still to fill in */
.tm-legal-draft {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 28px !important;
  padding: 14px 16px;
  border: 1px solid var(--tm-gold-soft);
  border-radius: var(--tm-radius-md);
  background: #FBF6E9;
  color: #6B5317;
  font-size: 0.9rem;
  line-height: 1.5;
}

.tm-legal-draft strong { color: #6B5317; }

mark.tm-legal-todo {
  padding: 0 3px;
  border-radius: 3px;
  background: #F9EEDA;
  color: #7A5A00;
  font-weight: 600;
}

@media (max-width: 900px) {
  .tm-legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 32px;
  }

  .tm-legal-toc {
    position: static;
    max-height: none;
    padding: 16px 18px;
    border: 1px solid var(--tm-line-200);
    border-radius: var(--tm-radius-md);
    background: #fff;
  }
}

/* Printing / Save as PDF: keep the navy band and highlights, and let the
   contents list sit normally instead of sticking. */
@media print {
  .tm-legal-page { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tm-legal-toc { position: static; max-height: none; overflow: visible; }
  .tm-legal-section { break-inside: auto; }
  .tm-legal-section h2 { break-after: avoid; }
  .tm-legal-body tr { break-inside: avoid; }
}

@media (max-width: 600px) {
  .tm-legal-page { --tm-legal-px: 16px; }
  .tm-legal-hero { padding-bottom: 40px; }
}
