/* ============================================
   Health100 — Animations & Scroll Effects
   ============================================ */

/* --- Scroll-triggered Animations --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.animate-on-scroll:nth-child(3) { transition-delay: 0.15s; }
.animate-on-scroll:nth-child(4) { transition-delay: 0.2s; }
.animate-on-scroll:nth-child(5) { transition-delay: 0.25s; }
.animate-on-scroll:nth-child(6) { transition-delay: 0.3s; }
.animate-on-scroll:nth-child(7) { transition-delay: 0.35s; }
.animate-on-scroll:nth-child(8) { transition-delay: 0.4s; }

/* --- Hero Entrance Animations --- */
.animate-fade-up {
    opacity: 0;
    transform: translateY(40px);
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-left {
    opacity: 0;
    transform: translateX(60px);
    animation: fadeLeft 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Heartbeat SVG Animation --- */
.heartbeat-line polyline {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawLine 2s ease forwards, pulseLine 3s ease-in-out 2s infinite;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes pulseLine {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* --- Card Shimmer Effect --- */
.hero-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    transition: left 0.6s ease;
}

.hero-card:hover::after {
    left: 100%;
}

/* --- Category Card Glow --- */
.category-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: var(--primary-gradient);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.category-card:hover::after {
    opacity: 0.1;
}

/* --- Tool Card Glow --- */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(14, 165, 115, 0.1),
        transparent 40%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card {
    position: relative;
}

/* --- Button Ripple Effect --- */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.btn-primary:active::after {
    transform: scale(2);
    opacity: 1;
    transition: 0s;
}

/* --- Smooth Image Reveal --- */
.story-image,
.wellness-image {
    position: relative;
    overflow: hidden;
}

.story-image::after,
.wellness-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    transform-origin: right;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.visible .story-image::after,
.visible .wellness-image::after {
    transform: scaleX(0);
}

/* --- Newsletter Pulse --- */
.newsletter-icon {
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* --- Trending Item Slide --- */
.trending-item {
    position: relative;
}

.trending-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.trending-item:hover::after {
    width: 100%;
}

/* --- A-Z Letter Pop --- */
.az-letter {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.az-letter:hover {
    transform: translateY(-4px) scale(1.1);
}

/* --- Smooth Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Loading Skeleton (for future use) --- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* --- Parallax-like subtle movement --- */
@media (prefers-reduced-motion: no-preference) {
    .hero-card-stack {
        perspective: 1000px;
    }

    .hero-card {
        will-change: transform;
    }

    .floating-shapes .shape {
        will-change: transform;
    }
}

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

    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }

    .animate-fade-up,
    .animate-fade-left {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .ticker-content {
        animation: none;
    }
}

/* --- Focus Styles for Accessibility --- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Smooth page transitions --- */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}
