/* ============================================================
   BASE — Design Tokens · Reset · Typography
   ============================================================ */

/* Open Sans — único font del proyecto. Solo 2 weights: 400 (regular) y 700 (bold).
   Loaded via Google Fonts. Preconnect agregado en cada HTML head. */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap');

:root {
  /* Brand Colors */
  --c-purple:       #8a3a8e;
  --c-purple-dark:  #6b2c6f;
  --c-purple-light: #b06cb4;
  --c-lime:         #95c500;
  --c-lime-dark:    #7aaa00;
  --c-white:        #ffffff;
  --c-bg-soft:      #f9f4f9;
  --c-bg-gray:      #f4f4f6;
  --c-text:         #1a1a2e;
  --c-text-muted:   #6b7280;
  --c-text-light:   #9ca3af;
  --c-whatsapp:     #25D366;
  --c-whatsapp-dk:  #1ebe5b;

  /* Spacing — 8pt system */
  --s1:  8px;
  --s2:  16px;
  --s3:  24px;
  --s4:  32px;
  --s5:  40px;
  --s6:  48px;
  --s8:  64px;
  --s10: 80px;
  --s12: 96px;

  /* Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 4px rgba(0,0,0,.06);
  --shadow-sm: 0 2px 8px rgba(138,58,142,.08);
  --shadow-md: 0 4px 16px rgba(138,58,142,.12);
  --shadow-lg: 0 8px 32px rgba(138,58,142,.18);
  --shadow-xl: 0 16px 48px rgba(138,58,142,.22);

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-slow: 0.45s ease;

  /* ------------------------------------------------------------
     BREAKPOINTS (referencia — usar en @media o JS)
     360 = Galaxy A03/A04, Moto E (base NSE D/D+ MX, ~60% audiencia)
     ------------------------------------------------------------ */
  --bp-xs:  360px;
  --bp-sm:  480px;
  --bp-md:  768px;
  --bp-lg:  1024px;
  --bp-xl:  1280px;
  --bp-2xl: 1440px;

  /* ------------------------------------------------------------
     CONTAINERS — usar con .container, .container--narrow, .container--wide
     ------------------------------------------------------------ */
  --container-narrow: 720px;   /* Texto largo, artículos blog */
  --container-base:   1200px;  /* Default — uso general */
  --container-wide:   1440px;  /* Grids amplias, hero */
  --max-w:            var(--container-base);  /* Alias compat */
  --gutter: 1rem;

  /* ------------------------------------------------------------
     TIPOGRAFÍA FLUIDA — escala semántica
     Body base 16px mínimo (regla dura NSE D/D+ MX)
     ------------------------------------------------------------ */
  --text-xs:   clamp(0.75rem,  1.5vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 1.8vw, 1rem);
  --text-base: clamp(1rem,     2vw,   1.125rem);
  --text-lg:   clamp(1.125rem, 2.3vw, 1.25rem);
  --text-xl:   clamp(1.25rem,  2.8vw, 1.5rem);

  /* ------------------------------------------------------------
     TOUCH TARGETS — WCAG 2.5.5 (mín 44px) + Material (48px)
     ------------------------------------------------------------ */
  --touch-min: 48px;

  /* ------------------------------------------------------------
     Z-INDEX SCALE — orden semántico, evita stacking conflicts
     ------------------------------------------------------------ */
  --z-fab:     50;
  --z-nav:    100;
  --z-drawer: 200;
  --z-modal:  300;
  --z-toast:  400;
}

@media (min-width: 640px)  { :root { --gutter: 1.5rem; } }
@media (min-width: 1024px) { :root { --gutter: 2rem;   } }

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin:     0;
  padding:    0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* `overflow-x: clip` en lugar de `hidden` para NO romper position:sticky
     en descendientes (bug clásico de CSS). clip = soporte 90%+ desde 2022. */
  overflow-x: clip;
}

body {
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Refuerzo: si algún hijo absoluto se sale, no rompe el viewport.
     clip en lugar de hidden para preservar position:sticky. */
  overflow-x: clip;
}

/* Refuerzo anti-scroll horizontal: main y section también clipean
   por si algún hero con bleed o grid con min-content desborda.
   REGLA: no usar min-width fijo en hijos de grid/flex sin garantizar
   que el padre tenga overflow:clip o overflow:hidden. */
main, section {
  overflow-x: clip;
  max-width: 100vw;
}

/* Ningún elemento puede ser más ancho que su padre */
img, video, iframe, svg, canvas, picture, source { max-width: 100%; }
img, svg { display: block; height: auto; }
a         { color: inherit; text-decoration: none; }
button    { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol    { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; }
p + p     { margin-top: var(--s2); }

:focus-visible {
  outline: 3px solid var(--c-purple);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Typography scale ---- */

/* Regla de tipografía: títulos en Open Sans REGULAR (400),
   solo palabras/frases clave POCAS en BOLD (700) usando <strong>. */

.t-display {
  font-size: clamp(2rem, 5.5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.t-h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
}

.t-h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 400;
  line-height: 1.28;
}

.t-h3 {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 400;
  line-height: 1.38;
}

/* Strong dentro de títulos: bold para frase clave */
.t-display strong, .t-h1 strong, .t-h2 strong, .t-h3 strong { font-weight: 700; }

/* Dual-color heading pattern: el primer <span> es la parte "regular"
   (queda en 400 aunque inline styles digan otra cosa). El segundo span
   conserva su font-weight inline (típicamente 700 = bold para frase clave). */
.t-display > span:first-child,
.t-h1 > span:first-child,
.t-h2 > span:first-child,
.t-h3 > span:first-child {
  font-weight: 400 !important;
}

.t-h4 {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 600;
  line-height: 1.48;
}

.t-body-lg { font-size: var(--text-lg);   line-height: 1.72; }
.t-body    { font-size: var(--text-base); line-height: 1.65; }
.t-sm      { font-size: var(--text-sm);   line-height: 1.55; }
.t-xs      { font-size: var(--text-xs);   line-height: 1.45; }

/* ---- Color utilities ---- */
.c-purple  { color: var(--c-purple); }
.c-lime    { color: var(--c-lime);   }
.c-white   { color: var(--c-white);  }
.c-muted   { color: var(--c-text-muted); }

.bg-purple  { background: var(--c-purple); }
.bg-lime    { background: var(--c-lime);   }
.bg-soft    { background: var(--c-bg-soft); }
.bg-white   { background: var(--c-white);  }

/* ---- Scroll-reveal animations ---- */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-up.is-visible {
  opacity: 1;
  transform: none;
}

.fade-up.delay-1 { transition-delay: 0.10s; }
.fade-up.delay-2 { transition-delay: 0.20s; }
.fade-up.delay-3 { transition-delay: 0.30s; }
.fade-up.delay-4 { transition-delay: 0.40s; }
