/**
 * Clippy floating assistant styles.
 *
 * Custom properties:
 *   --cff-clippy-radius    bubble/button corner radius
 *   --cff-clippy-duration  default transition duration
 *   --cff-clippy-leave-ms  exit transition duration
 *   --cff-clippy-ease      entry/exit easing curve
 *   --cff-clippy-focus     keyboard focus outline color
 */

:root {
    --cff-clippy-radius: 12px;
    --cff-clippy-duration: 700ms;
    --cff-clippy-leave-ms: 500ms;
    --cff-clippy-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --cff-clippy-focus: #2271b1;
}

#cff-clippy-root {
    position: fixed;
    bottom: 20px;
    right: 50px;
    z-index: 1000001;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 320px;
    opacity: 0;
}

#cff-clippy-root[hidden] {
    display: none !important;
}

#cff-clippy-root.is-visible {
    opacity: 1;
    pointer-events: auto;
}

#cff-clippy-root.is-leaving {
    opacity: 0;
}

#cff-clippy-mascot {
    width: 96px;
    height: 96px;
    flex: 0 0 auto;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    opacity: 0;
    transform: translateY(24px) scale(0.85);
    transition:
        opacity var(--cff-clippy-duration) var(--cff-clippy-ease),
        transform var(--cff-clippy-duration) var(--cff-clippy-ease);
    will-change: transform, opacity;
}

#cff-clippy-root.is-visible #cff-clippy-mascot {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: cff-clippy-bounce 2.4s ease-in-out 700ms infinite;
}

#cff-clippy-root.is-leaving #cff-clippy-mascot,
#cff-clippy-root.is-leaving #cff-clippy-bubble {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
    transition-duration: var(--cff-clippy-leave-ms);
    transition-delay: 0ms;
    animation: none;
}

#cff-clippy-bubble {
    pointer-events: auto;
    background: #ffffff;
    color: #1d2327;
    border: 1px solid #c3c4c7;
    border-radius: var(--cff-clippy-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 16px 36px 14px 16px;
    position: relative;
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 280px;
    opacity: 0;
    transform: translateY(24px) scale(0.85);
    transition:
        opacity var(--cff-clippy-duration) var(--cff-clippy-ease),
        transform var(--cff-clippy-duration) var(--cff-clippy-ease);
    will-change: transform, opacity;
}

#cff-clippy-root.is-visible #cff-clippy-bubble {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition-delay: 120ms;
}

/* Subtle vertical bobbing while Clippy is visible. */
@keyframes cff-clippy-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-5px) scale(1); }
}

#cff-clippy-bubble .cff-clippy-message {
    margin: 0 0 14px;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

#cff-clippy-bubble .cff-clippy-cta.button,
#cff-clippy-bubble .cff-clippy-cta.button-primary {
    width: 100%;
    text-align: center;
    border-radius: var(--cff-clippy-radius);
}

#cff-clippy-bubble .cff-clippy-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #50575e;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#cff-clippy-bubble .cff-clippy-close:hover {
    color: #1d2327;
}

#cff-clippy-bubble .cff-clippy-close:focus-visible,
#cff-clippy-bubble .cff-clippy-cta:focus-visible {
    outline: 2px solid var(--cff-clippy-focus);
}

#cff-clippy-bubble .cff-clippy-close:focus-visible {
    outline-offset: 1px;
}

#cff-clippy-bubble .cff-clippy-cta:focus-visible {
    outline-offset: 2px;
}

/* REQ-CFF-CLIPPY-12: respect prefers-reduced-motion at the CSS layer. */
@media (prefers-reduced-motion: reduce) {
    #cff-clippy-root {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1;
    }
    #cff-clippy-root.is-visible,
    #cff-clippy-root.is-leaving {
        transform: none !important;
    }
}

@media (max-width: 710px) {
    #cff-clippy-root {
        display: none;
    }
}

@media (max-width: 600px) {
    #cff-clippy-root {
        max-width: 220px;
        right: 12px;
        bottom: 12px;
    }
    #cff-clippy-bubble {
        max-width: 220px;
    }
    #cff-clippy-mascot {
        width: 72px;
        height: 72px;
    }
}
