/* ============================================================================
   Privacy and Terms — readability and navigation.  (brief §17)
   ============================================================================

   "Prioritise readability and navigation. No decorative financial dashboard
   styling is needed."  Both pages had the dashboard styling and neither had
   the navigation.

   What the pages carried instead of this file: roughly forty inline `style`
   attributes, one per heading, paragraph and list, restating the same four
   declarations each time — including `padding-left: 1.5rem` on every `<ul>`,
   a physical property, so the Arabic pages indented their bullets off the
   wrong edge.  Those are gone from the markup, which is why this sheet exists
   at all.

   2026-09-18, the visual system pass.  Two changes.

   The prose is no longer described here.  The reading column, the measure,
   the list markers, the link ink and the hairline between sections are the
   `.am-report` component (static/css/am-system.css), which every written
   surface on the site now shares; this file had its own copy of all five and
   they had already drifted (a 52ch measure against the system's 70ch, disc
   markers against the system's drawn dot).  What is left here is the part
   that is genuinely this page's: the frame, the contents list, and the number
   that hangs beside each clause.

   And the contents list pins.  §17 asked for navigation, and a list of ten
   anchors that scrolls away after the first clause is navigation you can use
   once.  On a desktop it is a column of its own at the reading start, stuck
   below the header; at 1023px and under it collapses back to the band above
   the document, which is where it reads on a phone.

   Nothing in this file writes a `.c-*` selector, and nothing writes an
   `.am-*` one either — those belong to the canvas and component layers, and
   test_canvas_design fails the build if a second stylesheet touches a canvas
   class.  Where this page needs to say something about its own reading
   column it says it through `.legal-doc`, which is on the same element.

   Cascade note.  page-unification.css cards these pages with
   `:is(.page-terms, .page-privacy, .page-blog_detail) .main-content >
   .container > div`, and sets the body ink with a matching `… > div :is(p,
   li)` rule.  The wrapper is an `<article>` — which is what a policy
   document is — so neither selector matches and the ink is set by the
   component layer instead of inherited from a card rule.  That is a change of
   element, not a specificity fight: nothing here overrides a rule another
   workstream owns.
   ============================================================================ */

/* --- The page ------------------------------------------------------------ */

.legal {
  width: 100%;
  max-width: var(--sh-max);
  margin-inline: auto;
  padding: var(--sh-page-start) 0 var(--c-space-7);
}

/* Document and contents side by side, contents at the reading start.  The
   column is 15rem because the longest entry in either document ("Limitation
   of Liability", "International Data Transfers") sets on two lines at that
   width and on three below it. */
.legal__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--c-space-6);
  align-items: start;
}

@media (min-width: 64rem) {
  .legal__layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem);
  }
}

/* --- Contents ------------------------------------------------------------ */

/* §17's "navigation".  Ten numbered sections and, before this, no way to
   reach one of them: a support reply could not link to clause 7. */
.legal-toc {
  padding-block: var(--c-space-4);
  border-block: 1px solid var(--c-line);
}

/* Pinned, but only where there is a margin to pin it in.  6.5rem clears the
   sticky shell header; `max-block-size` plus `overflow-y` means a longer
   document's contents scroll inside the pinned column rather than running off
   the bottom of the viewport, which is the failure mode of every unbounded
   sticky sidebar. */
@media (min-width: 64rem) {
  .legal-toc {
    position: sticky;
    inset-block-start: 6.5rem;
    max-block-size: calc(100vh - 8rem);
    overflow-y: auto;
    overscroll-behavior-block: contain;
    padding-block: 0;
    border-block: 0;
    border-inline-start: 1px solid var(--c-line);
    padding-inline-start: var(--c-space-5);
  }
}

.legal-toc__head {
  margin: 0 0 var(--c-space-3);
  font-size: var(--c-t-label);
  font-weight: var(--c-w-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* Arabic does not have capitals and tracked capitals are what this treatment
   is; without the reset the label renders as spaced-out Arabic letterforms. */
[dir="rtl"] .legal-toc__head { letter-spacing: 0; text-transform: none; }

/* The list numbers itself, so the markers agree with the section numbers
   without either being typed twice. */
.legal-toc__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0 var(--c-space-5);
  margin: 0;
  padding-inline-start: 1.4rem;
  list-style: decimal;
  color: var(--c-text-faint);
}

@media (min-width: 64rem) {
  .legal-toc__list { grid-template-columns: minmax(0, 1fr); }
}

.legal-toc__list li {
  padding-block: 0.18rem;
}

.legal-toc__list a {
  display: inline-block;
  /* Under the 44px touch floor as drawn text, so the padding is the target;
     the row stays one line tall because the padding is vertical only. */
  padding-block: 0.3rem;
  font-size: var(--c-t-meta);
  line-height: 1.5;
  color: var(--c-text-secondary);
  text-decoration: none;
  border-block-end: 1px solid transparent;
}

.legal-toc__list a:hover {
  color: var(--c-text);
  border-block-end-color: var(--c-line-strong);
}

.legal-toc__list a:focus-visible {
  outline: 2px solid var(--c-evidence);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Sections ------------------------------------------------------------ */

/* The measure, the rhythm between sections and the prose itself come from
   `.am-report` on this element.  `.legal-doc` exists so the print rules and
   any page-specific correction have a name of this page's own to hang on. */
.legal-doc {
  min-width: 0;
}

/* The number hangs beside the heading so the headings align with each other
   and with the body text below them, rather than each starting a different
   distance in depending on whether it is 1. or 10. */
.legal-section__head {
  display: flex;
  align-items: baseline;
  gap: var(--c-space-2);
  /* Defensive, not load-bearing. `header.dashboard-header` declares
     `position: sticky`, so this was written as if a pinned header would
     swallow the heading an anchor jumps to -- but measured, the header's
     bottom is -389px once the page scrolls: it does not actually pin on
     this shell, and every one of the ten anchors lands with 500px of
     clearance. Kept because it costs nothing and is correct the day the
     header does stick; the rationale is corrected because a comment that
     describes behaviour the page does not have is worse than none. */
  scroll-margin-block-start: 6.5rem;
}

.legal-section__n {
  flex: 0 0 auto;
  min-width: 1.4rem;
  font-family: var(--c-mono);
  font-size: var(--c-t-meta);
  font-weight: var(--c-w-bold);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-faint);
}

.legal-section strong {
  color: var(--c-text);
  font-weight: var(--c-w-bold);
}

/* --- Narrow -------------------------------------------------------------- */

@media (max-width: 48rem) {

  /* One column: two 15rem columns of contents on a 390px screen is two
     columns of broken words. */
  .legal-toc__list {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   Print
   ============================================================================

   These pages are read on paper as well as on screen -- a policy someone
   files, an article someone annotates -- and nothing on the site had ever
   styled the printed form of them.  Rendered under `media: print` the dark
   theme carried straight through, and browsers do not print background
   colours unless the reader ticks "Background graphics".  The dark ground was
   therefore dropped and the light ink kept: body prose left the printer at
   rgb(182,198,218) on white, 1.74:1, and the page title at 1.14:1.  A sheet
   that reads as blank.

   Three things were needed, and the first attempt got only the first.

   Ink.  Forced dark, which takes the prose to 17.74:1 in either theme.  The
   selectors carry a `html body.page-*` prefix because the rules they answer
   are important and outweigh a bare class: an unscoped `.legal-toc__head`
   with `!important` still lost, and measured light afterwards.

   Headings.  The page title and the clause headings are set by the canvas and
   component layers, which this sheet may not name, so headings are reached by
   element instead.  That is not a workaround so much as the right tool: on
   paper every heading wants the same ink regardless of which layer named it.

   Chrome.  `nav.am-quick-dock` is `position: fixed` and printed *over* the
   body text near the foot of the page; the header and footer print as slabs
   of 3.04:1 links that no one can click.  All of it goes.  Nothing hidden
   here carries content -- the document keeps its own title, and the contents
   list stays, because on paper it is a table of contents rather than a
   scroll affordance.
   ============================================================================ */

@media print {
  html:root,
  /* `[class^="page-"]` is carried onto the ink selectors for weight, not for
     matching.  theme-foundation.css sets the headings with
     `body[class^="page-"] .main-content :is(h1, ...) { color: var(--am-u-text)
     !important }` -- (0,2,2) and important.  A `html body.page-x :is(h1, ...)`
     rule is only (0,1,3), because `:is()` takes the weight of its most
     specific argument and every argument here is an element, so the first
     attempt at this lost and the headings measured 1.14:1 on white after it.
     Repeating the attribute lifts these to (0,2,3). */
  html body.page-privacy[class^="page-"],
  html body.page-terms[class^="page-"] {
    background: #fff !important;
  }

  /* Fixed and interactive chrome: useless on paper, and the dock actively
     obscures the text it lands on. */
  header.dashboard-header,
  footer.dashboard-footer,
  nav.am-quick-dock,
  .pg-modal,
  .pg-launcher,
  .share-toast,
  .cookie-consent,
  .social-banner {
    display: none !important;
  }

  html body.page-privacy[class^="page-"] :is(h1, h2, h3, h4, h5, h6),
  html body.page-terms[class^="page-"] :is(h1, h2, h3, h4, h5, h6) {
    color: #000 !important;
  }

  html body.page-privacy[class^="page-"] :is(p, li, span, strong, em, dt, dd, time, a, td, th),
  html body.page-terms[class^="page-"] :is(p, li, span, strong, em, dt, dd, time, a, td, th) {
    color: var(--c-text) !important;
  }

  /* The reading measure is a screen concern; the page box is the column on
     paper, so the cap only wastes half the sheet.  Same for the two-column
     layout: the contents list prints as a table of contents above the
     document, not beside it. */
  .legal,
  .legal-doc,
  .legal-doc p,
  .legal-doc li {
    max-width: none;
    max-inline-size: none;
  }

  .legal__layout {
    display: block;
  }

  .legal-toc {
    position: static;
    max-block-size: none;
    overflow: visible;
    margin-block-end: var(--c-space-5);
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .legal {
    padding: 0;
  }

  /* A clause split across a page break is a clause someone misreads. */
  .legal-section {
    break-inside: avoid;
  }

  .legal-section__head {
    break-after: avoid;
  }
}

/* ---------------------------------------------------------------------------
   Forced colours (Windows High Contrast)
   ---------------------------------------------------------------------------
   The UA replaces every author colour with a system palette: `color`,
   `background-color` and `border-color` are all overridden, while `outline`,
   `text-decoration` and box geometry survive.  Any state whose only cue is a
   colour -- a border colour included -- therefore goes silent.

   Measured with forced colours active, this control's hover had no visible
   cue at all.  A `text-decoration` is the cue that survives, so it is added
   here and only here: outside forced colours the designed treatment is
   unchanged.
   --------------------------------------------------------------------------- */

@media (forced-colors: active) {
  .legal-toc__list a:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
  }
}
