/* Legal document layout shared by /privacy/ and /terms/.
   Sits on top of the styles.css design system: quiet typography, no cards. */

.legal-doc-page {
  background: var(--bg);
}

/* Same track as .nav-shell and .footer-inner: var(--max) capped, shared gutters,
   so the left edge lines up with the header logo at every width. */
.doc-shell {
  width: min(100% - var(--gutter) * 2, var(--max));
  margin: 0 auto;
}

/* Hero */

.doc-hero {
  padding: 148px 0 54px;
}

.doc-hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(40px, 5.4vw, 64px);
  font-weight: 640;
  letter-spacing: -.035em;
  line-height: 1.02;
}

.doc-hero__lede {
  max-width: 30em;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.doc-hero__meta {
  margin: 30px 0 0;
  color: var(--quiet);
  font-size: 13px;
  letter-spacing: .01em;
}

/* Document layout */

.doc-layout {
  display: grid;
  padding: 0 0 40px;
  align-items: start;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0 84px;
  border-top: 1px solid var(--line-soft);
}

.doc-toc {
  position: sticky;
  top: 104px;
  padding-top: 56px;
}

/* One <details> serves both layouts: a plain label on desktop (forced open by
   script.js), a tap-to-open panel below the tablet breakpoint. */
.doc-toc summary {
  display: block;
  margin-bottom: 18px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 640;
  letter-spacing: .09em;
  list-style: none;
  pointer-events: none;
  text-transform: uppercase;
}

.doc-toc summary::-webkit-details-marker {
  display: none;
}

.doc-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.doc-toc li {
  counter-increment: toc;
}

.doc-toc a {
  display: grid;
  padding: 7px 0;
  align-items: baseline;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  color: var(--quiet);
  font-size: 13.5px;
  line-height: 1.45;
  transition: color 180ms ease;
}

.doc-toc a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--quiet);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: .7;
  transition: color 180ms ease, opacity 180ms ease;
}

.doc-toc a:hover,
.doc-toc a:focus-visible {
  color: var(--text);
}

.doc-toc a.is-current {
  color: var(--text);
}

.doc-toc a.is-current::before {
  color: var(--blue-bright);
  opacity: 1;
}

/* Document body */

.doc-body {
  max-width: 760px;
  padding-top: 56px;
}

.doc-section {
  padding: 54px 0;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 96px;
}

.doc-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.doc-section__index {
  display: block;
  margin-bottom: 14px;
  color: var(--quiet);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
}

.doc-section h2 {
  margin: 0 0 22px;
  color: var(--text);
  font-size: clamp(26px, 2.4vw, 30px);
  font-weight: 620;
  letter-spacing: -.022em;
  line-height: 1.2;
}

.doc-section h3 {
  margin: 34px 0 12px;
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.35;
}

.doc-section p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.7;
}

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

.doc-section strong {
  color: var(--text);
  font-weight: 600;
}

.doc-section a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .28);
  text-underline-offset: 3px;
  transition: text-decoration-color 180ms ease;
}

.doc-section a:hover,
.doc-section a:focus-visible {
  text-decoration-color: var(--blue-bright);
}

.doc-section ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.doc-section li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.7;
}

.doc-section li + li {
  margin-top: 7px;
}

.doc-section li::before {
  position: absolute;
  top: .78em;
  left: 2px;
  width: 4px;
  height: 1px;
  content: "";
  background: var(--quiet);
}

.doc-section ul:last-child {
  margin-bottom: 0;
}

/* Company identity rows */

.doc-facts {
  margin: 26px 0 0;
  border-top: 1px solid var(--line-soft);
}

.doc-facts div {
  display: grid;
  padding: 13px 0;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.doc-facts dt {
  color: var(--quiet);
  font-size: 14px;
}

.doc-facts dd {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

/* Tables */

.doc-table {
  width: 100%;
  margin: 4px 0 0;
  border-collapse: collapse;
  text-align: left;
}

.doc-table th,
.doc-table td {
  padding: 15px 20px 15px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.doc-table thead th {
  color: var(--quiet);
  border-bottom-color: var(--line);
  font-size: 12px;
  font-weight: 620;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.doc-table tbody th {
  width: 38%;
  color: var(--text);
  font-size: 15px;
  font-weight: 560;
  line-height: 1.5;
}

.doc-table td {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Closing contact block */

.doc-outro {
  padding: 58px 0 96px;
  border-top: 1px solid var(--line-soft);
}

.doc-outro h2 {
  max-width: 14em;
  margin: 0 0 14px;
  color: var(--text);
  font-size: clamp(24px, 2.2vw, 28px);
  font-weight: 620;
  letter-spacing: -.022em;
  line-height: 1.25;
}

.doc-outro p {
  max-width: 38em;
  margin: 0;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.7;
}

.doc-outro a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .28);
  text-underline-offset: 3px;
  transition: text-decoration-color 180ms ease;
}

.doc-outro a:hover,
.doc-outro a:focus-visible {
  text-decoration-color: var(--blue-bright);
}

/* Tablet */

@media (max-width: 1040px) {
  .doc-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .doc-toc {
    position: static;
    padding: 30px 0 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .doc-toc summary {
    display: flex;
    min-height: 44px;
    margin-bottom: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    pointer-events: auto;
  }

  .doc-toc summary::after {
    content: "+";
    color: var(--quiet);
    font-size: 17px;
    line-height: 1;
  }

  .doc-toc__panel[open] summary::after {
    content: "\2013";
  }

  .doc-toc ol {
    padding-bottom: 16px;
    columns: 2;
    column-gap: 32px;
  }

  .doc-toc li {
    break-inside: avoid;
  }

  .doc-toc a {
    min-height: 40px;
    align-items: center;
  }

  .doc-body {
    max-width: none;
    padding-top: 44px;
  }
}

/* Tablet and below: gutters come from --gutter, and the tables stop being tables. */

@media (max-width: 860px) {
  .doc-hero {
    padding: calc(var(--header-h) + 48px) 0 40px;
  }

  .doc-section {
    padding: 44px 0;
  }

  .doc-facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .doc-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .doc-table,
  .doc-table tbody,
  .doc-table tr,
  .doc-table th,
  .doc-table td {
    display: block;
    width: auto;
  }

  .doc-table tr {
    padding: 16px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .doc-table tbody th,
  .doc-table td {
    padding: 0;
    border-bottom: 0;
  }

  .doc-table td {
    margin-top: 6px;
  }

  .doc-outro {
    padding: 44px 0 72px;
  }
}

/* Phone: the collapsed table of contents stays a single tap row until opened,
   and the legal body keeps a comfortable reading size. */
@media (max-width: 640px) {
  .doc-hero {
    padding-top: calc(var(--header-h) + 36px);
  }

  .doc-hero h1 {
    font-size: clamp(32px, 8.6vw, 44px);
  }

  .doc-hero__lede {
    margin-top: 16px;
    font-size: 16px;
  }

  .doc-hero__meta {
    margin-top: 20px;
  }

  .doc-toc {
    padding-top: 22px;
  }

  .doc-toc ol {
    columns: 1;
    padding-bottom: 10px;
  }

  .doc-body {
    padding-top: 32px;
  }

  .doc-section {
    padding: 38px 0;
  }

  .doc-section h2 {
    margin-bottom: 16px;
    font-size: clamp(23px, 6vw, 27px);
    line-height: 1.24;
  }

  .doc-section h3 {
    margin-top: 26px;
    font-size: 17px;
  }

  .doc-section p,
  .doc-section li,
  .doc-outro p {
    font-size: 16px;
    line-height: 1.65;
  }

  .doc-outro {
    padding: 36px 0 64px;
  }

  .doc-outro h2 {
    max-width: none;
    font-size: clamp(21px, 5.6vw, 25px);
  }
}
