/* ==========================================================================
   Kodiyo — legal.css
   Shared by the Privacy Policy and Terms pages.

   These are long reference documents, not marketing pages. The job is
   legibility over a lot of text: a narrow measure, a clear heading ladder,
   and a table of contents that actually moves you around. Everything is
   drawn from the same tokens as the rest of the site — no new colours, no
   new type scale.
   ========================================================================== */

.legal-hero {
  padding-block: clamp(3.5rem, 9vh, 6rem) 0;
  text-align: center;
}

.legal-hero__title {
  font-size: var(--fs-h1);
}

.legal-hero__meta {
  margin-top: var(--space-md);
  font-size: var(--fs-sm);
  color: var(--color-faint);
}

/* The document ---------------------------------------------------------- */
.legal {
  padding-block: clamp(2.5rem, 6vh, 4rem) var(--section-py);
}

.legal__doc {
  /* ~70 characters at body size. Long-form legal text is unreadable at the
     full container width, so this is deliberately much narrower. */
  max-width: 760px;
  margin-inline: auto;
}

.legal__doc > * + * {
  margin-top: var(--space-md);
}

.legal__doc p,
.legal__doc li {
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--color-muted);
}

.legal__doc strong {
  color: var(--color-fg);
  font-weight: var(--weight-sub);
}

.legal__doc a {
  color: var(--color-fg);
  border-bottom: 1px solid var(--color-line-strong);
  transition: border-color var(--dur-fast) var(--ease-out);
  /* Long email and URL strings must not push the page sideways. */
  word-break: break-word;
}

.legal__doc a:hover {
  border-bottom-color: var(--color-fg);
}

/* Heading ladder -------------------------------------------------------- */
.legal__doc h2 {
  /* scroll-margin is NOT set here: html already carries scroll-padding-top
     for the fixed header, and adding both doubles the offset. */
  margin-top: clamp(3rem, 7vh, 4.5rem);
  font-size: var(--fs-h3);
  line-height: 1.25;
  color: var(--color-fg);
}

.legal__doc h3 {
  margin-top: var(--space-2xl);
  font-family: var(--font-sub);
  font-weight: var(--weight-mid);
  font-size: var(--fs-lead);
  line-height: 1.35;
  color: var(--color-fg);
}

.legal__doc h4 {
  margin-top: var(--space-xl);
  font-family: var(--font-sub);
  font-weight: var(--weight-sub);
  font-size: var(--fs-body);
  color: var(--color-fg);
}

/* A rule under each numbered section makes the ladder scannable when you
   are hunting for one clause. */
.legal__doc h2 {
  padding-bottom: var(--space-sm);
  border-bottom: var(--border-hairline) solid var(--color-line);
}

/* "In Short" summaries --------------------------------------------------- */
.legal__short {
  margin-top: var(--space-lg);
  padding-left: var(--space-lg);
  border-left: 2px solid var(--color-line-strong);
  font-style: italic;
}

.legal__short strong {
  font-style: normal;
}

/* Lists ------------------------------------------------------------------ */
.legal__doc ul {
  margin-top: var(--space-md);
  padding-left: 1.35em;
  list-style: disc;
}

.legal__doc ul ul {
  margin-top: var(--space-xs);
  list-style: circle;
}

.legal__doc li + li {
  margin-top: var(--space-xs);
}

.legal__doc li::marker {
  color: var(--color-faint);
}

/* Table of contents ------------------------------------------------------ */
.legal__toc {
  margin-top: var(--space-lg);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: var(--border-hairline) solid var(--color-line);
  border-radius: var(--radius-card);
  background-color: var(--color-surface);
}

.legal__toc ol {
  margin: 0;
  padding-left: 1.6em;
  list-style: decimal;
}

.legal__toc li {
  margin-top: var(--space-2xs);
}

.legal__toc li::marker {
  color: var(--color-faint);
  font-size: var(--fs-sm);
}

.legal__toc a {
  border-bottom-color: transparent;
}

.legal__toc a:hover {
  border-bottom-color: var(--color-line-strong);
}

/* Contact block ---------------------------------------------------------- */
.legal__address {
  margin-top: var(--space-md);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--color-muted);
  font-style: normal;
}

/* The California categories table ---------------------------------------- */
.legal__table-wrap {
  margin-top: var(--space-lg);
}

.legal__table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.legal__table th,
.legal__table td {
  padding: var(--space-sm) var(--space-md);
  border: var(--border-hairline) solid var(--color-line);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--color-muted);
  vertical-align: top;
}

.legal__table th {
  font-family: var(--font-sub);
  font-weight: var(--weight-mid);
  color: var(--color-fg);
  background-color: var(--color-surface);
}

.legal__table td:last-child {
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-sub);
  color: var(--color-fg);
}

/* Below 720px the three columns cannot hold a readable measure, so each row
   becomes its own block with the column name as an inline label. Reading it
   as a list beats pinch-zooming a squashed grid or scrolling it sideways. */
@media (max-width: 720px) {
  .legal__table,
  .legal__table tbody,
  .legal__table tr,
  .legal__table td {
    display: block;
    width: 100%;
  }

  .legal__table thead {
    /* Visually hidden, still read by assistive tech. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .legal__table tr {
    margin-top: var(--space-md);
    border: var(--border-hairline) solid var(--color-line);
    border-radius: var(--radius-input);
    overflow: hidden;
  }

  .legal__table td {
    border: 0;
    border-bottom: var(--border-hairline) solid var(--color-line);
    padding: var(--space-sm) var(--space-md);
  }

  .legal__table tr td:last-child {
    border-bottom: 0;
    text-align: left;
  }

  .legal__table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-family: var(--font-sub);
    font-size: var(--fs-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-faint);
  }
}
