/* F2AIA — sistema visual de las páginas legales (/privacidad, /terminos).
   Consume los tokens de /lib/f2aia-ui.css. Sin estilos inline: estas páginas corren con CSP estricta. */

:root {
  --legal-max: 1180px;
  --nav-h: 62px;
  --surface: rgba(255, 255, 255, 0.022);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 55% at 100% 0%, rgba(0, 255, 136, 0.07), transparent 60%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(0, 255, 136, 0.035), transparent 62%);
}

/* Spotlight del cursor: las reglas viven acá (CSS externo) para que /lib/cursor.js
   funcione sin aflojar la CSP con un <style> inyectado. */
#f2aia-cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 460px; height: 460px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform;
  background: radial-gradient(circle, rgba(0,255,136,0.10) 0%, rgba(0,255,136,0.045) 32%, rgba(0,255,136,0) 68%);
}

/* === ACCESIBILIDAD === */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--bg-elev);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 99px;
  padding: 10px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 16px; top: 12px; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* === NAV === */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(7, 7, 7, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  height: var(--nav-h);
  max-width: var(--legal-max);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 8px; }

/* Botones: borde verde + interior gris oscuro (el verde lleno quedó descartado). */
.nav-btn {
  font-size: 0.82rem;
  color: var(--text-2);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--bg-elev);
  border: 1px solid rgba(0, 255, 136, 0.22);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.nav-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.nav-btn-accent {
  color: var(--accent);
  font-weight: 600;
  border-color: var(--accent-line);
}

/* === CONTENEDOR === */
.legal-wrap {
  position: relative;
  z-index: 1;
  max-width: var(--legal-max);
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* === HERO === */
.legal-hero {
  padding: 56px 0 34px;
  border-bottom: 1px solid var(--border);
}
.legal-hero .f2-eyebrow { display: block; margin-bottom: 14px; }
.legal-hero h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--text);
}
.legal-lead {
  max-width: 60ch;
  margin: 0;
  font-size: 1.02rem;
  color: var(--text-2);
}
.legal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.legal-badge {
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(0, 255, 136, 0.07);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-weight: 500;
}

/* === LAYOUT === */
.legal-body { padding-top: 32px; }

@media (min-width: 1024px) {
  .legal-body {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
}

/* === ÍNDICE === */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin-bottom: 28px;
}
.toc-title {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
}
.toc-list a {
  display: block;
  padding: 6px 0 6px 12px;
  border-left: 2px solid transparent;
  color: var(--text-3);
  font-size: 0.85rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.toc-list a:hover { color: var(--text-2); }
.toc-list a.toc-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

@media (min-width: 1024px) {
  .toc {
    position: sticky;
    top: calc(var(--nav-h) + 26px);
    max-height: calc(100vh - var(--nav-h) - 60px);
    overflow-y: auto;
    margin-bottom: 0;
  }
  .toc-list { grid-template-columns: minmax(0, 1fr); }
}

/* === SECCIONES === */
.legal-section {
  scroll-margin-top: calc(var(--nav-h) + 20px);
  margin-bottom: 22px;
  padding: 26px 26px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.legal-section > *:last-child { margin-bottom: 0; }

.legal-section h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(21px, 2.6vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}
.legal-section h2 .num {
  font-family: var(--font-mono);
  font-size: 0.62em;
  font-weight: 400;
  color: var(--accent);
  margin-right: 10px;
  vertical-align: 0.12em;
}
.legal-section h3 {
  margin: 22px 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.legal-section p {
  margin: 0 0 14px;
  max-width: 68ch;
}
.legal-section strong { color: var(--text); font-weight: 600; }

.legal-section ul {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-width: 68ch;
}
.legal-section ul li {
  position: relative;
  padding: 5px 0 5px 22px;
}
.legal-section ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: border-color 0.2s;
}
.legal-section a:hover { border-bottom-color: var(--accent); }

/* === CALLOUT === */
.callout {
  margin: 18px 0;
  padding: 16px 20px;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--accent-line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 34px rgba(0, 255, 136, 0.05);
}
.callout p { margin: 0; font-size: 0.95rem; color: var(--text-2); }

/* === TABLA === */
.table-wrap {
  margin: 4px 0 16px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.legal-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.legal-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
.legal-table td {
  padding: 12px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.legal-table tbody tr:nth-child(even) td { background: var(--bg-elev); }
.legal-table tbody tr:last-child td { border-bottom: 0; }
.legal-table td strong { color: var(--text); }

/* === CONTACTO === */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.contact-card p { margin: 0 0 8px; }
.contact-card p:last-child { margin-bottom: 0; }
.contact-legal {
  margin-top: 14px !important;
  font-size: 0.84rem;
  color: var(--text-3);
}

/* === FOOTER === */
.legal-footer {
  position: relative;
  z-index: 1;
  max-width: var(--legal-max);
  margin: 40px auto 0;
  padding: 26px 20px 52px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-3);
  line-height: 1.7;
}
.legal-footer a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.legal-footer a:hover { color: var(--accent); border-bottom-color: var(--accent-line); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
}
.footer-ai { max-width: 72ch; margin: 0 0 10px; }
.footer-copy { margin: 0; }

/* === RESPONSIVE === */
@media (max-width: 520px) {
  body { font-size: 16px; }
  .legal-wrap { padding: 0 16px 32px; }
  .legal-hero { padding: 40px 0 28px; }
  .legal-section { padding: 22px 18px 20px; }
  .toc-list { grid-template-columns: minmax(0, 1fr); }
  .nav-btn { padding: 7px 12px; font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  #f2aia-cursor-glow { display: none; }
}

/* === IMPRESIÓN === */
@media print {
  body {
    background: #fff;
    color: #111;
    font-size: 11pt;
    line-height: 1.5;
  }
  body::before,
  #f2aia-cursor-glow,
  .nav,
  .toc,
  .skip-link { display: none !important; }
  .legal-body { display: block; padding-top: 0; }
  .legal-wrap, .legal-footer { max-width: none; padding: 0; }
  .legal-hero h1 { color: #000; font-size: 24pt; }
  .legal-hero, .legal-footer { border-color: #bbb; }
  .legal-section {
    background: none;
    border: 0;
    border-top: 1px solid #ddd;
    border-radius: 0;
    padding: 12pt 0 0;
    margin-bottom: 0;
    break-inside: avoid;
  }
  .legal-section h2, .legal-section h3, .legal-section strong { color: #000; }
  .legal-section a { color: #000; border-bottom: 0; }
  .legal-section a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
  .callout {
    background: none;
    border: 1px solid #999;
    box-shadow: none;
  }
  .callout p, .legal-section p, .legal-section ul li { color: #111; }
  .legal-table th, .legal-table td { border-color: #ccc; color: #111; }
  .legal-table tbody tr:nth-child(even) td { background: #f4f4f4; }
  .table-wrap { overflow: visible; border-color: #ccc; }
  .contact-card { background: none; border-color: #999; }
  .legal-badge { color: #000; border-color: #999; background: none; }
}
