/* === SKIP BUTTON === */
.intro-animation__skip-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #2f6bb3;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(47, 107, 179, 0.1);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.intro-animation__skip-btn:hover {
    background: #2f6bb3;
    color: #fff;
    border-color: #2f6bb3;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(47, 107, 179, 0.25);
}

/**
 * Guidy Intro Animation
 * Modern, configurable intro animation with Guidy mascot
 */

:root {
    /* Animation Configuration */
    --guidy-duration: 12s;
    --guidy-primary-color: #2f6bb3;
    --guidy-secondary-color: #0099FF;
    --guidy-gradient-mid: #2662ca;

    /* Timing Variables */
    --guidy-headline-delay: 0.3s;
    --guidy-logo-delay: 0s;
    --guidy-gif-delay: 0.1s;
    --guidy-bubble-delay: 2.2s;

    /* Sizes */
    --guidy-logo-height: clamp(50px, 12vw, 90px);

    /* Responsive Breakpoint */
    --guidy-breakpoint: 768px;
}

/* === ANIMATION STAGE === */
.intro-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: url('../images/animations/guidy/background.jpg') no-repeat center center;
    background-size: cover;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
}

.intro-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Removed overlay to fix "milky" look */
    background: transparent;
    pointer-events: none;
}

.intro-animation.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* === CONTENT BOX === */
.intro-animation__content {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90vw;
    max-width: 1000px;
    transition: opacity 0.3s ease;
    background: transparent;
    padding: 0 2vw;
    z-index: 2;
}

/* === GUIDY GIF (Desktop) - HIDDEN === */
.intro-animation__guidy {
    display: none;
}

/* === HEADLINE === */
.intro-animation__headline {
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--guidy-primary-color) 0%, var(--guidy-secondary-color) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    white-space: nowrap;
    text-align: center;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation: headlineSlideUp 0.8s cubic-bezier(0.215, 0.610, 0.355, 1.000) forwards;
    animation-delay: var(--guidy-headline-delay);
    line-height: 1.1;
    margin: 0;
    filter: drop-shadow(0 4px 12px rgba(47, 107, 179, 0.15));
}

@keyframes headlineSlideUp {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === LOGO === */
.intro-animation__logo {
    opacity: 0;
    margin: 15px 0;
    transition: opacity 0.3s ease;
    position: relative;
    display: inline-block;
}

.intro-animation__logo.show {
    opacity: 1;
    animation: logoPop 0.5s ease forwards;
    animation-delay: var(--guidy-logo-delay);
}

@keyframes logoPop {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.intro-animation__logo-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    border-radius: 4px;
}

.intro-animation__logo img {
    height: var(--guidy-logo-height);
    display: block;
    -webkit-user-drag: none;
    user-select: none;
}

/* === LOGO SHINE EFFECT === */
.intro-animation__logo-shine {
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    opacity: 0;
}

.intro-animation__logo.show .intro-animation__logo-shine {
    opacity: 1;
    animation: logoShine 1.2s ease forwards;
    animation-delay: calc(var(--guidy-logo-delay) + 0.6s);
}

@keyframes logoShine {
    from {
        left: -75%;
    }

    to {
        left: 125%;
    }
}

/* === CHAT LAYOUT === */
.intro-animation__mobile-chat {
    position: absolute;
    top: 55%;
    left: 50%;
    /* Move Guidy to the left of center so the bubble extends into the center */
    margin-left: -300px; 
    width: auto;
    max-width: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding-left: 0;
    gap: 0;
}

.intro-animation__mobile-chat .intro-animation__guidy {
    display: block;
    position: static;
    opacity: 0;
    width: 180px;
    max-width: 180px;
    height: auto;
    transform: translateY(100px);
    flex-shrink: 0;
    filter: drop-shadow(0 15px 30px rgba(47, 107, 179, 0.15));
    z-index: 2;
}

.intro-animation__mobile-chat .intro-animation__guidy.show {
    /* Removed float animation to stop jumping */
    animation: guidySlideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: var(--guidy-gif-delay);
}

@keyframes guidySlideUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Removed guidyFloat keyframes */

.intro-animation__mobile-chat .intro-animation__bubble {
    position: static;
    transform: scale(0.9);
    transform-origin: left center;
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 580px;
    width: fit-content;
    padding: 24px 32px;
    text-align: left;
    opacity: 0;
    border-radius: 24px;
    border-bottom-left-radius: 0;
    background: rgba(255, 255, 255, 0.95); /* More opaque */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 
        0 10px 30px rgba(47, 107, 179, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-left: 5px; /* Increased gap */
    margin-top: -20px; /* Adjust vertical position slightly up */
    z-index: 1;
}

.intro-animation__mobile-chat .intro-animation__bubble.show {
    opacity: 1;
    transform: scale(1);
}

/* Desktop bubble hidden */
.intro-animation__bubble--desktop {
    display: none;
}

.intro-animation__bubble--mobile {
    display: block;
}

/* === TEXT === */
.intro-animation__text {
    background-image: linear-gradient(45deg,
            var(--guidy-gradient-mid),
            var(--guidy-gradient-mid) 25%,
            var(--guidy-secondary-color) 50%,
            var(--guidy-gradient-mid) 75%,
            var(--guidy-secondary-color) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: 300;
    max-width: 100%;
    word-wrap: break-word;
    white-space: pre-line;
}

.intro-animation__cursor {
    display: inline-block;
    width: 2px;
    background: currentColor;
    animation: cursorBlink 0.6s steps(1) infinite;
    vertical-align: bottom;
    margin-left: 2px;
}

@keyframes cursorBlink {
    50% {
        background: transparent;
    }
}

/* === FLASH BAR TRANSITION === */
.intro-animation__flash {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    background: #ffffff;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-50%);
    pointer-events: none;
}

.intro-animation__flash.animate {
    animation: flashTransition 0.3s ease forwards;
}

@keyframes flashTransition {
    0% {
        opacity: 0;
        height: 0;
    }

    20% {
        opacity: 1;
        height: 100%;
    }

    100% {
        opacity: 0;
        height: 0;
    }
}

/* === RESPONSIVE: MOBILE (≤767px) === */
@media (max-width: 767px) {
    .intro-animation__headline {
        white-space: normal;
        font-size: clamp(1.8rem, 6vw, 3rem);
    }

    .intro-animation__content {
        top: 40%;
    }

    .intro-animation__mobile-chat {
        top: 55%;
        left: 50%;
        transform: none;
        margin-left: -170px; /* Further left */
        width: auto;
        justify-content: flex-start;
        gap: 0;
    }

    .intro-animation__mobile-chat .intro-animation__guidy {
        width: 100px;
        max-width: 25vw;
    }

    .intro-animation__mobile-chat .intro-animation__bubble {
        padding: 16px 20px;
        min-width: 140px;
        max-width: 60vw;
        margin-bottom: 20px;
        margin-left: 5px; /* Increased gap */
        margin-top: -10px;
    }

    .intro-animation__text {
        font-size: clamp(0.85rem, 3.5vw, 1.1rem);
    }
}

/* === RESPONSIVE: TABLET (768px-1200px) === */
@media (min-width: 768px) and (max-width: 1200px) {
    .intro-animation__content {
        top: 42%;
    }

    .intro-animation__headline {
        font-size: clamp(2rem, 5vw, 4rem);
    }

    .intro-animation__mobile-chat {
        top: 52%;
        width: auto;
        max-width: 900px;
        padding-left: 0;
        gap: 0;
        margin-left: -200px; /* Adjusted offset for tablet */
    }

    .intro-animation__mobile-chat .intro-animation__guidy {
        width: 150px;
        max-width: 150px;
    }

    .intro-animation__mobile-chat .intro-animation__bubble {
        padding: 20px 28px;
        min-width: 180px;
        max-width: 500px;
        margin-left: 5px; /* Increased gap */
        margin-top: -15px;
    }

    .intro-animation__text {
        font-size: clamp(1rem, 3.5vw, 1.6rem);
    }
}