/* ==========================================================================
   Pip website · css/legal.css
   The long-form pages: privacy-policy.html and terms.html. Linked after
   css/site.css on those two pages only, and built from its tokens, so dark
   mode comes with them. Nunito 400 / 500 / 600, never uppercase.
   ========================================================================== */

/* ── The page ────────────────────────────────────────────────────────────── */
.legal-page .page-hero { margin-bottom: clamp(48px, 6vw, 88px); }
.legal-page .page-hero .h1 { max-width: 14ch; }

/* The draft banner: a warning wash, so nobody mistakes it for the final word */
.legal-draft {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 14px;
  border-radius: var(--radius-full);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 15px;
  font-weight: var(--weight-medium);
  line-height: 1.4;
}
.legal-draft::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--warning);
}

.legal-updated {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ── Contents beside the words, as on the questions page ─────────────────── */
.legal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(32px, 7vw, 112px);
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: calc(var(--header-h) + 36px);
  max-height: calc(100vh - var(--header-h) - 72px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.legal-toc-h {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: var(--weight-medium);
  line-height: 1.4;
  color: var(--text-muted);
}
.legal-toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  font-size: 15px;
  font-weight: var(--weight-medium);
  line-height: 1.35;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.legal-toc a::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border);
  transform: translateY(-2px);
  transition: background-color var(--transition-normal);
}
.legal-toc a:hover { color: var(--text-primary); }
.legal-toc a[aria-current="true"] { color: var(--text-primary); }
.legal-toc a[aria-current="true"]::before { background: var(--accent); }

@media (max-width: 899px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 20px 22px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
  }
  /* On a phone the list is a plain list: no marker that follows the reader */
  .legal-toc a[aria-current="true"] { color: var(--text-secondary); }
  .legal-toc a[aria-current="true"]::before { background: var(--border); }
}

/* ── The words ───────────────────────────────────────────────────────────── */
.legal-body {
  min-width: 0;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 6vw, 88px);
}
.legal-sec { scroll-margin-top: calc(var(--header-h) + 28px); }

.legal-sec > h2 {
  margin-bottom: 20px;
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.legal-sec h3 {
  margin-top: 36px;
  margin-bottom: 12px;
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.legal-sec > h2 + h3 { margin-top: 8px; }

.legal-sec p,
.legal-sec li,
.legal-sec dd {
  max-width: var(--measure);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--text-secondary);
}
.legal-sec p + p,
.legal-sec p + ul,
.legal-sec ul + p,
.legal-sec p + dl,
.legal-sec dl + p,
.legal-sec .legal-table-wrap + p,
.legal-sec p + .legal-table-wrap,
.legal-sec .legal-flag + p,
.legal-sec p + .legal-flag,
.legal-sec ul + .legal-flag { margin-top: 16px; }

.legal-sec strong { color: var(--text-primary); }

/* Lists: a small neutral dot, the hanging kind */
.legal-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.legal-list li { position: relative; padding-left: 22px; }
.legal-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  opacity: 0.6;
}

/* The short version: the same list, on a stone card */
.legal-summary {
  width: fit-content;
  max-width: 100%;
  padding: clamp(24px, 3vw, 32px);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}
.legal-summary li { color: var(--text-primary); }

/* Facts: who we are, a label beside its value */
.legal-facts {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  max-width: var(--measure);
  box-shadow: inset 0 1px 0 var(--border-light);
}
.legal-facts dt,
.legal-facts dd {
  padding: 12px 0;
  box-shadow: inset 0 -1px 0 var(--border-light);
  font-size: var(--text-body);
  line-height: 1.5;
}
.legal-facts dt { padding-right: 16px; color: var(--text-muted); }
.legal-facts dd { color: var(--text-primary); }
@media (max-width: 479px) {
  .legal-facts { grid-template-columns: minmax(0, 1fr); }
  .legal-facts dt { padding-bottom: 0; box-shadow: none; }
  .legal-facts dd { padding-top: 2px; }
}

/* An open question, said out loud for the owner and the lawyer */
.legal-flag {
  max-width: var(--measure);   /* measured at body size, so it lines up with the paragraphs */
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  font-size: var(--text-body);
}
.legal-sec .legal-flag p { max-width: none; color: var(--text-primary); font-size: 15px; line-height: 1.6; }

/* ── Tables: who handles what. They scroll inside their own box on a phone,
   never the page. ─────────────────────────────────────────────────────────── */
.legal-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  background: var(--surface-pip);
  box-shadow: var(--shadow-sm), var(--win-ring);
}
.legal-table-wrap:focus-visible { outline-offset: 3px; }
.legal-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}
.legal-table--2 { min-width: 480px; }
.legal-table caption {
  padding: 16px 18px 4px;
  text-align: left;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.legal-table th,
.legal-table td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
}
.legal-table thead th {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  box-shadow: inset 0 -1px 0 var(--border-light);
  white-space: nowrap;
}
.legal-table tbody th {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  min-width: 150px;
}
.legal-table td { color: var(--text-secondary); }
.legal-table tbody tr + tr > * { box-shadow: inset 0 1px 0 var(--border-light); }
.legal-table .host { display: block; margin-top: 2px; font-size: 13px; font-weight: var(--weight-regular); color: var(--text-muted); overflow-wrap: anywhere; }

/* Review markers sit inside headings and tables too, and never break in two */
.legal-sec .rm { white-space: nowrap; }
.legal-sec h2 .rm,
.legal-sec h3 .rm { font-weight: var(--weight-regular); letter-spacing: 0; }

/* On a phone a table reads as a list of cards: the row's name, then each
   answer under its column's name. The column headings stay for screen readers. */
@media (max-width: 599px) {
  .legal-table,
  .legal-table--2 { min-width: 0; }
  .legal-table thead {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .legal-table caption { padding: 18px 18px 2px; }
  .legal-table tbody tr { display: block; padding: 16px 18px 18px; }
  .legal-table tbody tr + tr { box-shadow: inset 0 1px 0 var(--border-light); }
  .legal-table tbody tr + tr > * { box-shadow: none; }
  .legal-table tbody th,
  .legal-table td { display: block; padding: 0; min-width: 0; }
  .legal-table td { margin-top: 10px; }
  .legal-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: var(--weight-medium);
    color: var(--text-muted);
  }
}
