/* ==========================================================================
   ATLAS · páginas legales (/terms y /privacy)
   Se carga DESPUÉS de /assets/atlas.css (tokens, cabecera, pie, botones).
   Misma identidad que la landing en versión editorial: fondo claro, acentos
   azul eléctrico y cian, tipografía grande y nada de efectos costosos detrás
   del texto jurídico (solo un gráfico SVG ligero en la cabecera).
   ========================================================================== */

/* ---------- Cabecera del documento ---------- */
.doc-hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: calc(var(--header-h) + clamp(36px, 6vw, 72px)) 0 clamp(44px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 420px at 88% 0%, rgba(59, 130, 246, .13), transparent 65%),
    radial-gradient(700px 360px at 0% 100%, rgba(34, 211, 238, .1), transparent 70%),
    var(--bg);
}
.doc-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .7; pointer-events: none;
  background-image: linear-gradient(rgba(11, 18, 32, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(11, 18, 32, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 85% 20%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 60% 80% at 85% 20%, #000 20%, transparent 75%);
}
.doc-hero__art {
  position: absolute; z-index: -1; right: max(-120px, calc(50% - 760px)); top: 50%; width: clamp(320px, 38vw, 560px); height: auto;
  transform: translateY(-46%); pointer-events: none; opacity: .9;
}
.doc-hero__art .o1 { transform-origin: 280px 280px; animation: orbit 60s linear infinite; }
.doc-hero__art .o2 { transform-origin: 280px 280px; animation: orbit 90s linear infinite reverse; }
@keyframes orbit { to { transform: rotate(360deg); } }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted-2); margin-bottom: 26px; }
.crumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.crumbs a:hover { color: var(--blue-600); }
.crumbs .sep { opacity: .5; }

.doc-head { max-width: 860px; }
.switch {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); margin-bottom: 30px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.switch a {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; transition: background-color .2s, color .2s;
}
.switch a:hover { color: var(--ink); }
.switch a[aria-current="page"] { color: #fff; background: var(--ink); }
.doc-head .eyebrow { display: flex; margin-bottom: 18px; }
.doc-head h1 {
  font-size: clamp(42px, 6.2vw, 92px); font-weight: 700; line-height: .98; letter-spacing: -.055em; color: var(--ink);
}
.doc-head h1 .grad { color: var(--muted-dark); }
.doc-head .lead { max-width: 640px; margin: 26px 0 26px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--muted); }
.updated {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
}
.updated .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan-400); box-shadow: 0 0 0 4px rgba(34, 211, 238, .18); }
.updated time { font-weight: 600; color: var(--ink); }

/* Aviso de borrador: solo existe en la salida de borrador (build.js lo retira al publicar). */
.draft-banner {
  max-width: 780px; margin: 26px 0 0; font-size: 14px; line-height: 1.55;
  padding: 14px 18px; border-radius: 14px; border: 1px solid #F5C451; background: #FFF8E1; color: #7A4B00;
}
.pending {
  display: inline; padding: 1px 7px; border-radius: 6px; font-size: .94em; font-weight: 600;
  border: 1px dashed #E0A82E; background: #FFF4D6; color: #7A4B00;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- Cuerpo: índice + texto ---------- */
.doc {
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: clamp(40px, 6vw, 96px);
  align-items: start; padding: clamp(44px, 6vw, 80px) 0 clamp(60px, 8vw, 110px);
}
.toc { position: sticky; top: calc(var(--header-h) + 24px); }
.toc details { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 18px 12px 12px; box-shadow: var(--shadow-sm); }
.toc summary {
  list-style: none; cursor: default; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-600);
}
.toc summary::-webkit-details-marker { display: none; }
.toc-progress { display: block; height: 3px; margin: 14px 8px 10px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.toc-progress i { display: block; height: 100%; background: var(--grad-brand); transform-origin: 0 50%; transform: scaleX(var(--read, 0)); }
.toc ol { list-style: none; counter-reset: toc; max-height: calc(100vh - var(--header-h) - 150px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.toc li { counter-increment: toc; }
.toc a {
  position: relative; display: flex; gap: 10px; padding: 7px 10px; border-radius: 10px;
  font-size: 14px; line-height: 1.4; color: var(--muted); text-decoration: none; transition: background-color .15s, color .15s;
}
.toc a::before { content: counter(toc, decimal-leading-zero); min-width: 20px; font-size: 11.5px; font-weight: 600; line-height: 1.75; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.toc a:hover { background: var(--bg); color: var(--ink); }
.toc a.active { background: rgba(37, 99, 235, .07); color: var(--blue-700); font-weight: 600; }
.toc a.active::before { color: var(--blue-600); }
.toc a.active::after { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad-brand); }

article.legal { max-width: 740px; min-width: 0; color: var(--ink-2); }
article.legal section { padding: 40px 0; border-top: 1px solid var(--line); }
article.legal section:first-child { border-top: none; padding-top: 0; }
article.legal h2 {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px;
  font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; line-height: 1.2; letter-spacing: -.03em; color: var(--ink);
}
article.legal h2 .n {
  flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--blue-600); background: rgba(37, 99, 235, .07); border: 1px solid rgba(37, 99, 235, .16);
  transform: translateY(-4px); font-variant-numeric: tabular-nums;
}
article.legal h3 { margin: 28px 0 10px; font-size: 19px; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
article.legal p { margin-bottom: 16px; font-size: 17px; line-height: 1.75; }
article.legal ul, article.legal ol { margin: 0 0 18px 22px; font-size: 17px; line-height: 1.7; }
article.legal li { margin-bottom: 9px; padding-left: 4px; }
article.legal li::marker { color: var(--blue-500); }
article.legal strong { color: var(--ink); font-weight: 600; }
article.legal a { color: var(--blue-600); word-break: break-word; }
article.legal a:hover { color: var(--blue-700); }
article.legal code { font-size: .9em; padding: 2px 7px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); word-break: break-all; }
article.legal [lang="en"] { font-feature-settings: normal; }

.card-note {
  margin: 8px 0 22px; padding: 20px 22px; border-radius: 16px; font-size: 16px;
  background: linear-gradient(180deg, #F3F8FF, #EEF5FE); border: 1px solid #D8E6FA; border-left: 3px solid var(--blue-500);
}
.card-note p:last-child, .card-note ul:last-child { margin-bottom: 0; }
.card-note ul { margin-left: 18px; }

/* Tabla de datos (se convierte en tarjetas en móvil) */
.table-wrap { margin: 8px 0 22px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.55; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 14px 18px; border-top: 1px solid var(--line); }
table.data thead th { border-top: none; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--blue-700); font-weight: 600; background: #F3F8FF; }
table.data td:first-child { color: var(--ink); font-weight: 600; width: 30%; }
table.data tbody tr:hover td { background: #FAFCFF; }

/* Paso a la otra página al final del documento */
.next-doc {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-top: 36px; padding: 28px 30px; border-radius: 24px; text-decoration: none;
  background: radial-gradient(400px 200px at 100% 0%, rgba(34, 211, 238, .25), transparent 70%), linear-gradient(150deg, #0E1A33, var(--night));
  box-shadow: var(--shadow-lg); transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.next-doc:hover { transform: translateY(-4px); box-shadow: 0 50px 100px -35px rgba(15, 45, 110, .5); }
.next-doc .k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--cyan-300); }
.next-doc .t { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; color: #fff; letter-spacing: -.03em; }
.next-doc .go {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 14.5px; font-weight: 600; color: var(--ink); background: #fff;
}

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none; color: var(--ink); font-size: 18px;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line); box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .25s, transform .25s var(--ease-out), color .2s;
}
.to-top:hover { color: var(--blue-600); }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top svg { width: 18px; height: 18px; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .doc { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .toc { position: static; }
  .toc details { padding: 6px 6px 6px; }
  .toc summary { cursor: pointer; min-height: 48px; padding: 0 12px; }
  .toc summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform .25s var(--ease-out); }
  .toc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .toc-progress { margin: 0 12px 8px; }
  .toc ol { max-height: none; padding-bottom: 6px; }
  .toc a.active::after { display: none; }
  .doc-hero__art { opacity: .35; right: -140px; width: 360px; top: 30%; }
}
@media (max-width: 600px) {
  .crumbs { margin-bottom: 20px; }
  .switch { margin-bottom: 24px; }
  .switch a { padding: 0 14px; }
  article.legal section { padding: 32px 0; }
  article.legal h2 { gap: 12px; }
  article.legal p, article.legal ul, article.legal ol { font-size: 16.5px; }
  article.legal ul, article.legal ol { margin-left: 18px; }
  .card-note { padding: 16px 16px; }
  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(--line); 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%; }
  .next-doc { padding: 24px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .doc-hero__art .o1, .doc-hero__art .o2 { animation: none; }
}

/* ---------- Impresión ---------- */
@media print {
  body { background: #fff; color: #111; }
  .doc-hero { padding: 0 0 16px; background: none; border: 0; }
  .doc-hero::before, .doc-hero__art, .toc, .switch, .crumbs, .to-top, .next-doc, .site-footer { display: none !important; }
  .doc { display: block; padding: 0; }
  .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; }
  .card-note { background: none; }
}
