/*
 * Docs-page styles. Sticky TOC on the left, article column on
 * the right, scroll-driven active-link indicator. Originally
 * built for /support; generalised so /terms, /privacy and
 * /cookies all share the same layout and rhythm.
 *
 * Page opt-in: <div class="lib-h-page docs-page"> wrapper.
 * Inside, the docs layout uses .docs-layout (grid), .docs-toc
 * (sticky aside), .docs-article (main column).
 */

/* Hero lede spans the full page width (rail) on docs pages
   instead of the default 60ch reading column. The lede sits
   above the TOC/article grid and reads as a section intro,
   not paragraph prose. */
.docs-page .lib-h-sub {
  max-width: none;
}

/* ============== Docs layout ============== */
.docs-page .docs-layout {
  max-width: calc(var(--rail) + 2 * var(--rail-x));
  margin: 0 auto;
  padding: 0 var(--rail-x) clamp(80px, 10vw, 120px);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0 64px;
}
.docs-page .docs-layout > * { min-width: 0; }

/* ============== TOC ============== */
.docs-page .docs-toc {
  position: sticky;
  top: calc(var(--nav-h) + env(safe-area-inset-top) + 24px);
  align-self: start;
  /* Match the article's first-section padding-top (8px) so
     the top of the first TOC link sits at the same vertical
     as the article's first h2 once the link's own 7px padding
     is accounted for. */
  padding-top: 1px;
}
/* Track + active indicator are absolutely-positioned 2px
   pseudo-elements. Track is the dim hairline through the
   whole list; indicator paints chartreuse over the slice
   that matches the active link's full bounds (top 0, bottom
   0) so it spans the exact same vertical extent as the
   link's hit area. */
.docs-page .docs-toc ol {
  list-style: none;
  position: relative;
  padding-left: 18px;
  margin: 0;
}
.docs-page .docs-toc ol::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  /* Track is dim ink so the rail recedes into the page;
     the active slice paints over it in chartreuse so the
     brand colour marks "you are here". */
  background: rgba(10, 10, 10, 0.06);
}
.docs-page .docs-toc li {
  padding: 0;
  margin: 0;
}
.docs-page .docs-toc a {
  display: block;
  padding: 7px 0;
  position: relative;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.011em;
  line-height: 1.4;
  color: var(--ink);
  opacity: 0.62;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.docs-page .docs-toc a:hover { opacity: 1; }
.docs-page .docs-toc a.is-active {
  opacity: 1;
  font-weight: 600;
}
.docs-page .docs-toc a.is-active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  /* Active slice in solid ink. Brand chartreuse felt too loud on
     long-form legal copy; ink reads as a navigational marker
     rather than a brand accent. */
  background: var(--ink);
}

/* ============== Article ============== */
/* Neutralise the global `main { padding: 72px ... 96px; display:
   flex; flex-direction: column; gap: 32px; max-width: rail; }`
   declaration in styles.css. The article in our docs layout is
   already inside the rail-width .docs-layout grid; without
   this reset the global rule was pushing the first section
   down by 72px (and constraining max-width / inserting flex
   gaps between sections). */
.docs-page .docs-article {
  max-width: none;
  margin: 0;
  padding: 0;
  display: block;
  gap: 0;
}
.docs-page .docs-article > section {
  padding: 48px 0;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.docs-page .docs-article > section:first-of-type {
  padding-top: 8px;
}
.docs-page .docs-article h2 {
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 14px;
}
.docs-page .docs-article h3 {
  font-size: clamp(1.0625rem, 1.3vw, 1.1875rem);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.25;
  color: var(--ink);
  margin: 28px 0 8px;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.docs-page .docs-article p {
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.011em;
  color: var(--ink);
  opacity: 0.78;
  margin: 0 0 14px;
  max-width: 70ch;
}
.docs-page .docs-article p:last-child { margin-bottom: 0; }
.docs-page .docs-article ol,
.docs-page .docs-article ul {
  margin: 8px 0 14px;
  padding-left: 22px;
  max-width: 70ch;
}
.docs-page .docs-article li {
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.78;
  margin: 0 0 6px;
}
.docs-page .docs-article a {
  color: var(--ink);
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.docs-page .docs-article code {
  font-family: var(--font-mono);
  font-weight: 500;
  background: rgba(10, 10, 10, 0.06);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.86em;
}
.docs-page .docs-article strong {
  font-weight: 600;
  color: var(--ink);
}
/* Small mono caps footer line for last-updated stamps on
   legal docs. Lives at the bottom of the article column.
   Selector includes the `p` element so it beats the
   `.docs-page .docs-article p` rule's font-size on
   specificity (0,3,1 vs 0,2,1) — without the trailing `p`
   the paragraph rule won and the size override never
   landed. */
.docs-page .docs-article p.docs-meta {
  margin: 32px 0 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  opacity: 0.55;
  max-width: none;
}

/* ============== Mobile ============== */
@media (max-width: 880px) {
  .docs-page .docs-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .docs-page .docs-toc {
    position: static;
    padding-top: 0;
  }
  /* TOC on mobile is a flat 2-column grid of links above the
     article. The vertical rail + active-section indicator
     made sense as a sticky desktop sidebar; on a stacked
     mobile layout they read as visual noise on a list that's
     just a list. Drop the track, drop the indicator pseudo
     on the active link, re-flow the ol as a 2-col grid, and
     bring all links to the active weight (600) so they read
     as a uniform list instead of "one bold + ten dim". */
  .docs-page .docs-toc ol {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding-left: 0;
    column-gap: 16px;
  }
  .docs-page .docs-toc ol::before {
    display: none;
  }
  .docs-page .docs-toc a.is-active::before {
    display: none;
  }
  .docs-page .docs-toc a,
  .docs-page .docs-toc a.is-active {
    padding: 8px 0;
    font-size: 1rem;
    font-weight: 600;
    opacity: 1;
  }
  .docs-page .docs-article > section {
    padding: 32px 0;
  }
}
@media (max-width: 720px) {
  .docs-page .lib-h {
    padding-bottom: clamp(20px, 4vw, 32px);
  }
}
