/* ============================================================
   MINDED — legal documents (privacy, terms, addenda)
   Long-form prose in the jtm design language. Depends on
   colors_and_type.css for tokens and site-v3.css for the nav /
   footer / .container chrome — this file only styles the document.
   ============================================================ */

.legal {
  padding: clamp(28px, 5vh, 56px) 0 clamp(56px, 9vh, 104px);
}

/* The prose column. Capped well below .container's 1180px — at full width a
   16px paragraph runs ~110 characters per line, far past the ~90 the eye can
   track back from without losing its place. 736px - 56px padding = a 680px
   measure, about 92 characters. */
.legal .container {
  max-width: 736px;
}

/* ---- document head ---------------------------------------- */
.legal-head {
  padding-bottom: 26px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

/* Serif page title, same treatment as `.hero h1` and the jtm section titles:
   Libre Baskerville at weight 400, and the clamp drops to ~85% of the sans
   equivalent because the serif sets noticeably larger at a given px. */
.legal-head h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.14;
  letter-spacing: -0.012em;
  color: var(--ink-900);
  text-wrap: balance;
}

.legal-meta {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg3);
}

/* ---- body prose -------------------------------------------- */
.legal-body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.72;
  color: var(--slate-700);
}

.legal-body p {
  margin: 0 0 18px;
  text-wrap: pretty;
}

.legal-body > p:first-child {
  margin-top: 0;
}

.legal-body strong,
.legal-body b {
  font-weight: 600;
  color: var(--ink-900);
}

/* Sections. Generous top space so the numbered headings do the wayfinding
   that a legal doc needs without a table of contents. */
.legal-body section {
  margin-top: 44px;
}

.legal-body h2 {
  margin: 0 0 16px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  text-wrap: balance;
}

.legal-body h3 {
  margin: 30px 0 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink-900);
}

/* Standalone h2s in the short addenda (no <section> wrapper) still need air. */
.legal-body > h2 {
  margin-top: 44px;
}

.legal-body > h2:first-child {
  margin-top: 0;
}

/* ---- lists -------------------------------------------------- */
.legal-body ol,
.legal-body ul {
  margin: 0 0 18px;
  padding-left: 26px;
}

.legal-body li {
  margin-bottom: 10px;
  text-wrap: pretty;
}

.legal-body li:last-child {
  margin-bottom: 0;
}

.legal-body ol {
  list-style: decimal;
}

.legal-body ul {
  list-style: disc;
}

.legal-body li::marker {
  color: var(--ink-600);
}

/* ---- links --------------------------------------------------
   site-v3.css resets `a { color: inherit; text-decoration: none }`, so inline
   document links must re-declare their own affordance. Coral + underline: in a
   wall of dense legal prose an underline alone is too easy to miss. */
.legal-body a {
  color: var(--brand-coral);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  overflow-wrap: break-word;
  transition: color 0.15s ease;
}

.legal-body a:hover {
  color: var(--brand-magenta);
}

/* ---- tables --------------------------------------------------
   One table exists today (the CCPA disclosure grid): 4 columns, and the two
   middle cells run to 40+ words. `table-layout: fixed` + explicit <col> widths
   stop the browser handing almost the whole row to the longest cell; the wrap
   allows a scroll rather than a crush once the columns hit their floor. */
.legal-table-wrap {
  /* break out of the prose measure — four columns of paragraph-length text need
     more room than a comfortable reading line does. Pulled back in below 900px,
     where the container no longer has 60px of gutter to spend. */
  margin: 24px -60px 26px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

@media (max-width: 900px) {
  .legal-table-wrap {
    margin-left: 0;
    margin-right: 0;
  }
}

.legal-body table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  line-height: 1.62;
}

.legal-body thead th {
  padding: 13px 16px;
  text-align: left;
  vertical-align: bottom;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  background: var(--surface-muted-2);
  border-bottom: 1px solid var(--line-strong);
}

.legal-body tbody td {
  padding: 14px 16px;
  vertical-align: top;
  color: var(--slate-700);
  border-bottom: 1px solid var(--line);
  /* Break only where a word genuinely cannot fit (a URL, a 25-character
     compound). NOT `hyphens: auto` — in ~190px columns it fires on nearly every
     line and the cell reads as "infor-mation ... employment-re-lated". */
  overflow-wrap: break-word;
  text-wrap: pretty;
}

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

.legal-body tbody tr:nth-child(even) td {
  background: rgba(249, 250, 252, 0.7);
}

/* The first column labels the row — give it the same weight as a row header. */
.legal-body tbody td:first-child {
  font-weight: 500;
  color: var(--ink-900);
}

/* Mobile: a 4-column grid of paragraph-length cells cannot be made to fit, so
   below the table's min-width each row becomes its own stacked card and the
   column names come back as inline labels from `data-label`. */
@media (max-width: 720px) {
  .legal-table-wrap {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .legal-body table,
  .legal-body tbody,
  .legal-body tr,
  .legal-body td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .legal-body thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .legal-body tbody tr {
    margin-bottom: 14px;
    padding: 6px 16px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .legal-body tbody td,
  .legal-body tbody tr:nth-child(even) td {
    padding: 10px 0;
    background: none;
    border-bottom: 1px solid var(--line);
  }

  .legal-body tbody td:last-child {
    border-bottom: 0;
  }

  .legal-body tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg3);
  }
}

/* ---- small screens ------------------------------------------ */
@media (max-width: 640px) {
  .legal-body {
    font-size: 15px;
    line-height: 1.68;
  }

  .legal-body ol,
  .legal-body ul {
    padding-left: 22px;
  }
}
