/* ===== Legal pages — editorial, content-first =====
 * Reference: Stripe legal, Linear changelog, Vercel docs, Mercury.
 * Stack: vanilla CSS. All sizing in px to escape the project's
 * fluid-rem scaling on this document.
 *
 * Hard rules:
 *   - No cards. No shadows. No border-radius on big containers.
 *   - One warm bg + one warm tint for the lede. That's it.
 *   - Hierarchy is built from spacing and typography, not boxes.
 */

:root {
  --page-bg: #fafaf7;
  --surface-tint: #f4f2ee;
  --text-primary: #1a1a1a;
  --text-secondary: #5c5c57;
  --text-muted: #9a9a95;
  --border: #e8e8e5;
  --brand: #2d2a6b;
  --brand-hover: #1f1d52;
  --legal-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", Helvetica, Arial, sans-serif;
}

/* Warm cream page background — single biggest "premium" lever.
 * Scoped to body when a legal page is rendered (see body class in templates).
 */
body.legal-page {
  background-color: var(--page-bg);
  font-feature-settings: "ss01", "cv11", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 32px;
}

body.legal-page ::selection {
  background-color: rgba(45, 42, 107, 0.15);
  color: var(--text-primary);
}

.legal {
  margin-top: 0;
  padding: 0;
  background-color: var(--page-bg);
  font-family: var(--legal-font);
  color: var(--text-secondary);
  overflow: visible;
}

/* ----- One container, one grid ----- */

.legal__container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ----- Hero ----- */

.legal__hero {
  padding: 96px 0 80px;
}

.legal__hero-inner {
  max-width: 760px;
}

.legal__title {
  font-family: var(--legal-font);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  margin: 0 0 24px;
}

.legal__lede {
  font-size: 19px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  max-width: 580px;
}

.legal__meta {
  margin-top: 32px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.legal__meta strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.legal__meta-sep {
  margin: 0 10px;
  opacity: 0.5;
}

/* ----- Two-column layout (TOC + content) ----- */

.legal__layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: 96px;
  padding-bottom: 120px;
  align-items: start;
}

/* ----- TOC — bare text, sticky ----- */

.legal__toc {
  position: sticky;
  top: 32px;
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.legal__toc-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.legal__toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.legal__toc-link {
  display: block;
  padding: 6px 0;
  margin-left: 0;
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  font-family: var(--legal-font);
  transition: color 150ms ease, border-color 150ms ease, padding-left 150ms ease;
}

.legal__toc-link:hover {
  color: var(--text-primary);
}

.legal__toc-link.is-active {
  color: var(--brand);
  font-weight: 500;
  border-left-color: var(--brand);
  padding-left: 12px;
  margin-left: -14px;
}

/* ----- Article: no card, sits on page bg ----- */

.legal__article {
  background-color: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  color: var(--text-secondary);
  font-family: var(--legal-font);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 400;
}

/* Intro lede — subtle warm tint, no border accent. */
.legal__intro {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-primary);
  font-weight: 400;
  padding: 24px 28px;
  margin: 0 0 64px;
  background-color: var(--surface-tint);
  border-radius: 6px;
}

/* ----- Sections — no dividers, spacing does the work ----- */

.legal__section {
  margin-top: 64px;
  scroll-margin-top: 32px;
}

.legal__section:first-of-type {
  margin-top: 0;
}

.legal__section-num {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.legal__h2 {
  font-family: var(--legal-font);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 16px;
}

/* ----- Body text rhythm ----- */

.legal__article p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal__article p:last-child {
  margin-bottom: 0;
}

.legal__article strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ----- Lists ----- */

.legal__list {
  list-style: none;
  padding: 0;
  margin: 20px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legal__list li {
  position: relative;
  padding-left: 24px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.legal__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 1px;
  background-color: var(--text-muted);
}

/* ----- Links ----- */

.legal__link {
  color: var(--brand);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(45, 42, 107, 0.25);
  transition: color 150ms ease, border-color 150ms ease;
}

.legal__link:hover {
  color: var(--brand-hover);
  border-bottom-color: var(--brand-hover);
}

/* ----- Contact block — plain typography, no box ----- */

.legal__contact {
  margin-top: 8px;
  font-style: normal;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.legal__contact-name {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.legal__contact-row {
  display: flex;
  gap: 8px;
  font-size: 15px;
  color: var(--text-muted);
}

.legal__contact-row span {
  min-width: 56px;
}

.legal__contact-row .legal__link {
  color: var(--text-primary);
  font-weight: 500;
}

/* ----- Subsection headings ----- */

.legal__h3 {
  margin: 32px 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.legal__blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--brand);
  background-color: var(--surface-tint);
}

.legal__blockquote p {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

/* ----- Language switch ----- */

.legal__lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
}

.legal__lang-switch a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.legal__lang-switch a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

.legal__lang-switch-sep {
  color: var(--text-muted);
}

/* ----- Documents hub ----- */

.legal--hub .legal__hero--hub {
  padding-bottom: 96px;
}

.legal--hub .legal__doc-hub {
  padding: 48px 0 0;
  width: 100%;
}

.legal__doc-group {
  margin-top: 56px;
}

.legal__doc-group:first-child {
  margin-top: 0;
}

.legal__doc-group-title {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.legal__doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.legal__doc-item {
  border-bottom: 1px solid var(--border);
}

.legal__doc-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal__doc-link:hover {
  color: var(--brand);
}

.legal__doc-link::after {
  content: "→";
  font-size: 18px;
  color: var(--text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.legal__doc-link:hover::after {
  color: var(--brand);
  transform: translateX(3px);
}

.legal__doc-link--disabled {
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
}

.legal__doc-link--disabled::after {
  content: "Soon";
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: none;
}

/* ----- Legal tables (GLBA notice) ----- */

.legal__table-wrap {
  margin: 24px 0 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.legal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.legal__table th,
.legal__table td {
  padding: 14px 16px;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.legal__table thead th {
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--surface-tint);
}

.legal__table tbody th[scope="row"] {
  width: 28%;
  min-width: 140px;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--surface-tint);
}

.legal__table--sharing td:nth-child(2),
.legal__table--sharing td:nth-child(3) {
  width: 120px;
  text-align: center;
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .legal__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding-bottom: 80px;
  }

  .legal__hero {
    padding: 64px 0 48px;
  }

  /* TOC becomes a collapsible details block at the top */
  .legal__toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .legal__toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 20px;
  }

  .legal__toc-link {
    padding: 4px 0;
    border-left: 0;
    border-bottom: 1px solid transparent;
  }

  .legal__toc-link.is-active {
    padding-left: 0;
    margin-left: 0;
    border-left: 0;
    border-bottom-color: var(--brand);
  }
}

@media (max-width: 768px) {
  .legal__container {
    padding: 0 24px;
  }

  .legal__hero {
    padding: 48px 0 32px;
  }

  .legal__title {
    margin-bottom: 16px;
  }

  .legal__lede {
    font-size: 17px;
  }

  .legal__meta {
    margin-top: 24px;
    font-size: 13px;
  }

  .legal__intro {
    font-size: 16px;
    padding: 20px 22px;
    margin-bottom: 48px;
  }

  .legal__section {
    margin-top: 48px;
  }

  .legal__h2 {
    font-size: 22px;
  }

  .legal__article,
  .legal__article p,
  .legal__list li,
  .legal__contact {
    font-size: 15px;
  }
}
