/* ==========================================================================
   TLC Website 3.0 - Advanced Animation System
   Parallax, Morphing, Particles, and Interactive Effects
   ========================================================================== */

/* Particle Canvas Container */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Floating Elements */
.float-animation {
    animation: float 6s ease-in-out infinite;
}

.float-animation-delay-1 { animation-delay: -1s; }
.float-animation-delay-2 { animation-delay: -2s; }
.float-animation-delay-3 { animation-delay: -3s; }
.float-animation-delay-4 { animation-delay: -4s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(2deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-10px) rotate(-2deg); }
}

/* Pulse Ring Animation */
.pulse-ring {
    position: relative;
}

.pulse-ring::before,
.pulse-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    transform: translate(-50%, -50%);
    animation: pulseRing 2s ease-out infinite;
}

.pulse-ring::after {
    animation-delay: 1s;
}

@keyframes pulseRing {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* Morphing Shapes */
.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
    75% { border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%; }
}

/* Gradient Text Animation */
.gradient-text-animated {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color), var(--primary-color));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Parallax Backgrounds */
.parallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    transform: translateZ(0);
    will-change: transform;
}

.parallax-slow {
    --parallax-speed: 0.3;
}

.parallax-medium {
    --parallax-speed: 0.5;
}

.parallax-fast {
    --parallax-speed: 0.8;
}

/* Glowing Border Animation */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--secondary-color), var(--primary-color));
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: glowRotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-border:hover::before {
    opacity: 1;
}

@keyframes glowRotate {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Wave Animation */
.wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-container svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 150px;
}

.wave-path {
    animation: waveMove 10s linear infinite;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    50% { transform: translateX(-25%); }
    100% { transform: translateX(0); }
}

/* 3D Card Flip */
.card-3d {
    perspective: 1000px;
}

.card-3d-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(180deg);
}

.card-3d-front,
.card-3d-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
}

.card-3d-back {
    transform: rotateY(180deg);
    background: var(--primary-gradient);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Magnetic Button Effect */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Stagger Animation Classes */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-item.animate {
    animation: staggerFadeIn 0.6s ease forwards;
}

.stagger-delay-1 { animation-delay: 0.1s; }
.stagger-delay-2 { animation-delay: 0.2s; }
.stagger-delay-3 { animation-delay: 0.3s; }
.stagger-delay-4 { animation-delay: 0.4s; }
.stagger-delay-5 { animation-delay: 0.5s; }

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

/* Reveal Animations */
.reveal {
    opacity: 0;
    transition: all 0.8s ease;
}

.reveal-left {
    transform: translateX(-50px);
}

.reveal-right {
    transform: translateX(50px);
}

.reveal-up {
    transform: translateY(50px);
}

.reveal-scale {
    transform: scale(0.8);
}

.reveal.active {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Typing Effect */
.typing-text {
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-color); }
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--primary-gradient);
    z-index: 9999;
    transition: width 0.1s linear;
}

.scroll-progress::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer 2s infinite;
}

/* Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Loading Spinner Variants */
.spinner-dots {
    display: inline-flex;
    gap: 4px;
}

.spinner-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: dotPulse 1.4s ease-in-out infinite both;
}

.spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Tilt Effect Container */
.tilt-container {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.tilt-element {
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-xl) + 2px);
    background: conic-gradient(from 0deg, var(--primary-color), var(--accent-color), var(--secondary-color), var(--primary-color));
    animation: rotateBorder 4s linear infinite;
    z-index: -1;
}

.gradient-border::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    z-index: -1;
}

@keyframes rotateBorder {
    to { transform: rotate(360deg); }
}

/* Neon Glow Effect */
.neon-glow {
    box-shadow: 
        0 0 5px var(--primary-color),
        0 0 10px var(--primary-color),
        0 0 20px var(--primary-color),
        0 0 40px var(--primary-color);
    animation: neonPulse 2s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    from { 
        box-shadow: 
            0 0 5px var(--primary-color),
            0 0 10px var(--primary-color),
            0 0 20px var(--primary-color),
            0 0 40px var(--primary-color);
    }
    to { 
        box-shadow: 
            0 0 10px var(--primary-color),
            0 0 20px var(--primary-color),
            0 0 40px var(--primary-color),
            0 0 80px var(--primary-color);
    }
}

/* Smooth Section Transitions */
.section-transition {
    position: relative;
}

.section-transition::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 100px;
    background: inherit;
    transform: skewY(-3deg);
    z-index: -1;
}

/* SVG Path Animations */
.path-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawPath 3s ease forwards;
}

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

/* Liquid Morphing Background */
.liquid-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.liquid-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(46, 125, 50, 0.1) 0%, transparent 50%);
    animation: liquidMove 20s ease-in-out infinite;
}

@keyframes liquidMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(5%, 5%) rotate(90deg); }
    50% { transform: translate(0, 10%) rotate(180deg); }
    75% { transform: translate(-5%, 5%) rotate(270deg); }
}

/* Interactive Cursor Trail */
.cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Hover Spotlight Effect */
.spotlight {
    position: relative;
    overflow: hidden;
}

.spotlight::before {
    content: '';
    position: absolute;
    top: var(--mouse-y, 50%);
    left: var(--mouse-x, 50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.spotlight:hover::before {
    opacity: 1;
}

/* Bouncing Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-indicator svg {
    width: 30px;
    height: 30px;
    color: white;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-15px); }
    60% { transform: translateX(-50%) translateY(-7px); }
}

/* Card Stack Effect */
.card-stack {
    position: relative;
}

.card-stack .card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-stack .card:nth-child(1) { transform: translateY(0) scale(1); z-index: 3; }
.card-stack .card:nth-child(2) { transform: translateY(10px) scale(0.95); z-index: 2; opacity: 0.7; }
.card-stack .card:nth-child(3) { transform: translateY(20px) scale(0.9); z-index: 1; opacity: 0.5; }

/* Aurora Background Effect */
.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.aurora-bg::before,
.aurora-bg::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(ellipse at center, rgba(46, 125, 50, 0.3) 0%, transparent 50%);
    animation: aurora 15s ease-in-out infinite;
}

.aurora-bg::after {
    background: radial-gradient(ellipse at center, rgba(255, 111, 0, 0.2) 0%, transparent 50%);
    animation-delay: -7s;
}

@keyframes aurora {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10%, 5%) rotate(120deg); }
    66% { transform: translate(-5%, 10%) rotate(240deg); }
}

/* Text Reveal Animation */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    animation: textReveal 0.6s ease forwards;
}

.text-reveal span:nth-child(1) { animation-delay: 0s; }
.text-reveal span:nth-child(2) { animation-delay: 0.1s; }
.text-reveal span:nth-child(3) { animation-delay: 0.2s; }

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

/* Shake Animation for Errors */
.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Success Check Animation */
.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #fff;
    stroke-miterlimit: 10;
    margin: 10% auto;
    box-shadow: inset 0px 0px 0px var(--success-color);
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--success-color);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
    100% { box-shadow: inset 0px 0px 0px 30px var(--success-color); }
}

/* Timeline Animation */
.timeline-item {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1s ease;
}

.timeline-line.visible {
    stroke-dashoffset: 0;
}

/* Progress Ring Animation */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s ease-in-out;
    transform-origin: 50% 50%;
}

/* Hover Card Expansion */
.expand-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.expand-card:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Fade Mask */
.fade-mask {
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .float-animation,
    .morph-shape,
    .gradient-text-animated,
    .pulse-ring,
    .wave-path,
    .path-draw,
    .aurora-bg::before,
    .aurora-bg::after {
        animation: none;
    }
    
    .reveal,
    .stagger-item,
    .timeline-item {
        opacity: 1;
        transform: none;
    }
    
    .parallax-bg {
        background-attachment: scroll;
    }
}
