/* ════════════════════════════════════════════════════════════════
   ELDARA GAMES — LEGAL (privacy.html, terms.html)
   ────────────────────────────────────────────────────────────────
   A reading room in the studio frame. The policy markup inside
   <main> is frozen (byte-identical to the June source), so this file
   styles its existing classes and never asks for new ones:

     main > article.legal-page > .container
       header.legal-header  > .legal-eyebrow, h1 (> .accent), .legal-subtitle
       nav.legal-toc        > h2, ol > li > a
       .legal-content       > .legal-callout > p
                            > section[id] > h2 (> .num), p, ul > li
                                            (last) a.legal-back-top

   Layout
     < 1200px   one centred column, max 72ch; contents as a card.
     ≥ 1200px   three columns: a label rail (eyebrow, sticky contents),
                the 72ch prose column, and quiet space. The prose sits on
                the page's centre line once the window is wide enough.
   Anchors
     Section jumps land the section's hairline 24px under the fixed
     header: html already reserves header + 16px (core.css
     scroll-padding-top, which also keeps tabbed-to links clear of the
     header); sections add the last 8px as scroll-margin.
   Contents highlight
     Where scroll-driven animations exist, the rail marks the section
     crossing the reading line (CSS only; no JS on these pages).
   Unlayered on purpose: page CSS outranks core.css.
   ════════════════════════════════════════════════════════════════ */

@property --toc-on{ syntax:"<number>"; inherits:true; initial-value:0; }

/* The skip-link target wraps the frozen main element: a programmatic
   focus target, not a control, so no ring (core.css does the same for main). */
.legal-main:focus{ outline:none; }

.legal-page{
  --measure:72ch;
  --rail-gap:clamp(56px,4.4vw,88px);
  --flow:1.15em;
  position:relative;
  padding-block:calc(var(--header-h) + clamp(48px,8vw,120px)) clamp(88px,10vw,152px);
  font-size:clamp(1rem,.95rem + .22vw,1.0625rem);
  line-height:1.72;
  color:var(--s-ink-2);
}
/* A faint lumen from above, behind the title (ambient ceiling: 10%) */
.legal-page::before{
  content:""; position:absolute; inset:0 0 auto; height:min(760px,90svh);
  pointer-events:none;
  background:radial-gradient(56% 100% at 24% 0%,rgba(255,243,220,.045),transparent 72%);
}
.legal-page > .container{ position:relative; width:var(--wrap); margin-inline:auto; }
.legal-page > .container > *{ max-width:var(--measure); margin-inline:auto; }


/* ── title block ────────────────────────────────────────────────── */
.legal-header{
  padding-bottom:clamp(36px,4.6vw,64px);
  margin-bottom:clamp(36px,4.6vw,64px);
  border-bottom:1px solid var(--s-line);
}
.legal-eyebrow{
  display:flex; align-items:center; gap:14px;
  margin-bottom:clamp(20px,2.4vw,32px);
  font:500 var(--fs-label)/1.3 var(--s-font-mono);
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--s-ink-3);
}
.legal-eyebrow::after{
  content:""; width:44px; height:0;
  border-top:1px solid var(--s-hair);
  -webkit-mask-image:linear-gradient(90deg,#000,transparent);
  mask-image:linear-gradient(90deg,#000,transparent);
}
.legal-header h1{
  font-size:var(--fs-h1);
  font-weight:650;
  line-height:1.02;
  letter-spacing:-.035em;
  color:var(--s-ink);
}
.legal-header h1 .accent{ color:var(--s-ink-3); }
.legal-subtitle{
  margin-top:clamp(18px,2vw,26px);
  font:500 var(--fs-label)/1.4 var(--s-font-mono);
  letter-spacing:.14em;
  text-transform:uppercase;
  font-variant-numeric:tabular-nums;
  color:var(--s-ink-3);
}


/* ── contents ───────────────────────────────────────────────────── */
.legal-toc{
  margin-bottom:clamp(40px,5vw,64px);
  padding:clamp(18px,2.4vw,28px) clamp(18px,2.6vw,32px) clamp(10px,1.4vw,18px);
  border:1px solid var(--s-line);
  border-radius:var(--r-md);
  background:color-mix(in srgb,var(--s-surface) 62%,transparent);
}
.legal-toc h2{
  margin-bottom:10px;
  font:500 var(--fs-label)/1.3 var(--s-font-mono);
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--s-ink-3);
}
/* One column on phones; from 640px two balanced columns that read down
   (01–05, then 06–09). A rule above every entry keeps both columns even. */
.legal-toc ol{ counter-reset:toc; }
@media (width >= 640px){ .legal-toc ol{ columns:2; column-gap:var(--grid-gap); } }
.legal-toc li{ counter-increment:toc; break-inside:avoid; border-top:1px solid var(--s-line); }
.legal-toc a{
  position:relative;
  display:grid; grid-template-columns:2.6em minmax(0,1fr); align-items:baseline;
  padding:9px 0;
  font-size:var(--fs-sm); line-height:1.45;
  color:color-mix(in srgb,var(--s-ink) calc(var(--toc-on) * 100%),var(--s-ink-2));
  text-decoration:underline 1px transparent;
  text-underline-offset:.3em;
  transition:color var(--d-4) var(--ease-soft),text-decoration-color var(--d-4) var(--ease-soft);
}
@media (pointer:coarse){ .legal-toc a{ min-height:44px; align-content:center; } }
.legal-toc a::before{
  content:counter(toc,decimal-leading-zero);
  font:500 var(--fs-micro)/1 var(--s-font-mono);
  letter-spacing:.1em;
  font-variant-numeric:tabular-nums;
  color:var(--s-ink-3);
}
@media (hover:hover){
  .legal-toc a:hover{ color:var(--s-ink); text-decoration-color:var(--s-signal); transition-duration:var(--d-3); }
}


/* ── prose ──────────────────────────────────────────────────────── */
.legal-content{ overflow-wrap:break-word; }
.legal-content :is(p,ul){ margin:0; }
.legal-content section > * + *{ margin-top:var(--flow); }
.legal-content section > ul{ margin-top:.75em; }
.legal-content section > p:has(> strong:only-child){ margin-top:1.5em; color:var(--s-ink); }

.legal-content section{
  padding:clamp(28px,3vw,36px) 0 clamp(40px,4.6vw,60px);
  border-top:1px solid var(--s-line);
  scroll-margin-top:8px;                  /* + html scroll-padding (header + 16px) = header + 24px */
}
.legal-content section:last-of-type{ padding-bottom:0; }
.legal-content section:target{ border-top-color:var(--s-line-3); }

.legal-content h2{
  display:flex; align-items:baseline; gap:14px;
  margin-bottom:.15em;
  font-size:var(--fs-h3);
  font-weight:650;
  line-height:1.2;
  letter-spacing:-.02em;
  color:var(--s-ink);
}
.legal-content h2 .num{
  flex:none;
  font:500 var(--fs-label)/1 var(--s-font-mono);
  letter-spacing:.12em;
  font-variant-numeric:tabular-nums;
  color:var(--s-ink-3);
  translate:0 -.15em;
}
.legal-content section:target h2 .num{ color:var(--s-ink); }

/* Lists: a hairline dash on the first line, the studio's mark of a list */
.legal-content ul{ display:grid; gap:.55em; padding:0; list-style:none; }
.legal-content li{ position:relative; padding-left:1.75em; }
.legal-content li::before{
  content:""; position:absolute; left:.15em; top:.86em;
  width:.8em; height:0;
  border-top:1px solid var(--s-ink-3);
}

/* Running-text links: ivory with a quiet underline; core.css turns the
   underline signal on hover and draws the focus ring. */
.legal-content :is(p,li) > a:not([class]){ color:var(--s-ink); text-decoration-color:var(--s-line-3); }

/* The short version: a lit panel, its edge a sliver of the sigil's beam */
.legal-callout{
  position:relative;
  margin-bottom:clamp(40px,5vw,64px);
  padding:clamp(20px,2.4vw,30px) clamp(20px,2.8vw,36px);
  border:1px solid var(--s-line-2);
  border-radius:var(--r-md);
  background:
    radial-gradient(90% 140% at 0% 0%,rgba(255,243,220,.05),transparent 60%),
    color-mix(in srgb,var(--s-surface) 72%,transparent);
}
.legal-callout::before{
  content:""; position:absolute; left:-1px; top:22%; bottom:22%;
  border-left:1px solid var(--s-lumen);
  box-shadow:0 0 14px 1px rgba(255,243,220,.32);
  opacity:.8;
}
.legal-callout p{
  font-size:clamp(1.0625rem,1rem + .3vw,1.1875rem);
  line-height:1.6;
  color:var(--s-ink);
}
.legal-callout strong{ font-weight:650; }

/* Back to top: a ghost button, as in core.css */
.legal-back-top{
  display:inline-flex; align-items:center; gap:.5em;
  min-height:44px;
  margin-top:clamp(32px,4vw,48px);
  padding:0 1.25em;
  border:1px solid var(--s-line-2);
  border-radius:var(--r-xs);
  font:650 var(--fs-sm)/1.1 var(--s-font-sans);
  color:var(--s-ink);
  transition:border-color var(--d-4) var(--ease-soft),background-color var(--d-4) var(--ease-soft);
}
@media (hover:hover){
  .legal-back-top:hover{ border-color:var(--s-line-3); background-color:rgb(242 239 233 / .06); transition-duration:var(--d-3); }
}


/* ── wide: label rail + prose column ────────────────────────────── */
@media (width >= 1200px){
  .legal-page > .container{
    display:grid;
    grid-template-columns:minmax(220px,1fr) minmax(0,var(--measure)) minmax(0,1fr);
    column-gap:var(--rail-gap);
    align-items:start;
  }
  .legal-page > .container > *{ max-width:none; margin-inline:0; }

  .legal-header{
    grid-column:1 / -1;
    display:grid; grid-template-columns:subgrid; align-items:baseline;
  }
  .legal-eyebrow{ grid-column:1; grid-row:1; margin:0; }
  .legal-header h1{ grid-column:2 / -1; grid-row:1; }
  .legal-subtitle{ grid-column:2 / -1; }

  .legal-toc{
    grid-column:1;
    position:sticky; top:calc(var(--header-h) + 32px);
    max-height:calc(100svh - var(--header-h) - 64px);
    overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin;
    margin:0; padding:0;
    border:0; border-radius:0; background:none;
  }
  .legal-toc h2{ margin-bottom:18px; }
  .legal-toc ol{ columns:auto; border-left:1px solid var(--s-line); }
  .legal-toc li{ border-top:0; }
  .legal-toc a{ padding:7px 0 7px 18px; }
  /* The rail marker: a signal hairline over the rail beside the current entry */
  .legal-toc a::after{
    content:""; position:absolute; left:-1px; top:8px; bottom:8px;
    border-left:1px solid var(--s-signal);
    opacity:var(--toc-on);
  }
  .legal-content{ grid-column:2; }
  /* Section numbers hang in the gutter, so titles share the text's left edge */
  .legal-content h2{ gap:0; margin-left:-40px; }
  .legal-content h2 .num{ width:40px; }
}

/* Contents highlight: each section's view timeline (a thin band at 30%
   of the viewport) drives --toc-on on its entry. Sections are contiguous
   (spacing is padding), so exactly one entry is lit while reading. */
@supports (timeline-scope:--a) and (animation-timeline:view()){
  @media (width >= 1200px){
    .legal-page > .container{ timeline-scope:--l1,--l2,--l3,--l4,--l5,--l6,--l7,--l8,--l9,--l10,--l11,--l12; }
    .legal-content > section{ view-timeline-inset:30% 69.5%; }
    .legal-content > section:nth-of-type(1){ view-timeline-name:--l1; }
    .legal-content > section:nth-of-type(2){ view-timeline-name:--l2; }
    .legal-content > section:nth-of-type(3){ view-timeline-name:--l3; }
    .legal-content > section:nth-of-type(4){ view-timeline-name:--l4; }
    .legal-content > section:nth-of-type(5){ view-timeline-name:--l5; }
    .legal-content > section:nth-of-type(6){ view-timeline-name:--l6; }
    .legal-content > section:nth-of-type(7){ view-timeline-name:--l7; }
    .legal-content > section:nth-of-type(8){ view-timeline-name:--l8; }
    .legal-content > section:nth-of-type(9){ view-timeline-name:--l9; }
    .legal-content > section:nth-of-type(10){ view-timeline-name:--l10; }
    .legal-content > section:nth-of-type(11){ view-timeline-name:--l11; }
    .legal-content > section:nth-of-type(12){ view-timeline-name:--l12; }
    .legal-toc li > a{ animation:toc-current linear none; animation-range:cover 0% cover 100%; }
    .legal-toc li:nth-child(1) > a{ animation-timeline:--l1; }
    .legal-toc li:nth-child(2) > a{ animation-timeline:--l2; }
    .legal-toc li:nth-child(3) > a{ animation-timeline:--l3; }
    .legal-toc li:nth-child(4) > a{ animation-timeline:--l4; }
    .legal-toc li:nth-child(5) > a{ animation-timeline:--l5; }
    .legal-toc li:nth-child(6) > a{ animation-timeline:--l6; }
    .legal-toc li:nth-child(7) > a{ animation-timeline:--l7; }
    .legal-toc li:nth-child(8) > a{ animation-timeline:--l8; }
    .legal-toc li:nth-child(9) > a{ animation-timeline:--l9; }
    .legal-toc li:nth-child(10) > a{ animation-timeline:--l10; }
    .legal-toc li:nth-child(11) > a{ animation-timeline:--l11; }
    .legal-toc li:nth-child(12) > a{ animation-timeline:--l12; }
  }
}
@keyframes toc-current{ from,to{ --toc-on:1; } }


/* ── entrance (motion allowed only) ─────────────────────────────── */
@media (prefers-reduced-motion:no-preference){
  html:not(.reduced) .legal-header{ animation:legal-in var(--d-5) var(--ease-out) both; }
  html:not(.reduced) .legal-toc,
  html:not(.reduced) .legal-content{ animation:legal-in var(--d-5) var(--ease-out) 120ms both; }
}
@keyframes legal-in{ from{ opacity:0; translate:0 16px; } }


/* ── print: the policy, nothing else ────────────────────────────── */
@media print{
  :root{ color-scheme:light; }
  body{ background:#fff; color:#111; }
  body::before,body::after,html::before,#fx,.cursor-light,
  .skip-link,.site-header,.site-footer,.legal-toc,.legal-back-top,.legal-page::before{ display:none !important; }
  .legal-page{ padding:0; font-size:11pt; color:#222; }
  .legal-page > .container{ display:block; width:auto; }
  .legal-page > .container > *{ max-width:none; }
  .legal-header,.legal-content section{ border-color:#ccc; }
  .legal-header h1,.legal-content h2,.legal-callout p,.legal-content strong,
  .legal-content :is(p,li) > a:not([class]){ color:#000; }
  .legal-header h1 .accent,.legal-eyebrow,.legal-subtitle,.legal-content h2 .num{ color:#555; }
  .legal-callout{ border-color:#bbb; background:none; }
  .legal-callout::before{ box-shadow:none; border-color:#999; }
  .legal-content li::before{ border-color:#888; }
  .legal-content section{ break-inside:avoid-page; }
  .legal-content h2{ break-after:avoid-page; }
  .legal-header,.legal-toc,.legal-content{ animation:none !important; }
}
