/* ==========================================================================
   Privacy Policy — editorial legal page.

   Two things here are new to the site and deliberate:

   1. A serif face. Every other page sets headings in Be Vietnam Pro, because
      --font-display resolves to --font-sans. The brief asks for serif headings
      on this page specifically, so Newsreader is loaded HERE rather than in
      src/partials/head.html — the head partial is shared by all 26 built pages
      and none of the other 25 would use the face.

   2. A two-column reading layout. The rest of the site is full-bleed sections;
      a legal notice needs a fixed measure and a persistent contents rail.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,300;6..72,400;6..72,500&display=swap");

@layer pages {

  /* Scoped to the page so the face cannot leak into the shared header,
     footer or cookie bar, which stay on the site's sans. */
  [data-page="privacy-notice"] {
    --pp-serif: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
    --pp-rail: 280px;
    --pp-measure: 800px;
  }

  /* --- Hero ---------------------------------------------------------------
     Short by design: roughly a third of the marketing hero's height, with no
     photograph. The only decoration is a hairline grid at low opacity, the
     same device the journey section uses.
     --------------------------------------------------------------------- */
  .pp-hero {
    position: relative;
    padding-block: clamp(72px, 11vh, 132px) clamp(40px, 6vh, 64px);
    overflow: hidden;
    background: var(--surface-black);
    border-bottom: 1px solid var(--line);
  }

  .pp-hero__grid {
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(to right, var(--cx-green-a06) 1px, transparent 1px),
      linear-gradient(to bottom, var(--cx-green-a06) 1px, transparent 1px);
    background-size: 84px 84px;
    /* Fades out before it reaches the copy, so the grid never competes with
       the heading it sits behind. */
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, .5), transparent 72%);
  }

  .pp-hero .wrap { position: relative; }

  .pp-hero__title {
    margin-top: var(--space-5);
    font-family: var(--pp-serif);
    font-size: clamp(44px, 6vw, 78px);
    font-weight: 300;
    line-height: 1.04;
    letter-spacing: -.015em;
    color: var(--text-primary);
  }

  .pp-hero__lede {
    max-width: 54ch;
    margin-top: var(--space-6);
    font-size: clamp(16px, 1.25vw, 19px);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
  }

  .pp-hero__meta {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-subtle);
    border-top: 1px solid var(--line);
    /* Only as wide as the words, so the rule reads as an underline to the
       date rather than a full-width divider. */
    display: inline-block;
  }

  /* --- Layout -------------------------------------------------------------
     Rail plus measure. `align-items: start` is what lets position: sticky work
     on the rail — the default `stretch` makes the grid item full-height, and a
     sticky element with nowhere to travel inside its own box never moves.
     --------------------------------------------------------------------- */
  .pp-layout {
    display: grid;
    grid-template-columns: var(--pp-rail) minmax(0, var(--pp-measure));
    align-items: start;
    justify-content: space-between;
    /* Capped at 64px, and the cap matters more than it looks.

       Above ~1760px the wrap stops growing — --container caps it at 1240px, so
       the content box is a fixed 1128px — but 5vw keeps climbing until it hits
       the cap. At an 88px cap the column came out at 1128 - 280 - 88 = exactly
       760px, landing precisely ON the container query's `max-width: 760px`,
       which is inclusive. Every viewport at or above 1760px therefore stacked
       the section 02 table instead of drawing it.

       64px leaves the column at 784px: clear of the breakpoint by 24px and
       still inside the 760-820 measure the page is designed around. */
    gap: clamp(48px, 5vw, 64px);
    padding-block: clamp(56px, 8vh, 96px) clamp(72px, 12vh, 140px);
  }

  /* --- Contents rail ------------------------------------------------------ */
  .pp-toc {
    position: sticky;
    /* Clears the fixed site header plus a breathing gap. */
    top: 104px;
    max-height: calc(100vh - 148px);
    overflow-y: auto;
    /* The rail scrolls independently once it outgrows the viewport; hide the
       scrollbar so it does not draw a second vertical line beside the green
       indicator. */
    scrollbar-width: none;
    /* overflow-y: auto clips on BOTH axes — CSS forces overflow-x to match, so
       a visible overflow-x is not available. The global focus ring is 2px at a
       3px offset, and the links sit flush to this box, so without room its left
       edge was being cut off. Pad by 6px and pull the same 6px back so the ring
       has space while the rail stays visually where it was. */
    padding-inline: 6px;
    margin-inline: -6px;
  }

  .pp-toc::-webkit-scrollbar { display: none; }

  .pp-toc__title {
    margin-bottom: var(--space-5);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-subtle);
  }

  .pp-toc__list {
    list-style: none;
    /* The rail's own hairline. The active item paints a green segment over it
       via .pp-toc__link::before rather than moving a separate indicator, so
       there is nothing to keep in sync on resize. */
    border-left: 1px solid var(--line);
  }

  .pp-toc__link {
    position: relative;
    display: flex;
    gap: var(--space-3);
    padding: 9px 0 9px var(--space-5);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted);
    transition: color var(--dur-fast);
  }

  .pp-toc__link::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    /* Sits exactly on the list's 1px border. */
    left: -1px;
    width: 2px;
    background: var(--cx-green);
    opacity: 0;
    transition: opacity var(--dur-fast);
  }

  .pp-toc__num {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    transition: color var(--dur-fast);
  }

  .pp-toc__link:hover { color: var(--text-secondary); }

  /* Active state carries three signals, not just colour: the green rule, the
     weight change and the brighter numeral. aria-current is the hook, so the
     state is announced as well as drawn. */
  .pp-toc__link[aria-current="true"] {
    font-weight: var(--weight-semibold);
    color: var(--cx-green);
  }

  .pp-toc__link[aria-current="true"]::before { opacity: 1; }
  .pp-toc__link[aria-current="true"] .pp-toc__num { color: var(--cx-green-bright); }

  /* --- Mobile contents ---------------------------------------------------- */
  .pp-toc-mobile {
    display: none;
    margin-bottom: var(--space-9);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
  }

  .pp-toc-mobile__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* 48px+ tall for a comfortable tap target. */
    padding: var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
  }

  .pp-toc-mobile__summary::-webkit-details-marker { display: none; }

  .pp-toc-mobile__chevron {
    width: 9px;
    height: 9px;
    border-right: 1.5px solid var(--cx-green);
    border-bottom: 1.5px solid var(--cx-green);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform var(--dur-fast);
  }

  .pp-toc-mobile[open] .pp-toc-mobile__chevron {
    transform: rotate(225deg) translate(-2px, -2px);
  }

  .pp-toc-mobile__list {
    list-style: none;
    padding: 0 var(--space-5) var(--space-4);
    border-top: 1px solid var(--line-soft);
  }

  .pp-toc-mobile__list a {
    display: flex;
    gap: var(--space-4);
    /* 14px + 14px + ~20px line box = 48px, the comfortable tap minimum. */
    padding: 14px 0;
    font-size: var(--text-sm);
    line-height: 1.45;
    color: var(--text-muted);
  }

  .pp-toc-mobile__list a:hover { color: var(--cx-green); }

  /* The three-column rows and the rights grid answer to the width of THIS
     column, not the window. Those two differ: between 1024px and 1200px the
     rail is still present and squeezes the column to ~650px, while at 1000px —
     a narrower window — the rail is gone and the column is ~900px. A viewport
     media query cannot express "stack when the column is narrow"; a container
     query is exactly that. */
  .pp-body {
    container-type: inline-size;
    container-name: ppbody;
  }

  /* --- Sections ----------------------------------------------------------- */
  .pp-section {
    /* Anything the header would otherwise cover when an anchor is followed. */
    scroll-margin-top: 96px;
    padding-top: clamp(48px, 7vh, 76px);
    /* A line's worth of clear space after each section's last line, so the
       closing sentence is not sitting on the rule that starts the next one. */
    padding-bottom: clamp(28px, 4vh, 44px);
    border-top: 1px solid var(--line-soft);
  }

  /* The first section sits directly under the mobile contents, so it needs no
     rule of its own. */
  .pp-section:first-of-type {
    padding-top: 0;
    border-top: 0;
  }

  .pp-section__num {
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    font-variant-numeric: tabular-nums;
    color: var(--cx-green);
  }

  .pp-section__title {
    max-width: 22ch;
    margin-top: var(--space-4);
    margin-bottom: var(--space-7);
    font-family: var(--pp-serif);
    font-size: clamp(28px, 3.1vw, 40px);
    font-weight: 300;
    line-height: 1.16;
    letter-spacing: -.01em;
    color: var(--text-primary);
  }

  /* --- Body copy ----------------------------------------------------------
     18px at the default root size, 1.72 leading, off-white rather than pure
     white. Text is left-aligned, never justified — justification on a measure
     this narrow opens rivers between words.
     --------------------------------------------------------------------- */
  /* :where() so this is the DEFAULT for prose, not a rule that outranks the
     labelled paragraphs below it. `.pp-body p` would be (0,1,0) and would beat
     single-class rules like .pp-section__num — which it silently did, painting
     the green numerals body-grey. :where(.pp-body) p is (0,0,1): every class
     rule wins over it without needing a compensating override. */
  :where(.pp-body) p {
    font-size: clamp(16.5px, 1.5vw, 18.5px);
    line-height: 1.72;
    color: var(--text-light);
    text-wrap: pretty;
  }

  :where(.pp-body) p + p { margin-top: var(--space-5); }

  .pp-h3 {
    margin-top: var(--space-9);
    margin-bottom: var(--space-4);
    font-family: var(--pp-serif);
    font-size: clamp(21px, 1.9vw, 26px);
    font-weight: 400;
    line-height: 1.25;
    color: var(--text-bright);
  }

  .pp-h4 {
    margin-bottom: var(--space-3);
    font-size: 15.5px;
    font-weight: var(--weight-semibold);
    letter-spacing: .01em;
    color: var(--cx-green);
  }

  .pp-list {
    margin-top: var(--space-4);
    padding-left: var(--space-5);
    list-style: none;
  }

  .pp-list li {
    position: relative;
    font-size: clamp(15.5px, 1.1vw, 16.5px);
    line-height: 1.66;
    color: var(--text-muted);
  }

  .pp-list li + li { margin-top: var(--space-3); }

  .pp-list li::before {
    content: "";
    position: absolute;
    top: .68em;
    left: calc(var(--space-5) * -1);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--cx-green-a50);
  }

  /* The two process lists in section 04 are read as prose, so they take the
     body size and colour rather than the tighter list treatment. */
  .pp-list--loose li {
    font-size: clamp(16.5px, 1.5vw, 18.5px);
    line-height: 1.72;
    color: var(--text-light);
  }

  .pp-list--loose li + li { margin-top: var(--space-4); }

  /* --- Section 02 table ---------------------------------------------------
     A real table on a wide column; stacked blocks once the column drops below
     760px. Subtle rules rather than card fills, per the page's overall
     treatment.
     --------------------------------------------------------------------- */
  .pp-table {
    width: 100%;
    margin-top: var(--space-7);
    border-collapse: collapse;
    text-align: left;
  }

  .pp-table__col--activity { width: 26%; }

  .pp-table th,
  .pp-table td {
    padding: var(--space-6) var(--space-6) var(--space-6) 0;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
  }

  .pp-table th:last-child,
  .pp-table td:last-child { padding-right: 0; }

  .pp-table thead th {
    padding-top: 0;
    padding-bottom: var(--space-4);
    font-size: 10.5px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-subtle);
  }

  .pp-table tbody th {
    font-size: clamp(15.5px, 1.15vw, 17px);
    font-weight: var(--weight-medium);
    /* 1.66 to match .pp-list, not 1.5. Half-leading is (line-height - 1) x
       font-size / 2, so two blocks only start their first line at the same
       height when they share a line-height ratio. At 1.5 the activity sat 2px
       above the first bullet beside it; matching the ratio leaves the two
       within a quarter-pixel, the residue of the small font-size difference. */
    line-height: 1.66;
    color: var(--text-bright);
  }

  /* Repeats the column name inside each cell for the stacked layout. Hidden
     here, where the real <th> headers already label the columns. */
  .pp-table__label { display: none; }

  /* The label span is display:none on a wide screen but still the cell's first
     child, so the list that follows it is never :first-child and kept its 16px
     top margin — dropping the first bullet 18px below the activity line beside
     it. Zero it here; in the stacked layout the visible label's own
     margin-bottom provides the separation instead. */
  .pp-table td > .pp-table__label + .pp-list { margin-top: 0; }

  .pp-basis {
    margin-top: var(--space-5);
    font-size: 13px;
    /* 1.66, the same ratio as the activity cell and the lists, so a cell that
       opens with a legal-basis label starts its first line at the same height
       as one that opens with a bullet. */
    line-height: 1.66;
    font-weight: var(--weight-semibold);
    color: var(--cx-green);
  }

  .pp-basis:first-of-type { margin-top: 0; }

  /* --- Blocks -------------------------------------------------------------
     Three related treatments, each a dark panel with a thin green edge. They
     differ in weight so a reader can tell "contact us" from "please note"
     without reading the label, but none of them shouts.
     --------------------------------------------------------------------- */
  .pp-panel {
    margin-top: var(--space-8);
    padding: var(--space-7);
    background: var(--surface-raised);
    border: 1px solid var(--cx-green-a30);
    border-radius: var(--radius-md);
  }

  .pp-panel__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    font-size: 15.5px;
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
  }

  .pp-icon { flex: 0 0 auto; color: var(--cx-green); }

  .pp-callout {
    margin-block: var(--space-8);
    padding-left: var(--space-6);
    border-left: 2px solid var(--cx-green);
  }

  .pp-callout__label {
    margin-bottom: var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--cx-green);
  }

  /* Standing on its own under the table, it needs more air above it than it
     did tucked inside a cell. */
  .pp-table + .pp-note { margin-top: var(--space-7); }

  .pp-note {
    margin-top: var(--space-6);
    padding: var(--space-5);
    background: var(--cx-green-a06);
    border: 1px solid var(--cx-green-a18);
    border-radius: var(--radius-sm);
  }

  .pp-note__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 11px;
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--cx-green);
  }

  /* Same :where() reason as the prose default: .pp-note p would be (0,1,1) and
     would beat .pp-note__label, which is itself a <p> inside this block. */
  :where(.pp-note) p {
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--text-muted);
  }

  /* --- Section 06 subsections --------------------------------------------- */
  .pp-subsections {
    margin-top: var(--space-7);
    border-top: 1px solid var(--line-soft);
  }

  .pp-subsection {
    padding-block: var(--space-6);
    border-bottom: 1px solid var(--line-soft);
  }

  /* --- Section 07 rights --------------------------------------------------
     Two columns on a wide screen, one below. A <dl> with each pair wrapped in
     a div so the grid can treat term and description as a single cell.
     --------------------------------------------------------------------- */
  .pp-rights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-top: var(--space-7);
    /* The 1px gap plus a background gives hairline separators between cells
       without doubling borders where two cells meet. */
    background: var(--line-soft);
    border: 1px solid var(--line-soft);
  }

  .pp-right {
    padding: var(--space-6);
    background: var(--surface-page);
  }

  .pp-right__term {
    margin-bottom: var(--space-3);
    font-size: 15.5px;
    font-weight: var(--weight-semibold);
    color: var(--text-bright);
  }

  .pp-right__desc {
    font-size: 14.5px;
    line-height: 1.66;
    color: var(--text-muted);
  }

  /* --- Links -------------------------------------------------------------- */
  .pp-mail,
  .pp-xref {
    color: var(--cx-green);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--cx-green-a50);
    /* Long addresses must never push the measure sideways on a phone. */
    overflow-wrap: anywhere;
    transition: color var(--dur-fast), text-decoration-color var(--dur-fast);
  }

  .pp-mail:hover,
  .pp-xref:hover {
    color: var(--cx-green-bright);
    text-decoration-color: var(--cx-green-bright);
  }

  .pp-mail--lg {
    font-size: clamp(18px, 1.8vw, 23px);
    text-decoration-thickness: 1px;
  }

  /* --- Closing panel ------------------------------------------------------ */
  .pp-closing {
    margin-top: clamp(56px, 8vh, 88px);
    padding-top: clamp(40px, 6vh, 60px);
    border-top: 1px solid var(--line);
  }

  .pp-closing__title {
    margin-bottom: var(--space-4);
    font-family: var(--pp-serif);
    font-size: clamp(24px, 2.4vw, 32px);
    font-weight: 300;
    color: var(--text-primary);
  }

  .pp-closing p + p { margin-top: var(--space-4); }

  /* --- Responsive ---------------------------------------------------------
     1024px is where the rail plus an 800px measure stops fitting inside the
     1240px container with a usable gutter, so that is where the sidebar is
     replaced by the <details> control rather than being squeezed narrower.
     --------------------------------------------------------------------- */
  @media (max-width: 1180px) {
    .pp-layout { gap: var(--space-9); }
    .pp-toc { --pp-rail: 240px; }
  }

  @media (max-width: 1024px) {
    .pp-layout {
      grid-template-columns: minmax(0, 1fr);
      padding-block: var(--space-9) clamp(64px, 10vh, 104px);
    }

    .pp-toc { display: none; }
    .pp-toc-mobile { display: block; }
  }

  /* Below 620px of column the three columns stop being readable, so each row
     becomes three labelled blocks stacked vertically. 620px is low enough that
     the table survives the whole rail zone — the column bottoms out at 630px at
     a 1024px viewport, its narrowest point — and stacking only takes over on
     phones and small tablets, from roughly a 690px viewport down. The labels
     were already real text rather than ::before content, so nothing is lost in
     the change of shape: they are still announced and still findable by
     in-page search. */
  @container ppbody (max-width: 620px) {
    /* Table parts become blocks so the rows stack. This is why the markup
       names its ARIA roles explicitly — changing `display` on a table drops
       the implicit ones. */
    .pp-table,
    .pp-table thead,
    .pp-table tbody,
    .pp-table tr,
    .pp-table th,
    .pp-table td { display: block; }

    /* The header row has nowhere to sit once the rows stack, but it must stay
       in the accessibility tree to keep labelling the cells. */
    .pp-table thead {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      clip-path: inset(50%);
    }

    .pp-table tbody { border-top: 1px solid var(--line); }

    .pp-table tr {
      padding-block: var(--space-7);
      border-bottom: 1px solid var(--line);
    }

    .pp-table th,
    .pp-table td {
      padding: 0;
      border-bottom: 0;
    }

    .pp-table td { margin-top: var(--space-6); }

    .pp-table__label {
      display: block;
      margin-bottom: var(--space-3);
      font-size: 10.5px;
      font-weight: var(--weight-semibold);
      letter-spacing: var(--tracking-wide);
      text-transform: uppercase;
      color: var(--text-subtle);
    }

    .pp-rights { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 680px) {
    .pp-hero { padding-block: var(--space-10) var(--space-8); }
    .pp-section__title { max-width: none; }
    .pp-panel { padding: var(--space-5); }
    .pp-right { padding: var(--space-5); }
    .pp-callout { padding-left: var(--space-5); }
  }

  /* --- Motion -------------------------------------------------------------
     A legal page gets smooth anchor scrolling and nothing else. The site's
     scroll reveals are deliberately not applied here: copy that fades in as
     you scroll is the wrong behaviour for a document people need to read,
     search and print.
     --------------------------------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    .pp-toc-mobile__chevron { transition: none; }
  }
}
