/* =========================================================================
   MOVIMIENTO — La Oveja Rosa.
   Principios (ui-ux-pro-max · Animation):
   · Solo transform/opacity (propiedades individuales translate/rotate/scale), sin reflow ni CLS.
   · Una coreografía de entrada en la portada; el resto revela al hacer scroll con escalonado corto.
   · Todo lo que se mueve en bucle lleva .or-loop y se pausa con el botón «Pausar animaciones».
   · prefers-reduced-motion: sin movimiento, contenido visible de inmediato.
   · Las animaciones de entrada usan fill-mode "backwards": al terminar no dejan estilos pegados,
     así que no pelean con los hover ni con las rotaciones estáticas de tema.css.
   ========================================================================= */

:root {
  --or-ease: cubic-bezier(.16, 1, .3, 1);          /* desaceleración suave al llegar */
  --or-spring: cubic-bezier(.34, 1.56, .64, 1);    /* rebote ligero */
  --or-dur-s: .25s;
  --or-dur-m: .7s;
  --or-dur-l: 1s;
}

/* ---------- Entradas (keyframes parametrizados con variables) ---------- */
@keyframes or-in {
  from { opacity: 0; translate: var(--dx, 0) var(--dy, 32px); rotate: var(--dr, 0deg); scale: var(--ds, 1); }
}
@keyframes or-palabra { from { translate: 0 110%; rotate: 6deg; } }
@keyframes or-pop { from { opacity: 0; scale: .55; rotate: -18deg; } }
@keyframes or-sello { from { opacity: 0; scale: 1.8; rotate: 8deg; } 60% { opacity: 1; } }
@keyframes or-sticker { from { opacity: 0; translate: 0 -60px; scale: 1.5; } 60% { translate: 0 6px; scale: .96; } }
@keyframes or-flota { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes or-cinta { to { translate: -50% 0; } }
@keyframes or-gira { to { rotate: 360deg; } }
@keyframes or-deriva { to { background-position-x: 160px; } }

@media (prefers-reduced-motion: no-preference) {

  /* ----- Portada: coreografía de carga (solo con JS) ----- */
  .js .or-hero .or-kicker { animation: or-in var(--or-dur-m) var(--or-ease) .05s backwards; --dy: 14px; }
  .js .or-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .1em; margin-bottom: -.1em; }
  .js .or-w__i { display: inline-block; animation: or-palabra .85s var(--or-ease) backwards; animation-delay: calc(.18s + var(--i, 0) * 70ms); }
  .js .or-hero__text { animation: or-in var(--or-dur-m) var(--or-ease) .75s backwards; --dy: 20px; }
  .js .or-hero__actions { animation: or-in var(--or-dur-m) var(--or-ease) .9s backwards; --dy: 20px; }
  .js .or-hero__badge { animation: or-pop 1s var(--or-spring) .3s backwards; }
  .js .or-sticker--lima { animation: or-sticker .9s var(--or-ease) 1.05s backwards; }
  .js .or-sticker--rosa { animation: or-sticker .9s var(--or-ease) 1.25s backwards; }
  .js .or-hero__firma { animation: or-in var(--or-dur-m) var(--or-ease) 1.4s backwards; --dy: 16px; }

  /* Flotación suave + paralaje + inclinación con el puntero */
  .or-hero__frame { animation: or-flota 7s ease-in-out infinite; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease-out; will-change: transform; }
  .or-hero__badge { translate: 0 calc(var(--py, 0px) * -1); }
  .or-sticker--lima { translate: 0 calc(var(--py, 0px) * -1.7); }
  .or-sticker--rosa { translate: 0 calc(var(--py, 0px) * .7); }

  /* ----- Revelado al hacer scroll (escalonado con --i) ----- */
  .js [data-reveal]:not(.is-visible) { opacity: 0; }
  .js [data-reveal].is-visible { animation: or-in var(--or-dur-m) var(--or-ease) backwards; animation-delay: calc(var(--i, 0) * 80ms); }
  .js .or-concepto[data-reveal] { --dy: 40px; --ds: .92; --dr: -2deg; }
  .js .or-def[data-reveal]:nth-child(odd) { --dx: -60px; --dy: 0px; --dr: -3deg; }
  .js .or-def[data-reveal]:nth-child(even) { --dx: 60px; --dy: 0px; --dr: 3deg; }
  .js .or-paso[data-reveal] { --dy: 36px; --ds: .94; }
  .js .or-caso[data-reveal], .js .or-post[data-reveal] { --dy: 48px; --ds: .96; }
  .js .or-index__item[data-reveal] { --dx: -24px; --dy: 0px; }
  .js .or-seccion__head[data-reveal] { --dy: 20px; }
  .js .or-que__cabeza.is-visible h2 em { animation: or-sello .7s var(--or-spring) .4s backwards; }

  /* ----- Cintas que se cruzan (marquee) ----- */
  .or-cinta__pista { animation: or-cinta 38s linear infinite; }
  .or-cinta--negra .or-cinta__pista { animation-direction: reverse; animation-duration: 46s; }
  .or-cinta__ast { animation: or-gira 7s linear infinite; }
  .or-leopardo { animation: or-deriva 14s linear infinite; }

  /* ----- Microinteracciones ----- */
  .or-btn, .or-link { transition: transform var(--or-dur-s) var(--or-ease), box-shadow var(--or-dur-s) var(--or-ease), background-color var(--or-dur-s), color var(--or-dur-s); }
  .or-btn svg, .or-link svg { transition: translate var(--or-dur-s) var(--or-ease); }
  .or-btn:hover svg, .or-link:hover svg { translate: 5px 0; }
  .or-btn:active { transition-duration: .08s; }

  .or-concepto { transition: scale .3s var(--or-spring), box-shadow .3s var(--or-ease); }
  .or-concepto:hover { scale: 1.035; }
  .or-concepto:hover .or-concepto__n { animation: or-sello .5s var(--or-spring) backwards; }

  .or-def { transition: scale .3s var(--or-spring), box-shadow .3s var(--or-ease); }
  .or-def:hover { scale: 1.02; box-shadow: 10px 10px 0 var(--or-tinta); }
  .or-def:nth-child(2):hover { box-shadow: 10px 10px 0 var(--or-papel); }

  .or-index__item { transition: background-color .2s; }
  .or-index__n, .or-index__title { transition: translate .3s var(--or-ease), scale .3s var(--or-spring); }
  .or-index__item:hover .or-index__n { scale: 1.25; rotate: -6deg; }
  .or-index__item:hover .or-index__title { translate: 10px 0; }

  .or-paso { transition: translate .3s var(--or-ease), background-color .25s, color .25s; }
  .or-paso:hover { translate: 0 -8px; background: var(--or-rosa); color: var(--or-tinta); }
  .or-paso:hover p, .or-paso:hover .or-paso__n { color: var(--or-tinta); }

  .or-caso__media, .or-post__media { transition: translate .35s var(--or-ease), box-shadow .35s var(--or-ease); }
  .or-caso__media img, .or-post__media img { transition: scale .6s var(--or-ease); }
  .or-caso:hover .or-caso__media { translate: -4px -4px; box-shadow: 9px 9px 0 var(--or-tinta); }
  .or-caso:hover .or-caso__media img, .or-post:hover .or-post__media img { scale: 1.07; }
  .or-post:hover .or-post__media { translate: -3px -3px; }

  .or-ecosistema__card, .or-formato, .or-bloque { transition: translate .3s var(--or-ease), box-shadow .3s var(--or-ease), background-color .2s; }
  .or-ecosistema__card:hover, .or-formato:hover { translate: -4px -4px; box-shadow: 9px 9px 0 var(--or-tinta); }

  .or-social__link, .or-chip, .or-filtros__btn { transition: translate .2s var(--or-spring), background-color .2s, color .2s; }
  .or-social__link:hover, .or-filtros__btn:hover { translate: 0 -3px; }
  .or-sticker { transition: scale .25s var(--or-spring), rotate .25s var(--or-spring); }
  .or-hero__frame:hover .or-sticker--lima { rotate: -14deg; scale: 1.08; }
  .or-hero__frame:hover .or-sticker--rosa { rotate: 12deg; scale: 1.08; }

  .or-faq-item .or-faq-item__icon { transition: transform .3s var(--or-spring); }
  .or-faq-item[open] > summary ~ * { animation: or-in .4s var(--or-ease) backwards; --dy: -8px; }

  /* ----- Encabezado y progreso de lectura ----- */
  .or-header { transition: box-shadow .3s; }
  .or-header.is-scrolled { box-shadow: 0 6px 0 rgba(250, 6, 127, .35); }
  .or-logo__img { transition: scale .3s var(--or-ease), rotate .5s var(--or-spring); }
  .or-header.is-scrolled .or-logo__img { scale: .86; }
  .or-logo:hover .or-logo__img { rotate: -12deg; }

  .or-burger svg { transition: rotate .3s var(--or-spring); }
  .or-burger[aria-expanded="true"] .or-burger__close { animation: or-pop .35s var(--or-spring); }

  @media (max-width: 899px) {
    .or-nav.is-open .menu-item { animation: or-in .5s var(--or-ease) backwards; --dx: -28px; --dy: 0px; }
    .or-nav.is-open .menu-item:nth-child(1) { animation-delay: .04s; }
    .or-nav.is-open .menu-item:nth-child(2) { animation-delay: .09s; }
    .or-nav.is-open .menu-item:nth-child(3) { animation-delay: .14s; }
    .or-nav.is-open .menu-item:nth-child(4) { animation-delay: .19s; }
    .or-nav.is-open .menu-item:nth-child(5) { animation-delay: .24s; }
    .or-nav.is-open .menu-item:nth-child(6) { animation-delay: .29s; }
    .or-nav.is-open .menu-item:nth-child(7) { animation-delay: .34s; }
  }

  .or-progreso { transform-origin: 0 50%; transform: scaleX(var(--prog, 0)); }
}

/* Transición suave entre páginas (navegadores con View Transitions; el resto navega normal) */
@view-transition { navigation: auto; }
@keyframes or-vt-out { to { opacity: 0; } }
@keyframes or-vt-in { from { opacity: 0; } }
::view-transition-old(root) { animation: .2s ease-in both or-vt-out; }
::view-transition-new(root) { animation: .35s var(--or-ease) both or-vt-in; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ---------- Cintas: maquetación (aplica con o sin movimiento) ---------- */
.or-banda { position: relative; z-index: 2; overflow: hidden; background: var(--or-tinta); padding: clamp(2rem, 5vw, 3.4rem) 0; }
.or-cinta { width: 116%; margin-left: -8%; overflow: hidden; white-space: nowrap; border-block: 3px solid var(--or-papel); }
.or-cinta--rosa { background: var(--or-rosa); color: var(--or-tinta); transform: rotate(-2.2deg); position: relative; z-index: 2; }
.or-cinta--negra { background: var(--or-tinta); color: var(--or-papel); transform: rotate(1.6deg); margin-top: calc(clamp(.6rem, 1.4vw, 1rem) * -1); border-color: var(--or-rosa); }
.or-cinta__pista { display: flex; width: max-content; }
.or-cinta__grupo { display: flex; align-items: center; flex-shrink: 0; gap: clamp(1rem, 2.4vw, 2rem); padding: clamp(.7rem, 1.8vw, 1.1rem) clamp(.5rem, 1.2vw, 1rem); }
.or-cinta__t { font-family: var(--or-font-display); text-transform: uppercase; line-height: 1; font-size: clamp(1.3rem, 3.4vw, 2.4rem); letter-spacing: .01em; }
.or-cinta--negra .or-cinta__t { font-size: clamp(1.1rem, 2.6vw, 1.8rem); color: var(--or-papel); }
.or-cinta__ast { flex-shrink: 0; width: clamp(1.2rem, 3vw, 2rem); height: clamp(1.2rem, 3vw, 2rem); background: currentColor; -webkit-mask: var(--or-asterisco) center / contain no-repeat; mask: var(--or-asterisco) center / contain no-repeat; }
.or-cinta--negra .or-cinta__ast { color: var(--or-lima); }

/* Botón de pausa (WCAG 2.2.2) */
.or-motion-toggle { display: block; margin: 1.2rem auto 0; background: transparent; color: var(--or-papel); border: 2px solid var(--or-papel); border-radius: 999px; padding: .45rem 1.1rem; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; position: relative; z-index: 3; }
.or-motion-toggle:hover, .or-motion-toggle:focus-visible { background: var(--or-lima); color: var(--or-tinta); border-color: var(--or-lima); outline-color: var(--or-lima); }
.or-motion-toggle[hidden] { display: none; }

/* Barra de progreso de lectura (creada por motion.js) */
.or-progreso { position: fixed; inset: 0 0 auto 0; height: 4px; background: var(--or-rosa); z-index: 70; pointer-events: none; transform: scaleX(0); }

/* ---------- Pausa global (botón) y reduced-motion ---------- */
html.or-pausa .or-loop, html.or-pausa .or-hero__frame, html.or-pausa .or-cinta__pista, html.or-pausa .or-cinta__ast, html.or-pausa .or-leopardo { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js .or-w__i { opacity: 1 !important; animation: none !important; translate: none !important; }
  .or-hero__frame, .or-cinta__pista, .or-cinta__ast, .or-leopardo { animation: none !important; transform: none; }
  .or-motion-toggle { display: none; }
  .or-progreso { display: none; }
}

/* =========================================================================
   v0.5 — Capítulos de la portada (patrón «Scroll-Triggered Storytelling»)
   Gancho → qué es → servicios apilados → método con progreso → casos → blog → cierre.
   Con la librería Motion (html.or-m): springs, scroll() e inView(). Sin ella, todo sigue legible.
   ========================================================================= */

/* ---- Servicios como tarjetas apiladas (sticky) ---- */
.or-index--pila { display: grid; gap: 1.4rem; }
.or-index--pila .or-index__item {
  --k: 0; --bg: var(--or-papel); --fg: var(--or-tinta); --nn: var(--or-rosa-fuerte); --sh: var(--or-tinta);
  position: sticky; top: calc(var(--or-header-h, 72px) + 1rem + var(--k) * .9rem);
  background: var(--bg); color: var(--fg);
  border: 3px solid var(--or-tinta); border-radius: 1.4rem; box-shadow: 6px 6px 0 var(--sh);
  padding: clamp(1.3rem, 3vw, 2.2rem); min-height: 11rem; align-content: center; transform-origin: 50% 0;
}
.or-index--pila .or-index__item:last-child { border-bottom: 3px solid var(--or-tinta); }
.or-index--pila .or-index__item:nth-child(3n+1) { --bg: var(--or-tinta); --fg: var(--or-papel); --nn: var(--or-rosa); --sh: var(--or-rosa); border-color: var(--or-tinta); }
.or-index--pila .or-index__item:nth-child(3n+2) { --bg: var(--or-rosa); --nn: var(--or-tinta); }
.or-index--pila .or-index__item:hover { background: var(--bg); }
.or-index--pila .or-index__n { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: .9; color: var(--nn); }
.or-index--pila .or-index__title { font-size: clamp(1.15rem, 1.4vw + .8rem, 1.7rem); }
.or-index--pila .or-index__desc { color: inherit; opacity: .92; }
.or-index--pila .or-index__item:nth-child(3n+1) .or-index__desc { color: #E9DCE3; opacity: 1; }

/* ---- Metodología: línea de progreso y pasos que se encienden ---- */
.or-linea { position: relative; height: 8px; margin: 0 0 2rem; background: rgba(255, 248, 251, .22); border-radius: 99px; overflow: hidden; }
.or-linea > i { position: absolute; inset: 0; background: var(--or-rosa); border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0); }
.or-paso .or-paso__n { transition: color .3s; }
.or-paso.is-on { border-color: var(--or-rosa); }
.or-paso.is-on .or-paso__n { color: var(--or-lima); }

/* ---- Casos: en móvil, riel horizontal con imán (scroll-snap) ---- */
@media (max-width: 779px) {
  .or-casos__grid--riel { display: grid; grid-auto-flow: column; grid-auto-columns: 82%; grid-template-columns: none; gap: 1.2rem; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: .4rem .4rem 1.6rem 0; margin-right: calc(var(--or-gutter, 1.25rem) * -1); padding-right: var(--or-gutter, 1.25rem); -webkit-overflow-scrolling: touch; }
  .or-casos__grid--riel > .or-caso { scroll-snap-align: start; }
  .or-casos__grid--riel::after { content: ''; flex: 0 0 1px; }
}

/* Cuando Motion controla botones, se anula el desplazamiento CSS que competiría con x/y */
.or-m .or-btn--primary:hover, .or-m .or-btn:hover { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .or-index--pila .or-index__item { position: static; transform: none !important; }
  .or-linea > i { transform: scaleX(1); }
}