/* ==========================================================================
   Mudanzas Rey — Base
   Reset moderno, tipografía, layout, utilidades, accesibilidad y animaciones
   de aparición. Todo lo relativo a "reduced motion" vive SOLO aquí.
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  interpolate-size: allow-keywords;
}

body {
  min-height: 100vh;
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-ink-2);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

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

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

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

ul,
ol {
  padding: 0;
  list-style: none;
}

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

[hidden] {
  display: none !important; /* el atributo hidden siempre debe ganar */
}

/* ---------- Tipografía ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--ff-display);
  color: var(--c-ink);
  line-height: var(--lh-tight);
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); letter-spacing: -0.015em; }

p {
  text-wrap: pretty;
}

strong {
  font-weight: 600;
  color: var(--c-ink);
}

.lead {
  font-size: var(--fs-lead);
  color: var(--c-muted);
  line-height: 1.7;
}

.text-gradient {
  background: var(--g-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--ff-display);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-brand);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--g-brand);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: calc(var(--container-narrow) + var(--gutter) * 2);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--surface {
  background-color: var(--c-surface);
}

.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.section-head {
  max-width: 680px;
  margin-inline: auto;
  margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
  text-align: center;
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
}

.section-head--start {
  text-align: start;
  justify-items: start;
  margin-inline: 0;
}

.section-head p {
  color: var(--c-muted);
  font-size: var(--fs-lead);
}

/* ---------- Accesibilidad ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-pill);
  background: var(--c-ink);
  color: #fff;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--t-base) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

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

::selection {
  background: var(--c-brand-100);
  color: var(--c-ink);
}

/* ---------- Aparición al hacer scroll ----------
   El estado oculto solo aplica si JS está activo: noscript.css lo anula. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--t-reveal) var(--ease-out),
    transform var(--t-reveal) var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

.reveal--scale {
  transform: translateY(16px) scale(0.97);
}

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

/* Escalonado (sin estilos inline → compatible con la CSP) */
.d-1 { --delay: 90ms; }
.d-2 { --delay: 180ms; }
.d-3 { --delay: 270ms; }
.d-4 { --delay: 360ms; }
.d-5 { --delay: 450ms; }
.d-6 { --delay: 540ms; }
.d-7 { --delay: 630ms; }

/* Entrada del hero (CSS puro, no depende de JS → no afecta el LCP) */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise-in 900ms var(--ease-out) both;
  animation-delay: var(--delay, 0ms);
}

/* Variante sin opacidad para los candidatos a LCP (H1, entradilla, imagen
   principal): se mueven pero son visibles desde el primer pintado, así la
   animación no retrasa el Largest Contentful Paint. */
@keyframes slide-in {
  from { transform: translateY(14px); }
  to { transform: none; }
}

.rise-slide {
  animation: slide-in 800ms var(--ease-out) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Movimiento reducido (único bloque del proyecto) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .reveal,
  .reveal--scale {
    opacity: 1;
    transform: none;
  }
}
