/* ============================================================
   Analytics360 — Páginas legales (términos, aviso de privacidad)
   Reutiliza el sistema de diseño de index.html / gobierno.html
   ============================================================ */

:root {
  --bg: #ffffff; --bg-soft: #f5f5f7; --surface: #ffffff; --surface-hi: #f0f0f2;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.16);
  --text: #1d1d1f; --text-dim: #515154; --text-faint: #86868b;
  --accent: #4d6622; --accent-bright: #607d2a; --accent-deep: #38491a; --accent-soft: rgba(77,102,34,0.10);
  --radius-card: 24px; --maxw: 1140px; --ease: cubic-bezier(.16,1,.3,1);
  --font: "Plus Jakarta Sans", Helvetica, "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-serif: "Literata", Georgia, "Times New Roman", serif;
}

/* Secciones oscuras de acento */
.dark {
  --bg: #16190d; --bg-soft: #1b2010; --surface: #232b15; --surface-hi: #2d371b;
  --border: rgba(255,237,215,0.12); --border-strong: rgba(255,237,215,0.20);
  --text: #ffedd7; --text-dim: rgba(255,237,215,0.66); --text-faint: rgba(255,237,215,0.44);
  --accent: #8eb43c; --accent-bright: #a6cc52; --accent-deep: #607d2a; --accent-soft: rgba(142,180,60,0.14);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
body.no-scroll { overflow: hidden; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
:is(h1,h2,h3,h4) { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:where(a, button, [tabindex]):focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.eyebrow { display: inline-flex; align-items: center; gap: .55rem; font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 20px; }
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 12px rgba(96,125,42,0.5); }

/* ---------- NAV ---------- */
header { position: fixed; top: 0; left: 0; width: 100%; z-index: 60; color: #f5f5f7; transition: background .4s var(--ease), border-color .4s var(--ease), color .4s var(--ease); border-bottom: 1px solid transparent; }
header.scrolled, header.solid { background: rgba(255,255,255,0.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0,0,0,0.08); color: #1d1d1f; }
header.solid .sound-toggle, header.solid .menu-btn { background: rgba(0,0,0,0.06); color: #1d1d1f; }
header.solid .sound-toggle:hover, header.solid .menu-btn:hover { background: rgba(0,0,0,0.10); }
header.solid .nav-pill { background: #4d6622; color: #fff; }
header.solid .nav-pill:hover { background: #3d521b; }
header.solid .nav-pill .pdot { background: #fff; box-shadow: none; }
header.solid .logo-light { display: none; }
header.solid .logo-dark { display: block; }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand img { height: 32px; width: auto; object-fit: contain; }
.brand .logo-dark { display: none; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-pill { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #ffedd7; color: #131909; transition: background .25s var(--ease); }
.nav-pill:hover { background: #e8e9ea; }
.nav-pill .pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 10px var(--accent-bright); }
.sound-toggle, .menu-btn { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 16px; background: rgba(255,237,215,0.10); border: none; color: #f5f5f7; border-radius: 999px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; transition: background .25s var(--ease), color .3s var(--ease); }
.sound-toggle:hover, .menu-btn:hover { background: rgba(255,237,215,0.13); }
.sound-toggle { width: 40px; padding: 0; justify-content: center; border-radius: 50%; }
.wave { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.wave i { width: 2px; height: 18px; background: currentColor; border-radius: 1px; transform: scaleY(0.1); transform-origin: center; transition: transform .4s var(--ease), background .3s var(--ease); }
.sound-toggle.playing .wave i { background: var(--accent-bright); animation: eqbar var(--d, .8s) ease-in-out infinite alternate; }
@keyframes eqbar { from { transform: scaleY(0.1); } to { transform: scaleY(var(--mx, 1)); } }
.wave i:nth-child(1){--d:.62s;--mx:.70;animation-delay:-.20s;} .wave i:nth-child(2){--d:.94s;--mx:1.0;animation-delay:-.55s;} .wave i:nth-child(3){--d:.73s;--mx:.82;animation-delay:-.10s;} .wave i:nth-child(4){--d:1.08s;--mx:.58;animation-delay:-.40s;} .wave i:nth-child(5){--d:.81s;--mx:.95;animation-delay:-.66s;} .wave i:nth-child(6){--d:.67s;--mx:.74;animation-delay:-.30s;} .wave i:nth-child(7){--d:.99s;--mx:1.0;animation-delay:-.12s;} .wave i:nth-child(8){--d:.77s;--mx:.80;animation-delay:-.48s;} .wave i:nth-child(9){--d:.88s;--mx:.64;animation-delay:-.05s;}
.menu-lines { position: relative; width: 18px; height: 12px; }
.menu-lines i { position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease); }
.menu-lines i:first-child { top: 2px; } .menu-lines i:last-child { bottom: 2px; }
.menu-btn[aria-expanded="true"] .menu-lines i:first-child { transform: translateY(3px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-lines i:last-child { transform: translateY(-3px) rotate(-45deg); }

.menu-overlay { position: fixed; inset: 0; z-index: 55; background: radial-gradient(70% 55% at 82% 8%, rgba(96,125,42,0.16), transparent 60%), linear-gradient(160deg, #19210b 0%, #222c0f 100%); display: flex; flex-direction: column; justify-content: center; padding: 120px 8vw 60px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s; }
.menu-overlay.open { opacity: 1; visibility: visible; transform: none; }
.menu-nav { display: flex; flex-direction: column; gap: clamp(6px,1.6vh,16px); }
.menu-nav a { font-size: clamp(1.85rem,5.5vw,3.5rem); font-weight: 600; letter-spacing: -0.03em; color: #ffedd7; width: max-content; max-width: 100%; opacity: 0; transform: translateY(22px); transition: color .25s var(--ease); }
.menu-overlay.open .menu-nav a { animation: menuIn .6s var(--ease) forwards; animation-delay: calc(var(--mi)*70ms + 120ms); }
@keyframes menuIn { to { transform: none; opacity: 1; } }
.menu-nav a:hover { color: var(--accent-bright); }
.menu-foot { margin-top: 6vh; display: flex; gap: 28px; flex-wrap: wrap; }
.menu-foot a { color: rgba(255,237,215,0.72); font-size: 16px; }
.menu-foot a:hover { color: #ffedd7; }

/* ---------- HERO LEGAL ---------- */
.legal-hero { position: relative; padding: calc(68px + clamp(3.5rem, 8vw, 6.5rem)) 0 clamp(2.5rem, 5vw, 4rem); background:
    radial-gradient(58% 72% at 84% 4%, rgba(77,102,34,0.07), transparent 62%),
    var(--bg-soft); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-faint); margin-bottom: 28px; }
.crumbs a { color: var(--text-dim); transition: color .25s var(--ease); }
.crumbs a:hover { color: var(--accent); }
.legal-hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.8rem); line-height: 1.04; letter-spacing: -0.03em; max-width: 20ch; }
.legal-sub { margin-top: 18px; font-family: var(--font-serif); font-style: italic; font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--text-dim); }

/* ---------- CUERPO LEGAL ---------- */
.legal-body { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(4rem, 9vw, 7rem); }
.legal-layout { display: grid; grid-template-columns: 240px 1fr; gap: clamp(40px, 5vw, 80px); align-items: start; }

.legal-toc { position: sticky; top: 96px; }
.toc-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin-bottom: 18px; }
.legal-toc ol { counter-reset: toc; display: grid; gap: 2px; }
.legal-toc a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--text-dim); border-left: 2px solid transparent; transition: color .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease); }
.legal-toc a:hover { color: var(--text); background: var(--surface-hi); }
.legal-toc a.active { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }

.legal-doc { max-width: 68ch; }
.legal-doc h2 { display: flex; align-items: baseline; gap: 14px; margin: clamp(2.6rem, 5vw, 3.6rem) 0 18px; font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.2; scroll-margin-top: 100px; }
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc h2 .num { flex: none; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--accent-bright); font-variant-numeric: tabular-nums; }
.legal-doc h3 { margin: clamp(1.8rem, 3vw, 2.4rem) 0 14px; font-size: clamp(1.1rem, 1.8vw, 1.3rem); scroll-margin-top: 100px; }
.legal-doc h4 { margin: 26px 0 10px; font-size: 15px; font-weight: 600; color: var(--accent); }
.legal-doc p { font-size: 16px; line-height: 1.72; color: var(--text-dim); }
.legal-doc p + p { margin-top: 12px; }
.legal-doc a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); transition: border-color .25s var(--ease); }
.legal-doc a:hover { border-bottom-color: var(--accent); }
.legal-doc strong { color: var(--text); font-weight: 600; }
.legal-doc em { font-family: var(--font-serif); }

.legal-list { margin-top: 14px; display: grid; gap: 10px; }
.legal-list li { position: relative; padding-left: 22px; font-size: 16px; line-height: 1.68; color: var(--text-dim); }
.legal-list li::before { content: ''; position: absolute; left: 0; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); }

.legal-note { margin-top: clamp(2.4rem, 4vw, 3.2rem); padding: 24px 26px; background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 0 14px 14px 0; font-size: 15px !important; }

/* Aviso de documento en borrador (no vinculante, pendiente de revisión legal) */
.draft-banner { position: sticky; top: 68px; z-index: 50; background: #7a2e12; color: #ffe9dc; }
.draft-banner .wrap { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.draft-banner svg { flex: none; width: 22px; height: 22px; }
.draft-banner p { font-size: 14px; line-height: 1.45; }
.draft-banner strong { color: #fff; font-weight: 700; }
.legal-doc .draft-inline { margin-top: 18px; padding: 18px 22px; background: rgba(122,46,18,0.07); border-left: 3px solid #7a2e12; border-radius: 0 12px 12px 0; font-size: 14px !important; color: var(--text-dim); }
.legal-doc .draft-inline strong { color: #7a2e12; }

.legal-contact { margin-top: clamp(3rem, 6vw, 4.5rem); padding-top: 28px; border-top: 1px solid var(--border); }
.legal-contact p { font-size: 15px; color: var(--text-faint); }
.legal-contact a { display: inline-block; margin-top: 8px; font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 600; color: var(--text) !important; border-bottom: 1px solid var(--border-strong) !important; padding-bottom: 3px; }
.legal-contact a:hover { border-bottom-color: var(--accent) !important; }

/* ---------- FOOTER ---------- */
footer { background: #191a1e; padding: 64px 0 40px; color: #ffedd7; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.foot img { height: 54px; width: auto; }
.foot .logo-light { display: none; }
.foot .logo-dark { display: block; }
.foot a { color: rgba(255,237,215,0.72); font-size: 15px; }
.foot a:hover { color: var(--accent-bright); }
.foot-mail { display: inline-flex; align-items: center; gap: 12px; color: #ffedd7 !important; font-size: clamp(1.05rem,2vw,1.3rem); font-weight: 500; }
.foot-mail .ic { width: 38px; height: 38px; background: rgba(255,237,215,0.06); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.foot-bottom { margin-top: 44px; padding-top: 24px; border-top: 1px solid rgba(255,237,215,0.12); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: rgba(255,237,215,0.5); }
.foot-bottom a { font-size: 13px; color: rgba(255,237,215,0.5); }
.foot-bottom a:hover { color: var(--accent-bright); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 980px) {
  .legal-layout { grid-template-columns: 1fr; gap: 36px; }
  .legal-toc { position: static; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
  .legal-toc ol { grid-template-columns: repeat(2, 1fr); display: grid; gap: 2px 16px; }
  .legal-doc { max-width: none; }
}
@media (max-width: 560px) {
  .legal-toc ol { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: flex-start; }
  .legal-doc h2 { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .menu-overlay.open .menu-nav a { animation: none; opacity: 1; transform: none; }
  .sound-toggle.playing .wave i { animation: none; transform: scaleY(0.1); }
}
