/* ==========================================================================
   Páginas legales de ATLAS (/terms y /privacy)
   Mismos tokens, tipografía y piezas que la landing (index.html): fondo con
   orbes violetas, rejilla, marca "A" y superficies translúcidas. Aquí el
   movimiento se reduce para que el texto largo se lea con calma.
   ========================================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --accent: #aa3bff;
  --accent-2: #c084fc;
  --accent-3: #7c3aed;
  --bg: #0a0710;
  --bg-2: #120d1c;
  --surface: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.09);
  --text: #c9c3d6;
  --text-h: #ffffff;
  --pending-bg: rgba(251,191,36,0.12);
  --pending-border: rgba(251,191,36,0.45);
  --pending-text: #fcd34d;
}
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}
a { color: var(--accent-2); text-underline-offset: 3px; }
a:hover { color: var(--text-h); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

/* ---------- Fondo (como la landing, más tenue) ---------- */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.32; animation: float 26s ease-in-out infinite; }
.orb.a { width: 520px; height: 520px; background: radial-gradient(circle, #aa3bff, transparent 70%); top: -180px; left: -140px; }
.orb.b { width: 460px; height: 460px; background: radial-gradient(circle, #7c3aed, transparent 70%); bottom: -200px; right: -120px; animation-delay: -9s; }
@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(40px,-30px) scale(1.08); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(170,59,255,0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(170,59,255,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------- Cabecera ---------- */
.wrap { position: relative; z-index: 2; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
header.top { padding: 28px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; color: var(--text-h); letter-spacing: -0.02em; text-decoration: none; }
.brand:hover { color: var(--text-h); }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 8px 30px rgba(170,59,255,0.5); font-weight: 900; color: #fff; font-size: 20px;
}
.nav-pill {
  font-size: 13px; color: var(--text); padding: 8px 16px; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); text-decoration: none; white-space: nowrap; transition: border-color 0.18s, color 0.18s;
}
.nav-pill:hover { color: var(--text-h); border-color: var(--accent); }

/* ---------- Cabecera del documento ---------- */
.doc-head { padding: 36px 0 34px; text-align: center; }
.switch {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 99px; margin-bottom: 30px;
  border: 1px solid var(--border); background: var(--surface);
}
.switch a {
  font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none;
  padding: 8px 18px; border-radius: 99px; transition: background 0.18s, color 0.18s;
}
.switch a:hover { color: var(--text-h); }
.switch a[aria-current="page"] {
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 6px 22px rgba(170,59,255,0.4);
}
.doc-head h1 {
  font-size: clamp(34px, 6vw, 56px); font-weight: 900; line-height: 1.05; letter-spacing: -0.04em;
  color: var(--text-h); margin-bottom: 16px;
}
.doc-head h1 .grad {
  background: linear-gradient(120deg, #c084fc 0%, #aa3bff 50%, #7c3aed 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.doc-head .lead { max-width: 620px; margin: 0 auto 22px; font-size: clamp(16px, 2.2vw, 18px); }
.updated {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
  padding: 7px 16px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--accent-2);
}
.updated .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }

/* Aviso de borrador: se retira (junto con las marcas .pending) al publicar. */
.draft-banner {
  max-width: 780px; margin: 26px auto 0; text-align: left; font-size: 14px; line-height: 1.55;
  padding: 14px 18px; border-radius: 14px; border: 1px solid var(--pending-border);
  background: var(--pending-bg); color: var(--pending-text);
}
.draft-banner strong { color: #fde68a; }

/* ---------- Cuerpo: índice + texto ---------- */
.doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; align-items: start; padding-bottom: 40px; }
.toc { position: sticky; top: 24px; }
.toc details { border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 18px 18px 14px; }
.toc summary {
  list-style: none; cursor: default; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-2); margin-bottom: 10px;
}
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; gap: 8px; font-size: 13.5px; line-height: 1.4; color: var(--text); text-decoration: none;
  padding: 6px 8px; border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.toc a::before { content: counter(toc) "."; color: var(--accent-2); font-weight: 600; min-width: 18px; }
.toc a:hover { background: rgba(170,59,255,0.1); color: var(--text-h); }
.toc a.active { background: rgba(170,59,255,0.14); color: var(--text-h); }

article.legal { max-width: 760px; min-width: 0; }
article.legal section {
  padding: 30px 0; border-top: 1px solid var(--border);
}
article.legal section:first-child { border-top: none; padding-top: 0; }
article.legal h2 {
  font-size: clamp(21px, 3vw, 26px); font-weight: 800; letter-spacing: -0.02em; color: var(--text-h);
  line-height: 1.25; margin-bottom: 14px; display: flex; gap: 12px; align-items: baseline;
}
article.legal h2 .n { color: var(--accent-2); font-size: 0.8em; font-weight: 700; min-width: 26px; }
article.legal h3 { font-size: 17px; font-weight: 700; color: var(--text-h); margin: 22px 0 8px; }
article.legal p { margin-bottom: 14px; font-size: 15.5px; }
article.legal ul, article.legal ol { margin: 0 0 16px 22px; font-size: 15.5px; }
article.legal li { margin-bottom: 8px; padding-left: 4px; }
article.legal li::marker { color: var(--accent-2); }
article.legal strong { color: var(--text-h); font-weight: 600; }
article.legal code { font-size: 0.92em; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,0.07); color: var(--text-h); word-break: break-all; }

.card-note {
  border: 1px solid rgba(170,59,255,0.3); background: rgba(170,59,255,0.07);
  border-radius: 16px; padding: 18px 20px; margin: 6px 0 18px; font-size: 15px;
}
.card-note p:last-child, .card-note ul:last-child { margin-bottom: 0; }

/* Tabla de datos (se convierte en tarjetas en móvil) */
.table-wrap { margin: 6px 0 18px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 13px 16px; border-top: 1px solid var(--border); }
table.data thead th { border-top: none; font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent-2); font-weight: 600; background: rgba(170,59,255,0.06); }
table.data td:first-child { color: var(--text-h); font-weight: 600; width: 30%; }

/* Dato pendiente de completar (borrador) */
.pending {
  display: inline; padding: 1px 7px; border-radius: 6px; font-size: 0.94em; font-weight: 600;
  border: 1px dashed var(--pending-border); background: var(--pending-bg); color: var(--pending-text);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Paso a la otra página al final del documento */
.next-doc {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-top: 26px; padding: 24px 26px; border-radius: 20px; text-decoration: none;
  border: 1px solid rgba(170,59,255,0.35); background: linear-gradient(155deg, rgba(170,59,255,0.14), rgba(20,13,28,0.4));
  transition: transform 0.22s, border-color 0.22s;
}
.next-doc:hover { transform: translateY(-4px); border-color: var(--accent); }
.next-doc .k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-2); }
.next-doc .t { font-size: 20px; font-weight: 800; color: var(--text-h); letter-spacing: -0.02em; }
.next-doc .go { font-size: 14px; font-weight: 600; color: var(--accent-2); }

/* ---------- Pie (compartido con la landing) ---------- */
footer { position: relative; z-index: 2; text-align: center; padding: 60px 0 40px; color: var(--text); font-size: 13.5px; }
footer .brand { justify-content: center; margin-bottom: 12px; font-size: 16px; }
.footer-links { display: flex; gap: 10px 22px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--accent-2); }

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 5; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; text-decoration: none; color: #fff; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3)); box-shadow: 0 10px 30px rgba(170,59,255,0.45);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .doc { grid-template-columns: 1fr; gap: 26px; }
  .toc { position: static; }
  .toc summary { cursor: pointer; margin-bottom: 0; display: flex; justify-content: space-between; align-items: center; }
  .toc summary::after { content: "+"; font-size: 18px; line-height: 1; }
  .toc details[open] summary { margin-bottom: 10px; }
  .toc details[open] summary::after { content: "−"; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  header.top { padding: 20px 0; }
  .nav-pill { padding: 7px 12px; font-size: 12.5px; }
  .doc-head { padding: 20px 0 26px; }
  .switch { margin-bottom: 22px; }
  .switch a { padding: 8px 14px; font-size: 13.5px; }
  article.legal p, article.legal ul, article.legal ol { font-size: 15px; }
  article.legal ul, article.legal ol { margin-left: 18px; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-top: 1px solid var(--border); padding: 12px 0; }
  table.data tr:first-child { border-top: none; }
  table.data td { border-top: none; padding: 3px 16px; }
  table.data td:first-child { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .orb { animation: none; }
  .next-doc, .to-top { transition: none; }
}

/* ---------- Impresión ---------- */
@media print {
  body { background: #fff; color: #111; }
  .bg-orbs, .grid-overlay, .toc, .switch, .to-top, .nav-pill, .next-doc, footer .footer-links { display: none !important; }
  .doc { display: block; }
  .doc-head h1, .doc-head h1 .grad, article.legal h2, article.legal h3, article.legal strong { color: #111; -webkit-text-fill-color: #111; }
  a { color: #111; }
  .pending { color: #7a4b00; background: #fff4d6; }
  .draft-banner { color: #7a4b00; background: #fff4d6; }
}
