/* ==========================================================================
   Animations - Magische Effekte und Uebergaenge
   ========================================================================== */

/* ==========================================================================
   Reveal Animations (Scroll-triggered)
   ========================================================================== */

/* Smooth easing curves */
:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
}

/* Initial State */
[data-reveal] {
    opacity: 0;
    transition:
        opacity 0.8s var(--ease-out-expo),
        transform 0.8s var(--ease-out-expo);
}

[data-reveal="up"] {
    transform: translateY(30px);
}

[data-reveal="down"] {
    transform: translateY(-30px);
}

[data-reveal="left"] {
    transform: translateX(-30px);
}

[data-reveal="right"] {
    transform: translateX(30px);
}

[data-reveal="scale"] {
    transform: scale(0.95);
}

[data-reveal="fade"] {
    transform: none;
}

/* Revealed State */
[data-reveal].revealed {
    opacity: 1;
    transform: none;
}

/* Staggered Children - Smoother delays */
[data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.6s var(--ease-out-expo),
        transform 0.6s var(--ease-out-expo);
}

[data-reveal-stagger].revealed > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal-stagger].revealed > *:nth-child(2) { transition-delay: 80ms; }
[data-reveal-stagger].revealed > *:nth-child(3) { transition-delay: 160ms; }
[data-reveal-stagger].revealed > *:nth-child(4) { transition-delay: 240ms; }
[data-reveal-stagger].revealed > *:nth-child(5) { transition-delay: 320ms; }
[data-reveal-stagger].revealed > *:nth-child(6) { transition-delay: 400ms; }
[data-reveal-stagger].revealed > *:nth-child(7) { transition-delay: 480ms; }
[data-reveal-stagger].revealed > *:nth-child(8) { transition-delay: 560ms; }
[data-reveal-stagger].revealed > *:nth-child(9) { transition-delay: 640ms; }
[data-reveal-stagger].revealed > *:nth-child(10) { transition-delay: 720ms; }
[data-reveal-stagger].revealed > *:nth-child(11) { transition-delay: 800ms; }
[data-reveal-stagger].revealed > *:nth-child(12) { transition-delay: 880ms; }

[data-reveal-stagger].revealed > * {
    opacity: 1;
    transform: none;
}

/* Fast stagger variant for grids */
[data-reveal-stagger="fast"] > * {
    transition:
        opacity 0.5s var(--ease-out-expo),
        transform 0.5s var(--ease-out-expo);
}

[data-reveal-stagger="fast"].revealed > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal-stagger="fast"].revealed > *:nth-child(2) { transition-delay: 50ms; }
[data-reveal-stagger="fast"].revealed > *:nth-child(3) { transition-delay: 100ms; }
[data-reveal-stagger="fast"].revealed > *:nth-child(4) { transition-delay: 150ms; }
[data-reveal-stagger="fast"].revealed > *:nth-child(5) { transition-delay: 200ms; }
[data-reveal-stagger="fast"].revealed > *:nth-child(6) { transition-delay: 250ms; }

/* ==========================================================================
   Hero Animations
   ========================================================================== */

.hero-logo {
    animation: heroLogoAppear 1.4s var(--ease-out-expo) forwards;
}

@keyframes heroLogoAppear {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(24px);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

.hero-title {
    animation: heroTextAppear 1s var(--ease-out-expo) 0.2s forwards;
    opacity: 0;
}

.hero-subtitle {
    animation: heroTextAppear 1s var(--ease-out-expo) 0.4s forwards;
    opacity: 0;
}

.hero .btn {
    animation: heroButtonAppear 0.8s var(--ease-out-expo) 0.6s forwards;
    opacity: 0;
}

@keyframes heroTextAppear {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroButtonAppear {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Card Hover Effects
   ========================================================================== */

.card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
    border-radius: inherit;
}

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

/* 3D Tilt on Hover (via JS class) */
.card.tilting {
    transition: none;
}

/* ==========================================================================
   Button Magic Glow Effect
   ========================================================================== */

.btn-magic {
    box-shadow:
        0 4px 20px rgba(201, 169, 98, 0.2),
        0 0 40px rgba(201, 169, 98, 0.08);
    transition:
        box-shadow 0.5s var(--ease-out-expo),
        transform 0.4s var(--ease-out-expo);
}

.btn-magic:hover {
    box-shadow:
        0 8px 30px rgba(201, 169, 98, 0.35),
        0 0 60px rgba(201, 169, 98, 0.2),
        0 0 100px rgba(201, 169, 98, 0.1);
}

/* ==========================================================================
   Loading Animation (Magic Wand)
   ========================================================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: loadingPulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) { animation-delay: 0ms; }
.loading-dot:nth-child(2) { animation-delay: 200ms; }
.loading-dot:nth-child(3) { animation-delay: 400ms; }

@keyframes loadingPulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Magic Wand Loader */
.loading-wand {
    width: 60px;
    height: 60px;
    position: relative;
}

.loading-wand::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 30px;
    background: linear-gradient(to bottom, var(--color-accent), transparent);
    top: 50%;
    left: 50%;
    transform-origin: bottom center;
    animation: wandSpin 1.5s ease-in-out infinite;
}

@keyframes wandSpin {
    0% { transform: translate(-50%, -100%) rotate(0deg); }
    100% { transform: translate(-50%, -100%) rotate(360deg); }
}

.loading-wand::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    animation: wandStar 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px var(--color-accent);
}

@keyframes wandStar {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateX(-50%) scale(0.5); }
}

/* ==========================================================================
   Floating Elements
   ========================================================================== */

.floating {
    animation: floating 7s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.floating-slow {
    animation: floating 10s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.floating-fast {
    animation: floating 5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-8px) rotate(1.5deg);
    }
    66% {
        transform: translateY(4px) rotate(-1deg);
    }
}

/* ==========================================================================
   Sparkle Trail (Cursor Effect)
   ========================================================================== */

.sparkle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.sparkle-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkleFloat 1s ease-out forwards;
}

@keyframes sparkleFloat {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateY(-30px);
    }
}

/* ==========================================================================
   Page Transitions
   ========================================================================== */

.page-transition {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    z-index: 9998;
    pointer-events: none;
}

.page-transition-enter {
    animation: pageEnter 0.4s ease-out forwards;
}

.page-transition-leave {
    animation: pageLeave 0.4s ease-in forwards;
}

@keyframes pageEnter {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes pageLeave {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ==========================================================================
   Accordion / Collapse
   ========================================================================== */

.collapse-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.collapse-content.open {
    max-height: 500px;
}

.collapse-trigger svg {
    transition: transform var(--transition-base);
}

.collapse-trigger.open svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   Pulsing Glow (for CTAs)
   ========================================================================== */

.pulse-glow {
    animation: pulseGlow 3s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow:
            0 0 8px rgba(201, 169, 98, 0.15),
            0 0 20px rgba(201, 169, 98, 0.08);
    }
    50% {
        box-shadow:
            0 0 15px rgba(201, 169, 98, 0.3),
            0 0 40px rgba(201, 169, 98, 0.15),
            0 0 60px rgba(201, 169, 98, 0.08);
    }
}

/* ==========================================================================
   Text Reveal
   ========================================================================== */

.text-reveal {
    overflow: hidden;
}

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

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

/* ==========================================================================
   Mikro-Interaktionen: Icon Hover Effects
   ========================================================================== */

/* Feature Icons (About Section) - Drehen und Gluehen */
.feature-icon {
    transition: transform 0.4s ease, filter 0.4s ease;
    cursor: default;
}

.feature-card:hover .feature-icon {
    transform: rotateY(180deg) scale(1.1);
    filter: drop-shadow(0 0 12px var(--color-accent));
}

.feature-icon .icon {
    transition: transform 0.4s ease;
}

.feature-card:hover .feature-icon .icon {
    transform: rotateY(180deg);
}

/* Card Icons (Angebote) - Schweben und Wackeln */
.card-icon {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover .card-icon {
    transform: translateY(-4px) rotate(8deg);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

/* Card Symbol (Hero) - Interaktiv bei Hover */
.card-symbol {
    transition: transform 0.5s ease, filter 0.5s ease;
    cursor: pointer;
    opacity: 0.7;
}

.card-symbol:hover {
    transform: scale(1.3) rotate(15deg) !important;
    filter: drop-shadow(0 0 20px var(--color-accent));
    opacity: 1;
    animation-play-state: paused;
}

/* ==========================================================================
   CTA Button Funken-Effekt
   ========================================================================== */

.btn-sparkle {
    position: relative;
    overflow: visible;
}

.btn-sparkle .sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkleExplode 0.8s ease-out forwards;
}

@keyframes sparkleExplode {
    0% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
    100% {
        opacity: 0;
        transform: scale(0) translate(var(--tx, 0), var(--ty, 0));
    }
}

/* Button Ripple bei Klick */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    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 ease, height 0.6s ease;
}

.btn-ripple.rippling::before {
    width: 300%;
    height: 300%;
}

/* ==========================================================================
   Hero Parallax
   ========================================================================== */

.hero-bg {
    transition: transform 0.1s ease-out;
}

.hero-bg.parallax {
    will-change: transform;
}

/* Tiefeneffekt fuer Card Symbols */
.card-symbols {
    perspective: 1000px;
}

.card-symbol {
    transform-style: preserve-3d;
}

/* ==========================================================================
   Angebot Card 3D Hover
   ========================================================================== */

.card-angebot {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.card-angebot:hover {
    transform: translateY(-8px) rotateX(2deg);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(212, 175, 55, 0.1);
}

.card-angebot .card-image img {
    transition: transform 0.6s ease;
}

.card-angebot:hover .card-image img {
    transform: scale(1.05);
}

/* ==========================================================================
   Magischer Cursor Trail (optional)
   ========================================================================== */

.magic-trail {
    position: fixed;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.magic-trail.active {
    opacity: 0.8;
    animation: trailPulse 0.5s ease-out;
}

@keyframes trailPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ==========================================================================
   Mobile Optimierungen - Performance
   ========================================================================== */

@media (max-width: 768px) {
    /* Parallax deaktivieren */
    .hero-bg.parallax {
        transform: none !important;
        will-change: auto;
    }

    /* Floating-Animationen vereinfachen */
    .floating,
    .floating-slow,
    .floating-fast {
        animation: none;
    }

    /* Card Symbols statisch */
    .card-symbol {
        opacity: 0.5;
        transform: none !important;
    }

    .card-symbol:hover {
        transform: none !important;
        filter: none;
    }

    /* 3D-Effekte auf Cards deaktivieren */
    .card-angebot:hover {
        transform: translateY(-4px);
    }

    .card-angebot .card-image img {
        transition: none;
    }

    .card-angebot:hover .card-image img {
        transform: none;
    }

    /* Feature-Icon Rotation deaktivieren (bleibt Glow) */
    .feature-card:hover .feature-icon {
        transform: scale(1.05);
    }

    .feature-card:hover .feature-icon .icon {
        transform: none;
    }

    /* Weniger Funken auf Mobile */
    .btn-sparkle .sparkle {
        display: none;
    }
}

/* ==========================================================================
   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-reveal] {
        opacity: 1;
        transform: none;
    }

    .floating,
    .floating-slow,
    .floating-fast {
        animation: none;
    }

    /* Alle aufwaendigen Effekte aus */
    .hero-bg.parallax {
        transform: none !important;
    }

    .card-symbol {
        transform: none !important;
    }

    .btn-sparkle .sparkle {
        display: none;
    }
}
