/* ============================================================
   OpositaPlus · Hoja de estilo compartida de las páginas legales
   Mismos tokens que index.html (espejo de AppColor.swift y DS.swift)
   ============================================================ */

:root {
  color-scheme: light;

  --accent: #2E6BE6;
  --accent-soft: #5B95FF;
  --accent-surface: #E8F0FE;
  --on-accent: #FFFFFF;

  --btn-grad-a: #2559C7;
  --btn-grad-b: #2E6BE6;

  --bg: #F6F9FE;
  --surface: #FFFFFF;
  --surface-elevated: #F0F4FB;

  --text-primary: #0F1B2D;
  --text-secondary: #5A6B85;
  --text-tertiary: #8E9CB2;

  --separator: #E2E9F4;
  --border: #D6E1F2;

  --success: #1B9C6B;
  --warning: #E0921A;
  --error: #D64550;

  --shadow: 0 6px 14px rgba(15, 27, 45, .08);
  --shadow-lg: 0 18px 40px rgba(15, 27, 45, .10);
  --shadow-accent: 0 10px 24px rgba(46, 107, 230, .28);

  --r-xs: 8px;
  --r-s: 12px;
  --r-m: 16px;
  --r-l: 20px;
  --r-card: 24px;
  --r-pill: 999px;

  --sp-s: 8px;
  --sp-m: 12px;
  --sp-l: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;
  --sp-xxxl: 48px;

  --ease-standard: cubic-bezier(.4, 0, .2, 1);
  --ease-bouncy: cubic-bezier(.34, 1.32, .48, 1);

  --font: "SF Pro Rounded", ui-rounded, "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #5B95FF;
    --accent-soft: #2E6BE6;
    --btn-grad-a: #5B95FF;
    --btn-grad-b: #3F7CF0;
    --accent-surface: #1B2A47;
    --on-accent: #0B1220;
    --bg: #0B1220;
    --surface: #151E30;
    --surface-elevated: #1D2840;
    --text-primary: #F2F5FA;
    --text-secondary: #9FB0C9;
    --text-tertiary: #6E7F99;
    --separator: #24314C;
    --border: #2C3A58;
    --success: #3ED598;
    --warning: #FFC160;
    --error: #FF7A85;
    --shadow: 0 6px 14px rgba(0, 0, 0, .34);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, .42);
    --shadow-accent: 0 10px 24px rgba(91, 149, 255, .26);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #5B95FF;
  --accent-soft: #2E6BE6;
  --btn-grad-a: #5B95FF;
  --btn-grad-b: #3F7CF0;
  --accent-surface: #1B2A47;
  --on-accent: #0B1220;
  --bg: #0B1220;
  --surface: #151E30;
  --surface-elevated: #1D2840;
  --text-primary: #F2F5FA;
  --text-secondary: #9FB0C9;
  --text-tertiary: #6E7F99;
  --separator: #24314C;
  --border: #2C3A58;
  --success: #3ED598;
  --warning: #FFC160;
  --error: #FF7A85;
  --shadow: 0 6px 14px rgba(0, 0, 0, .34);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .42);
  --shadow-accent: 0 10px 24px rgba(91, 149, 255, .26);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -.015em;
  text-wrap: balance;
}

p { margin: 0; }

a { color: inherit; }

::selection { background: var(--accent-surface); color: var(--text-primary); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.ic {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }

/* ---------- Fondo ambiente ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .42;
  background: radial-gradient(circle at 35% 35%, var(--accent-soft), transparent 68%);
}

.blob-a { width: 44vw; height: 44vw; top: -16vw; left: -10vw; animation: drift 19s var(--ease-standard) infinite alternate; }
.blob-b { width: 34vw; height: 34vw; top: 54vh; right: -14vw; opacity: .26; animation: drift 23s var(--ease-standard) infinite alternate-reverse; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 5vh, 0) scale(1.14); }
}

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease-standard);
}

.topbar.is-stuck { border-bottom-color: var(--separator); }

.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-l);
  height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #FFFFFF;
  font-size: 19px;
  background: linear-gradient(135deg, #2E6BE6, #5B95FF);
  box-shadow: var(--shadow-accent);
}

.brand-name { display: inline-block; white-space: nowrap; }
.brand-name em { font-style: normal; color: var(--accent); }

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.nav .nav-link {
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .22s var(--ease-standard), background .22s var(--ease-standard);
}

.nav .nav-link:hover { color: var(--text-primary); background: var(--surface-elevated); }
.nav .nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-surface); }

@media (max-width: 860px) { .nav .nav-link { display: none; } }

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  border: 1px solid var(--separator);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
  transition: transform .22s var(--ease-bouncy), color .22s var(--ease-standard);
}

.theme-toggle:hover { color: var(--accent); transform: scale(1.06); }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ic-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .ic-moon { display: none; }
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding: 0 26px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease-bouncy), box-shadow .25s var(--ease-standard),
              background .25s var(--ease-standard), color .25s var(--ease-standard);
}

.btn .ic { font-size: 20px; }

.btn-primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--btn-grad-a), var(--btn-grad-b));
  box-shadow: var(--shadow-accent);
}

:root[data-theme="dark"] .btn-primary { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0B1220; } }

.btn-primary:hover { transform: translateY(-2px) scale(1.015); }
.btn-primary:active { transform: scale(.975); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.btn-secondary:hover { transform: translateY(-2px); color: var(--accent); }
.btn-secondary:active { transform: scale(.975); }

.btn-sm { height: 42px; padding: 0 18px; font-size: 15px; }

.eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Cabecera de página legal ---------- */

.legal-hero {
  padding: clamp(36px, 6vw, 68px) 0 var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-m);
  max-width: 66ch;
}

.legal-hero h1 {
  font-size: clamp(32px, 5.2vw, 50px);
  line-height: 1.06;
  letter-spacing: -.03em;
}

.legal-hero .lede { color: var(--text-secondary); font-size: clamp(16px, 2vw, 18.5px); }

.updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 14px 6px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--separator);
  color: var(--text-tertiary);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- Cuerpo: índice + contenido ---------- */

.legal-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 60px);
  align-items: start;
  padding-bottom: clamp(48px, 7vw, 88px);
}

@media (max-width: 940px) { .legal-layout { grid-template-columns: 1fr; } }

.toc {
  position: sticky;
  top: 90px;
  padding: var(--sp-l);
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow);
}

@media (max-width: 940px) { .toc { position: static; } }

.toc h2 {
  font-size: 12.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-m);
}

.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }

.toc li { counter-increment: toc; }

.toc a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-s);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .2s var(--ease-standard), background .2s var(--ease-standard);
}

.toc a::before { content: counter(toc) ". "; color: var(--text-tertiary); }

.toc a:hover { color: var(--accent); background: var(--accent-surface); }

.legal-body { max-width: 74ch; display: flex; flex-direction: column; gap: var(--sp-xl); }

.legal-body section {
  scroll-margin-top: 88px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-m);
}

.legal-body h2 {
  font-size: clamp(21px, 2.6vw, 26px);
  line-height: 1.2;
  padding-top: var(--sp-s);
}

.legal-body h3 { font-size: 17.5px; font-weight: 700; color: var(--text-primary); }

.legal-body p,
.legal-body li { color: var(--text-secondary); }

.legal-body strong { color: var(--text-primary); font-weight: 700; }

.legal-body ul { margin: 0; padding-left: 1.15em; display: flex; flex-direction: column; gap: 7px; }

.legal-body a:not(.btn) {
  color: var(--accent);
  font-weight: 600;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}

.legal-body a:not(.btn):hover { text-decoration-color: var(--accent); }

/* Tarjetas destacadas dentro del texto */

.note {
  display: flex;
  gap: var(--sp-m);
  padding: var(--sp-l);
  border-radius: var(--r-l);
  background: var(--accent-surface);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.note .ic { font-size: 22px; color: var(--accent); margin-top: 2px; }
.note p { color: var(--text-primary); font-size: 16px; }
.note strong { display: block; margin-bottom: 3px; }

.note-warn {
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 38%, transparent);
}

.note-warn .ic { color: var(--warning); }

.card {
  padding: var(--sp-l);
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--sp-s);
}

.data-list { display: grid; gap: 10px; margin: 0; }

.data-list div { display: flex; flex-wrap: wrap; gap: 6px 10px; }

.data-list dt {
  min-width: 150px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 15.5px;
}

.data-list dd { margin: 0; color: var(--text-secondary); font-size: 15.5px; }

/* Acordeón de FAQ (soporte) */

.faq {
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .25s var(--ease-standard);
}

.faq[open] { box-shadow: var(--shadow-lg); }

.faq summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-l);
  display: flex;
  align-items: center;
  gap: var(--sp-m);
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text-primary);
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary .ic {
  margin-left: auto;
  font-size: 18px;
  color: var(--text-tertiary);
  transition: transform .28s var(--ease-bouncy);
}

.faq[open] summary .ic { transform: rotate(90deg); color: var(--accent); }

.faq .faq-body {
  padding: 0 var(--sp-l) var(--sp-l);
  display: flex;
  flex-direction: column;
  gap: var(--sp-s);
  animation: faq-in .3s var(--ease-standard);
}

@keyframes faq-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.faq-stack { display: flex; flex-direction: column; gap: var(--sp-m); }

.contact-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  font-size: 16px;
}

.contact-line:hover { text-decoration: underline; }

/* ---------- Pie ---------- */

footer {
  border-top: 1px solid var(--separator);
  padding: var(--sp-xl) 0 var(--sp-xxl);
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-l);
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-tertiary);
}

.foot-links { display: flex; flex-wrap: wrap; gap: var(--sp-l); }
.foot-links a { text-decoration: none; font-weight: 600; }
.foot-links a:hover { color: var(--accent); }

.foot-social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-m);
  flex-basis: 100%;
  padding-top: var(--sp-l);
  border-top: 1px solid var(--separator);
}

.foot-social span { font-weight: 700; color: var(--text-secondary); }

.foot-social a {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-surface);
  padding: 6px 14px;
  border-radius: 999px;
  transition: transform .25s var(--ease-standard);
}

.foot-social a:hover { transform: translateY(-2px); }

/* ---------- Aparición al hacer scroll ---------- */

html.js .reveal { opacity: 0; transform: translateY(16px); }

html.js .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s var(--ease-standard), transform .55s var(--ease-bouncy);
  transition-delay: var(--d, 0s);
}

@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}
