/* ============================================================
   WalletLoop — legal pages design system (privacy / terms / delete)
   Shares tokens with index.html (the premium homepage). See
   website/DESIGN_SPEC.md for the full system reference.
   ============================================================ */

:root {
  --navy: #0B0F1A; --navy-2: #10172B; --navy-3: #161E38;
  --line-d: rgba(233,236,245,0.10); --text-d: #E9ECF5; --text-d2: #A8AFC2;
  --indigo: #1A237E; --indigo-bright: #3D4DD8; --indigo-glow: #8B93FF;
  --green: #0F8A6F; --green-bright: #4ECCA0;
  /* Cool Grey light surfaces — match the app's default theme (1.4.32). */
  --cream: #F4F5F8; --card: #FFFFFF; --raised: #EAECF2; --line: #E2E5ED;
  --ink: #0E1330; --ink-2: #2A3358; --ink-3: #6B7088;
  --mint: #E5F2EC; --amber: #A4751A; --amber-soft: #F5E6C8; --coral: #D14238;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Roboto Mono', Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--cream); color: var(--ink); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ---------- reading progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--green), var(--green-bright)); z-index: 200; transition: width .1s linear; }

/* ---------- nav (mirrors index.html) ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(11,15,26,0.72); border-bottom: 1px solid transparent; transition: background .3s, border-color .3s; }
.nav.scrolled { background: rgba(11,15,26,0.93); border-color: var(--line-d); }
.nav-inner { max-width: 1120px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17.5px; color: var(--indigo-glow); letter-spacing: -0.4px; }
.nav-brand .loop { color: var(--green-bright); }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 500; color: var(--text-d2); }
.nav-links a:hover { color: var(--text-d); }
.nav-links a.active { color: var(--green-bright); }
.nav-cta { background: var(--green); color: #fff !important; padding: 9px 18px; border-radius: 999px; font-weight: 600; transition: background .2s; }
.nav-cta:hover { background: #0C7A62; }
.nav-burger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--text-d); margin: 5px 0; border-radius: 2px; }
@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; align-items: flex-start; position: absolute; top: 100%; left: 0; right: 0; background: rgba(11,15,26,0.97); padding: 20px 24px 26px; gap: 18px; border-bottom: 1px solid var(--line-d); }
  .nav-burger { display: block; }
}

/* ---------- legal hero ---------- */
.legal-hero { background: radial-gradient(900px 420px at 80% -30%, rgba(61,77,216,0.22), transparent 60%), var(--navy); color: var(--text-d); padding: 140px 0 56px; }
.legal-hero .eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 2.2px; text-transform: uppercase; color: var(--green-bright); margin-bottom: 14px; }
.legal-hero h1 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.6px; font-size: clamp(32px, 4.6vw, 46px); line-height: 1.12; }
.legal-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.meta-chip { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.6px; color: var(--text-d2); border: 1px solid var(--line-d); border-radius: 999px; padding: 6px 13px; }
.meta-chip svg { color: var(--green-bright); flex-shrink: 0; }

/* ---------- layout: sticky TOC + article ---------- */
.legal-wrap { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 56px; padding: 56px 0 96px; align-items: start; }
.toc-aside { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 6px; }
.toc-label { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.toc { list-style: none; border-left: 1px solid var(--line); }
.toc a { display: block; font-size: 13.5px; color: var(--ink-3); padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; line-height: 1.45; transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--green); font-weight: 600; border-left-color: var(--green); }
.toc-toggle { display: none; }
.toc-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.toc-foot a { color: var(--green); font-weight: 600; }

@media (max-width: 960px) {
  .legal-wrap { grid-template-columns: 1fr; gap: 0; padding-top: 28px; }
  .toc-aside { position: static; max-height: none; margin-bottom: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0; overflow: hidden; }
  .toc-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; cursor: pointer; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink); padding: 15px 18px; }
  .toc-toggle .chev { transition: transform .25s; color: var(--ink-3); }
  .toc-aside.open .toc-toggle .chev { transform: rotate(180deg); }
  .toc-label { display: none; }
  .toc-body { display: none; padding: 0 18px 16px; }
  .toc-aside.open .toc-body { display: block; }
  .toc-foot { margin-top: 14px; }
}

/* ---------- article typography ---------- */
.legal-content { max-width: 720px; }
.legal-content h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.4px; font-size: clamp(23px, 2.6vw, 28px); line-height: 1.25; color: var(--ink); margin: 52px 0 16px; padding-top: 26px; border-top: 1px solid var(--line); scroll-margin-top: 92px; }
.legal-content h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal-content h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.2px; color: var(--ink); margin: 30px 0 10px; scroll-margin-top: 92px; }
.legal-content p { font-size: 15.5px; color: var(--ink-2); margin-bottom: 14px; }
.legal-content ul, .legal-content ol { margin: 0 0 16px 22px; }
.legal-content li { font-size: 15px; color: var(--ink-2); margin-bottom: 9px; }
.legal-content li strong, .legal-content p strong { color: var(--ink); font-weight: 600; }
.legal-content a { color: var(--green); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(15,138,111,0.35); text-underline-offset: 3px; }
.legal-content a:hover { text-decoration-color: var(--green); }
.legal-content code { font-family: var(--mono); font-size: 0.88em; background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

/* anchor affordance on section headings */
.legal-content h2 .anchor { opacity: 0; margin-left: 8px; font-family: var(--sans); font-weight: 400; color: var(--ink-3); text-decoration: none; transition: opacity .15s; }
.legal-content h2:hover .anchor { opacity: 1; }

/* ---------- callouts + boxes ---------- */
.callout { border-radius: 18px; padding: 22px 24px; margin: 22px 0 28px; font-size: 15px; line-height: 1.65; }
.callout strong { font-weight: 700; }
.callout-success { background: var(--mint); border: 1px solid rgba(15,138,111,0.25); color: #1F4A3E; }
.callout-success strong { color: #0C3A30; }
.callout-warn { background: var(--amber-soft); border: 1px solid rgba(164,117,26,0.3); color: #5C420F; }
.callout-warn strong { color: #4A350B; }
.contact-box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; margin: 18px 0 26px; box-shadow: 0 2px 12px rgba(14,19,48,0.05); }
.contact-box p { margin-bottom: 6px; }
.contact-box p:last-child { margin-bottom: 0; }

/* numbered in-app steps (delete-account) */
.legal-content ol.steps-list { list-style: none; margin-left: 0; counter-reset: step; }
.legal-content ol.steps-list li { counter-increment: step; display: flex; gap: 14px; align-items: baseline; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; margin-bottom: 8px; }
.legal-content ol.steps-list li::before { content: counter(step, decimal-leading-zero); font-family: var(--serif); font-style: italic; font-size: 19px; color: #B8A878; flex-shrink: 0; line-height: 1.2; }

/* ---------- back to top ---------- */
.to-top { position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: var(--text-d); border: 1px solid var(--line-d); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--navy-3); }

/* ---------- footer (mirrors index.html) ---------- */
footer { background: var(--navy); border-top: 1px solid var(--line-d); padding: 44px 0 54px; color: var(--text-d2); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 22px; }
.foot-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--indigo-glow); }
.foot-brand .loop { color: var(--green-bright); }
.foot-links { display: flex; flex-wrap: wrap; gap: 22px; font-size: 13.5px; }
.foot-links a:hover { color: var(--text-d); }
.foot-fine { width: 100%; font-size: 12.5px; color: #6F7891; margin-top: 8px; }

/* ---------- print ---------- */
@media print {
  .nav, .toc-aside, .progress, .to-top, footer { display: none !important; }
  .legal-hero { background: none; color: #000; padding: 20px 0 10px; }
  .legal-hero .eyebrow { color: #444; }
  .legal-hero h1 { color: #000; }
  .meta-chip { color: #444; border-color: #ccc; }
  .meta-chip svg { color: #444; }
  body { background: #fff; }
  .legal-wrap { display: block; padding: 10px 0; }
  .legal-content { max-width: none; }
  .legal-content h2 { border-top-color: #ddd; }
  .callout-success, .callout-warn, .contact-box { border: 1px solid #ccc; background: #fff; color: #000; }
}
