/* ==========================================================================
   Legal documents — privacy policy, terms of use.
   Loads on top of styles.css and reuses its tokens, so these pages stay part
   of the same product rather than looking like a lawyer's attachment.
   ========================================================================== */

.legal {
  background: var(--ground);
  font-size: 1.0625rem;   /* long-form reading measure; headings stay large */
}

/* --- Top bar -------------------------------------------------------------- */
.legalbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.legalbar__inner {
  width: 100%; max-width: 1240px; margin-inline: auto;
  padding: 0 var(--gutter);
  min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.legalbar__brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.legalbar__brand:hover { color: var(--blue-deep); }
.legalbar__mark { width: 28px; height: 28px; flex: none; }
.legalbar__org { font-size: 1rem; color: var(--muted); text-align: right; }

/* --- Document head -------------------------------------------------------- */
.legal__head { border-bottom: 1px solid var(--line); }
.legal__headinner {
  width: 100%; max-width: 1240px; margin-inline: auto;
  padding: clamp(40px, 6vw, 72px) var(--gutter) clamp(32px, 4vw, 48px);
}
.legal__eyebrow {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--blue-deep);
}
.legal__title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.02;
  margin-top: 14px;
}
.legal__badges {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: clamp(20px, 3vw, 28px);
}
.legal__badge {
  display: inline-block; padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--paper); color: var(--muted);
  font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.legal__badge--key { background: var(--blue-tint); color: var(--blue-deep); }

/* The standfirst: what this document covers, and what it doesn't. */
.legal__intro {
  margin-top: clamp(24px, 3vw, 32px);
  max-width: 68ch;
  background: var(--paper);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 20px 24px;
  line-height: 1.6;
}

/* --- Two-column body ------------------------------------------------------ */
.legal__body {
  width: 100%; max-width: 1240px; margin-inline: auto;
  padding: clamp(40px, 5vw, 64px) var(--gutter) clamp(64px, 8vw, 96px);
  display: grid; gap: clamp(32px, 5vw, 72px);
}
@media (min-width: 900px) {
  .legal__body { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
}

/* --- Contents rail -------------------------------------------------------- */
.legal__toc { font-size: 1rem; }
@media (min-width: 900px) {
  .legal__toc { position: sticky; top: 96px; max-height: calc(100vh - 128px); overflow-y: auto; }
}
.legal__toctitle {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 16px;
}
.legal__toc ol { list-style: none; border-left: 1px solid var(--line); }
.legal__toc li { margin: 0; }
.legal__toc a {
  display: block;
  padding: 8px 0 8px 18px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; line-height: 1.35;
}
.legal__toc a:hover { color: var(--ink); }
.legal__toc a[aria-current='true'] {
  color: var(--blue-deep); font-weight: 600; border-left-color: var(--blue);
}
/* On a phone the rail becomes a plain list above the text; sticky would eat
   most of the screen. */
@media (max-width: 899px) {
  .legal__toc {
    background: var(--paper); border-radius: var(--r-lg); padding: 20px 22px;
  }
  .legal__toc ol { border-left: none; }
  .legal__toc a { padding-left: 0; border-left: none; }
}

/* --- The document itself -------------------------------------------------- */
.legal__doc { min-width: 0; max-width: 74ch; }
.legal__doc p { margin-top: 16px; line-height: 1.7; color: #232a34; }
.legal__doc > *:first-child { margin-top: 0; }

.legal__h2 {
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.25;
  margin-top: clamp(44px, 5vw, 60px);
  padding: 2px 0 14px 16px;
  border-left: 4px solid var(--blue);
  border-bottom: 1px solid var(--line);
  /* clears the sticky bar when jumped to from the contents rail */
  scroll-margin-top: 92px;
}
.legal__doc > .legal__h2:first-child { margin-top: 0; }
.legal__h3 {
  font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.01em;
  margin-top: 32px;
}

.legal__list { margin-top: 16px; display: grid; gap: 12px; }
.legal__list li {
  position: relative; padding-left: 26px;
  line-height: 1.65; color: #232a34;
}
.legal__list li::before {
  content: ''; position: absolute; left: 6px; top: 0.72em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue);
}

.legal__doc a { color: var(--blue-deep); text-underline-offset: 2px; }
.legal__doc strong { color: var(--ink); font-weight: 700; }

.legal__callout {
  margin-top: 24px;
  background: var(--paper);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 18px 22px;
  line-height: 1.65;
}

/* Sub-processor tables. Wide content scrolls inside its own box rather than
   pushing the page sideways. */
.legal__tablewrap {
  margin-top: 20px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.legal__table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.legal__table th, .legal__table td {
  text-align: left; padding: 14px 16px; vertical-align: top;
  border-bottom: 1px solid var(--line); line-height: 1.55;
}
.legal__table th {
  background: var(--paper); font-weight: 700; white-space: nowrap;
  font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.legal__table tr:last-child td { border-bottom: none; }
/* Provider names read as one unit; without a floor the column collapses and
   breaks "Twilio (Twilio Inc.)" across three lines. */
.legal__table th:first-child, .legal__table td:first-child { min-width: 190px; }
.legal__table td { color: #232a34; }

/* --- Footer --------------------------------------------------------------- */
.legal__footer {
  border-top: 1px solid var(--line);
  padding: 32px var(--gutter) 48px;
  font-size: 1rem; color: var(--muted); line-height: 1.6;
}
.legal__footer p { max-width: 1240px; margin-inline: auto; }
.legal__footer a { color: var(--blue-deep); }
.legal__footerlinks {
  margin-top: 14px; display: flex; flex-wrap: wrap; gap: 12px 24px;
}
