/* ===========================================================================
   legal.css — long-form legal pages (privacy, terms, cookies, eula, notice).
   Standalone like showcase.css: each legal page loads only this + variables.
   Warm cinematic brand, but tuned for READING — a single measured column, calm
   type, gold only on structure (links, section rules, the "on this page" list).
   =========================================================================== */
@import './variables.css';

body.legal {
  --ink0:  #0E0D0C;
  --ink1:  #17140F;
  --paper: #F4F0E9;
  --mut:   #A79F92;
  --dim:   #6B6458;
  --line:  rgba(244, 240, 233, .10);
  --line2: rgba(244, 240, 233, .18);
  --gold:  #E8B04B;
  --gold-ink: #17140F;

  --display: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --edge: clamp(1.25rem, 5vw, 3rem);

  margin: 0;
  background: var(--ink0);
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
.legal *, .legal *::before, .legal *::after { box-sizing: border-box; }
.legal a { color: var(--gold); text-decoration: none; }
.legal a:hover { text-decoration: underline; text-underline-offset: 3px; }
.legal ::selection { background: var(--gold); color: var(--gold-ink); }
.legal :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }

/* ---- Top bar ------------------------------------------------------------- */
.ldoc__top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem var(--edge);
  background: rgba(8, 7, 6, .85);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.ldoc__brand { font-family: var(--display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--paper) !important; }
.ldoc__back { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mut) !important; }
.ldoc__back:hover { color: var(--gold) !important; text-decoration: none; }

/* ---- Document column ----------------------------------------------------- */
.ldoc { max-width: 760px; margin: 0 auto; padding: clamp(2.5rem, 7vw, 5rem) var(--edge) 4rem; }
.ldoc__eyebrow { font-family: var(--mono); font-size: .72rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 0 0 1rem; }
.ldoc h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.25rem, 6vw, 3.5rem); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 1.25rem; }
.ldoc__meta { font-family: var(--mono); font-size: .78rem; color: var(--dim); margin: 0 0 2.5rem; line-height: 1.6; }

/* A callout for the draft / placeholder notice. */
.ldoc__note {
  border: 1px solid var(--line2); border-left: 3px solid var(--gold);
  background: rgba(232, 176, 75, .06);
  padding: 1.1rem 1.35rem; margin: 0 0 3rem;
  font-size: .92rem; color: var(--mut); line-height: 1.6;
}
.ldoc__note strong { color: var(--paper); font-weight: 700; }

/* On-this-page index. */
.ldoc__toc { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1.5rem 0; margin: 0 0 3rem; }
.ldoc__toc h2 { font-family: var(--mono); font-size: .72rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin: 0 0 1rem; }
.ldoc__toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; columns: 2; column-gap: 2.5rem; }
.ldoc__toc li { counter-increment: toc; margin: 0 0 .55rem; font-size: .95rem; break-inside: avoid; }
.ldoc__toc a { color: var(--paper) !important; }
.ldoc__toc a::before { content: counter(toc, decimal-leading-zero) " "; font-family: var(--mono); font-size: .72rem; color: var(--gold); margin-right: .5rem; }
.ldoc__toc a:hover { color: var(--gold) !important; text-decoration: none; }

/* Sections. */
.ldoc section { margin: 0 0 2.75rem; scroll-margin-top: 6rem; }
.ldoc h2.ldoc__h { font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; margin: 3rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.ldoc h2.ldoc__h .n { font-family: var(--mono); font-size: .9rem; color: var(--gold); font-weight: 500; margin-right: .6rem; }
.ldoc h3 { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin: 1.75rem 0 .6rem; color: var(--paper); }
.ldoc p { margin: 0 0 1rem; color: rgba(244, 240, 233, .84); }
.ldoc ul, .ldoc ol.ldoc__list { margin: 0 0 1.25rem; padding-left: 1.3rem; color: rgba(244, 240, 233, .84); }
.ldoc li { margin: 0 0 .5rem; }
.ldoc strong { color: var(--paper); font-weight: 700; }
.ldoc em { font-style: italic; color: var(--paper); }
.ldoc code { font-family: var(--mono); font-size: .88em; background: var(--ink1); padding: .1em .4em; border-radius: 2px; color: var(--paper); }

/* A definitions / data table. */
.ldoc__table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: .95rem; }
.ldoc__table th, .ldoc__table td { text-align: left; vertical-align: top; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.ldoc__table th { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
.ldoc__table td { color: rgba(244, 240, 233, .84); }
.ldoc__table td:first-child { color: var(--paper); font-weight: 600; white-space: nowrap; }
.ldoc__wrap { overflow-x: auto; }

/* A placeholder token, so [LIKE THIS] stands out to whoever fills it in. */
.ldoc mark, .ldoc .ph { background: rgba(232, 176, 75, .16); color: var(--gold); padding: .05em .35em; border-radius: 2px; font-family: var(--mono); font-size: .86em; }

/* ---- Foot ---------------------------------------------------------------- */
.ldoc__foot { border-top: 1px solid var(--line); padding: 2.5rem var(--edge) 3.5rem; }
.ldoc__foot-inner { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: center; }
.ldoc__foot a { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mut) !important; }
.ldoc__foot a:hover { color: var(--gold) !important; text-decoration: none; }
.ldoc__foot .sep { color: var(--dim); font-size: .74rem; }
.ldoc__copy { font-family: var(--mono); font-size: .74rem; color: var(--dim); margin-left: auto; }

@media (max-width: 620px) {
  .ldoc__toc ol { columns: 1; }
  .ldoc__copy { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ===========================================================================
   404 — a calm off-ramp, same brand.
   =========================================================================== */
.n404 { max-width: 640px; margin: 0 auto; padding: clamp(4rem, 16vh, 9rem) var(--edge); text-align: center; }
.n404__code { font-family: var(--mono); font-size: 1rem; letter-spacing: .35em; color: var(--gold); margin: 0 0 1.5rem; }
.n404__title { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 1.25rem; }
.n404__sub { color: var(--mut); font-size: 1.05rem; line-height: 1.6; margin: 0 auto 2.5rem; max-width: 44ch; }
.n404__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.n404__cta, .n404__ghost {
  font-family: var(--mono); font-size: .72rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  padding: .95rem 1.9rem; border: 1px solid;
}
.n404__cta { background: var(--paper); color: var(--ink0) !important; border-color: var(--paper); }
.n404__cta:hover { background: var(--gold); border-color: var(--gold); color: var(--gold-ink) !important; text-decoration: none; }
.n404__ghost { background: transparent; color: var(--paper) !important; border-color: var(--line2); }
.n404__ghost:hover { border-color: var(--gold); color: var(--gold) !important; text-decoration: none; }

/* ===========================================================================
   REDESIGN — two-column reading layout with a sticky "on this page" sidebar,
   scroll-spy, and a reading-progress bar. Single column on smaller screens.
   =========================================================================== */
.ldoc { max-width: 1140px; }
.ldoc__head { max-width: 780px; margin-bottom: 1rem; }
.ldoc__head .ldoc__meta { margin-bottom: 0; }

.ldoc__layout { display: block; }

@media (min-width: 1000px) {
  .ldoc__layout {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }
  .ldoc__content { max-width: 760px; }
  .ldoc__content section:first-child h2.ldoc__h { border-top: 0; padding-top: 0; margin-top: 0; }

  /* The TOC becomes a quiet sticky rail — no box, one column. */
  .ldoc__aside { position: sticky; top: 5.25rem; }
  .ldoc__aside .ldoc__toc { border: 0; padding: 0; margin: 0; }
  .ldoc__aside .ldoc__toc ol { columns: 1; }
  .ldoc__aside .ldoc__toc li { margin-bottom: .75rem; }
  .ldoc__aside .ldoc__toc a { color: var(--mut) !important; transition: color .18s ease; display: inline-block; }
}

/* Scroll-spy active link. */
.ldoc__toc a.is-active { color: var(--gold) !important; font-weight: 600; }
.ldoc__toc a.is-active::before { color: var(--gold); }

/* Reading progress bar — thin gold line pinned to the very top. */
.ldoc__progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30;
  background: var(--gold);
  transform: scaleX(0); transform-origin: left center;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) { .ldoc__progress { transition: none; } }
