/*
 * Estilos de las animaciones de todas las páginas (js/animaciones.js).
 * Solo se aplican si el sistema no pide "reducir movimiento".
 * Curvas: suave cubic-bezier(.2,.7,.2,1) · rebote cubic-bezier(.34,1.56,.64,1)
 */
@media (prefers-reduced-motion: no-preference) {

  /* ---------- aparición al hacer scroll ---------- */
  .cc-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
    transition-delay: var(--cc-d, 0ms);
  }
  .cc-reveal.cc-in { opacity: 1; transform: none; }
  .cc-fade { opacity: 0; transition: opacity 1s ease; transition-delay: var(--cc-d, 0ms); }
  .cc-fade.cc-in { opacity: 1; }
  .cc-rise {
    opacity: 0;
    transform: translateY(90px);
    transition: opacity 1.2s ease, transform 1.4s cubic-bezier(.2,.7,.2,1);
    transition-delay: var(--cc-d, 0ms);
  }
  .cc-rise.cc-in { opacity: 1; transform: none; }
  .cc-growy {
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform .9s cubic-bezier(.34,1.56,.64,1);
    transition-delay: var(--cc-d, 0ms);
  }
  .cc-growy.cc-in { transform: none; }

  /* ---------- hover ---------- */
  .cc-lift { transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s cubic-bezier(.2,.7,.2,1); }
  .cc-lift:hover { transform: translateY(-6px); box-shadow: 0 22px 44px #1A133014; }
  .cc-click [data-pencil-name="Arrow"],
  .cc-click [data-pencil-name="Icon"] { transition: transform .25s cubic-bezier(.2,.7,.2,1); }
  .cc-click:hover [data-pencil-name="Arrow"] { transform: translateX(4px); }
  .cc-click:hover [data-icon-name="arrow-up-right"] { transform: translate(3px, -3px); }
  .cc-click:hover [data-icon-name="arrow-up"] { transform: translateY(-3px); }
  [data-pencil-name="Email CTA"] { transition: border-color .25s ease; }
  [data-pencil-name="Email CTA"].cc-click:hover { opacity: 1; text-decoration: none; border-color: #B79CFF !important; }
  .cc-spot {
    background-image: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px), rgba(183, 156, 255, .14), transparent 45%);
  }

  /* ---------- logo ---------- */
  @keyframes ccCatIn {
    from { opacity: 0; transform: translateY(8px) rotate(-14deg); }
    to { opacity: 1; transform: none; }
  }
  [data-pencil-name="Logo CatCoding"] [data-pencil-name="Cat"] {
    transform-origin: 50% 100%;
    transition: transform .5s cubic-bezier(.34,1.56,.64,1);
    animation: ccCatIn .8s cubic-bezier(.2,.7,.2,1) .15s backwards;
  }
  [data-pencil-name="Logo CatCoding"]:hover [data-pencil-name="Cat"] { transform: rotate(-9deg); }

  /* ---------- hero ---------- */
  @keyframes ccBlink { 50% { opacity: 0; } }
  .cc-blink { animation: ccBlink 1.1s steps(1) infinite; }
  @keyframes ccPop {
    from { opacity: 0; transform: scale(.6) translateY(16px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes ccBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
  .cc-chip {
    animation: ccPop .7s cubic-bezier(.34,1.56,.64,1) var(--cc-d1, 1s) backwards,
               ccBob 6s ease-in-out var(--cc-d2, 2s) infinite;
  }

  /* ---------- cinta y figuras ---------- */
  @keyframes ccSpin { to { transform: rotate(360deg); } }
  .cc-spin { animation: ccSpin 48s linear infinite; }
  .cc-spin-fast { animation: ccSpin 9s linear infinite; }
  @keyframes ccMarquee { to { transform: translateX(calc(-1 * var(--cc-period, 0px))); } }
  .cc-marquee { animation: ccMarquee var(--cc-dur, 50s) linear infinite; will-change: transform; }
  [data-pencil-name="Cinta"]:hover .cc-marquee { animation-play-state: paused; }

  /* ---------- proceso y planes ---------- */
  [data-pencil-name="Steps"] [data-pencil-name="Num"] { transition: color .45s ease; }
  [data-pencil-name="Steps"] [data-pencil-name="Step Title"] { transition: transform .45s cubic-bezier(.2,.7,.2,1); }
  .cc-step-on [data-pencil-name="Num"] { color: #B79CFF !important; }
  .cc-step-on [data-pencil-name="Step Title"] { transform: translateX(10px); }
  @keyframes ccShine {
    from { background-position: 150% 0; }
    to { background-position: -50% 0; }
  }
  .cc-shine {
    background: linear-gradient(100deg, #B79CFF 38%, #F3EFFC 50%, #B79CFF 62%) 0 0 / 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: ccShine 3.2s linear infinite;
  }

  /* ---------- detalles ---------- */
  @keyframes ccPing {
    0% { box-shadow: 0 0 0 0 var(--cc-ring); }
    100% { box-shadow: 0 0 0 9px transparent; }
  }
  .cc-ping { animation: ccPing 1.8s ease-out infinite; }
  @keyframes ccGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
  .cc-grow { transform: scaleX(0); transform-origin: left center; }
  .cc-grow.cc-in { animation: ccGrow 1.4s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: var(--cc-d, 0ms); }
  .cc-wa-float { animation: ccPop .6s cubic-bezier(.2,.7,.2,1) 1.2s backwards; }
  .cc-wa-float::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    animation: ccPing 2.4s ease-out 2s infinite;
    --cc-ring: #25D36666;
  }

  /* ---------- títulos: palabras que suben desde una máscara ---------- */
  .cc-w {
    display: inline-block;
    vertical-align: top;
    /* máscara solo arriba y abajo: no recorta letras con espaciado negativo */
    clip-path: inset(-.2em -.6em -.2em -.6em);
  }
  .cc-w > span {
    display: inline-block;
    transform: translateY(140%) rotate(4deg);
    transform-origin: 0 100%;
    transition: transform .9s cubic-bezier(.2,.7,.2,1);
    transition-delay: calc(var(--cc-d, 0ms) + var(--cc-i, 0) * 70ms);
  }
  .cc-words.cc-in .cc-w > span { transform: none; }

  /* ---------- botones magnéticos ---------- */
  .cc-magnet { transition: translate .6s cubic-bezier(.34,1.56,.64,1), opacity .15s, transform .15s, background-color .15s; }
  .cc-magnet.cc-magnet-on { transition: translate .15s ease-out, opacity .15s, transform .15s, background-color .15s; }

  /* barra de progreso de lectura */
  .cc-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: #6A45C2;
    transform-origin: left center;
    transform: scaleX(0);
    z-index: 80;
    pointer-events: none;
  }
}
