/* Legal reading layout for /privacy/ and /terms/ (terms.css imports this file; behaviour: js/legal.js,
   shared by both pages). One column of text at a 65 to 72 character measure, hairline sections, and a contents rail:
   sticky beside the text on wide screens, a compact glass disclosure under the site header on phones.
   Without the script the contents is a native <details> of plain anchor links and everything reads the same.
   Motion here is navigational only: the marker glides to the section being read, the rule under "On this page"
   fills with reading progress, the disclosure drops and lifts. Nothing in the text itself moves after it arrives. */

.lg-head{ padding-bottom:clamp(48px, 2rem + 3vw, 88px); }
.lg-head .lede{ max-width:52ch; }
.lg-status{ display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:32px; }
.lg-draft{ color:var(--ink); font-weight:600; }

.lg-wrap{ padding-block:clamp(48px, 2rem + 3vw, 96px) var(--section); border-top:1px solid var(--line); }
.lg-grid{ display:grid; grid-template-columns:240px minmax(0,1fr); gap:clamp(40px, 7vw, 120px); align-items:start; }

/* ---------- contents rail ---------- */
.lg-toc{ --lg-row:38px; position:sticky; top:100px; }
.lg-toc summary{ display:block; list-style:none; }
.lg-toc summary::-webkit-details-marker{ display:none; }
.lg-toc-label{ font-size:13px; font-weight:500; line-height:1.35; color:var(--ink-3); }
.lg-toc ol{ list-style:none; }
.lg-toc a{ display:grid; grid-template-columns:30px minmax(0,1fr); align-items:baseline; align-content:center; min-height:var(--lg-row); font-size:var(--t-small); line-height:1.35; color:var(--ink-2); text-decoration:none; transition:color var(--dur-micro) ease; }
.lg-toc li:first-child a{ grid-template-columns:minmax(0,1fr); }
.lg-tn{ font:500 var(--t-label)/1.35 var(--mono); color:var(--ink-3); font-variant-numeric:tabular-nums; transition:color var(--dur-micro) ease; }
.lg-toc a[aria-current], .lg-toc a[aria-current] .lg-tn{ color:var(--ink); }
.lg-toc a:active{ color:var(--ink); }
@media (hover: hover) and (pointer: fine){
  .lg-toc a:hover{ color:var(--ink); }
}
@media (pointer: coarse){ .lg-toc{ --lg-row:44px; } }

/* Reading progress: the rule under the label fills from the left. Empty (a plain hairline) until the script runs. */
.lg-progress{ display:block; height:1px; background:var(--line-2); }
.lg-progress i{ display:block; height:100%; background:var(--ink-2); transform:scaleX(0); transform-origin:0 50%; }

@media (min-width: 961px){
  /* The rail is always open here. The script sets [open]; this keeps it open with the script off too. */
  .lg-toc summary{ pointer-events:none; }
  .lg-toc-d::details-content{ content-visibility:visible; }
  .lg-toc-now, .lg-toc-chev{ display:none; }
  .lg-progress{ margin-top:14px; }
  .lg-toc-panel{ position:relative; max-height:calc(100vh - 170px); margin-top:12px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; }
  .lg-toc-panel::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:1px; background:var(--line); }
  .lg-toc a{ padding:8px 0 8px 20px; }
  .lg-toc a:focus-visible{ outline-offset:-2px; border-radius:6px; }
  /* The marker: a short ink tick on the track. The script moves it with one transform to the row being read. */
  .lg-marker{ position:absolute; left:0; top:0; width:2px; height:20px; border-radius:1px; background:var(--ink); opacity:0; transition:transform var(--dur-ui) var(--ease-out), opacity var(--dur-micro) ease; }
  .lg-toc.has-now .lg-marker{ opacity:1; }
}

/* ---------- body ---------- */
/* 560px of 18px text averages 69 characters a line (measured); the 44px gutter holds the section numbers. */
.lg-body{ max-width:604px; color:var(--ink-2); font-size:1.125rem; line-height:1.65; letter-spacing:-.011em; }
.lg-body a{ color:var(--ink); }
.lg-body h2{ display:flex; align-items:baseline; gap:16px; font-size:1.625rem; font-weight:650; letter-spacing:-.03em; line-height:1.15; }
/* Jumps land a breath below the sticky header (html has scroll-padding-top:88px). */
.lg-summary, .lg-sec{ scroll-margin-top:12px; }
.lg-body h2:focus{ outline:none; } /* focused by the script after a jump, so the next Tab continues from that section */

/* Section numbers are the sections' own anchor links. */
.lg-body .lg-n{ position:relative; flex:none; width:28px; font:500 var(--t-micro)/1 var(--mono); letter-spacing:0; color:var(--ink-3); font-variant-numeric:tabular-nums; text-decoration:none; border-radius:4px; transition:color var(--dur-micro) ease, transform var(--dur-micro) var(--ease-out); }
.lg-body .lg-n::after{ content:""; position:absolute; inset:-16px -8px; } /* 44px target */
.lg-anchor{ position:relative; flex:none; align-self:center; display:inline-grid; place-items:center; width:28px; height:28px; margin-left:-6px; border-radius:6px; text-decoration:none; transition:transform var(--dur-micro) var(--ease-out); }
.lg-anchor::before{ content:"#"; font:500 var(--t-small)/1 var(--mono); letter-spacing:0; color:var(--ink-4); transition:color var(--dur-micro) ease; }
.lg-anchor::after{ content:""; position:absolute; inset:-8px; }
.lg-body .lg-n:active, .lg-anchor:active{ transform:scale(.94); }
.lg-body .lg-n:focus-visible{ color:var(--ink); }
.lg-anchor:focus-visible::before{ color:var(--ink); }
@media (hover: hover) and (pointer: fine){
  .lg-body .lg-n:hover{ color:var(--ink); text-decoration:underline; text-underline-offset:.3em; text-decoration-color:var(--ink-3); }
  .lg-anchor:hover::before{ color:var(--ink); }
}

.lg-summary{ padding-bottom:clamp(40px, 2rem + 1.5vw, 64px); }
.lg-summary h2{ gap:8px; font-size:var(--t-h3); font-weight:600; letter-spacing:-.022em; }
.lg-points{ list-style:none; margin-top:20px; border-top:1px solid var(--line-2); }
.lg-points li{ padding:16px 0; border-bottom:1px solid var(--line); color:var(--ink); font-size:1.125rem; line-height:1.5; letter-spacing:-.012em; }
.lg-facts{ margin-top:28px; }
.lg-facts dd{ font-family:var(--font); font-size:var(--t-small); font-weight:600; }

.lg-sec{ padding-block:clamp(40px, 2rem + 1.2vw, 56px); border-top:1px solid var(--line); }
.lg-sec > * + *{ margin-top:18px; }
.lg-sec > h2 + *{ margin-top:20px; }
.lg-sec > p, .lg-sec > ul, .lg-sec > aside{ margin-left:44px; }
/* Sections arrive once, briefly and from close by: reading is never kept waiting. */
.lg-sec[data-rise], .lg-summary[data-rise], .lg-next[data-rise]{ --rise-y:14px; --rise-dur:.6s; }

.lg-list{ list-style:none; }
.lg-list li{ padding:16px 0; border-top:1px solid var(--line); }
.lg-list li:first-child{ border-top:0; padding-top:0; }

.lg-aside{ margin-top:24px; padding:4px 0 4px 20px; border-left:2px solid var(--ink); }
.lg-aside p{ color:var(--ink); }
.lg-aside b{ font-weight:650; }

.lg-next{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:0 40px; margin-top:clamp(40px, 2rem + 2vw, 72px); border-top:1px solid var(--line-2); font-size:var(--t-body); line-height:1.55; }
.lg-next a{ display:grid; gap:8px; padding:24px 0; border-bottom:1px solid var(--line); text-decoration:none; transition:transform var(--dur-micro) var(--ease-out); transform-origin:0 50%; }
.lg-next a:active{ transform:scale(.985); }
.lg-next .more{ font-size:var(--t-h3); }
@media (hover: hover) and (pointer: fine){
  .lg-next a:hover .more::after{ transform:translateX(4px); color:var(--ink); }
}

/* ---------- phones and tablets: the contents is a compact disclosure that rides under the site header ---------- */
@media (max-width: 960px){
  .lg-grid{ grid-template-columns:minmax(0,1fr); gap:40px; }
  .lg-wrap{ padding-top:24px; }
  /* Jumps land below the header (html has scroll-padding-top:88px) and below this bar as well. */
  .lg-summary, .lg-sec{ scroll-margin-top:36px; }
  .lg-toc{ --lg-row:44px; top:calc(68px + env(safe-area-inset-top, 0px)); z-index:20; width:100%; max-width:560px; }
  .lg-toc summary{ position:relative; isolation:isolate; display:flex; align-items:center; gap:12px; min-height:44px; padding:0 16px 0 18px; border-radius:999px; overflow:clip; cursor:pointer; color:var(--ink); transition:transform var(--dur-micro) var(--ease-out); }
  .lg-toc summary::before{ content:""; position:absolute; inset:0; z-index:-1; border-radius:inherit; background:color-mix(in srgb, var(--card) 84%, transparent); -webkit-backdrop-filter:saturate(1.8) blur(28px); backdrop-filter:saturate(1.8) blur(28px); box-shadow:inset 0 0 0 1px rgba(255,255,255,.09); }
  .lg-toc summary:active{ transform:scale(.985); }
  .lg-toc summary:focus-visible{ outline-offset:2px; }
  /* The bar names the section being read; "On this page" shows until the first one. The two swap in place. */
  .lg-toc-cur{ position:relative; flex:1; min-width:0; display:grid; align-items:center; }
  .lg-toc-label, .lg-toc-now{ grid-area:1 / 1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; transition:opacity var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out); }
  .lg-toc-label{ font-size:var(--t-small); color:var(--ink-2); }
  .lg-toc-now{ display:flex; align-items:baseline; gap:10px; font-size:var(--t-small); font-weight:500; opacity:0; transform:translateY(8px); }
  .lg-toc-now .lg-tn{ flex:none; color:var(--ink-3); }
  .lg-toc-now b{ min-width:0; overflow:hidden; text-overflow:ellipsis; font-weight:500; }
  .lg-toc.has-now .lg-toc-label{ opacity:0; transform:translateY(-8px); }
  .lg-toc.has-now .lg-toc-now{ opacity:1; transform:none; }
  .lg-toc-chev{ flex:none; width:8px; height:8px; margin:-4px 3px 0 0; border:solid var(--ink-3); border-width:0 1.5px 1.5px 0; transform:rotate(45deg); transition:transform var(--dur-ui) var(--ease-out); }
  .lg-toc-d[open]:not(.is-closing) .lg-toc-chev{ transform:translateY(4px) rotate(225deg); }
  /* Progress: a 2px strip along the bottom of the pill, clipped by its shape. */
  .lg-progress{ position:absolute; left:0; right:0; bottom:0; height:2px; background:none; }
  .lg-progress i{ background:var(--ink-3); }
  .lg-marker{ display:none; }

  .lg-toc-panel{ position:absolute; top:calc(100% + 8px); left:0; right:0; max-height:calc(100vh - 150px); max-height:calc(100dvh - 150px - env(safe-area-inset-top, 0px)); overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:8px; border-radius:24px; background:color-mix(in srgb, var(--card) 94%, transparent); -webkit-backdrop-filter:saturate(1.6) blur(24px); backdrop-filter:saturate(1.6) blur(24px); box-shadow:inset 0 0 0 1px rgba(255,255,255,.09), 0 24px 60px -12px rgba(0,0,0,.7); transform-origin:50% -8px; }
  .lg-toc a{ padding:8px 14px; border-radius:16px; transition:color var(--dur-micro) ease, background-color var(--dur-micro) ease; }
  .lg-toc li:first-child a{ padding-left:44px; }
  .lg-toc a[aria-current]{ background:rgba(255,255,255,.08); }
  .lg-toc a:active{ background:rgba(255,255,255,.05); }
  .lg-toc a:focus-visible{ outline-offset:-2px; }
  /* Opens with a short drop from the bar, leaves faster than it came (the script holds [open] for the exit). */
  .lg-toc-d[open] .lg-toc-panel{ animation:lg-drop var(--dur-ui) var(--ease-out); }
  .lg-toc-d.is-closing .lg-toc-panel{ animation:lg-lift .14s var(--ease-in) forwards; }
}
@keyframes lg-drop{ from{ opacity:0; transform:translateY(-8px) scale(.98); } }
@keyframes lg-lift{ to{ opacity:0; transform:translateY(-6px) scale(.985); } }

@media (max-width: 560px){
  .lg-toc{ width:auto; margin-inline:-6px; } /* lines up with the header pill */
  .lg-body{ font-size:var(--t-body); line-height:1.62; }
  .lg-sec > p, .lg-sec > ul, .lg-sec > aside{ margin-left:0; }
  .lg-body h2{ font-size:1.4375rem; gap:12px; }
  .lg-body .lg-n{ width:auto; }
  .lg-next{ grid-template-columns:minmax(0,1fr); }
  .lg-facts > div{ gap:12px; }
}

@media print{
  .lg-toc, .lg-anchor{ display:none; }
  .lg-grid{ display:block; }
  .lg-body{ max-width:none; }
}
