/* =====================================================================
   Luxtra — Legal / Policy page system
   Builds ON TOP of colors_and_type.css (tokens + fonts).
   Drop-in styling for the redesigned .legal-doc, plus the editorial
   hero, sticky scrollspy TOC, and the cosmic chrome (nav / footer /
   backdrop). Shared across all six policy pages.
   ===================================================================== */

/* NOTE: the global reset, body, .wrap and the whole .nav are owned site-wide by the app's
   pseo.css (loaded in app/[locale]/layout.jsx) and the shared <Nav> component. This file
   must NOT redefine them — duplicating them here conflicted with pseo.css and broke the
   header/top on mobile. Only the legal-specific layer (backdrop chrome, hero, TOC, prose)
   lives below. */

/* ---------- BACKDROP + STARFIELD ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 75% at 16% 4%, rgba(139,92,246,0.16) 0%, transparent 54%),
    radial-gradient(100% 65% at 86% 14%, rgba(201,169,98,0.07) 0%, transparent 50%),
    radial-gradient(140% 100% at 50% 112%, rgba(139,92,246,0.12) 0%, transparent 60%),
    #0C0618;
}
.sky-lite { position: absolute; inset: 0; }
.sky-lite .s { position: absolute; border-radius: 50%; animation: sky-tw var(--d,5s) ease-in-out var(--ad,0s) infinite; }
@keyframes sky-tw { 0%,100% { opacity: var(--o,0.5); } 50% { opacity: 0.06; } }

/* (nav styles intentionally omitted — owned by pseo.css site-wide) */

/* ---------- EDITORIAL HERO ---------- */
.legal-hero {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 138px 24px 0;
}
@media (min-width: 768px) { .legal-hero { padding: 150px 48px 0; } }

.legal-hero__eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-ritual); font-weight: 400;
  font-size: 11px; letter-spacing: 0.30em; text-transform: uppercase;
  color: var(--gold-11);
}
.legal-hero__eyebrow::before {
  content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-9));
}
.legal-hero__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(40px, 6.6vw, 74px); line-height: 1.0;
  letter-spacing: -0.028em; color: var(--neutral-12);
  margin: 22px 0 0; text-wrap: balance;
}
.legal-hero__standfirst {
  font-family: var(--font-editorial); font-weight: 400;
  font-size: clamp(18px, 2.1vw, 24px); line-height: 1.5;
  color: var(--neutral-11); margin: 22px 0 0; max-width: 34ch;
  letter-spacing: 0.005em;
}
.legal-hero__standfirst em { font-style: italic; color: var(--gold-11); }

.legal-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin-top: 34px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--neutral-11);
}
.legal-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-9); opacity: 0.8; }
.legal-meta b { color: var(--gold-11); font-weight: 400; }

.legal-hero__rule { max-width: 1200px; margin: 44px auto 0; padding: 0 24px; }
@media (min-width: 768px) { .legal-hero__rule { padding: 0 48px; } }
.legal-hero__rule .line { height: 1px; background: linear-gradient(90deg, rgba(201,169,98,0.42), rgba(201,169,98,0.10) 40%, transparent 78%); }

/* ---------- LAYOUT — TOC sidebar + document ---------- */
.legal-layout {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto; padding: 40px 24px 88px;
  display: grid; grid-template-columns: 1fr; gap: 0;
}
@media (min-width: 768px) { .legal-layout { padding: 44px 48px 110px; } }
@media (min-width: 1080px) {
  .legal-layout { grid-template-columns: 236px minmax(0, 1fr); gap: 72px; align-items: start; }
}

/* Mobile TOC (collapsible) */
.toc-mobile {
  border: 1px solid var(--border-default); border-radius: var(--r-xl);
  background: var(--glass-light); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  margin-bottom: 34px; overflow: hidden;
}
@media (min-width: 1080px) { .toc-mobile { display: none; } }
.toc-mobile > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
  font-family: var(--font-ritual); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-11);
}
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary .chev { font-family: var(--font-mono); color: var(--gold-9); transition: transform 250ms var(--ease-out); }
.toc-mobile[open] > summary .chev { transform: rotate(45deg); }
.toc-mobile ol { list-style: none; margin: 0; padding: 4px 8px 12px; }
.toc-mobile ol a { display: flex; gap: 12px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--neutral-11); transition: background 160ms, color 160ms; }
.toc-mobile ol a:hover { background: rgba(255,255,255,0.04); color: var(--neutral-12); }
.toc-mobile ol a .n { font-family: var(--font-mono); font-size: 11px; color: var(--gold-9); min-width: 20px; }

/* Desktop sticky TOC */
.legal-toc { display: none; }
@media (min-width: 1080px) {
  .legal-toc {
    display: block; position: sticky; top: 104px;
    max-height: calc(100vh - 132px); overflow-y: auto; padding-inline-end: 6px;
    scrollbar-width: thin; scrollbar-color: var(--neutral-6) transparent;
  }
  .legal-toc::-webkit-scrollbar { width: 4px; }
  .legal-toc::-webkit-scrollbar-thumb { background: var(--neutral-6); border-radius: 4px; }
}
.legal-toc__label {
  font-family: var(--font-ritual); font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold-11); margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.legal-toc__label::after { content: ""; flex: 1; height: 1px; background: var(--border-default); }
.legal-toc ol { list-style: none; margin: 0; padding: 0; }
.legal-toc li { position: relative; }
.legal-toc a {
  display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: baseline;
  padding: 7px 0; padding-inline-start: 14px; margin-inline-start: -14px;
  font-size: 13.5px; line-height: 1.35; color: var(--neutral-11);
  border-inline-start: 1.5px solid transparent;
  transition: color 200ms var(--ease-out), border-color 200ms;
}
.legal-toc a .n { font-family: var(--font-mono); font-size: 10.5px; color: var(--neutral-9); transition: color 200ms; letter-spacing: 0.02em; }
.legal-toc a:hover { color: var(--neutral-12); }
.legal-toc a:hover .n { color: var(--gold-9); }
.legal-toc a.is-active { color: var(--gold-11); border-inline-start-color: var(--gold-9); }
.legal-toc a.is-active .n { color: var(--gold-11); }

/* ---------- THE DOCUMENT ---------- */
.legal-doc {
  counter-reset: sec;
  max-width: 68ch;
  color: var(--neutral-11);
  font-size: 17px; line-height: 1.75;
}
.legal-doc > *:first-child { margin-top: 0; }

.legal-doc h2 {
  counter-increment: sec;
  position: relative; margin: 0; padding-top: 40px; scroll-margin-top: 100px;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(23px, 2.7vw, 30px); line-height: 1.18;
  letter-spacing: -0.012em; color: var(--neutral-12); text-wrap: balance;
}
.legal-doc h2::before {
  content: counter(sec, decimal-leading-zero);
  display: block; margin-bottom: 14px;
  font-family: var(--font-mono); font-weight: 400;
  font-size: 12px; letter-spacing: 0.18em; color: var(--gold-11);
}
.legal-section { border-top: 1px solid var(--border-default); margin-top: 14px; padding-top: 6px; }
.legal-section:first-of-type { border-top: 0; }

.legal-doc h3 {
  margin: 30px 0 0; font-family: var(--font-display); font-weight: 600;
  font-size: 19px; line-height: 1.3; letter-spacing: -0.005em; color: var(--neutral-12);
}

.legal-doc p { margin: 16px 0 0; text-wrap: pretty; }
.legal-doc h2 + p, .legal-doc h3 + p { margin-top: 14px; }
.legal-doc strong { color: var(--neutral-12); font-weight: 600; }

.legal-doc a:not(.contact-card a):not(.legal-note a) {
  color: var(--violet-11); border-bottom: 1px solid rgba(184,158,250,0.32);
  transition: color 180ms, border-color 180ms;
}
.legal-doc a:not(.contact-card a):not(.legal-note a):hover { color: var(--violet-12); border-bottom-color: var(--violet-11); }

.legal-doc code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-default);
  padding: 1px 6px; border-radius: 5px; color: var(--gold-11);
}

/* Unordered lists — gold ✦ markers */
.legal-doc ul { list-style: none; margin: 18px 0 0; padding: 0; }
.legal-doc ul li { position: relative; padding-inline-start: 26px; margin-top: 11px; text-wrap: pretty; }
.legal-doc ul li::before { content: "✦"; position: absolute; inset-inline-start: 2px; top: 0.18em; font-size: 10px; color: var(--gold-9); }

/* Ordered lists — numbered chips */
.legal-doc ol { list-style: none; counter-reset: li; margin: 18px 0 0; padding: 0; }
.legal-doc ol li { position: relative; padding-inline-start: 40px; margin-top: 14px; counter-increment: li; text-wrap: pretty; min-height: 26px; }
.legal-doc ol li::before {
  content: counter(li); position: absolute; inset-inline-start: 0; top: -1px;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--gold-11);
  border: 1px solid var(--border-gold); border-radius: 50%; background: var(--bg-gold-muted);
}

/* hr / blockquote */
.legal-doc hr { border: 0; height: 1px; background: var(--border-default); margin: 38px 0 0; }
.legal-doc blockquote {
  margin: 14px 0 0; padding: 18px 22px;
  border: 1px solid var(--border-default); border-inline-start: 2px solid var(--gold-9);
  border-start-start-radius: var(--r-sm); border-end-start-radius: var(--r-sm);
  border-start-end-radius: var(--r-lg); border-end-end-radius: var(--r-lg);
  background: var(--glass-light); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.legal-doc blockquote p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--neutral-12); }
.legal-doc blockquote p + p { margin-top: 10px; }

/* ---------- Callout note (replaces emoji-led legal warnings) ---------- */
.legal-note {
  margin: 22px 0 0; padding: 18px 22px; border-radius: var(--r-xl);
  background: var(--grad-card-accent); border: 1px solid var(--border-accent);
  color: var(--neutral-11);
}
.legal-note--gold { background: var(--grad-card-gold); border-color: var(--border-gold); }
.legal-note p { margin: 0; }
.legal-note p + p { margin-top: 10px; }
.legal-note strong { color: var(--neutral-12); }
.legal-note .note-label {
  display: block; margin-bottom: 9px;
  font-family: var(--font-ritual); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--violet-11);
}
.legal-note--gold .note-label { color: var(--gold-11); }
.legal-note a { color: var(--gold-11); border-bottom: 1px solid rgba(201,169,98,0.4); }
.legal-note a:hover { color: var(--gold-12); }

/* ---------- Controller / contact info panel ---------- */
.contact-card {
  margin: 22px 0 0; padding: 22px 24px;
  border: 1px solid var(--border-gold); border-radius: var(--r-xl);
  background: var(--grad-card-gold);
}
.contact-card .cc-label {
  font-family: var(--font-ritual); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold-11); display: block; margin-bottom: 12px;
}
.contact-card .cc-org { color: var(--neutral-12); font-weight: 600; font-size: 16px; }
.contact-card .cc-rows { margin-top: 10px; display: grid; gap: 7px; font-size: 14.5px; line-height: 1.5; }
.contact-card .cc-rows span { color: var(--neutral-11); }
.contact-card a { color: var(--gold-11); border-bottom: 1px solid rgba(201,169,98,0.4); }
.contact-card a:hover { color: var(--gold-12); }
.contact-card .cc-rep { color: var(--neutral-9); font-size: 13px; }

/* ---------- Data table ---------- */
.table-wrap {
  margin: 22px 0 0; border: 1px solid var(--border-default); border-radius: var(--r-xl);
  overflow: hidden; background: var(--grad-card-default);
}
.table-scroll { overflow-x: auto; }
.legal-doc table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.legal-doc thead th {
  text-align: start; padding: 14px 18px;
  font-family: var(--font-ritual); font-weight: 400; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-11); background: var(--glass-light);
  border-bottom: 1px solid var(--border-emphasis); white-space: nowrap;
}
.legal-doc tbody td { padding: 14px 18px; border-top: 1px solid var(--separator); color: var(--neutral-11); line-height: 1.5; vertical-align: top; }
.legal-doc tbody tr:nth-child(even) td { background: rgba(255,255,255,0.018); }
.legal-doc tbody td:first-child { color: var(--neutral-12); font-weight: 500; white-space: nowrap; }
.legal-doc tbody td strong { color: var(--neutral-12); }
@media (max-width: 560px) { .legal-doc tbody td:first-child { white-space: normal; } }

/* ---------- Mobile table containment + responsiveness ----------
   A wide table (min-width:560px) inside the .legal-layout grid's 1fr column would, on
   phones, expand the column past the viewport and force a horizontal scroll on the WHOLE
   page — this is the "legal pages break at the top on mobile" bug. Grid items default to
   min-width:auto (they refuse to shrink below their content), so pin the grid chain to 0
   and let the table either reflow to fit or scroll *inside* its own bordered card. */
.legal-layout, .legal-layout > *, .legal-doc { min-width: 0; }
.table-wrap, .table-scroll { max-width: 100%; }
.table-scroll { -webkit-overflow-scrolling: touch; }
@media (max-width: 700px) {
  /* Drop the 560px floor so 2-3 column legal tables reflow to the phone width (cells wrap)
     instead of forcing a horizontal scroll. Anything still too wide scrolls in its card. */
  .legal-doc table { min-width: 0; font-size: 13.5px; }
  .legal-doc thead th { padding: 11px 12px; white-space: normal; }
  .legal-doc tbody td { padding: 11px 12px; white-space: normal; overflow-wrap: anywhere; }
  .legal-doc tbody td:first-child { white-space: normal; }
}

/* ---------- Sign-off ---------- */
.legal-signoff {
  margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--border-default);
  font-size: 13px; color: var(--neutral-9); line-height: 1.7;
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; inset-inline-end: 24px; bottom: 100px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,6,24,0.82); border: 1px solid var(--border-gold);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--gold-11); font-family: var(--font-mono); font-size: 16px;
  opacity: 0; transform: translateY(10px) scale(0.9); pointer-events: none;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out), background 200ms, border-color 200ms;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: rgba(201,169,98,0.12); border-color: var(--gold-9); }

/* ---------- FOOTER ---------- */
.foot { position: relative; z-index: 1; padding: 64px 0 36px; border-top: 1px solid var(--border-default); background: #0A0414; }
.foot__langs { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 14px; color: var(--neutral-11); }
.foot__brand { font-family: "Cinzel", serif; font-size: 30px; letter-spacing: 0.14em; color: var(--neutral-12); }
.foot a { transition: color 200ms; }
.foot a:hover { color: var(--gold-11); }
.foot .hair { height: 1px; background: linear-gradient(90deg, transparent, var(--border-default) 18%, var(--border-default) 82%, transparent); }
.foot .eyebrow { font-family: var(--font-ritual); font-size: 10px; letter-spacing: 0.30em; text-transform: uppercase; color: var(--gold-11); }
.foot__links a.is-on { color: var(--gold-11); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
