/* =========================================================
   Limpia Tu Huella — Sistema de diseño
   Colores en canales RGB para que Tailwind pueda aplicar
   transparencias (bg-tarjeta/90, border-acento/20, etc.)
   ========================================================= */

:root,
:root[data-theme="musculo-legal"] {
  --color-fondo: 10 17 40;            /* #0A1128 */
  --color-tarjeta: 28 37 65;          /* #1C2541 */
  --color-texto-principal: 255 255 255;
  --color-texto-secundario: 203 213 225; /* #CBD5E1 */
  --color-acento: 212 175 55;         /* #D4AF37 */
  --color-acento-hover: 243 205 68;   /* #F3CD44 */
  --color-acento-texto: 212 175 55;
  --color-sobre-acento: 10 17 40;     /* texto encima del botón de acento */
  --shadow-glow: 0 0 24px rgba(212, 175, 55, 0.4);
}

:root[data-theme="escudo-blindado"] {
  --color-fondo: 18 18 20;            /* #121214 */
  --color-tarjeta: 26 26 30;          /* #1A1A1E */
  --color-texto-principal: 255 255 255;
  --color-texto-secundario: 203 213 225;
  --color-acento: 153 27 27;          /* #991B1B */
  --color-acento-hover: 185 28 28;    /* #B91C1C */
  --color-acento-texto: 226 85 85;    /* #E25555 legible sobre fondo oscuro */
  --color-sobre-acento: 255 255 255;
  --shadow-glow: 0 0 24px rgba(153, 27, 27, 0.5);
}

:root[data-theme="equilibrio-institucional"] {
  --color-fondo: 6 36 25;             /* #062419 */
  --color-tarjeta: 11 60 42;          /* #0B3C2A */
  --color-texto-principal: 255 255 255;
  --color-texto-secundario: 203 213 225;
  --color-acento: 184 134 11;         /* #B8860B */
  --color-acento-hover: 218 165 32;   /* #DAA520 */
  --color-acento-texto: 218 165 32;
  --color-sobre-acento: 6 36 25;
  --shadow-glow: 0 0 24px rgba(184, 134, 11, 0.4);
}

html { scroll-behavior: smooth; color-scheme: dark; }
body {
  background-color: rgb(var(--color-fondo));
  color: rgb(var(--color-texto-principal));
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease;
}
::selection { background: rgb(var(--color-acento) / .35); color: #fff; }

/* ---------- Scrollbar ---------- */
* { scrollbar-width: thin; scrollbar-color: rgb(var(--color-acento)) rgb(var(--color-fondo)); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgb(var(--color-fondo)); }
::-webkit-scrollbar-thumb { background: rgb(var(--color-acento)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--color-acento-hover)); }

/* ---------- Tipografía ---------- */
.font-display { font-family: "Playfair Display", Georgia, serif; }
.texto-acento { color: rgb(var(--color-acento-texto)); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  font-weight: 700; border-radius: .75rem; padding: .9rem 1.6rem; font-size: 1rem;
  transition: all .3s ease; transform: translateY(0); cursor: pointer; text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid rgb(var(--color-acento-hover)); outline-offset: 3px; }
.btn-primario {
  background: rgb(var(--color-acento)); color: rgb(var(--color-sobre-acento));
  box-shadow: var(--shadow-glow);
}
.btn-primario:hover { background: rgb(var(--color-acento-hover)); box-shadow: var(--shadow-glow), 0 8px 30px rgb(0 0 0 / .35); }
.btn-secundario {
  background: transparent; color: rgb(var(--color-texto-principal));
  border: 1px solid rgb(var(--color-texto-principal) / .25);
}
.btn-secundario:hover { border-color: rgb(var(--color-acento-texto)); color: rgb(var(--color-acento-texto)); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: rgb(var(--color-tarjeta));
  border: 1px solid rgb(255 255 255 / .06);
  border-radius: 1.25rem;
  transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease;
}
.tarjeta-hover:hover { border-color: rgb(var(--color-acento) / .45); transform: translateY(-4px); box-shadow: 0 18px 40px rgb(0 0 0 / .35); }

/* Imagen con respaldo: si la foto no carga, queda el degradado */
.foto {
  background-color: rgb(var(--color-tarjeta));
  background-size: cover; background-position: center;
}

/* ---------- Formularios ---------- */
.campo {
  width: 100%; background: rgb(var(--color-fondo)); color: #fff;
  border: 1px solid rgb(255 255 255 / .15); border-radius: .75rem;
  padding: .85rem 1rem; font-size: 1rem; transition: border-color .2s, box-shadow .2s;
}
.campo::placeholder { color: rgb(var(--color-texto-secundario) / .7); }
.campo:focus { outline: none; border-color: rgb(var(--color-acento-texto)); box-shadow: 0 0 0 1px rgb(var(--color-acento-texto)); }
.check { width: 1.25rem; height: 1.25rem; accent-color: rgb(var(--color-acento)); flex-shrink: 0; margin-top: .2rem; }

/* ---------- Header ---------- */
.nav-link { color: rgb(var(--color-texto-secundario)); font-weight: 600; transition: color .2s; }
.nav-link:hover, .nav-link[aria-current="page"] { color: rgb(var(--color-acento-texto)); }
.tema-btn { width: 1.35rem; height: 1.35rem; border-radius: 9999px; border: 2px solid rgb(255 255 255 / .25); transition: transform .2s, border-color .2s; }
.tema-btn:hover { transform: scale(1.12); }
.tema-btn[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px rgb(255 255 255 / .15); }

/* ---------- Hero ---------- */
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.hero-velo {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 70% at 75% 50%, rgb(var(--color-acento) / .18), transparent 70%),
    linear-gradient(90deg, rgb(var(--color-fondo)) 15%, rgb(var(--color-fondo) / .75) 55%, rgb(var(--color-fondo) / .35) 100%),
    linear-gradient(0deg, rgb(var(--color-fondo)) 0%, transparent 30%);
}

/* ---------- Chat Libertad ---------- */
#libertad-panel { transition: opacity .25s ease, transform .25s ease; }
#libertad-panel.cerrado { opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none; }
.burbuja { max-width: 85%; padding: .7rem .95rem; border-radius: 1rem; font-size: .95rem; line-height: 1.5; white-space: pre-line; }
.burbuja-libertad { background: rgb(var(--color-tarjeta)); border: 1px solid rgb(var(--color-acento) / .25); border-bottom-left-radius: .25rem; color: #fff; }
.burbuja-usuario { background: rgb(var(--color-acento)); color: rgb(var(--color-sobre-acento)); border-bottom-right-radius: .25rem; margin-left: auto; font-weight: 600; }
.chip {
  border: 1px solid rgb(var(--color-acento) / .5); color: rgb(var(--color-acento-texto));
  border-radius: 9999px; padding: .45rem .9rem; font-size: .9rem; font-weight: 600; transition: all .2s;
}
.chip:hover { background: rgb(var(--color-acento)); color: rgb(var(--color-sobre-acento)); }
.escribiendo span { width: .45rem; height: .45rem; border-radius: 9999px; background: rgb(var(--color-acento-texto)); display: inline-block; animation: rebote 1.2s infinite ease-in-out; }
.escribiendo span:nth-child(2) { animation-delay: .15s; }
.escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Evaluador / pasos ---------- */
.aparecer { animation: aparecer .45s ease both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.barra { height: 6px; border-radius: 9999px; background: rgb(255 255 255 / .08); overflow: hidden; }
.barra > div { height: 100%; background: rgb(var(--color-acento)); transition: width .4s ease; box-shadow: var(--shadow-glow); }

/* ---------- Firma ---------- */
#firma-canvas { touch-action: none; cursor: crosshair; background: #000; border-radius: .75rem; width: 100%; height: 220px; display: block; }

/* ---------- Artículos ---------- */
.articulo { font-size: 1.125rem; line-height: 1.85; color: rgb(var(--color-texto-secundario)); }
.articulo h2 { font-family: "Playfair Display", Georgia, serif; color: #fff; font-weight: 800; font-size: 1.75rem; line-height: 1.25; margin: 2.5rem 0 1rem; }
.articulo h3 { color: #fff; font-weight: 700; font-size: 1.3rem; margin: 2rem 0 .75rem; }
.articulo p { margin: 0 0 1.25rem; }
.articulo ul, .articulo ol { margin: 0 0 1.25rem 1.25rem; }
.articulo ul { list-style: disc; } .articulo ol { list-style: decimal; }
.articulo li { margin-bottom: .5rem; }
.articulo strong { color: #fff; }
.articulo a { color: rgb(var(--color-acento-texto)); text-decoration: underline; text-underline-offset: 3px; }
.articulo blockquote { border-left: 3px solid rgb(var(--color-acento)); padding: .5rem 0 .5rem 1.25rem; margin: 1.5rem 0; color: #fff; font-style: italic; }

/* Texto legal: mínimo 14px */
.legal { font-size: .95rem; line-height: 1.75; color: rgb(var(--color-texto-secundario)); }
.legal h2 { color: #fff; font-weight: 800; font-size: 1.35rem; margin: 2rem 0 .75rem; font-family: "Playfair Display", Georgia, serif; }
.legal h3 { color: #fff; font-weight: 700; font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
.legal p, .legal ul, .legal ol { margin-bottom: 1rem; }
.legal ul { list-style: disc; margin-left: 1.25rem; } .legal ol { list-style: decimal; margin-left: 1.25rem; }
.legal strong { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
