/* ============================================================
   ATLAS GUIDE — LEGAL PAGES (Privacy, Terms, Cookies)
   legal.css
   Requires: global.css loaded first
   ============================================================ */

/* ============================================================
   LOCAL TOKEN BRIDGE
   ============================================================ */
:root {
  --primary:        var(--ag-green-800);
  --primary-light:  var(--ag-green-600);
  --primary-dark:   var(--ag-green-900);
  --secondary:      var(--ag-terra-500);
  --secondary-light:#D4845A;
  --accent:         var(--ag-gold-500);

  --text:           var(--ag-ink);
  --text-mid:       var(--ag-ink-mid);
  --text-light:     var(--ag-ink-light);

  --bg:             var(--ag-warm-white);
  --bg-warm:        var(--ag-parchment);
  --bg-card:        var(--ag-white);
}

/* ============================================================
   LEGAL HERO
   ============================================================ */
.legal-hero {
  background: linear-gradient(135deg, var(--ag-green-900) 0%, var(--ag-green-800) 55%, var(--ag-green-600) 100%);
  padding: 160px 0 100px;
  position: relative; overflow: hidden; text-align: center;
}
.legal-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 40%, rgba(255,255,255,.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 70%, rgba(194,75,58,.12) 0%, transparent 50%);
}
.legal-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.legal-hero-inner {
  position: relative; z-index: 2;
  max-width: 700px; margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

/* Badge */
.legal-hero-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.14); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.22);
  padding: 9px 22px; border-radius: var(--radius-full);
  font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.9); margin-bottom: 28px;
}
.legal-hero-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ag-gold-500); }

.legal-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 600;
  line-height: 1.1; color: #fff; margin-bottom: 20px; letter-spacing: -.02em;
}
.legal-hero p {
  font-size: 1.1rem; color: rgba(255,255,255,.78); line-height: 1.75;
  max-width: 540px; margin: 0 auto;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.legal-layout {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 40px; max-width: 1200px; margin: 0 auto;
  padding: clamp(40px, 5vw, 72px) clamp(20px, 4vw, 48px);
  align-items: start;
}

/* ============================================================
   STICKY TABLE OF CONTENTS
   ============================================================ */
.legal-toc {
  position: sticky; top: 100px;
  background: var(--bg-card); border-radius: var(--radius-md);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden;
}
.legal-toc-header {
  background: linear-gradient(135deg, var(--ag-green-800), var(--ag-green-600));
  padding: 18px 24px;
}
.legal-toc-header h3 {
  font-size: .75rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.8); margin: 0;
}
.legal-toc-list      { list-style: none; padding: 12px 0; }
.legal-toc-list li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px; font-size: .875rem; font-weight: 500;
  color: var(--text-mid); text-decoration: none;
  transition: all .2s ease; border-left: 2px solid transparent;
}
.legal-toc-list li a::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: .5;
}
.legal-toc-list li a:hover,
.legal-toc-list li a.active {
  color: var(--primary); border-left-color: var(--primary);
  background: var(--ag-green-50);
}
.legal-toc-updated {
  padding: 14px 24px; border-top: 1px solid var(--border);
  font-size: .75rem; color: var(--text-light); font-weight: 500;
}

/* ============================================================
   LEGAL CONTENT PROSE
   ============================================================ */
.legal-content { min-width: 0; }

.legal-content h2 {
  font-family: var(--font-display);
  font-size: 1.85rem; font-weight: 600; color: var(--text);
  margin: 56px 0 20px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(26,58,43,.10);
  position: relative; scroll-margin-top: 100px;
}
.legal-content h2:first-child { margin-top: 0; }
.legal-content h2::after {
  content: ''; position: absolute; bottom: -1px; left: 0;
  width: 52px; height: 2px;
  background: linear-gradient(90deg, var(--ag-green-800), var(--ag-terra-500));
  border-radius: 2px;
}

.legal-content h3 {
  font-size: 1.15rem; font-weight: 700; color: var(--primary);
  margin: 32px 0 12px; scroll-margin-top: 100px;
}
.legal-content h4 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 24px 0 10px; }

.legal-content p        { font-size: 1rem; line-height: 1.8; color: var(--text-mid); margin-bottom: 18px; }
.legal-content strong   { color: var(--text); font-weight: 700; }
.legal-content a        { color: var(--primary); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(26,58,43,.3); text-underline-offset: 3px; transition: all .2s ease; }
.legal-content a:hover  { color: var(--secondary); text-decoration-color: var(--secondary); }

/* Lists */
.legal-content ol,
.legal-content ul     { padding-left: 0; list-style: none; margin-bottom: 20px; }
.legal-content li     { position: relative; padding-left: 24px; margin-bottom: 10px; font-size: .975rem; color: var(--text-mid); line-height: 1.75; }
.legal-content ul li::before {
  content: ''; position: absolute; left: 0; top: .65em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); opacity: .5;
}
.legal-content ol             { counter-reset: list-counter; }
.legal-content ol li          { counter-increment: list-counter; }
.legal-content ol li::before  {
  content: counter(list-counter);
  position: absolute; left: 0; top: 0;
  font-size: .75rem; font-weight: 800; color: var(--primary);
  background: var(--ag-green-50); width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-top: .2em;
}

/* ============================================================
   CALLOUT BOX
   ============================================================ */
.legal-callout {
  background: linear-gradient(135deg, rgba(26,58,43,.06), rgba(194,75,58,.05));
  border: 1px solid rgba(26,58,43,.14);
  border-radius: var(--radius-md); padding: 28px 32px; margin: 32px 0; position: relative;
}
.legal-callout::before {
  content: attr(data-icon);
  position: absolute; top: -14px; left: 28px;
  background: var(--bg-card); padding: 4px 10px;
  border-radius: var(--radius-full); font-size: 1rem;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.legal-callout p:last-child { margin-bottom: 0; }
.legal-callout.warning { background: var(--ag-gold-50); border-color: rgba(201,168,92,.2); }

/* Info box (left-border style) */
.legal-infobox {
  background: var(--bg-warm); border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 22px 28px; margin: 28px 0;
}
.legal-infobox p:last-child { margin-bottom: 0; }

/* Last updated pill */
.legal-updated {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-warm); border: 1px solid rgba(26,58,43,.12);
  border-left: 3px solid var(--primary);
  padding: 12px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .85rem; font-weight: 600; color: var(--text-mid); margin-bottom: 44px;
}
.legal-updated-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }

/* ============================================================
   GRID CARDS (data type / affiliate type cards)
   ============================================================ */
.legal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px; margin: 28px 0;
}
.legal-grid-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 22px 24px;
  border-top: 3px solid var(--secondary); box-shadow: var(--shadow-sm);
  transition: box-shadow .3s ease, transform .3s ease;
}
.legal-grid-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.legal-grid-card h4 {
  color: var(--secondary); font-size: .9rem; font-weight: 800;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.legal-grid-card p { font-size: .875rem; margin-bottom: 0; line-height: 1.65; }

/* Cookie cards */
.legal-cookie-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 22px 24px;
  border-left: 4px solid var(--ag-gold-500); margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.legal-cookie-card h4    { color: var(--text); font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.legal-cookie-meta       { font-size: .78rem; font-weight: 600; color: var(--ag-gold-700); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.legal-cookie-card p     { font-size: .9rem; margin-bottom: 0; }

/* Rights cards */
.legal-rights-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px; margin: 28px 0;
}
.legal-right-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 22px 24px;
  border-top: 3px solid var(--primary); box-shadow: var(--shadow-sm);
  transition: box-shadow .3s ease, transform .3s ease;
}
.legal-right-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.legal-right-card h4 {
  font-size: .9rem; font-weight: 800; color: var(--primary);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.legal-right-card h4::before {
  content: '✓'; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .7rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.legal-right-card p { font-size: .875rem; margin-bottom: 0; line-height: 1.65; }

/* ============================================================
   CONTACT CTA
   ============================================================ */
.legal-contact {
  background: linear-gradient(135deg, var(--ag-green-800), var(--ag-green-900));
  border-radius: var(--radius-md); padding: 44px 48px;
  margin-top: 56px; text-align: center;
  position: relative; overflow: hidden;
}
.legal-contact::before {
  content: ''; position: absolute; top: -40%; right: -10%;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.07) 0%, transparent 70%);
}
.legal-contact::after {
  content: ''; position: absolute; bottom: -30%; left: -5%;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(194,75,58,.15) 0%, transparent 70%);
}
.legal-contact h2 {
  font-family: var(--font-display); font-size: 1.8rem; font-weight: 600;
  color: #fff; margin: 0 0 12px;
  border: none; padding: 0; position: relative; z-index: 2;
}
.legal-contact h2::after { display: none; }
.legal-contact p        { color: rgba(255,255,255,.82); margin-bottom: 10px; position: relative; z-index: 2; }
.legal-contact a        { color: #fff; font-weight: 700; text-decoration: underline; text-decoration-color: rgba(255,255,255,.4); }
.legal-contact a:hover  { text-decoration-color: #fff; color: rgba(255,255,255,.9); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 32px; }
  .legal-toc    { position: static; display: none; }
}

@media (max-width: 768px) {
  .legal-hero       { padding: 130px 0 72px; }
  .legal-hero h1    { font-size: clamp(2.1rem, 7vw, 2.8rem); }
  .legal-content h2 { font-size: 1.5rem; margin-top: 40px; }
  .legal-contact    { padding: 32px 24px; }
  .legal-grid,
  .legal-rights-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .legal-callout { padding: 22px 20px; }
  .legal-contact { padding: 28px 20px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .legal-hero { background: transparent !important; padding: 20px 0 !important; }
  .legal-hero h1,
  .legal-hero p { color: var(--text) !important; }
  .legal-toc    { display: none; }
  .legal-layout { grid-template-columns: 1fr; padding: 20px 0; }
  .legal-contact {
    background: transparent !important;
    border: 1px solid var(--text-mid) !important;
  }
  .legal-contact a,
  .legal-contact h2,
  .legal-contact p { color: var(--text) !important; }
}