/* ============================================================
   FITPHARMA LABS — Base: reset, tipografía, utilidades, animación
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
/* Lenis maneja el scroll: desactivamos el nativo cuando está activo */
html.lenis { scroll-behavior: auto; }
html.lenis body { height: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--f-texto);
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--negro);
  background: var(--blanco);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* `display: contents` deja que <img> siga siendo el hijo directo del
   contenedor (grid/flex), así el CSS existente de las imágenes sigue
   aplicando aunque estén envueltas en <picture> para servir WebP. */
picture { display: contents; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: var(--azul);
  color: var(--blanco);
}

/* ---------------- Tipografía ---------------- */

h1, h2, h3, h4, h5 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--negro);
  text-wrap: balance;
}

.display {
  font-family: var(--f-display);
  font-size: var(--t-3xl);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
}

/* Título fino en mayúsculas — estilo del catálogo impreso FitPharma */
.display-fino {
  font-family: var(--f-display);
  font-weight: 200;
  font-size: var(--t-2xl);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.t-xl { font-size: var(--t-xl); }
.t-lg { font-size: var(--t-lg); }
.t-md { font-size: var(--t-md); }
.t-sm { font-size: var(--t-sm); }

.eyebrow {
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--azul);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: currentColor;
  flex: none;
}
.eyebrow--centro { justify-content: center; }

.lead {
  font-size: var(--t-md);
  color: var(--gris-texto);
  max-width: var(--ancho-texto);
}

.azul { color: var(--azul); }
.tenue { color: var(--gris-texto); }
.mono-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ---------------- Layout ---------------- */

.contenedor {
  width: 100%;
  max-width: var(--ancho);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.contenedor--angosto { max-width: 900px; }

.seccion { padding-block: var(--seccion); }
.seccion--gris { background: var(--gris); }
.seccion--navy {
  background: var(--navy);
  color: var(--blanco);
}
.seccion--navy h1, .seccion--navy h2, .seccion--navy h3 { color: var(--blanco); }
.seccion--navy .lead, .seccion--navy .tenue { color: var(--gris-texto-inv); }
.seccion--navy .eyebrow { color: var(--azul-claro); }

.grid { display: grid; gap: var(--s-6); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

.fila {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
}
.fila--entre { justify-content: space-between; }

.cabecera-seccion {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
  max-width: 760px;
}
.cabecera-seccion--centro {
  margin-inline: auto;
  text-align: center;
  align-items: center;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* El enlace «Saltar al contenido» debe hacerse visible al recibir foco;
   si no, quien navega con teclado tabula a un destino invisible. */
a.sr-only:focus,
a.sr-only:focus-visible {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.7em 1.3em;
  overflow: visible;
  clip-path: none;
  z-index: var(--z-preloader);
  background: var(--navy);
  color: var(--blanco);
  border-radius: var(--r-full);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  box-shadow: var(--sh-lg);
  outline: 2px solid var(--azul-claro);
  outline-offset: 2px;
}

/* Los destinos de ancla no deben quedar bajo el nav fijo.
   Sin esto, entrar por legal.html#terminos deja el título tapado
   por la barra (el ancla cae en top:0 y el nav ocupa 76 px). */
[id] { scroll-margin-top: calc(var(--nav-h) + 1.5rem); }

/* ---------------- Primitivas de animación ----------------
   Las clases .rv-* arrancan ocultas y las revela GSAP
   (ui/animations.js). El fallback `no-js` las deja visibles. */

[data-rv] { will-change: transform, opacity; }

.rv-up   { opacity: 0; transform: translate3d(0, 40px, 0); }
.rv-down { opacity: 0; transform: translate3d(0, -30px, 0); }
.rv-left { opacity: 0; transform: translate3d(-40px, 0, 0); }
.rv-right{ opacity: 0; transform: translate3d(40px, 0, 0); }
.rv-fade { opacity: 0; }
.rv-scale{ opacity: 0; transform: scale(0.92); }
.rv-clip { clip-path: inset(0 0 100% 0); }

/* Reveal de línea de texto (máscara) */
.linea-mask { overflow: hidden; display: block; }
.linea-mask > span {
  display: block;
  transform: translate3d(0, 110%, 0);
}

/* Split por palabras — lo genera ui/animations.js (data-split) */
.palabra {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.palabra > span { display: inline-block; }
[data-split]:not([data-dividido]) { visibility: hidden; }
.no-js [data-split] { visibility: visible !important; }

/* Sin JS: todo visible */
.no-js .rv-up, .no-js .rv-down, .no-js .rv-left,
.no-js .rv-right, .no-js .rv-fade, .no-js .rv-scale {
  opacity: 1;
  transform: none;
}
.no-js .rv-clip { clip-path: none; }
.no-js .linea-mask > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rv-up, .rv-down, .rv-left, .rv-right, .rv-fade, .rv-scale {
    opacity: 1 !important;
    transform: none !important;
  }
  .rv-clip { clip-path: none !important; }
  .linea-mask > span { transform: none !important; }
  html { scroll-behavior: auto; }
}

/* Flotación suave decorativa */
@keyframes flotar {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(1.5deg); }
}
.flota { animation: flotar 7s ease-in-out infinite; }
.flota--lento { animation-duration: 11s; }

@keyframes pulso-anillo {
  0% { transform: scale(0.8); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

@keyframes marquesina {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Burbujas / esferas decorativas del lenguaje visual FitPharma */
.esfera {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 32% 28%,
    rgba(255, 255, 255, 0.95), rgba(41, 171, 226, 0.55) 45%, rgba(0, 86, 179, 0.4) 100%);
  filter: blur(0.3px);
  opacity: 0.65;
}
.esfera--difusa {
  background: radial-gradient(circle at 30% 30%,
    rgba(41, 171, 226, 0.35), rgba(0, 86, 179, 0.06) 70%);
  filter: blur(28px);
  opacity: 0.9;
}
