/* Legal pages (privacy / terms) — layout helpers on top of styles.css tokens.
   WHY separate file: styles-sections.css is landing-only and already long;
   legal pages need TOC, data tables and a summary card the landing never uses. */

.legal-page {
  padding: 48px 0 80px;
}

.legal-page h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.03em;
}

.legal-meta {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--muted);
}

.legal-page h2 {
  margin: 40px 0 12px;
  font-size: 20px;
  letter-spacing: -0.02em;
  /* WHY: sticky header (~60px) would otherwise cover anchor targets from the TOC. */
  scroll-margin-top: 80px;
}

.legal-page h3 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.legal-page p,
.legal-page li,
.legal-page td,
.legal-page th {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.65;
}

.legal-page strong {
  color: var(--text);
  font-weight: 600;
}

.legal-page ul,
.legal-page ol {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

.legal-page li + li {
  margin-top: 4px;
}

.legal-page a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.legal-summary {
  margin: 0 0 28px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.legal-summary h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.legal-summary ul {
  margin: 0;
}

.legal-toc {
  margin: 0 0 8px;
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
}

.legal-toc p {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.legal-toc ol {
  margin: 0;
  columns: 2;
  column-gap: 32px;
}

.legal-toc li {
  font-size: 14px;
  break-inside: avoid;
}

.legal-toc a {
  text-decoration: none;
}

/* WHY wrapper scroll: a 3-column table cannot shrink below ~480px; scroll the
   table, never the page (no horizontal page scroll at 375px). */
.legal-table-wrap {
  margin: 12px 0 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.legal-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

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

.legal-table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-soft);
}

.legal-table tr:last-child td {
  border-bottom: 0;
}

.legal-requisites {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 15px;
  color: var(--muted);
}

.legal-requisites dt {
  color: var(--text);
}

.legal-requisites dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .legal-page {
    padding: 32px 0 56px;
  }

  .legal-toc ol {
    columns: 1;
  }

  .legal-requisites {
    grid-template-columns: 1fr;
  }

  .legal-requisites dd {
    margin-bottom: 6px;
  }

  /* WHY cards on phones: sideways-scrolling legal tables hide columns people must read. */
  .legal-table-wrap {
    overflow-x: visible;
    border: 0;
  }

  .legal-table {
    min-width: 0;
  }

  .legal-table thead {
    display: none;
  }

  .legal-table,
  .legal-table tbody,
  .legal-table tr,
  .legal-table td {
    display: block;
  }

  .legal-table tr {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .legal-table td {
    padding: 2px 0;
    border: 0;
  }

  .legal-table td:first-child {
    color: var(--text);
    font-weight: 600;
  }

  .legal-table td + td::before {
    content: attr(data-label) ": ";
    color: var(--text);
    font-weight: 500;
  }
}

@media print {
  .site-header,
  .site-footer,
  .legal-toc {
    display: none;
  }

  .legal-page p,
  .legal-page li,
  .legal-page td {
    color: #000;
  }
}

/* WHY: unfilled requisites must be impossible to miss before deploy
   (scripts/check-legal.sh fails while any remain). */
.legal-fill {
  background: #fff3c4;
  color: #7a4b00;
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 600;
}
