/* =============================================================================
   Choyens marketing site — Legal pages (Privacy, Terms)
   =============================================================================
   Cardless premium reading layout. Body text sits directly on the warm
   page background — no white card chrome — so the page reads as part of
   the brand surface (Apple, Linear, Stripe model) rather than a generic
   document container.
   ===========================================================================*/

/* The whole legal flow lives on a warm cream surface so the body text
   reads as part of the brand, not a separate documentation system. */
body.legal-page {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ─── HERO ──────────────────────────────────────────────────────────────
   Cinematic dark hero — espresso gradient backdrop, decorative glyph
   pushed off-canvas right, grain overlay for film texture, sand-gold
   eyebrow + tall display title + meta strip. Same vocabulary as the
   marketing hero in index.html but distilled for content-first pages. */
.legal-hero {
  position: relative;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 65%, var(--primary-light) 100%);
  color: var(--text-on-dark);
  padding: clamp(96px, 14vw, 168px) 0 clamp(56px, 8vw, 112px);
  overflow: hidden;
  isolation: isolate;
}

/* Sand-gold radial glow behind the title — gives the hero depth without
   adding more DOM. Sits below the content via z-index. */
.legal-hero::before {
  content: "";
  position: absolute;
  top: -20%;
  left: 50%;
  width: 1200px;
  height: 1200px;
  background: radial-gradient(closest-side, var(--accent) 0%, transparent 70%);
  opacity: 0.10;
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
}

/* Decorative glyph — a 320px line-art SVG anchored bottom-right of the
   hero, low opacity, rotated for visual interest. Mirrors the
   trophy/sport-glyph treatment used elsewhere in the app. */
.legal-hero-glyph {
  position: absolute;
  bottom: -40px;
  right: -60px;
  width: clamp(220px, 24vw, 360px);
  color: var(--accent);
  opacity: 0.14;
  transform: rotate(-12deg);
  z-index: -1;
  pointer-events: none;
}

.legal-hero-glyph svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Subtle grain texture — same SVG noise pattern marketing hero uses,
   added inline so legal pages don't depend on a separate asset file. */
.legal-hero-grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.legal-hero-inner {
  max-width: 920px;
  position: relative;
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-md);
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--r-round);
  background: rgba(242, 206, 152, 0.08);
}

.legal-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.legal-title {
  font-family: var(--font-stack);
  font-size: var(--fs-6xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--text-white);
  margin: 0 0 var(--sp-lg);
}

.legal-sub {
  font-size: var(--fs-xl);
  line-height: 1.45;
  color: var(--text-on-dark);
  margin: 0 0 var(--sp-xl);
  max-width: 640px;
  font-weight: 500;
}

/* Meta strip — date · read time · format pill. Three small affordances
   on the same row, dot-separated, sand-gold accents. */
.legal-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.legal-meta-item {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-on-dark-muted);
  letter-spacing: 0.04em;
}

.legal-meta-item strong {
  color: var(--accent);
  font-weight: 700;
}

.legal-meta-divider {
  color: var(--accent);
  opacity: 0.4;
  font-weight: 600;
}

/* ─── BODY GRID — sticky TOC + reading column ───────────────────────────
   Desktop: 240px TOC fixed-pin column + flex reading column.
   Mobile: TOC collapses inside a <details> at the top of the article. */
.legal-body {
  padding: clamp(56px, 8vw, 112px) 0 clamp(64px, 9vw, 128px);
}

.legal-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}

@media (max-width: 880px) {
  .legal-grid {
    grid-template-columns: 1fr;
  }
}

/* TOC — borderless, no card chrome. Just type. Sticks 100px from the
   top on desktop so it stays in view as the user scrolls. */
.legal-toc {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: var(--sp-sm);
}

.legal-toc::-webkit-scrollbar { width: 4px; }
.legal-toc::-webkit-scrollbar-thumb { background: var(--accent-dark); border-radius: 4px; opacity: 0.4; }

.legal-toc-title {
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border);
}

.legal-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.legal-toc-list li {
  counter-increment: toc-counter;
  margin: 0;
}

.legal-toc-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -14px;
  transition: color 0.2s var(--easing), border-color 0.2s var(--easing);
}

.legal-toc-list a::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.legal-toc-list a:hover {
  color: var(--primary);
}

.legal-toc-list a:hover::before {
  color: var(--accent-dark);
}

/* Scroll-spy active state — set by /js/legal.js when the section enters
   the viewport. Sand-gold border + primary text. */
.legal-toc-list a.is-active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--accent);
}

.legal-toc-list a.is-active::before {
  color: var(--primary);
}

/* Mobile TOC — collapsible via <details>. */
.legal-toc-mobile {
  display: none;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

@media (max-width: 880px) {
  .legal-toc { display: none; }
  .legal-toc-mobile { display: block; }
}

.legal-toc-mobile summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legal-toc-mobile summary::-webkit-details-marker { display: none; }

.legal-toc-mobile summary::after {
  content: "+";
  font-size: 20px;
  color: var(--accent-dark);
  font-weight: 400;
  transition: transform 0.2s var(--easing);
}

.legal-toc-mobile[open] summary::after {
  transform: rotate(45deg);
}

.legal-toc-mobile .legal-toc-list {
  margin-top: var(--sp-md);
}

/* ─── ARTICLE — reading column ──────────────────────────────────────────
   Max-width tuned for ~70 characters per line. Pure type, no chrome. */
.legal-article {
  max-width: 720px;
}

/* The first paragraph reads as a "lead" — slightly larger, secondary
   color, sets context for the whole document. */
.legal-lead {
  font-size: var(--fs-xl);
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 var(--sp-xl);
  font-weight: 500;
}

/* Section — each major numbered chapter. A 1-px sand-gold rule + the
   "section number" badge above the h2 acts as a visual rhythm marker
   without needing any container chrome. */
.legal-section {
  margin-top: clamp(48px, 7vw, 96px);
  scroll-margin-top: 100px;
}

.legal-section:first-of-type {
  margin-top: 0;
}

/* Sand-gold accent rule above each section heading. 40px wide so it
   reads as a typographic flourish, not a divider line. */
.legal-section-number {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-stack);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: var(--sp-md);
}

.legal-section-number::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}

.legal-article h2 {
  font-family: var(--font-stack);
  font-size: var(--fs-3xl);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.15;
  color: var(--primary);
  margin: 0 0 var(--sp-lg);
}

.legal-article h3 {
  font-family: var(--font-stack);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  margin: var(--sp-2xl) 0 var(--sp-md);
  line-height: 1.3;
  position: relative;
  padding-left: var(--sp-md);
}

.legal-article h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  bottom: 0.4em;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.legal-article p,
.legal-article li {
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 var(--sp-md);
}

.legal-article strong {
  font-weight: 700;
  color: var(--primary);
}

.legal-article a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dark);
  padding-bottom: 1px;
  transition: color 0.2s var(--easing), border-color 0.2s var(--easing);
}

.legal-article a:hover {
  color: var(--primary-light);
  border-bottom-color: var(--accent);
}

.legal-article code {
  font-family: 'SF Mono', Menlo, Monaco, 'Cascadia Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  color: var(--primary);
}

.legal-article ul {
  margin: 0 0 var(--sp-md);
  padding-left: 0;
  list-style: none;
}

.legal-article ul li {
  position: relative;
  padding-left: var(--sp-xl);
  margin-bottom: var(--sp-sm);
}

.legal-article ul li::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0.7em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateY(-50%);
}

/* Nested lists — slimmer marker so the indentation reads as a hierarchy
   change, not just more bullets. */
.legal-article ul ul {
  margin-top: var(--sp-sm);
  margin-bottom: 0;
}

.legal-article ul ul li::before {
  background: transparent;
  border: 1.5px solid var(--accent-dark);
  width: 6px;
  height: 6px;
}

/* ─── Callout — premium highlight block ────────────────────────────────
   Used for sections that deserve extra visual weight — Account Deletion,
   Children's Privacy, Advertising disclosure. NOT a "card" in the
   traditional sense — it's a sand-gold tinted strip with a left-edge
   accent rule, sitting flush with the reading column. */
.legal-callout {
  margin: var(--sp-xl) 0;
  padding: var(--sp-lg) var(--sp-xl);
  background: linear-gradient(135deg, rgba(242, 206, 152, 0.10), rgba(242, 206, 152, 0.04));
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.legal-callout-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 var(--sp-sm);
}

.legal-callout p {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}

/* ─── Boilerplate block (Disclaimers, Liability) ────────────────────────
   ALL-CAPS legal blocks read better in a tighter, secondary-color
   block. The dimmed treatment also signals "this is the standard
   warranty text, not the part you need to read for daily use". */
.legal-article .legal-boilerplate {
  font-size: var(--fs-sm);
  line-height: 1.75;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.025);
  border-left: 2px solid var(--border-medium);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 0 0 var(--sp-md);
  letter-spacing: 0.01em;
}

/* ─── COMPANION-DOC STRIP ──────────────────────────────────────────────
   Full-width band at the bottom of the article pointing the reader to
   the companion document. Dark espresso for visual punctuation between
   the body and the site footer. */
.legal-companion {
  background: var(--primary);
  color: var(--text-on-dark);
  padding: clamp(48px, 7vw, 96px) 0;
  margin-top: clamp(48px, 7vw, 96px);
}

.legal-companion-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-xl);
  flex-wrap: wrap;
}

.legal-companion-text {
  flex: 1 1 320px;
}

.legal-companion-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-sm);
}

.legal-companion-title {
  font-family: var(--font-stack);
  font-size: var(--fs-3xl);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.1;
  color: var(--text-white);
  margin: 0 0 var(--sp-sm);
}

.legal-companion-sub {
  font-size: var(--fs-md);
  color: var(--text-on-dark);
  margin: 0;
  line-height: 1.55;
  max-width: 560px;
}

.legal-companion-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 14px 28px;
  background: var(--accent);
  color: var(--primary);
  border-radius: var(--r-round);
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.2s var(--easing), transform 0.2s var(--easing);
  flex-shrink: 0;
}

.legal-companion-cta:hover {
  background: var(--accent-light);
  transform: translateX(4px);
}

.legal-companion-cta::after {
  content: "→";
  font-size: 18px;
  font-weight: 400;
}

/* ─── Print styling ────────────────────────────────────────────────────
   Premium docs should print cleanly: drop the chrome (hero, nav, TOC,
   companion strip), keep the article body, black-on-white. */
@media print {
  .nav,
  .scroll-progress,
  .legal-hero,
  .legal-toc,
  .legal-toc-mobile,
  .legal-companion,
  .footer { display: none !important; }

  body.legal-page { background: white; color: black; }
  .legal-grid { display: block; }
  .legal-article { max-width: none; }
  .legal-article h2,
  .legal-article h3,
  .legal-article strong { color: black; }
  .legal-callout,
  .legal-article .legal-boilerplate {
    background: transparent;
    border-left-color: black;
  }
}
