/* ============================================================
   base.css — El Secreto de las Manos v2
   Reset · Variables CSS · Tipografías · Estilos globales
   Fondo y textura · Animaciones reutilizables
   ============================================================ */


/* ────────────────────────────────────────────────────────────
   VARIABLES CSS (Design Tokens)
   ──────────────────────────────────────────────────────────── */
:root {

  /* ── Colores de fondo (de más oscuro a más claro) ── */
  --bg-void:      #020008;   /* negro casi puro — fondo base */
  --bg-deep:      #070414;   /* fondo secundario */
  --bg-surface:   #0e0824;   /* superficie de cards */
  --bg-elevated:  #16103a;   /* elementos elevados */
  --bg-overlay:   rgba(2, 0, 8, 0.85); /* overlays */

  /* ── Púrpuras (paleta primaria) ── */
  --purple-abyss: #1a0c5e;   /* fondo de hero sections */
  --purple-deep:  #2d1478;   /* fondos de cards */
  --purple-mid:   #4a2299;   /* bordes activos */
  --purple-core:  #7B47C9;   /* color de marca principal */
  --purple-light: #9b6de0;   /* hover states */

  /* ── Violetas (acento claro) ── */
  --violet:       #c4a5f5;   /* texto acento, checkmarks */
  --violet-faint: rgba(196, 165, 245, 0.15);
  --violet-glow:  rgba(196, 165, 245, 0.08);

  /* ── Dorado (acento secundario) ── */
  --gold:         #DCB978;   /* acento dorado */
  --gold-light:   #e8cc97;   /* dorado claro hover */
  --gold-faint:   rgba(220, 185, 120, 0.15);
  --gold-whisper: rgba(220, 185, 120, 0.07);

  /* ── Blancos funcionales ── */
  --white:        #ffffff;
  --white-90:     rgba(255, 255, 255, 0.90);
  --white-70:     rgba(255, 255, 255, 0.70);
  --white-50:     rgba(255, 255, 255, 0.50);
  --white-40:     rgba(255, 255, 255, 0.40);
  --white-30:     rgba(255, 255, 255, 0.30);
  --white-20:     rgba(255, 255, 255, 0.20);
  --white-15:     rgba(255, 255, 255, 0.15);
  --white-08:     rgba(255, 255, 255, 0.08);
  --white-04:     rgba(255, 255, 255, 0.04);

  /* ── Tipografías ── */
  --font-ritual:  'Cormorant Garamond', Georgia, serif;  /* ritual, quiz, diagnóstico */
  --font-display: 'Playfair Display', Georgia, serif;    /* títulos de sección */
  --font-ui:      'Inter', -apple-system, sans-serif;    /* UI funcional */

  /* ── Escala tipográfica ── */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 16px;
  --text-md:   18px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  32px;
  --text-3xl:  42px;
  --text-4xl:  56px;
  --text-5xl:  72px;

  /* ── Pesos tipográficos ── */
  --fw-light:   300;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold:600;

  /* ── Line-heights ── */
  --lh-tight:  1.1;
  --lh-snug:   1.3;
  --lh-base:   1.5;
  --lh-relaxed:1.7;

  /* ── Letter spacings ── */
  --ls-tight: -0.02em;
  --ls-normal: 0em;
  --ls-wide:   0.08em;
  --ls-wider:  0.15em;
  --ls-widest: 0.25em;

  /* ── Espaciado (escala 4px) ── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;
  --sp-32: 128px;

  /* ── Border radii ── */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-base: 12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-2xl:  32px;
  --r-full: 9999px;

  /* ── Sombras ── */
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 16px 60px rgba(0, 0, 0, 0.6);
  --shadow-glow-purple: 0 0 30px rgba(123, 71, 201, 0.4);
  --shadow-glow-gold:   0 0 20px rgba(220, 185, 120, 0.2);

  /* ── Transiciones ── */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);  /* spring suave */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);  /* deceleración */
  --ease-in:     cubic-bezier(0.55, 0, 0.67, 0.3);/* aceleración */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);/* micro-bounce */

  --t-fast:  0.15s;
  --t-base:  0.35s;
  --t-slow:  0.65s;
  --t-xslow: 1.10s;

  /* ── Z-index layers ── */
  --z-back:   -1;
  --z-base:    1;
  --z-above:  10;
  --z-overlay:100;
  --z-modal: 1000;
  --z-header:2000;
  --z-noise: 8000;
  --z-top:   9999;
}


/* ────────────────────────────────────────────────────────────
   RESET MODERNO
   Basado en Josh Comeau's CSS Reset (minimalista, funcional)
   ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Scroll suave para anclas */
  scroll-behavior: smooth;
  /* Prevenir ajuste automático de fuentes en iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* El body bloqueado cuando el menu mobile está abierto */
body.menu-open {
  overflow: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Foco accesible (no se muestra en mouse, sí en teclado) */
:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* Selección de texto */
::selection {
  background: rgba(123, 71, 201, 0.35);
  color: var(--white);
}


/* ────────────────────────────────────────────────────────────
   ESTILOS GLOBALES DEL BODY
   ──────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  color: var(--white-70);
  background-color: var(--bg-void);
}


/* ────────────────────────────────────────────────────────────
   FONDO GLOBAL CON TEXTURA DE RUIDO
   El .noise-overlay es un div fixed que vive encima de todo
   (excepto modales y header) y da la sensación de grano/película
   ──────────────────────────────────────────────────────────── */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-noise);
  pointer-events: none;
  /* SVG turbulence inline como textura de grano */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.80' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='250' height='250' filter='url(%23n)' opacity='0.038'/%3E%3C/svg%3E");
  background-size: 250px 250px;
  background-repeat: repeat;
  opacity: 1;
}


/* ────────────────────────────────────────────────────────────
   TIPOGRAFÍA BASE
   ──────────────────────────────────────────────────────────── */

/* Eyebrow — texto de categoría sobre títulos */
.eyebrow {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.70;
}

/* Jerarquía tipográfica de secciones */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  color: var(--white-90);
  line-height: var(--lh-tight);
}

h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  color: var(--white-70);
  line-height: var(--lh-snug);
}

/* Texto ritual (Cormorant Garamond) — usado en quiz, diagnóstico */
.text-ritual {
  font-family: var(--font-ritual);
  font-weight: var(--fw-light);
}
.text-ritual-italic {
  font-family: var(--font-ritual);
  font-style: italic;
  font-weight: var(--fw-light);
}

/* Utilidades de color */
.text-gold   { color: var(--gold); }
.text-violet { color: var(--violet); }
.text-muted  { color: var(--white-30); }
.text-secondary { color: var(--white-50); }


/* ────────────────────────────────────────────────────────────
   ANIMACIONES GLOBALES (keyframes reutilizables)
   ──────────────────────────────────────────────────────────── */

/* Entrada desde abajo con fade */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade simple */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Entrada desde abajo más pronunciada */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Escala desde centro */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Entrada desde izquierda */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Entrada desde derecha */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulsación de glow — usado en botones y símbolos */
@keyframes glowPulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.85; }
}

/* Titilación de estrellas/partículas */
@keyframes twinkle {
  0%, 100% { opacity: 0.05; transform: scale(0.8); }
  50%       { opacity: 0.55; transform: scale(1.1); }
}

/* Flotación vertical suave */
@keyframes float {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  33%       { transform: translateY(-10px) translateX(3px); }
  66%       { transform: translateY(-5px) translateX(-3px); }
}

/* Rotación continua lenta */
@keyframes slowRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Trazado de línea SVG */
@keyframes lineTrace {
  from { stroke-dashoffset: var(--line-length, 90); }
  to   { stroke-dashoffset: 0; }
}

/* Parpadeo del cursor de texto (para el quiz) */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Modal de carta (entrada) */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Revelación de bloque desde abajo — oferta regalo */
@keyframes revealFromBottom {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shimmer — para el badge de análisis */
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}


/* ────────────────────────────────────────────────────────────
   CLASES DE ANIMACIÓN DE SCROLL (js-reveal)
   Activadas por IntersectionObserver en animations.js (Fase 5)
   ──────────────────────────────────────────────────────────── */

/* Elementos ocultos que esperan reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-slow) var(--ease-out),
              transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
[data-reveal="left"] {
  transform: translateX(-30px);
}
[data-reveal="right"] {
  transform: translateX(30px);
}
[data-reveal="scale"] {
  transform: scale(0.94);
}

/* Cuando el IntersectionObserver agrega .is-visible */
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}


/* ────────────────────────────────────────────────────────────
   CLASES DE ANIMACIÓN INMEDIATA (carga de página)
   Usadas con --anim-delay como CSS custom property inline
   ──────────────────────────────────────────────────────────── */

.anim-fade-up {
  opacity: 0;
  animation: fadeInUp var(--t-slow) var(--ease-smooth) var(--anim-delay, 0s) both;
}

.anim-fade-in {
  opacity: 0;
  animation: fadeIn var(--t-slow) var(--ease-out) var(--anim-delay, 0s) both;
}

.anim-scale-in {
  opacity: 0;
  animation: scaleIn var(--t-xslow) var(--ease-smooth) var(--anim-delay, 0s) both;
}

.anim-slide-left {
  opacity: 0;
  animation: slideInLeft var(--t-slow) var(--ease-smooth) var(--anim-delay, 0s) both;
}

.anim-slide-right {
  opacity: 0;
  animation: slideInRight var(--t-slow) var(--ease-smooth) var(--anim-delay, 0s) both;
}


/* ────────────────────────────────────────────────────────────
   HELPERS VISUALES GLOBALES
   ──────────────────────────────────────────────────────────── */

/* Separador decorativo */
.divider {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: var(--sp-6) auto;
  opacity: 0.4;
}

.divider-full {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--white-08), transparent);
}

/* Utilidades de visibilidad responsive (se completan en layout.css) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
