/* ============================================================
   LUXURY SALES — legal.html (page-specific styles only)
   Quiet hero → Terms/Privacy tabs → sticky TOC with a gold
   travelling thread → 68ch Fraunces-numbered documents.
   Choreography register: LITERATE — the page sets itself like a
   book as you read. Word-cascade headline, scrub-drawn rules,
   masked heading wipes + index stamps, two-step paragraph
   reveals, one faint § ghost numeral. No foil, no drift, no
   tape, no beams: restraint IS the luxury here.
   Doctrine: transform/opacity + independent translate/rotate/
   scale only; hidden states gated on html.js; reduced motion
   lands every element on its finished frame; zero CLS.
   ============================================================ */

/* ---------- Hero (quiet, small) ---------- */
.lg-hero {
  padding-top: calc(var(--nav-h) + clamp(64px, 10vw, 128px));
  padding-bottom: clamp(34px, 5vw, 64px);
  position: relative;
}
.lg-h1 { font-size: clamp(2.3rem, 5.8vw, 4.1rem); }
.lg-hero .lede { margin-top: 20px; }
.lg-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px;
  margin-top: 28px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.lg-meta .sep { opacity: 0.55; }
/* The hero's closing rule: a gold hairline that draws itself across the
   page on the first scroll movement (scrub-drawn — the one gold accent
   artifact of this viewport). No-JS / reduced: --p defaults to 1, drawn. */
.lg-hero-rule { margin-top: clamp(30px, 5vw, 52px); }

/* ---------- Documents section ---------- */
.lg-docsec {
  padding-top: 0;
  position: relative;
  overflow: clip;               /* the § ghost drifts — clip is the overflow guard */
}
.lg-docsec > .wrap { position: relative; z-index: 1; }
/* One faint § behind the document — 3–4% alpha, drifting VERY slowly on
   the section's own --p (the section is thousands of px tall, so the
   traversal is sub-pixel per scroll tick). Reduced motion: rests in place. */
.lg-ghost {
  right: -0.05em; top: clamp(120px, 16vh, 260px);
  font-size: clamp(11rem, 26vw, 24rem);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.042), rgba(245, 239, 226, 0.03));
  -webkit-background-clip: text; background-clip: text;
  --gn-amp: -70px;
}

/* Tab row — hidden without JS (panels stack as one long document) */
.lg-tabrow { display: flex; align-items: center; gap: 16px; }
html:not(.js) .lg-tabrow { display: none; }
.tab-btn .cnt {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  margin-left: 9px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
/* 0.85 alpha: composites to 5.17:1 over the gradient's #B8912C end and 8.40:1
   over #E9C767 — passes 4.5:1 while staying lighter than the solid tab label */
.tab-btn.is-active .cnt { color: rgba(23, 17, 6, 0.85); }

/* Panel switch — refined crossfade + rise (opacity/translate, 300ms),
   one-shot, JS-gated. Independent translate: never fights child reveals. */
.lg-panel { margin-top: clamp(34px, 5vw, 56px); }
html.js [data-panel].is-active { animation: lg-panel-in 0.3s var(--ease-out) both; }
@keyframes lg-panel-in {
  from { opacity: 0; translate: 0 10px; }
  to { opacity: 1; translate: 0 0; }
}

/* ---------- Two-column editorial grid ---------- */
.lg-grid {
  display: grid; grid-template-columns: 248px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
}
.lg-grid > * { min-width: 0; }

/* ---------- Sticky TOC — ONE gold thread that travels to the section
   being read (JS-created .lg-thread; independent translate/scale, smooth
   transitions). Sticky aside = the positioned host. No-JS: no scrollspy,
   no thread — the hairline track stays. ---------- */
.lg-toc { position: sticky; top: calc(var(--nav-h) + 32px); }
.lg-toc-label {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 16px;
}
.lg-toc ol { list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--hairline); }
.lg-toc li { min-width: 0; }
.lg-toc a {
  position: relative;
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.5;
  color: var(--ink-faint);
  padding: 7px 10px 7px 18px;
  border-radius: 0 8px 8px 0;
  transition: color 0.3s, background-color 0.3s;
}
.lg-toc a .no { flex: none; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.lg-toc a:hover { color: var(--ink); background: rgba(245, 239, 226, 0.04); }
.lg-toc a.is-active { color: var(--ink); }
.lg-toc a.is-active .no { color: var(--gold); }
/* the travelling thread: 28px reference bar, height shaped via scale-y,
   position via translate-y — both independent properties, both transition */
.lg-thread {
  position: absolute; left: -0.5px; top: 0;
  width: 2px; height: 28px;
  background: var(--grad);
  transform-origin: left top;
  translate: 0 44px; scale: 1 0;
  opacity: 0;
  transition: translate 0.55s var(--ease-out), scale 0.55s var(--ease-out), opacity 0.4s var(--ease-out);
  pointer-events: none;
}
html:not(.js) .lg-thread { display: none; }

/* ---------- The document (68ch, Fraunces heads, mono numbers) ---------- */
.lg-doc { max-width: 68ch; min-width: 0; }
.lg-dochead { padding-bottom: clamp(22px, 3.4vw, 34px); position: relative; }
.lg-updated {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 14px;
}
.lg-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  letter-spacing: -0.01em; line-height: 1.15;
}
.lg-plain { color: var(--ink-dim); margin-top: 10px; font-size: 0.98rem; line-height: 1.7; }
/* dochead seat rule — scrub-drawn (band span of its own thin wrapper) */
.lg-dochead-rule { position: absolute; left: 0; right: 0; bottom: 0; }

.lg-sec {
  padding-block: clamp(30px, 4.4vw, 46px);
  position: relative;
}
/* section top rule — 1px space always reserved (zero CLS), draws
   left→right via one-shot scale transition when the engine reveals it */
.lg-rule {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--hairline-strong);
  transform-origin: left center;
}
html.js .lg-rule[data-reveal] {
  opacity: 1; transform: none; filter: none;   /* neutralize the base reveal channels */
  scale: 0 1;
  transition: scale 1.15s var(--ease-wipe);
  transition-delay: var(--d, 0s);
}
html.js .lg-rule[data-reveal].is-in { scale: 1 1; }

/* heading — masked wipe (base .ls-lines drives the rise); the rising
   span keeps the baseline flex layout of the old h3 */
.lg-sec h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.18rem, 2.2vw, 1.5rem);
  letter-spacing: -0.005em; line-height: 1.25;
}
.lg-sec h3 .ls-line > span,
html.js .lg-sec h3 .ls-line > span { display: flex; align-items: baseline; gap: 14px; }
.lg-sec h3 .no {
  flex: none;
  font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.08em; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
/* the index stamps (serial-press) as the heading wipe settles — same
   letterspacing-contract exception family as the eyebrow .idx stamp */
html.js .lg-sec h3.is-in .no {
  animation: lg-stamp-no 0.55s var(--ease-out) both;
  animation-delay: calc(var(--d, 0s) + 0.28s);
}
@keyframes lg-stamp-no {
  from { letter-spacing: 0.34em; opacity: 0; }
  to { letter-spacing: 0.08em; opacity: 1; }
}

/* paragraphs — soft two-step rise (gentler 14px drift than the house 22px) */
html.js .lg-sec p[data-reveal]:not(.is-in),
html.js .lg-sec ul[data-reveal]:not(.is-in) { transform: translateY(14px); }

.lg-sec p { color: var(--ink-dim); font-size: 0.97rem; line-height: 1.78; margin-top: 13px; }
.lg-sec p strong { color: var(--ink); font-weight: 600; }
.lg-sec .mono { font-size: 0.88em; font-weight: 600; color: var(--ink); }
.lg-sec a { color: var(--champagne); border-bottom: 1px solid rgba(245, 225, 164, 0.25); transition: border-color 0.3s; }
.lg-sec a:hover { border-color: rgba(245, 225, 164, 0.7); }
.lg-sec ul { list-style: none; margin-top: 13px; display: grid; gap: 10px; }
.lg-sec li {
  display: flex; gap: 12px;
  color: var(--ink-dim); font-size: 0.97rem; line-height: 1.65;
}
.lg-sec li::before { content: '—'; flex: none; color: var(--ink-faint); }
.lg-sec li strong { color: var(--ink); font-weight: 600; }

/* quiet end-of-document rule — flanking hairlines draw OUTWARD from the
   words once the mark reveals (fade), like a colophon being ruled off */
.lg-end {
  display: flex; align-items: center; gap: 14px;
  margin-top: clamp(26px, 4vw, 40px);
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-faint);
}
.lg-end::before, .lg-end::after { content: ''; height: 1px; flex: 1; background: var(--hairline); }
.lg-end::before { transform-origin: right center; }
.lg-end::after { transform-origin: left center; }
html.js .lg-end::before, html.js .lg-end::after {
  scale: 0 1;
  transition: scale 1.2s var(--ease-wipe) 0.15s;
}
html.js .lg-end.is-in::before, html.js .lg-end.is-in::after { scale: 1 1; }

/* ---------- Mobile: TOC becomes a contained chip rail ---------- */
@media (max-width: 920px) {
  .lg-grid { grid-template-columns: 1fr; gap: 26px; }
  .lg-toc { position: static; }
  .lg-thread { display: none; }
  .lg-toc ol {
    display: flex; gap: 8px; border-left: 0;
    overflow-x: auto;
    margin-inline: calc(clamp(20px, 4vw, 40px) * -1);
    padding-inline: clamp(20px, 4vw, 40px);
    padding-bottom: 10px;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .lg-toc ol::-webkit-scrollbar { display: none; }
  .lg-toc li { flex: none; }
  .lg-toc a {
    white-space: nowrap;
    padding: 8px 15px;
    border: 1px solid var(--hairline); border-radius: 999px;
    background: rgba(245, 239, 226, 0.03);
  }
  .lg-toc a.is-active {
    border-color: rgba(212, 175, 55, 0.45);
    background: rgba(212, 175, 55, 0.07);
    color: var(--champagne);
  }
}

/* ---------- Reduced motion: land every page-authored frame ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js .lg-rule[data-reveal] { scale: 1 1 !important; }
  html.js .lg-sec h3 .no { animation: none !important; opacity: 1 !important; letter-spacing: 0.08em !important; }
  html.js .lg-end::before, html.js .lg-end::after { scale: 1 1 !important; }
  html.js [data-panel].is-active { animation: none !important; }
  .lg-thread { transition: none !important; }
}
