/* Legal reading pages and the 404. */

@property --legal-fade { syntax: "<length>"; inherits: false; initial-value: 72px; }

/* ================= legal ================= */
.legal {
  position: relative;
  isolation: isolate;
  padding-top: calc(var(--nav-h) + clamp(56px, 4vw + 32px, 112px));
  padding-bottom: calc(var(--section-y) * 1.2);
}
/* Pre-blurred wash: soft radial stops instead of a live filter, so long reads stay cheap. */
.legal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 360px;
  background:
    radial-gradient(42% 100% at 14% 0%, rgb(0 229 191 / .14), transparent 72%),
    radial-gradient(40% 90% at 52% 0%, rgb(124 92 252 / .12), transparent 72%),
    radial-gradient(38% 80% at 90% 0%, rgb(255 107 157 / .11), transparent 72%);
  pointer-events: none;
}
.legal::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 360px;
  background-image: radial-gradient(circle, rgb(17 23 44 / .16) var(--dot-r), transparent 1.4px);
  background-size: var(--dot-pitch) var(--dot-pitch);
  -webkit-mask-image: radial-gradient(70% 100% at 50% 0%, #000, transparent 80%);
  mask-image: radial-gradient(70% 100% at 50% 0%, #000, transparent 80%);
  pointer-events: none;
}

.legal__grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.legal__head { display: flex; flex-direction: column; align-items: flex-start; }
.legal__title {
  margin-top: 30px;
  max-width: 18ch;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 452;
  line-height: 1;
  letter-spacing: var(--track-display);
  color: var(--ink);
}
.legal .updated {
  margin-top: 20px;
  font-size: var(--fs-small);
  color: var(--ink-body);
}

.legal__body {
  max-width: 50ch;
  margin-top: clamp(32px, 2vw + 20px, 48px);
  padding-top: clamp(32px, 2vw + 24px, 48px);
  border-top: .5px solid var(--hairline);
  /* No Inter in between: it sets wider than Google Sans Flex, so the swap rewraps the 50ch column and shifts the page. */
  font-family: "Google Sans Flex", system-ui, sans-serif;
  font-size: clamp(1.0625rem, 1.03rem + .14vw, 1.125rem);
  line-height: 1.65;
  color: var(--ink-2);
}
.legal__body > * + * { margin-top: 1.1em; }
.legal__body > h2 {
  margin-top: 48px;
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .005em;
  color: var(--ink);
}
.legal__body > h2 + * { margin-top: 14px; }
.legal__body > h3 {
  margin-top: 32px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.legal__body > h3 + * { margin-top: 10px; }
.legal__body ul { padding-left: 1.25em; }
.legal__body li + li { margin-top: 8px; }
.legal__body li::marker { color: rgb(17 23 44 / .35); }
.legal__body strong { font-weight: 600; color: var(--ink); }
/* Vertical padding widens the hit area to 44px without moving the line box. */
.legal__body a {
  padding-block: 12px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgb(17 23 44 / .35);
  transition: text-decoration-color var(--dur-fast) var(--ease-out-quart);
}
.legal__body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .86em;
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  white-space: nowrap;
}

/* ---- tables ---- */
.legal-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-card-sm);
  background: var(--surface-1);
  overscroll-behavior-x: contain;
}
/* Inset ring: the mobile edge-fade mask would clip an outer one. */
.legal-table-wrap:focus-visible { outline-offset: -2px; }
.legal-table-wrap table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.5;
}
.legal-table-wrap th,
.legal-table-wrap td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: .5px solid rgb(0 0 0 / .14);
}
.legal-table-wrap thead th {
  background: var(--table-head);
  border-bottom: 1px solid var(--table-border);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.legal-table-wrap td { color: var(--ink-2); }
.legal-table-wrap tbody tr:last-child td { border-bottom: 0; }
.legal-table-wrap td code { background: #fff; }

/* Right-edge fade while there is more to scroll. It retracts as the end is reached where scroll timelines exist. */
@media (max-width: 767px) {
  .legal-table-wrap {
    margin-inline-end: calc(-1 * var(--pad-r));
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    -webkit-mask-image: linear-gradient(to left, transparent, #000 var(--legal-fade));
    mask-image: linear-gradient(to left, transparent, #000 var(--legal-fade));
  }
  @supports (animation-timeline: scroll(self inline)) {
    .legal-table-wrap {
      animation: legal-fade linear both;
      animation-timeline: scroll(self inline);
      animation-range: 85% 100%;
    }
  }
}
@keyframes legal-fade { to { --legal-fade: 0px; } }

/* ---- on this page (sticky beside the column) ---- */
.legal__toc { display: none; }
@media (min-width: 1200px) {
  /* The pair centres as one block so the rail stays beside the text it indexes.
     The track is a fixed length just over the body's 50ch: a ch or content sized track moves the whole pair when the font swaps. */
  .legal__grid {
    grid-template-columns: minmax(0, 37rem) 260px;
    justify-content: center;
    column-gap: 80px;
  }
  .legal__head { grid-area: 1 / 1; }
  .legal__body { grid-area: 2 / 1; }
  .legal__toc {
    display: block;
    grid-area: 2 / 2;
    align-self: start;
    position: sticky;
    top: calc(var(--nav-h) + 48px);
    max-height: calc(100svh - var(--nav-h) - 96px);
    overflow-y: auto;
    margin-top: calc(clamp(32px, 2vw + 20px, 48px) + clamp(32px, 2vw + 24px, 48px));
  }
}
.legal__toc ol { margin: 0; padding: 0; list-style: none; border-left: .5px solid var(--hairline); }
.legal__toc a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0 8px 20px;
  font-size: var(--fs-small);
  line-height: 1.3;
  color: var(--ink-body);
  transition: color var(--dur-fast) var(--ease-out-quart);
}
.legal__toc a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--ink);
  transform: scaleY(0);
  transition: transform var(--dur-mid) var(--ease-out-expo);
}
.legal__toc a[aria-current] { color: var(--ink); }
.legal__toc a[aria-current]::before { transform: none; }

@media (hover: hover) and (pointer: fine) {
  .legal__body a:hover { text-decoration-color: var(--ink); }
  .legal__toc a:hover { color: var(--ink); }
}

/* The footer link for the page being read. */
.site-footer__nav a[aria-current="page"] { color: #fff; }

/* ================= 404 ================= */
.nf {
  position: relative;
  overflow: clip;
  display: grid;
  place-items: center;
  --nf-pt: calc(var(--nav-h) + 40px);
  --nf-pb: 72px;
  min-height: max(560px, 100svh);
  padding-block: var(--nf-pt) var(--nf-pb);
  text-align: center;
}
/* Centre on the copy, not the section, so the outer ring clears it evenly. */
.nf .orbit { --orbit-size: 640px; top: calc(50% + (var(--nf-pt) - var(--nf-pb)) / 2); }
/* The shared glow mask is cut for a short band. Here the section is full height, so the glow stays whole. */
.nf .orbit__glow { -webkit-mask-image: none; mask-image: none; }
.nf__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.nf__title {
  margin-top: 24px;
  max-width: 14ch;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 452;
  line-height: 1;
  letter-spacing: var(--track-display);
  color: var(--ink);
}
.nf__text {
  margin-top: 24px;
  max-width: 34ch;
  font-family: var(--font-display);
  font-size: var(--fs-sub);
  line-height: 1.35;
  letter-spacing: var(--track-lead);
  /* The glow tints the ground behind this line, so --ink-body falls to about 4.1:1 here. */
  color: var(--ink-muted-strong);
  text-wrap: balance;
}
.nf__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; }
.nf .btn-line { background: rgb(255 255 255 / .6); }
@media (max-width: 479px) {
  .nf__actions { flex-direction: column; align-self: stretch; }
  .nf__actions .btn { width: 100%; }
}
