/* ==========================================================================
   legal.v1.css
   THE LEGAL DOCUMENT REGISTER (dark) - one owner for every .doc-* selector.
   The scaffold markup is shared (src/components/LegalPage.tsx), so its CSS
   lives here in the shared layer, never page-local. Loaded LAST in the
   cascade (after uplift.v1.css) so these declarations deliberately win over
   the retired paper-era .doc-* rules in components.v1.css §13.
   Class names are load-bearing: e2e/legal-identity.spec.ts matches
   class="doc-lang-note" literally and asserts the div[lang="en-GB"] wrapper;
   anchors #clause-NN are deep-linked from other documents.
   ========================================================================== */

/* (--link is defined in tokens.v1.css with the rest of the theme contract.) */

/* No-JS safety for the shared .kin hero: the mask holds lines at
   transform+opacity until the reveal engine arms .in - without JS that never
   happens, and a legal document must render unconditionally. */
html:not(.js) .kin .kin-inner{transform:none;opacity:1}

/* HERO - trust's register: kicker eyebrow, kinetic monument h1, lede, and
   the document record plate. */
.legal-hero{padding-top:28px}
.legal-hero .lede{max-width:64ch;margin-top:22px}

/* document record plate (doc ref / last reviewed / controller / status):
   hairline-gap grid, cells one step up from ground */
.doc-meta{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));
  gap:1px;
  background:var(--hairline-strong);
  border:1px solid var(--hairline-strong);
  border-radius:var(--r-1);
  overflow:hidden;
  margin:28px 0 0;
  max-width:860px;
}
/* the DPA's three-field plate: declared, not page-local */
.doc-meta[data-fields="3"]{grid-template-columns:repeat(3, 1fr)}
/* below the 4-up width, auto-fit resolves to 3 columns and orphans the 4th
   cell; pin to a balanced 2x2 at tablet/mobile. The 3-field plate stays
   3-abreast (a 2-up fallback orphans its third cell over an empty
   hairline-strong track) and goes single-column on phones. */
@media (max-width:1000px){
  .doc-meta{grid-template-columns:repeat(2, 1fr)}
}
@media (max-width:560px){
  .doc-meta[data-fields="3"]{grid-template-columns:1fr}
}
.doc-meta>div{background:var(--bg-1);padding:12px 14px}
.dm-label{
  display:block;
  font-size:var(--t-label);font-weight:800;
  letter-spacing:1.3px;text-transform:uppercase;
  color:var(--ink-3);
  margin-bottom:3px;
}
.dm-value{
  display:block;
  font-size:12px;font-weight:600;color:var(--ink-1);
  font-variant-numeric:tabular-nums;
}

/* DOCUMENT BODY - .doc-sheet composes .evidence-surface (bg/border/stamp
   top rule/radius/shadow/padding come from the primitive); this file only
   sets the document column and its type. */
.doc-sheet{
  max-width:860px;
  margin:0;
  color:var(--ink-2);
}
.doc-sheet h2{font-size:18px;font-weight:700;color:var(--ink-1);margin:2.2em 0 .7em}
.doc-sheet p{font-size:15px;line-height:1.7;margin-bottom:1.1em}
.doc-sheet p:last-child{margin-bottom:0}
.doc-sheet a{color:var(--link);text-decoration:underline;text-underline-offset:2px}
.doc-sheet .clause{scroll-margin-top:96px}

.clause{position:relative}
.clause-n{
  /* marginal number sits inside the evidence-surface padding (48px at
     desktop), so the offset must stay under it - the paper era's -58px would
     poke through the surface border */
  position:absolute;left:-34px;top:.25em;
  font-size:var(--t-label);font-weight:700;
  color:var(--ink-3);
  font-variant-numeric:tabular-nums;
}
@media (max-width:1020px){
  .clause-n{position:static;display:block;margin-bottom:4px}
}

/* localised English-document notice - rendered OUTSIDE the en-GB wrapper so
   assistive tech reads it in the visitor's language. The class attribute
   must stay exactly "doc-lang-note" (e2e literal match). */
.doc-lang-note{
  margin:0 0 26px;
  padding:12px 16px;
  border:1px solid var(--hairline);
  border-left:3px solid var(--datum);
  border-radius:var(--r-2);
  background:var(--bg-1);
  font-size:13.5px;line-height:1.55;
  color:var(--ink-2);
}

/* in-page contents */
.doc-toc{
  margin:0 0 34px;
  padding:16px 20px 18px;
  border:1px solid var(--hairline-strong);
  border-radius:var(--r-2);
  background:var(--bg-1);
}
.doc-toc-label{
  font-family:var(--font-mono);
  font-size:var(--t-label);letter-spacing:1.2px;text-transform:uppercase;
  color:var(--ink-3);margin:0 0 10px;
}
.doc-toc ol{
  margin:0;padding-left:2.2em;
  list-style:decimal-leading-zero;
  columns:2;column-gap:36px;
  font-size:14px;line-height:1.45;
}
.doc-toc li{break-inside:avoid}
/* block padding lifts each link's hit target (~32px) - the 20px-tall rows
   were the site's densest sub-40px tap-target cluster */
.doc-toc a{color:var(--ink-2);display:inline-block;padding-block:6px;text-decoration:none}
.doc-toc a:hover,
.doc-toc a:focus-visible{color:var(--ink-1);text-decoration:underline;text-underline-offset:2px}
@media (max-width:640px){.doc-toc ol{columns:1}}

/* closing note (verbatim approved text) */
.doc-note{
  font-size:13px;color:var(--ink-3);
  border-top:1px solid var(--hairline);
  padding-top:18px;margin-top:40px;
}

/* cookies register table (legal-register furniture, shared here rather than
   page-local now the markup is shared) */
.doc-table-wrap{overflow-x:auto;margin:18px 0}
.doc-table{border-collapse:collapse;width:100%;min-width:560px;font-size:13.5px;line-height:1.5}
.doc-table th{
  font-family:var(--font-mono);
  /* the shared micro-type tier, not a 10.5px literal: this is a column label on
     a document a phone visitor reads, and the tier holds the 12px phone floor */
  font-size:var(--t-label);font-weight:700;letter-spacing:1px;text-transform:uppercase;
  color:var(--ink-3);text-align:left;
}
.doc-table th,
.doc-table td{border:1px solid var(--hairline-strong);padding:9px 12px;vertical-align:top}
.doc-table td{color:var(--ink-2)}
/* the per-cell column label belongs to the restacked (narrow) form only - the
   real header row carries it at every width above that */
.doc-td-label{display:none}

/* NARROW WIDTHS: the inventory RESTACKS into label/value pairs.
   The 560px floor above is a minimum width, not a maximum: measured at 390 the
   scrollport is 306px (the sheet's own padding takes the other 84), so the
   Lifespan column sat wholly outside it with no scrollbar affordance at rest -
   and the Purpose cell, a 160-character sentence, would be ~80px wide even once
   reached. 560 + 84 = 644, so the sideways flick starts below ~650px and 700 is
   the first breakpoint clear of it.
   display:block strips a table's semantics from the accessibility tree, so the
   markup carries explicit table/rowgroup/row/columnheader/cell roles (see
   cookies/page.tsx) and the thead is hidden VISUALLY only, keeping the column
   headers in the AT tree. Each cell then shows its own column name from a real
   aria-hidden <span> (.doc-td-label) carrying the SAME translated <th> string -
   no new copy, and no ::before generated content: generated content is exposed to
   assistive tech, so with the header row still present every label was announced
   TWICE per cell. */
@media (max-width:700px){
  .doc-table-wrap{overflow-x:visible}
  .doc-table{min-width:0}
  .doc-table,
  .doc-table thead,
  .doc-table tbody,
  .doc-table tr,
  .doc-table th,
  .doc-table td{display:block}
  .doc-table thead{
    position:absolute;width:1px;height:1px;
    padding:0;margin:-1px;overflow:hidden;
    clip:rect(0,0,0,0);white-space:nowrap;border:0;
  }
  .doc-table tr{
    border:1px solid var(--hairline-strong);
    border-radius:var(--r-1);
    margin-bottom:12px;
  }
  .doc-table tr:last-child{margin-bottom:0}
  .doc-table td{
    border:0;border-top:1px solid var(--hairline);
    padding:10px 14px;
  }
  .doc-table tr td:first-child{border-top:0}
  .doc-td-label{
    display:block;margin-bottom:3px;
    font-family:var(--font-mono);
    font-size:var(--t-label);font-weight:700;
    letter-spacing:1px;text-transform:uppercase;
    color:var(--ink-3);
  }
}

/* ==========================================================================
   PRINT - the ONE print block for the legal register (the five page-local
   copies died with the paper register). A legal document must print as clean
   paper: no fixed chrome, no dark surfaces, no reveal masks.
   ========================================================================== */
@media print{
  .nav,.nav-drawer,.footer,.skip-link,
  .chrome-bar,.return-banner,
  .jeff-fab,.jeff-panel,
  #glhero{display:none !important}
  body:not(.doc-light) main::after{display:none}
  #main{padding:0}
  .sheet-section,.page-hero{padding-block:0;background:none;box-shadow:none}
  .page-hero::before{display:none}
  .legal-hero{padding-top:0}
  .doc-sheet,
  .doc-sheet.evidence-surface{
    margin:0;max-width:none;
    border:0;border-radius:0;box-shadow:none;
    padding:0;
    background:#fff;color:#0c0a09;
  }
  .doc-sheet a{color:#1d4ed8}
  .doc-meta,.doc-toc,.doc-lang-note{background:#fff;box-shadow:none}
  .related-strip{display:none}
  .kicker::before,.kicker::after,.amber-rule::after{display:none}
  .kin .kin-inner{transform:none !important;opacity:1 !important}
  .clause{break-inside:avoid}
  .doc-toc,.doc-table{break-inside:avoid}
}
