/**
 * Juventud Cuba - Animations
 * Intersection Observer based animations
 */

/* ============================================
   ANIMATION BASE
   ============================================ */
[data-animate] {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate].jc-animated {
    opacity: 1;
    transform: none !important;
}

/* Fade Up */
[data-animate="fade-up"] {
    transform: translateY(60px);
}

/* Fade Down */
[data-animate="fade-down"] {
    transform: translateY(-60px);
}

/* Fade Left */
[data-animate="fade-left"] {
    transform: translateX(-60px);
}

/* Fade Right */
[data-animate="fade-right"] {
    transform: translateX(60px);
}

/* Scale Up */
[data-animate="scale-up"] {
    transform: scale(0.9);
}

/* Rotate In */
[data-animate="rotate-in"] {
    transform: rotate(-5deg) scale(0.95);
}

/* Stagger children */
[data-animate-stagger] > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate-stagger].jc-animated > * {
    opacity: 1;
    transform: none;
}

[data-animate-stagger].jc-animated > *:nth-child(1) { transition-delay: 0.05s; }
[data-animate-stagger].jc-animated > *:nth-child(2) { transition-delay: 0.1s; }
[data-animate-stagger].jc-animated > *:nth-child(3) { transition-delay: 0.15s; }
[data-animate-stagger].jc-animated > *:nth-child(4) { transition-delay: 0.2s; }
[data-animate-stagger].jc-animated > *:nth-child(5) { transition-delay: 0.25s; }
[data-animate-stagger].jc-animated > *:nth-child(6) { transition-delay: 0.3s; }
[data-animate-stagger].jc-animated > *:nth-child(7) { transition-delay: 0.35s; }
[data-animate-stagger].jc-animated > *:nth-child(8) { transition-delay: 0.4s; }
[data-animate-stagger].jc-animated > *:nth-child(9) { transition-delay: 0.45s; }
[data-animate-stagger].jc-animated > *:nth-child(10) { transition-delay: 0.5s; }

/* ============================================
   MARQUEE
   ============================================ */
.jc-marquee {
    overflow: hidden;
    white-space: nowrap;
    background-color: white;
    color: black;
    padding: 1rem 0;
}

.jc-marquee__track {
    display: inline-flex;
    gap: 5rem;
    animation: jc-marquee 20s linear infinite;
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    font-style: italic;
    align-items: center;
}

.jc-marquee__track span {
    flex-shrink: 0;
}

.jc-marquee__star--red {
    color: var(--jc-primary);
}

.jc-marquee__star--blue {
    color: var(--jc-secondary);
}

@keyframes jc-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   PARALLAX TEXT (Background kinetic)
   ============================================ */
.jc-parallax-text {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0.1;
    pointer-events: none;
}

.jc-parallax-text__inner {
    font-size: 30vw;
    font-weight: 900;
    line-height: 1;
    color: white;
    user-select: none;
    will-change: transform;
}

/* ============================================
   HERO IMAGE EFFECTS
   ============================================ */
.jc-hero-image {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.jc-hero-image__glow {
    position: absolute;
    inset: 0;
    background-color: rgba(37, 99, 235, 0.2);
    filter: blur(60px);
    border-radius: 50%;
    animation: jc-pulse 4s ease-in-out infinite;
}

.jc-hero-image__img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4rem;
    filter: grayscale(100%);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: rotate(3deg);
    position: relative;
    z-index: 1;
}

.jc-hero-image:hover .jc-hero-image__img {
    filter: grayscale(0);
    transform: rotate(0deg);
}

.jc-hero-image__star {
    position: absolute;
    top: -2.5rem;
    right: -2.5rem;
    background-color: var(--jc-primary);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 2;
    cursor: grab;
    user-select: none;
}

.jc-hero-image__star:active {
    cursor: grabbing;
}

@keyframes jc-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* ============================================
   SKEWED SECTION
   ============================================ */
.jc-skewed-section {
    position: relative;
    padding: 10rem 0;
}

.jc-skewed-section__bg {
    position: absolute;
    inset: 0;
    background-color: var(--jc-secondary);
    transform: skewY(-6deg);
    translate: 0 5rem;
}

.jc-skewed-section__content {
    position: relative;
    z-index: 2;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.jc-lightbox {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.jc-lightbox--open {
    display: flex;
}

.jc-lightbox__close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 201;
}

.jc-lightbox__img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--jc-radius-md);
}

.jc-lightbox__caption {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* ============================================
   HOVER LINK EFFECT (Underline grow)
   ============================================ */
.jc-link-effect {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 900;
    font-size: 1.25rem;
    border-bottom: 4px solid var(--jc-primary);
    padding-bottom: 0.25rem;
    transition: gap var(--jc-transition);
}

.jc-link-effect:hover {
    gap: 1.5rem;
    color: var(--jc-text);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-animate] {
        opacity: 1;
        transform: none;
    }

    .jc-marquee__track {
        animation: none;
    }
}
