/* ==========================================================================
   Motion 2026 — animaciones puntuales de la web nueva (home primero).
   Pedido de Mateo 2026-11-30: nada generalizado, cubic-beziers propias, con
   las referencias medidas por Felipe en Kontext (src/data/medicion-refs/felipe).

   Curvas (sacadas de esas mediciones, no inventadas):
   --m-revela  Chipperfield, transform 1s  → fotos que se destapan
   --m-funde   Chipperfield, opacity 1s    → fundidos largos y suaves
   --m-sube    Snøhetta, transform .8s     → palabras que suben de su máscara
   --m-abre    BIG, width/height .78s      → cosas que se abren / se dibujan
   --m-toque   Purplus, opacity .3s        → hovers y respuestas al toque

   Todo estado "oculto" cuelga de html.m-on, que pone js/motion-2026.js sólo si
   hay JS y el usuario no pidió reducir movimiento. Sin eso, la página se ve
   quieta y completa.
   ========================================================================== */

:root {
  --m-revela: cubic-bezier(0.1, 0.6, 0.4, 1);
  --m-funde: cubic-bezier(0, 0.23, 0.07, 1);
  --m-sube: cubic-bezier(0.165, 0.84, 0.44, 1);
  --m-abre: cubic-bezier(0.45, 0, 0.55, 1);
  --m-toque: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   1 · Títulos: cada palabra sube desde atrás de su propia máscara.
   El JS envuelve las palabras en .m-l > .m-w y le pasa --i (orden).
   -------------------------------------------------------------------------- */
.m-l { display: inline-block; overflow: hidden; vertical-align: top; padding: .08em .03em .1em; margin: -.08em -.03em -.1em; }
.m-w { display: inline-block; }
html.m-on [data-m="titulo"] .m-w {
  transform: translateY(108%);
  transition: transform .95s var(--m-sube);
  transition-delay: calc(min(var(--i, 0), 14) * 42ms);
}
html.m-on [data-m="titulo"].m-in .m-w { transform: none; }

/* El eyebrow no sube: aparece apenas antes que el título, sólo fundido. */
html.m-on body.design-2026 .th .th-eyebrow.th-aparece,
html.m-on [data-m="eyebrow"] { opacity: 0; transform: none; transition: opacity 1.1s var(--m-funde); }
html.m-on body.design-2026 .th .th-eyebrow.th-aparece.is-visible,
html.m-on [data-m="eyebrow"].m-in { opacity: 1; }

/* --------------------------------------------------------------------------
   2 · Hero del home: la foto se asienta, el título sube palabra por palabra,
   el resto llega detrás y la tarjeta del buscador entra desde la derecha.
   -------------------------------------------------------------------------- */
html.m-on body.design-2026 .th .th-hero .th-hero__foto {
  opacity: 0; transform: scale(1.14);
  transition: transform 2.4s var(--m-revela), opacity 1.6s var(--m-funde);
}
html.m-on body.design-2026 .th .th-hero.m-in .th-hero__foto { opacity: .5; transform: scale(1); }

html.m-prep, html.m-prep * { transition: none !important; }
/* Hasta que el JS lo parte, el título del hero no se ve (si no, salta). */
html.m-on body.design-2026 .th .th-hero__titulo:not([data-m-partido]) { opacity: 0; }

html.m-on body.design-2026 .th .th-hero .th-hero__titulo .m-w { transition-duration: 1.15s; transition-delay: calc(250ms + var(--i, 0) * 90ms); }

html.m-on body.design-2026 .th .th-hero .th-hero__bajada,
html.m-on body.design-2026 .th .th-hero .th-hero__detalle,
html.m-on body.design-2026 .th .th-hero .th-acciones {
  opacity: 0; transform: translateY(14px);
  transition: opacity 1s var(--m-funde), transform 1s var(--m-sube);
}
html.m-on body.design-2026 .th .th-hero .th-hero__bajada { transition-delay: .62s; }
html.m-on body.design-2026 .th .th-hero .th-hero__detalle { transition-delay: .72s; }
html.m-on body.design-2026 .th .th-hero .th-acciones { transition-delay: .84s; }
html.m-on body.design-2026 .th .th-hero.m-in .th-hero__bajada,
html.m-on body.design-2026 .th .th-hero.m-in .th-hero__detalle,
html.m-on body.design-2026 .th .th-hero.m-in .th-acciones { opacity: 1; transform: none; }

html.m-on body.design-2026 .th #th-buscador-card {
  opacity: 0; transform: translateX(40px);
  transition: opacity 1.1s var(--m-funde) .7s, transform 1.3s var(--m-revela) .7s;
}
html.m-on body.design-2026 .th #th-buscador-card.m-in { opacity: 1; transform: none; }
@media (max-width: 767px) {
  /* En mobile la tarjeta está abajo del hero, pisándolo: sube en vez de venir de costado. */
  html.m-on body.design-2026 .th #th-buscador-card { transform: translateY(32px); transition-delay: .9s; }
}

/* --------------------------------------------------------------------------
   3 · Carrusel "Esto es BIGG Life Change": cada foto se destapa de abajo
   hacia arriba mientras la imagen se acomoda (escala inversa), en cascada.
   -------------------------------------------------------------------------- */
html.m-on body.design-2026 .th [data-m="cascada"] > .th-card-foto {
  clip-path: inset(100% 0 0 0 round 28px);
  transition: clip-path 1.2s var(--m-revela);
  transition-delay: calc(min(var(--i, 0), 5) * 110ms);
}
html.m-on body.design-2026 .th [data-m="cascada"] > .th-card-foto img {
  transform: scale(1.22);
  transition: transform 1.6s var(--m-revela);
  transition-delay: inherit;
}
html.m-on body.design-2026 .th [data-m="cascada"] > .th-card-foto .th-card-foto__texto {
  opacity: 0;
  transition: opacity .9s var(--m-funde);
  transition-delay: calc(450ms + min(var(--i, 0), 5) * 110ms);
}
html.m-on body.design-2026 .th [data-m="cascada"].m-in > .th-card-foto { clip-path: inset(0 0 0 0 round 28px); }
html.m-on body.design-2026 .th [data-m="cascada"].m-in > .th-card-foto img { transform: none; }
html.m-on body.design-2026 .th [data-m="cascada"].m-in > .th-card-foto .th-card-foto__texto { opacity: 1; }

/* Hover (sólo con mouse): la foto se acerca apenas, sin mover la tarjeta. */
@media (hover: hover) {
  html.m-on body.design-2026 .th [data-m="cascada"].m-hecho > .th-card-foto img { transition: transform .9s var(--m-revela); transition-delay: 0s; }
  html.m-on body.design-2026 .th [data-m="cascada"].m-hecho > .th-card-foto:hover img { transform: scale(1.05); }
}

/* --------------------------------------------------------------------------
   4 · Fotos grandes sueltas (Own a BIGG, "Tu primera clase", la foto de la
   grilla de objetivo individual): se abren como un diafragma.
   -------------------------------------------------------------------------- */
html.m-on [data-m="diafragma"] { overflow: hidden; }
html.m-on [data-m="diafragma"] img {
  clip-path: inset(9% 9% 9% 9% round 28px);
  transform: scale(1.12);
  transition: clip-path 1.25s var(--m-abre), transform 1.7s var(--m-revela);
}
html.m-on [data-m="diafragma"].m-in img { clip-path: inset(0 0 0 0 round 0px); transform: none; }
/* La tarjeta de Own a BIGG ya no sube entera: la foto hace el movimiento. */
html.m-on body.design-2026 .th .th-own.th-aparece { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   5 · Preguntas frecuentes: el + se vuelve – girando, y la respuesta se
   despliega (la altura la anima el JS; acá el signo).
   -------------------------------------------------------------------------- */
html.m-on body.design-2026 .tg .tg-faq__signo { position: relative; width: 16px; height: 16px; flex: 0 0 16px; margin-top: 6px; }
html.m-on body.design-2026 .tg .tg-faq__signo::before,
html.m-on body.design-2026 .tg .tg-faq__signo::after {
  content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 2px; border-radius: 2px;
  background: var(--tg-gris, #8a8a8a); font-size: 0;
  transition: transform .6s var(--m-abre), opacity .4s var(--m-toque);
}
html.m-on body.design-2026 .tg .tg-faq__signo::after { transform: rotate(90deg); }
html.m-on body.design-2026 .tg .tg-faq details[open] .tg-faq__signo::before { content: ""; transform: rotate(180deg); }
html.m-on body.design-2026 .tg .tg-faq details[open] .tg-faq__signo::after { transform: rotate(180deg); }
html.m-on body.design-2026 .tg .tg-faq details p { overflow: hidden; }

/* --------------------------------------------------------------------------
   6 · Links con › y botones: respuesta al toque.
   El subrayado se dibuja de izquierda a derecha y la flecha se adelanta.
   -------------------------------------------------------------------------- */
html.m-on body.design-2026 .th .th-link,
html.m-on body.design-2026 .tg .tg-link {
  text-decoration: none !important;
  background: linear-gradient(currentColor, currentColor) left bottom / 0% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size .55s var(--m-abre);
}
@media (hover: hover) {
  html.m-on body.design-2026 .th .th-link:hover,
  html.m-on body.design-2026 .tg .tg-link:hover { background-size: 100% 1px; }
}
.m-flecha { display: inline-block; transition: transform .45s var(--m-toque); }
@media (hover: hover) {
  html.m-on a:hover > .m-flecha { transform: translateX(5px); }
}

html.m-on body.design-2026 .th .th-btn,
html.m-on body.design-2026 .tg .tg-btn { transition: transform .35s var(--m-toque), background-color .35s var(--m-toque); }
html.m-on body.design-2026 .th .th-btn:active,
html.m-on body.design-2026 .tg .tg-btn:active { transform: scale(.97); transition-duration: .12s; }

/* Por las dudas: si el sistema pide menos movimiento, nada de esto corre. */
@media (prefers-reduced-motion: reduce) {
  html.m-on * { transition: none !important; }
}
