/* Policy pages: a quiet document. The site's header bar and footer, one reading column
   and the list of sections, which stays beside the text on wide screens. */
html {
  /* The page is white from its top edge, and its header scrolls away, so a section link
     needs no room for a floating bar. */
  background: var(--surface);
  scroll-padding-top: 24px;
}
.legal-header {
  padding: calc(var(--safe-top) + 12px) max(12px, var(--safe-side)) 0;
}
html.js .legal-header .nav {
  animation: none;
}
/* The language picker is this header's only control, so it stays at every width. */
.legal-header .language-menu {
  display: block;
}
/* The layout follows the room the text has, measured in the reader's own text size, so
   enlarged text keeps a full-width column. */
.legal {
  --legal-gap: clamp(32px, 4vw, 48px);
  --legal-end: clamp(72px, 9vw, 128px);
  padding-top: clamp(48px, 7vw, 96px);
  container: legal / inline-size;
}
.legal-doc {
  display: grid;
  width: min(68rem, 100% - 2 * max(var(--gutter), var(--safe-side)));
  padding-bottom: var(--legal-end);
  grid-template-columns: minmax(0, 44rem);
  justify-content: center;
  row-gap: var(--legal-gap);
}
.legal-head h1 {
  color: var(--ink);
  font-size: clamp(1.75rem, 1.2rem + 2.8vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.032em;
  hyphens: auto;
}
.legal-meta {
  color: var(--ink-2);
  font-size: 0.95rem;
}
h1 + .legal-meta {
  margin-top: clamp(16px, 2vw, 24px);
}

/* Sections of the document */
.legal-toc {
  align-self: start;
  padding: 22px clamp(20px, 3vw, 28px);
  border-radius: 24px;
  background: var(--bg);
}
.legal-toc h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font: 600 0.88rem/1.4 var(--font-display);
  letter-spacing: 0;
}
.legal-toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.35;
  text-decoration: none;
}
.legal-toc a:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The text */
.legal-body {
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.legal-body section + section {
  margin-top: clamp(40px, 5vw, 56px);
}
.legal-body h2 {
  margin-bottom: 16px;
  color: var(--ink);
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  hyphens: auto;
}
.legal-body p + p,
.legal-body p + ul,
.legal-body ul + p {
  margin-top: 1em;
}
.legal-body ul {
  padding-left: 1.25em;
  list-style: disc;
}
.legal-body li + li {
  margin-top: 0.5em;
}
.legal-body li::marker {
  color: var(--ink-3);
}
.legal-body strong {
  color: var(--ink);
  font-weight: 600;
}
.legal-body a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.legal-body a:hover {
  color: var(--brand-pressed);
  text-decoration-thickness: 2px;
}

/* The market's other documents */
.legal-related {
  padding-top: clamp(24px, 3vw, 32px);
  border-top: 1px solid var(--line);
}
.legal-related a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--brand);
  font: 600 1rem/1.3 var(--font-display);
  text-decoration: none;
}
.legal-related a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-related .icon {
  width: 18px;
  height: 18px;
}

/* With room for both columns, the sections stay in view beside the text. The space
   under the document is the grid's last row, which the list may use, so it stays with
   the reader into the last section and still ends clear of the footer. */
@container legal (min-width: 68.75rem) {
  .legal-doc {
    grid-template-columns: minmax(0, 17rem) minmax(0, 44rem);
    grid-template-rows: auto auto auto var(--legal-end);
    gap: 0 clamp(40px, 5vw, 72px);
    padding-bottom: 0;
  }
  .legal-head,
  .legal-body,
  .legal-related {
    grid-column: 2;
  }
  .legal-head {
    margin-bottom: var(--legal-gap);
  }
  .legal-related {
    grid-row: 3;
    margin-top: var(--legal-gap);
  }
  .legal-toc {
    position: sticky;
    top: 24px;
    grid-column: 1;
    grid-row: 2 / 5;
    /* Keep the contents visible beside a short final section, with room above the footer. */
    margin-bottom: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .legal-toc a {
    min-height: 36px;
    font-size: 0.9rem;
  }
}

/* On paper: the document alone, in black, with each link's address written out. */
@media print {
  html,
  body {
    background: #fff;
  }
  .skip,
  .legal-header,
  .legal-toc,
  .legal-related,
  .site-footer {
    display: none;
  }
  .legal {
    padding: 0;
  }
  .legal-doc {
    display: block;
    width: auto;
    padding: 0;
  }
  .legal-head {
    margin-bottom: 24pt;
  }
  .legal-head h1 {
    font-size: 22pt;
  }
  .legal-head .eyebrow,
  .legal-meta,
  .legal-body,
  .legal-body h2,
  .legal-body strong,
  .legal-body a {
    color: #000;
  }
  .legal-body {
    font-size: 10.5pt;
    line-height: 1.5;
  }
  .legal-body h2 {
    font-size: 13pt;
    break-after: avoid;
  }
  .legal-body section + section {
    margin-top: 18pt;
  }
  .legal-body li {
    break-inside: avoid;
  }
  .legal-body a[href^="https:"]::after {
    content: " (" attr(href) ")";
    overflow-wrap: anywhere;
  }
}
