/* ==========================================================================
   Portada — capa visual "liquid" (solo efectos; no cambia distribución ni contenido)
   Basado en la biblioteca de animaciones del proyecto (carpeta "animaciones").
   Todo se apaga con prefers-reduced-motion.
   ========================================================================== */

.page-home {
    --liquid: cubic-bezier(.22, 1.4, .36, 1);
    --liquid-soft: cubic-bezier(.3, 1.25, .4, 1);
    --fx-red: 233, 63, 52;
}

/* --------------------------------------------------------------------------
   1. Entradas con desenfoque y rebote suave (sustituye el deslizamiento simple)
   -------------------------------------------------------------------------- */
.js .page-home main [data-reveal] {
    filter: blur(10px);
    transform: translate3d(0, 26px, 0) scale(.97);
    transition:
        opacity .9s var(--ease),
        transform 1s var(--liquid-soft),
        filter .9s var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}
.js .page-home main [data-reveal].from-top { transform: translate3d(0, -26px, 0) scale(.97); }
.js .page-home main [data-reveal="left"] { transform: translate3d(-40px, 0, 0) scale(.97); }
.js .page-home main [data-reveal="right"] { transform: translate3d(40px, 0, 0) scale(.97); }
.js .page-home main [data-reveal="zoom"] { transform: scale(.9); }
.js .page-home main [data-reveal="fade"] { transform: scale(1.02); }
.js .page-home main [data-reveal].is-revealed { opacity: 1; transform: none; filter: none; }
html.pt-enter .page-home main [data-reveal] { filter: blur(10px); }

/* --------------------------------------------------------------------------
   2. Luces rojas que flotan detrás de las secciones (ambiente)
   -------------------------------------------------------------------------- */
.page-home .home-intro, .page-home .home-ponce, .page-home .home-why, .page-home .home-contact { position: relative; isolation: isolate; }
.page-home .home-intro::before, .page-home .home-ponce::before, .page-home .home-why::before, .page-home .home-contact::before {
    content: ''; position: absolute; z-index: -1; pointer-events: none;
    width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--fx-red), .16), rgba(var(--fx-red), 0) 68%);
    filter: blur(30px);
    animation: fx-morph 14s linear infinite, fx-drift 22s ease-in-out infinite;
}
.page-home .home-intro::before { top: -120px; right: 6%; }
.page-home .home-ponce::before { top: 10%; left: -160px; animation-duration: 17s, 26s; animation-direction: reverse, normal; }
.page-home .home-why::before { bottom: -80px; right: -120px; animation-duration: 12s, 19s; }
.page-home .home-contact::before { top: 20%; left: 30%; width: 460px; height: 460px; animation-duration: 15s, 24s; animation-direction: normal, reverse; }

@keyframes fx-morph {
    0%, 100% { border-radius: 42% 58% 63% 37% / 45% 40% 60% 55%; }
    33% { border-radius: 60% 40% 35% 65% / 55% 62% 38% 45%; }
    66% { border-radius: 38% 62% 50% 50% / 62% 35% 65% 38%; }
}
@keyframes fx-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    30% { transform: translate(-70px, 50px) scale(1.12); }
    60% { transform: translate(40px, 90px) scale(.9); }
    85% { transform: translate(60px, -30px) scale(1.06); }
}

/* --------------------------------------------------------------------------
   3. Banner: entra con un zoom muy lento y un brillo que lo cruza una vez
   -------------------------------------------------------------------------- */
.page-home .home-banner a { position: relative; display: block; overflow: hidden; }
.page-home .home-banner img { animation: fx-kenburns 9s var(--ease) both; transform-origin: 50% 40%; }
.page-home .home-banner a::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%) no-repeat;
    background-size: 60% 100%; background-position: -150% 0;
    animation: fx-sheen 1.6s var(--ease) .9s 1 both;
}
.page-home .home-banner a:hover::after { animation: fx-sheen 1.2s var(--ease) 1 both; }
@keyframes fx-kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }
@keyframes fx-sheen { from { background-position: -150% 0; } to { background-position: 250% 0; } }

/* --------------------------------------------------------------------------
   4. Fotos con movimiento interno (zoom suave + parallax al hacer scroll)
      La foto se dibuja en una capa interna; la caja y su tamaño no cambian.
   -------------------------------------------------------------------------- */
.page-home .home-alive-image, .page-home .ponce-image, .page-home .why-card-image {
    position: relative; overflow: hidden; isolation: isolate;
}
.page-home .home-alive-image::before, .page-home .ponce-image::before, .page-home .why-card-image::before,
.page-home .donate-card::after {
    content: ''; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
    background-image: inherit; background-size: cover; background-position: inherit; background-repeat: no-repeat;
    transform: translate3d(0, var(--par, 0px), 0) scale(1.12);
    transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
    will-change: transform;
}
.page-home .donate-card { isolation: isolate; }
.page-home .donate-card::after { z-index: -2; }
.page-home .donate-card::before { z-index: -1; }
.page-home .donate-card:hover::after, .page-home .home-alive-image:hover::before,
.page-home .ponce-image:hover::before, .page-home .why-card:hover .why-card-image::before {
    transform: translate3d(0, var(--par, 0px), 0) scale(1.18);
}

/* --------------------------------------------------------------------------
   5. Tarjetas oscuras: brillo que sigue al cursor y borde de luz
   -------------------------------------------------------------------------- */
.page-home .pillars, .page-home .ponce-card, .page-home .discover-bar, .page-home .why-card, .page-home .stats-card {
    position: relative; isolation: isolate;
}
.page-home .pillars::after, .page-home .ponce-card::after, .page-home .discover-bar::after,
.page-home .why-card::after, .page-home .stats-card::after {
    content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -30%), rgba(var(--fx-red), .10), transparent 55%);
    opacity: 0; transition: opacity .5s ease;
}
.page-home .pillars:hover::after, .page-home .ponce-card:hover::after, .page-home .discover-bar:hover::after,
.page-home .why-card:hover::after, .page-home .stats-card:hover::after { opacity: 1; }

/* Pilares: se elevan con resorte y el ícono flota */
.page-home .pillar { position: relative; transition: background-color .3s ease, transform .55s var(--liquid); }
.page-home .pillar:hover { transform: translateY(-6px); background: rgba(255, 255, 255, .035); }
.page-home .pillar-icon { animation: fx-float 4.5s ease-in-out infinite; transition: transform .5s var(--liquid); }
.page-home .pillar:nth-child(2) .pillar-icon { animation-delay: -1.5s; }
.page-home .pillar:nth-child(3) .pillar-icon { animation-delay: -3s; }
.page-home .pillar:hover .pillar-icon { animation-play-state: paused; transform: translateY(-4px) scale(1.15) rotate(-6deg); }
@keyframes fx-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* Tarjeta "Make a Difference": leve inclinación 3D con el cursor */
.page-home .donate-card { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .6s var(--liquid-soft), box-shadow .5s ease; }
.page-home .donate-card:hover { box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 1px rgba(var(--fx-red), .25); }

/* Mini tarjetas de Ponce: flotan alternadas y el ícono rebota al pasar */
.page-home .mini-card { transition: transform .55s var(--liquid); }
.page-home .mini-card:hover { transform: translateX(6px); }
.page-home .mini-card-icon { animation: fx-float 5s ease-in-out infinite; transition: transform .5s var(--liquid); }
.page-home .mini-card:nth-child(2) .mini-card-icon { animation-delay: -1.7s; }
.page-home .mini-card:nth-child(3) .mini-card-icon { animation-delay: -3.4s; }
.page-home .mini-card:hover .mini-card-icon { transform: scale(1.18) rotate(8deg); }

/* Barra Discover: un brillo la recorre de vez en cuando y el check late */
.page-home .discover-bar { overflow: hidden; }
.page-home .discover-bar::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
    background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .06) 50%, transparent 60%) no-repeat;
    background-size: 50% 100%; background-position: -150% 0;
    animation: fx-sheen 7s ease-in-out 2s infinite;
}
.page-home .discover-bar .check-item svg { animation: fx-pulse 2.6s ease-in-out infinite; transform-origin: center; }
@keyframes fx-pulse { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.35); } 30% { transform: scale(.95); } 45% { transform: scale(1.05); } }

/* Why: el botón de flecha emite un anillo, las cifras brillan y la tarjeta de cifras tiene "lava" */
.page-home .why-card-btn { position: relative; transition: background-color .3s ease, transform .5s var(--liquid); }
.page-home .why-card-btn::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: 0 0 0 0 rgba(var(--fx-red), .55); animation: fx-ring 2.8s ease-out infinite;
}
.page-home .why-card-btn:hover { transform: scale(1.08); }
@keyframes fx-ring { 0% { box-shadow: 0 0 0 0 rgba(var(--fx-red), .5); } 70%, 100% { box-shadow: 0 0 0 14px rgba(var(--fx-red), 0); } }
.page-home .stats-card { overflow: hidden; }
.page-home .stats-card::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
    background:
        radial-gradient(circle at 20% 30%, rgba(var(--fx-red), .10), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(var(--fx-red), .08), transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(255, 170, 150, .05), transparent 45%);
    background-size: 180% 180%, 200% 200%, 160% 160%; background-repeat: no-repeat;
    animation: fx-lava 16s ease-in-out infinite alternate;
}
@keyframes fx-lava {
    0% { background-position: 0% 0%, 100% 100%, 50% 50%; }
    50% { background-position: 60% 30%, 30% 70%, 80% 20%; }
    100% { background-position: 100% 60%, 0% 30%, 20% 90%; }
}
.page-home .stat-number { transition: text-shadow .6s ease; }
.page-home .stats.is-counting .stat-number, .page-home .stats-card:hover .stat-number { text-shadow: 0 0 24px rgba(var(--fx-red), .45); }

/* --------------------------------------------------------------------------
   6. Botones: relleno líquido que nace donde entra el cursor + gelatina al tocar
   -------------------------------------------------------------------------- */
.page-home main .btn { position: relative; overflow: hidden; isolation: isolate; }
.page-home main .btn::before {
    content: ''; position: absolute; left: var(--bx, 50%); top: var(--by, 50%); z-index: -1;
    width: 0; height: 0; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
    background: rgba(255, 255, 255, .18);
    transition: width .6s var(--liquid-soft), height .6s var(--liquid-soft);
    animation: fx-morph 3.5s linear infinite paused;
}
.page-home main .btn:hover::before { width: 260%; height: 600%; animation-play-state: running; }
.page-home .fx-jelly { animation: fx-jelly .6s var(--liquid) !important; }
@keyframes fx-jelly {
    0% { transform: scale(1, 1); } 25% { transform: scale(1.07, .93); } 45% { transform: scale(.95, 1.05); }
    62% { transform: scale(1.025, .975); } 80% { transform: scale(.995, 1.005); } 100% { transform: scale(1, 1); }
}

/* --------------------------------------------------------------------------
   7. Títulos: la palabra en rojo recibe un brillo cuando aparece
   -------------------------------------------------------------------------- */
.page-home main .is-revealed .title-xl .accent, .page-home main .is-revealed .title-xl .texto-rojo,
.page-home main .is-revealed .title-lg .accent, .page-home main .is-revealed .title-lg .texto-rojo,
.page-home main .is-revealed.title-xl .accent, .page-home main .is-revealed.title-xl .texto-rojo {
    background: linear-gradient(100deg, var(--c-red) 40%, #ff9d8c 50%, var(--c-red) 60%) no-repeat;
    background-size: 250% 100%; background-position: 100% 0;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: fx-text-sheen 1.8s var(--ease) .5s 1 both;
}
@keyframes fx-text-sheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* --------------------------------------------------------------------------
   8. Carrusel y mosaico de fotos
   -------------------------------------------------------------------------- */
.page-home .slider--campaign .slider-slide img { transition: transform .9s cubic-bezier(.2, .7, .2, 1), filter .5s ease; }
.page-home .slider--campaign .slider-slide:hover img { transform: scale(1.05); filter: brightness(1.06); }
.page-home .mosaic-item { transition: transform .6s var(--liquid), box-shadow .5s ease; }
.page-home .mosaic-item img { transition: transform 1s cubic-bezier(.2, .7, .2, 1), filter .4s ease; }
.page-home .mosaic-item:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 16px 34px rgba(0, 0, 0, .35); z-index: 3; }
.page-home .mosaic-item:hover img { transform: scale(1.08); filter: brightness(1); }
.js .page-home .is-revealed .mosaic-item { animation: fx-liquid-in .95s var(--liquid-soft) both; }
.js .page-home .is-revealed .mosaic-item:nth-child(2) { animation-delay: .08s; }
.js .page-home .is-revealed .mosaic-item:nth-child(3) { animation-delay: .16s; }
.js .page-home .is-revealed .mosaic-item:nth-child(4) { animation-delay: .24s; }
.js .page-home .is-revealed .mosaic-item:nth-child(5) { animation-delay: .32s; }
.js .page-home .is-revealed .mosaic-item:nth-child(6) { animation-delay: .4s; }
@keyframes fx-liquid-in {
    0% { opacity: 0; transform: translateY(22px) scale(.94); filter: blur(12px); }
    55% { opacity: 1; transform: translateY(-3px) scale(1.012); filter: blur(0); }
    78% { transform: translateY(1px) scale(.997); }
    100% { opacity: 1; transform: none; filter: none; }
}

/* Pestañas Contact / FAQ: el contenido entra con rebote suave */
.page-home .home-contact .tab-panel.is-active { animation: fx-liquid-in .7s var(--liquid-soft); }

/* --------------------------------------------------------------------------
   En pantallas táctiles no hay cursor: se quitan los efectos que dependen de él
   -------------------------------------------------------------------------- */
@media (hover: none) {
    .page-home .donate-card { transform: none; }
    .page-home .pillars::after, .page-home .ponce-card::after, .page-home .discover-bar::after,
    .page-home .why-card::after, .page-home .stats-card::after { display: none; }
}
@media (max-width: 767px) {
    .page-home .home-intro::before, .page-home .home-ponce::before, .page-home .home-why::before, .page-home .home-contact::before {
        width: 320px; height: 320px;
    }
}

/* --------------------------------------------------------------------------
   Movimiento reducido: todo quieto
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .page-home *, .page-home *::before, .page-home *::after { animation: none !important; transition: none !important; }
    .js .page-home main [data-reveal] { filter: none !important; transform: none !important; opacity: 1 !important; }
    .page-home .home-intro::before, .page-home .home-ponce::before, .page-home .home-why::before, .page-home .home-contact::before { display: none; }
}

/* Ajustes de prioridad: el efecto al pasar el cursor convive con la animación de entrada */
.js .page-home main .donate-card.is-revealed { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.js .page-home main .pillar.is-revealed:hover { transform: translateY(-6px); transition-delay: 0ms; }
.js .page-home main .mini-card.is-revealed:hover { transform: translateX(6px); transition-delay: 0ms; }
@media (hover: none) { .js .page-home main .donate-card.is-revealed { transform: none; } }
@media (prefers-reduced-motion: reduce) { .js .page-home main .donate-card.is-revealed { transform: none; } }