/* ===========================================================================
   motion.css — entrada de tarjetas y copys de ModoFan (24-oct-2026).

   Ficha de movimiento:
     Tarjetas ..... opacidad + 16 px en Y, 360 ms, 80 ms entre hermanas (máx. 4).
     Copys ........ h1 y h2 en 2–4 grupos de palabras, 420 ms, 80 ms entre grupos.
     Imagen ....... se revela dentro de su tarjeta una sola vez, 360 ms.
     Hover/foco ... solo la imagen interna escala a 1.02 en 200 ms.

   Reglas:
   · El contenido existe sin JavaScript. Todo el estado oculto vive bajo
     html.mf-motion, clase que agrega el <head> solo si hay JavaScript y no hay
     movimiento reducido. Si motion.js no arranca, el <head> quita la clase a
     los 4 s y todo queda visible.
   · Solo se anima transform y opacity. Sin librerías.
   · Con prefers-reduced-motion: reduce todo queda visible y quieto.
   =========================================================================== */

html.mf-motion {
  --mf-motion-ease: cubic-bezier(.22, .61, .36, 1);
  --mf-motion-y: 16px;
  --mf-motion-tarjeta: 360ms;
  --mf-motion-copy: 420ms;
}

/* --- 1 · Tarjetas -------------------------------------------------------
   El estado oculto no espera a que motion.js marque la tarjeta: se aplica
   desde el primer pintado bajo html.mf-motion (la clase que pone el <head>).
   Así no se ve la tarjeta entera y después escondida (el parpadeo). */
html.mf-motion :is(.mf-card, .mf-model, .mf-path, .mf-inspiration__piece, .ms-card):not(.mf-in) {
  opacity: 0;
  transform: translate3d(0, var(--mf-motion-y), 0);
}
html.mf-motion :is(.mf-card, .mf-model, .mf-path, .mf-inspiration__piece, .ms-card).mf-reveal.mf-anim {
  transition: opacity var(--mf-motion-tarjeta) var(--mf-motion-ease),
    transform var(--mf-motion-tarjeta) var(--mf-motion-ease);
  transition-delay: var(--mf-delay, 0ms);
  will-change: opacity, transform;
}
html.mf-motion :is(.mf-card, .mf-model, .mf-path, .mf-inspiration__piece, .ms-card).mf-reveal.mf-in {
  opacity: 1;
  transform: none;
}

/* La caja y el texto no se mueven: el hover de la casa de marca (que subía
   la tarjeta 3 px) queda anulado; el borde y la sombra sí responden. */
html.mf-motion .mf-card:hover,
html.mf-motion .mf-card:focus-within {
  transform: none;
}

/* --- 2 · Solo la imagen responde al hover o al foco --------------------- */
html.mf-motion :is(.mf-card__image img, .mf-model > img, .mf-inspiration__piece img, .ms-card__media) {
  transition: transform 200ms ease-out, opacity var(--mf-motion-tarjeta) ease-out;
}
html.mf-motion .mf-card:hover .mf-card__image img,
html.mf-motion .mf-card:focus-within .mf-card__image img,
html.mf-motion .mf-model:hover > img,
html.mf-motion .mf-model:focus-within > img,
html.mf-motion .mf-inspiration__piece:hover img,
html.mf-motion .mf-inspiration__piece:focus-within img,
html.mf-motion .ms-card__visual:hover .ms-card__media,
html.mf-motion .ms-card:focus-within .ms-card__media {
  transform: scale(1.02);
}
/* El 1.02 no debe salirse de la caja de la tarjeta. */
html.mf-motion .mf-model {
  overflow: clip;
}

/* --- 3 · El arte se revela una vez dentro de su tarjeta ----------------- */
html.mf-motion :is(.mf-card, .mf-model, .mf-path, .mf-inspiration__piece, .ms-card):not(.mf-in) :is(.mf-card__image img, .mf-model > img, .mf-inspiration__piece img, .ms-card__media) {
  opacity: 0;
}

/* --- 4 · Copys: h1 y h2 en grupos de palabras ---------------------------- */
html.mf-motion main :is(h1, h2):not(.mf-txt) {
  opacity: 0;
}
html.mf-motion main :is(h1, h2).mf-txt {
  opacity: 1;
}
html.mf-motion .mf-txt .mf-w {
  display: inline-block;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  opacity: 0;
  transform: translate3d(0, .28em, 0);
}
html.mf-motion .mf-txt.mf-anim .mf-w {
  transition: opacity var(--mf-motion-copy) var(--mf-motion-ease),
    transform var(--mf-motion-copy) var(--mf-motion-ease);
  transition-delay: var(--mf-w-delay, 0ms);
}
html.mf-motion .mf-txt.mf-in .mf-w {
  opacity: 1;
  transform: none;
}
html.mf-motion .mf-txt.mf-hecho .mf-w {
  will-change: auto;
}

/* --- 5 · Enlaces de lectura en celular ----------------------------------
   Un enlace que se parte en dos líneas deja una caja que se cruza con el
   enlace vecino (el detector visual lo marca como «montado»). Cada enlace
   se mantiene entero y el navegador lo baja de línea si no cabe. */
@media (max-width: 767px) {
  html.mf-motion .mf-reading a {
    white-space: nowrap;
  }
}

/* --- 6 · Movimiento reducido -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html.mf-motion :is(.mf-card, .mf-model, .mf-path, .mf-inspiration__piece, .ms-card).mf-reveal,
  html.mf-motion .mf-txt .mf-w {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html.mf-motion main :is(h1, h2) {
    opacity: 1 !important;
  }
  html.mf-motion :is(.mf-card__image img, .mf-model > img, .mf-inspiration__piece img, .ms-card__media) {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
