/* Document layout (doc.css): the site's page for policies and legal text,
   shared by policy.html, terms.html and privacy.html. Loaded after
   brand/clear-brand.css and page.css (the plain page, its tokens, header,
   kicker, footer, toast); a page adds its own sheet after this one only
   for parts no other document needs.

   Not a product page: no hero, no floating card, no big section
   headlines. Five parts:
     1. Title block: small eyebrow (page.css's .kicker), a normal-size H1,
        one summary line, the "Last updated" date, a hairline under it.
     2. One text column, 64ch (about 75 characters), 17 px on 1.65.
     3. "On this page": a labeled nav. Sticky beside the text on wide
        screens (it stops at the end of the text, never over the footer);
        an inline box under the title on tablets and phones.
     4. Sections divided by a soft rule, H2 then H3, lists, clause lists
        ((i), (a)), a two-column list for paired lines, tables with headers
        (rows stack on phones when marked .doc-table--stack).
     5. A small callout: paper, a 1 px edge, a bold title.
   Ink on paper; brand green only for links and the kicker. Every colour
   is a Clear token or a page.css token; no colour carries an alpha on
   text. */

/* ── 1 · Title block ────────────────────────────────────────────── */
.doc { --doc-text: 17px; }
.doc-head { padding: 56px 0 32px; border-bottom: 1px solid var(--hair); }
.doc-title { margin-top: 14px; font-size: clamp(32px, 3.1vw, 42px); line-height: 1.12; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.doc-summary { margin-top: 12px; max-width: 38em; font-size: 18.5px; line-height: 1.5; color: var(--muted-foreground); text-wrap: pretty; }
.doc-meta { margin-top: 18px; font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.doc-meta time, .doc-meta b { font-weight: 600; color: var(--card-foreground); }

/* ── 2 · Layout: text left, contents right ─────────────────────────
   The column width is set in the text's own size: 64ch, which in
   Schibsted Grotesk (a wide zero) holds about 75 characters of running
   text. The contents sits in its own grid area, so its sticky range ends
   where the text ends. */
.doc-layout { display: grid; grid-template-columns: minmax(0, 64ch) minmax(188px, 232px); grid-template-areas: "body toc"; column-gap: clamp(48px, 7vw, 104px); align-items: start; padding-top: 40px; font-size: var(--doc-text); }
.doc-body { grid-area: body; min-width: 0; font-size: var(--doc-text); line-height: 1.65; color: var(--foreground); }

/* ── 3 · On this page ─────────────────────────────────────────────── */
/* Wide screens: a quiet list with a rail; the hovered link's rail goes to
   the control edge. A scroll box only if the list outgrows the screen
   (padding keeps focus rings inside it). */
.doc-toc { grid-area: toc; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain; margin: -4px; padding: 4px; }
.doc-toc__title { font-size: 12.5px; line-height: 16px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-foreground); }
.doc-toc__list { margin-top: 12px; border-left: 1px solid var(--hair); }
.doc-toc__list a { display: block; margin-left: -1px; padding: 6px 0 6px 15px; border-left: 2px solid transparent; font-size: 14.5px; line-height: 20px; color: var(--muted-foreground); text-decoration: none; transition: color 150ms ease, border-color 150ms ease; }
.doc-toc__list a:hover { color: var(--ink); border-left-color: var(--border-strong); }
.doc-toc__list a:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; border-radius: 4px; color: var(--ink); }

/* ── 4 · The text ──────────────────────────────────────────────────── */
.doc-sec + .doc-sec { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--hair-soft); }
.doc-sec > * + *, .doc-sub > * + * { margin-top: 16px; }
.doc-body h2 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.doc-body h3 { font-size: 18.5px; line-height: 1.35; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); text-wrap: balance; }
.doc-sec > * + h3, .doc-sec > * + .doc-sub { margin-top: 32px; }
.doc-body .doc-sec > h2 + * { margin-top: 14px; }
.doc-body h3 + * { margin-top: 8px; }
.doc-body p { text-wrap: pretty; }
.doc-body strong, .doc-body b { font-weight: 650; color: var(--ink); }
.doc-lead { font-size: 18px; line-height: 1.6; color: var(--foreground); }

/* Links in running text are underlined, so they never rely on colour. */
.doc-body a:not(.btn) { font-weight: 500; color: var(--primary-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.doc-body a:not(.btn):hover { text-decoration-thickness: 2px; }
.doc-body a:not(.btn):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }

/* Bulleted lists: a small muted dot on the first line. */
.doc-body ul { display: grid; row-gap: 8px; }
.doc-body ul > li { position: relative; padding-left: 24px; }
.doc-body ul > li::before { content: ""; position: absolute; left: 7px; top: calc(0.825em - 3px); width: 6px; height: 6px; border-radius: 50%; background: var(--muted-foreground); }
.doc-body ul ul { margin-top: 8px; }
.doc-body ul ul > li::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted-foreground); }

/* Numbered lists: the number in ink, right-aligned. (No tabular figures:
   in Schibsted Grotesk they space the period out.) */
.doc-body ol { counter-reset: doc-n; display: grid; row-gap: 10px; }
.doc-body ol > li { counter-increment: doc-n; position: relative; padding-left: 34px; }
.doc-body ol > li::before { content: counter(doc-n) "."; position: absolute; left: 0; width: 22px; text-align: right; font-weight: 650; color: var(--ink); }

/* Clause lists keep the source's own markers ((i), (a)) as text, hung in
   the margin, so the wording is untouched. */
.doc-body ol.doc-clauses > li { padding-left: 40px; }
.doc-body ol.doc-clauses > li::before { content: none; }
.doc-clauses__n { position: absolute; left: 0; width: 30px; color: var(--muted-foreground); }

/* Paired lines (a lead-in and its answer): two columns, a soft rule
   between pairs; one column on phones. */
.doc-pairs { border-top: 1px solid var(--hair-soft); }
.doc-pairs > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; row-gap: 2px; padding: 12px 0 13px; border-bottom: 1px solid var(--hair-soft); }
.doc-pairs dt { font-weight: 600; color: var(--ink); }
.doc-pairs dd { margin: 0; color: var(--foreground); }
/* Closing a section, the section's own rule follows: no second line. */
.doc-sec > .doc-pairs:last-child > div:last-child { border-bottom: 0; }

/* An address or contact block. */
.doc-address { font-style: normal; line-height: 1.6; }

/* Tables: a paper sheet with a 1 px edge, small-caps column heads, a soft
   rule between rows, the row's name in ink with an optional muted line. */
.doc-table-wrap { border: 1px solid var(--edge); border-radius: var(--radius-xl); background: var(--paper); box-shadow: var(--sheen); overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
.doc-table th, .doc-table td { padding: 13px 18px; border-top: 1px solid var(--hair-soft); text-align: left; vertical-align: top; }
.doc-table thead th { padding-top: 13px; padding-bottom: 11px; border-top: 0; white-space: nowrap; font-size: 12.5px; line-height: 16px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); }
.doc-table tbody tr:first-child > * { border-top: 1px solid var(--hair); }
.doc-table tbody th { font-weight: 600; color: var(--ink); }
.doc-table td { color: var(--foreground); }
.doc-table td b { font-weight: 650; color: var(--ink); }
.doc-table small { display: block; margin-top: 2px; font-size: 14px; line-height: 1.4; font-weight: 400; color: var(--muted-foreground); }
.doc-table a:not(.btn) { font-weight: 600; }

/* ── 5 · Callout ──────────────────────────────────────────────────── */
.doc-callout { padding: 16px 20px 18px; border-radius: var(--radius-xl); border: 1px solid var(--edge); background: var(--paper); box-shadow: var(--sheen); font-size: 16px; line-height: 1.6; color: var(--foreground); }
.doc-callout > * + * { margin-top: 6px; }
.doc-callout__title { font-size: 16.5px; line-height: 1.4; font-weight: 700; color: var(--ink); }

/* Screen-reader-only text (captions). */
.doc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The footer marks the page you're on. */
.site-footer__links a[aria-current="page"] { color: var(--card-foreground); }
.site-footer__links a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }

@media (forced-colors: active) {
  .doc-body ul > li::before { background: CanvasText; }
  .doc-body ul ul > li::before { background: Canvas; box-shadow: none; border: 1.5px solid CanvasText; }
  .doc-toc__list a:hover { border-left-color: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .doc-toc__list a { transition: none; }
}

/* ── Responsive ─────────────────────────────────────────────────────
   Below 1000 px the contents leaves the side: it sits under the title as
   a box, and the text takes the full column (still capped at 64ch). */
@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: minmax(0, 64ch); grid-template-areas: "toc" "body"; row-gap: 40px; padding-top: 32px; }
  .doc-toc { position: static; max-height: none; overflow: visible; margin: 0; padding: 18px 20px 14px; border-radius: var(--radius-xl); border: 1px solid var(--edge); background: var(--paper); box-shadow: var(--sheen); }
  .doc-toc__list { margin-top: 8px; border-left: 0; columns: 2; column-gap: 28px; }
  .doc-toc__list li { break-inside: avoid; }
  .doc-toc__list a { margin-left: 0; padding: 7px 0; border-left: 0; font-size: 15px; color: var(--card-foreground); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 4px; }
  .doc-toc__list a:hover { text-decoration-color: currentColor; }
  .doc-toc__list a:focus-visible { outline-offset: 2px; }
}
@media (max-width: 768px) {
  .doc { --doc-text: 16.5px; }
  .doc-head { padding: 36px 0 26px; }
  .doc-title { font-size: 32px; }
  .doc-summary { font-size: 17px; }
  .doc-meta { margin-top: 14px; }
  .doc-layout { row-gap: 32px; padding-top: 28px; }
  .doc-sec + .doc-sec { margin-top: 40px; padding-top: 32px; }
  .doc-body h2 { font-size: 22px; }
  .doc-body h3 { font-size: 17.5px; }
  .doc-lead { font-size: 17px; }
}
@media (max-width: 600px) {
  .doc-title { font-size: 30px; }
  .doc-toc { padding: 16px 18px 10px; }
  .doc-toc__list { columns: 1; }
  .doc-pairs > div { grid-template-columns: minmax(0, 1fr); }
  .doc-callout { padding: 14px 16px 16px; }
  .doc-table th, .doc-table td { padding: 12px 14px; }
  /* Stacking tables: each row becomes a block, its name across the top
     and each value under its column's name (data-label). The column heads
     stay for screen readers. */
  .doc-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .doc-table--stack tbody { display: block; }
  .doc-table--stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; padding: 14px 16px 16px; border-top: 1px solid var(--hair-soft); }
  .doc-table--stack tbody tr:first-child { border-top: 0; }
  .doc-table--stack th, .doc-table--stack td, .doc-table--stack tbody tr:first-child > * { padding: 0; border-top: 0; }
  .doc-table--stack tbody th { grid-column: 1 / -1; }
  .doc-table--stack td { margin-top: 10px; }
  .doc-table--stack td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); }
}

/* Print: the text alone, full width. */
@media print {
  .site-header, .site-footer, .doc-toc, .toast { display: none !important; }
  .doc-layout { display: block; padding-top: 24px; }
  .doc-sec { break-inside: auto; }
  .doc-body h2, .doc-body h3 { break-after: avoid; }
}
