/*
 * Long-form legal text: terms.html, privacy.html, dpa.html, cookies.html and sub-processors.html,
 * and no other page. Those five files are generated (tests/website/legalPages.test.ts); never
 * edit them by hand.
 *
 * The documents are the app's own LegalDocumentView markup. Its Tailwind utility classes mean
 * nothing on this site, so these rules use its stable hooks (legal-document, legal-meta,
 * legal-toc, legal-notice, legal-placeholder, data-slot="eyebrow") and the plain elements
 * inside them. The look follows the long-form legal pages of Alva's other product site.
 * Tokens from alva.css only, never a literal colour (the test checks).
 */

.legal-page {
  padding-top: 64px;
}

/* A reading measure, left-aligned with the logo as on the other legal pages of Alva's sites. */
.legal-measure {
  max-width: 72ch;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
}

.legal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.legal-breadcrumb a {
  color: inherit;
  text-decoration: none;
}
.legal-breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Title and the version line */
.legal-document h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 4.4vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-wrap: balance;
}
.legal-meta {
  margin: 20px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--muted);
}

/* Contents */
.legal-toc {
  margin-top: 40px;
  padding: 20px 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.45;
}
.legal-toc [data-slot="eyebrow"] {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
/* The section titles carry their own numbers. */
.legal-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.legal-toc li {
  break-inside: avoid;
}
.legal-toc li + li {
  margin-top: 8px;
}
.legal-document .legal-toc a {
  color: var(--ink-2);
  text-decoration: none;
}
.legal-document .legal-toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}
@media (min-width: 760px) {
  .legal-toc ol {
    columns: 2;
    column-gap: 32px;
  }
  .legal-toc li + li {
    margin-top: 0;
  }
  .legal-toc li {
    padding-bottom: 8px;
  }
}

/* Sections; the sticky navigation is 64 px high, so an anchor stops below it. */
.legal-document > section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line-hair);
  scroll-margin-top: 88px;
}
.legal-document h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.legal-document p {
  margin: 16px 0 0;
}
.legal-document ul {
  margin: 16px 0 0;
  padding-left: 1.25rem;
}
.legal-document li + li {
  margin-top: 8px;
}
.legal-document ul li::marker {
  color: var(--muted);
}
.legal-document a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.legal-document a:hover {
  color: var(--ink);
}
.legal-document a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.legal-document strong {
  font-weight: 600;
  color: var(--ink);
}

/* A notice set apart (the warranty disclaimer of the Terms). */
.legal-notice {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--ink);
}

/* Tables: their wrapper scrolls sideways on a narrow screen; the page never does. */
.legal-document section > div:not([role="note"]) {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.legal-document table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.55;
}
.legal-document th {
  padding: 12px 14px;
  text-align: left;
  vertical-align: bottom;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
}
.legal-document td {
  min-width: 10rem;
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-hair);
}
.legal-document tbody tr:last-child td {
  border-bottom: 0;
}

/* An unfilled [[NAME]] value (none is open today); visible on purpose. */
.legal-document mark.legal-placeholder {
  padding: 0 4px;
  border-radius: 3px;
  background: var(--warn-soft);
  color: var(--ink);
}

@media (max-width: 640px) {
  .legal-page {
    padding-top: 40px;
  }
  .legal-measure {
    font-size: 16px;
  }
  .legal-toc {
    padding: 16px 18px;
  }
  .legal-document > section {
    margin-top: 40px;
    padding-top: 28px;
  }
  .legal-document td {
    min-width: 9rem;
  }
}
