/* =========================================================
   MIVI — Reset y estilos globales
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Lenis toma el control del scroll; sin esto pelea con scroll-behavior */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--void);
  /* `clip` en vez de `hidden`: `hidden` convierte al body en contenedor de
     scroll y rompe el pin de ScrollTrigger. La primera línea es el respaldo. */
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--neon);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--purple-lit);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--void);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--purple-deep), var(--purple));
  border-radius: var(--r-pill);
  border: 2px solid var(--void);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--purple-lit);
}

/* =========================================================
   Layout
   ========================================================= */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
  z-index: var(--z-content);
}

.section--tight {
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

/* =========================================================
   Textura y ambiente de fondo
   ========================================================= */

/* Capa de ruido global: rompe el banding de los gradientes */
.noise {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Viñeta que cierra los bordes y centra la mirada */
.vignette {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(8, 6, 15, 0.85) 100%);
}

/* Manchas de color que respiran detrás del contenido */
.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: var(--z-bg);
  will-change: transform;
}

.aura--purple {
  background: radial-gradient(circle, rgba(124, 58, 237, 0.55), transparent 70%);
}

.aura--neon {
  background: radial-gradient(circle, rgba(255, 61, 154, 0.34), transparent 70%);
}

@keyframes aura-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(4%, -6%, 0) scale(1.14);
  }
}

/* =========================================================
   Utilidades tipográficas
   ========================================================= */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple-lit);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--grad-brand);
}

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Sin background-clip:text, `color: transparent` dejaría el título invisible. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .grad-text,
  .grad-text .word {
    background: none;
    color: var(--purple-lit);
  }
}

/* Cuando reveal.js parte el título, cada palabra queda `inline-block`: una caja
   atómica que pinta su propio texto, así que el recorte del padre NO la alcanza
   y quedaría invisible. Por eso cada palabra lleva su propio degradado.
   reveal.js les ajusta background-size/position para que se lea continuo. */
.grad-text .word {
  background-image: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 58ch;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--step-2);
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.section-head h2 {
  font-size: var(--fs-h2);
}

/* reveal.js parte los títulos en .word; el perspective da profundidad al giro */
[data-split] {
  perspective: 900px;
}

/* inline-block para que el transform funcione. Los espacios entre palabras son
   nodos de texto reales, así que el corte de línea sigue siendo el del navegador. */
[data-split] .word {
  display: inline-block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   Accesibilidad: menos movimiento
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .aura {
    animation: none !important;
  }
}
