.swup-transition-fade {
    transition: opacity 0.18s ease-in-out, filter 0.18s ease-in-out;
    opacity: 1;
    filter: blur(0);
}

/* Swup animation states */
html.is-animating .swup-transition-fade {
    opacity: 0.35;
    filter: blur(4px);
    pointer-events: none;
}

html.is-changing .swup-transition-fade {
    opacity: 0.35;
    filter: blur(4px);
}

html.is-animating.swup-stuck .swup-transition-fade {
    opacity: 1 !important;
    transition: none !important;
    pointer-events: auto !important;
}

[x-cloak] {
    display: none !important;
}

/* Swup fallback: Ensure content is visible even if animation fails */
html.is-animating.swup-stuck .transition-fade {
    opacity: 1 !important;
    transition: none !important;
}

/* Character Menu Button - 3-Step Animation */
.menu-char-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
    cursor: pointer;
    overflow: hidden;
}
.menu-char-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 3-Step Cycle: Closed -> Open -> Glow */
@keyframes charCycle1 { /* Closed */
    0%, 28% { opacity: 1; transform: scale(1); }
    33%, 100% { opacity: 0; transform: scale(0.9); }
}
@keyframes charCycle2 { /* Open Regular */
    0%, 28% { opacity: 0; }
    33%, 61% { opacity: 1; transform: scale(1); }
    66%, 100% { opacity: 0; }
}
@keyframes charCycle3 { /* Open Glow */
    0%, 61% { opacity: 0; }
    66%, 95% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; }
}

.menu-char-closed {
    animation: charCycle1 2s infinite ease-in-out;
    z-index: 10;
}
.menu-char-open {
    animation: charCycle2 2s infinite ease-in-out;
    z-index: 5;
}
.menu-char-glow {
    animation: charCycle3 2s infinite ease-in-out;
    z-index: 6;
}

/* User-provided 3D Neumorphic Button Style */
.three-d-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.three-d-btn:active {
    transform: scale(0.95);
}

/* Dual-State Animation Cycle */
.three-d-btn {
    width: 70px !important; /* Wider to accommodate scroll */
    perspective: 1000px;
    overflow: visible !important;
    position: relative;
}

@media (min-width: 768px) {
    .main-menu-btn {
        display: none !important;
    }
}

.bars-state, .scroll-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-in-out;
}

/* 6s Total Cycle: 3s Bars, 3s Scroll */
@keyframes cycle-bars {
    0%, 45% { opacity: 1; transform: scale(1); visibility: visible; }
    50%, 100% { opacity: 0; transform: scale(0.8); visibility: hidden; }
}
@keyframes cycle-scroll {
    0%, 50% { opacity: 0; transform: scale(0.8); visibility: hidden; }
    55%, 95% { opacity: 1; transform: scale(1); visibility: visible; }
    100% { opacity: 0; transform: scale(0.8); visibility: hidden; }
}

.bars-state { animation: cycle-bars 6s infinite; }
.scroll-state { animation: cycle-scroll 6s infinite; }

/* Disable cycling when menu is OPEN (show X) */
.three-d-btn.open .bars-state { animation: none; opacity: 1; visibility: visible; transform: scale(1); }
.three-d-btn.open .scroll-state { display: none; }

.simple-menu-btn {
    width: 48px !important;
}

.simple-menu-btn.main-menu-btn {
    background: linear-gradient(135deg, #123f91 0%, #1d4ed8 54%, #2563eb 100%);
    border: none;
    box-shadow:
        0 12px 26px rgba(15, 23, 42, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.simple-menu-btn .bars-state {
    animation: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.simple-menu-btn .scroll-state {
    display: none !important;
}

.bar-3d-container {
    width: 24px;
    height: 20px;
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.bar-3d {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #ef4444, #f87171);
    border-radius: 4px;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.4);
}

/* Main Menu Button (Top Right) - Cobalt */
.main-menu-btn .bar-3d {
    background: linear-gradient(to right, #dbeafe, #93c5fd);
    box-shadow: 0 4px 8px -1px rgba(15, 23, 42, 0.42), 0 0 10px rgba(147, 197, 253, 0.52);
}
.main-menu-btn .bar-3d::before {
    background: #0f2f76;
}

/* Sub Menu Button (Top Left) - Teal/Cyan */
.sub-menu-btn .bar-3d {
    background: linear-gradient(to right, #0d9488, #2dd4bf);
    box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.4);
}
.sub-menu-btn .bar-3d::before {
    background: #0f766e;
}

/* 3D Depth Effect */
.bar-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #dc2626;
    transform: translateZ(-2px);
    border-radius: 4px;
}

/* Continuous 3D Animation: Floating & Pulsing */
@keyframes float-pulse-3d {
    0%, 100% {
        transform: translateZ(0) scale(1) rotateX(0deg);
    }
    50% {
        transform: translateZ(8px) scale(1.1) rotateX(10deg);
    }
}

.bar-3d:nth-child(1) { animation: float-pulse-3d 3s infinite ease-in-out; }
.bar-3d:nth-child(2) { animation: float-pulse-3d 3s infinite ease-in-out 0.5s; }
.bar-3d:nth-child(3) { animation: float-pulse-3d 3s infinite ease-in-out 1s; }

/* X Animation for 3D Bars */
.three-d-btn.open .bar-3d:nth-child(1) {
    transform: translateY(8px) rotate(45deg) translateZ(5px);
    animation: none;
}
.three-d-btn.open .bar-3d:nth-child(2) {
    opacity: 0;
    transform: scale(0);
    animation: none;
}
.three-d-btn.open .bar-3d:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg) translateZ(5px);
    animation: none;
}

/* Scroll / Medical Document Style */
.scroll-parchment {
    width: 0;
    height: 34px;
    background: #f5f3ff; /* Light Purple */
    border: 1px solid #ddd6fe;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2);
    animation: unfold-scroll 3s infinite ease-in-out;
}

.scroll-parchment::before, .scroll-parchment::after {
    content: '';
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 8px;
    background: #7c3aed; /* Brand Purple Roller */
    border-radius: 4px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}
.scroll-parchment::before { left: 0; }
.scroll-parchment::after { right: 0; }

@keyframes unfold-scroll {
    0%, 10% { width: 6px; opacity: 0; }
    30%, 80% { width: 100px; opacity: 1; }
    90%, 100% { width: 6px; opacity: 0; }
}

.scroll-text {
    font-size: 10px;
    font-weight: 800;
    color: #0056b3; /* Brand Blue Text */
    text-transform: uppercase;
    line-height: 1.1;
    white-space: nowrap;
    font-family: 'Outfit', 'sans-serif';
    letter-spacing: 0.8px;
}

/* Menu Item Styling */
.menu-item-neumorphic {
    padding: 12px 16px;
    border-radius: 12px;
    color: #4b5563;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
    display: block;
}
.menu-item-neumorphic:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

@keyframes star-twinkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.3) rotate(15deg); opacity: 1; filter: drop-shadow(0 0 8px rgba(255,255,255,1)); }
}
@keyframes neural-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.05); filter: brightness(1.2); }
}
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes scan-line {
    0% { transform: translateY(-100%); opacity: 0; }
    50% { opacity: 0.4; }
    100% { transform: translateY(100%); opacity: 0; }
}
.animate-star-twinkle { animation: star-twinkle 2.5s infinite ease-in-out; }
.animate-neural-pulse { animation: neural-pulse 4s infinite ease-in-out; }
.animate-spin-slow { animation: spin-slow 15s infinite linear; }
.animate-scan-line { animation: scan-line 3.5s infinite linear; }

@keyframes ai-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.animate-ai-float {
    animation: ai-float 4s infinite ease-in-out;
}
/* --- v20.0.0: Premium Cobalt Medical AI Bubble --- */
@keyframes cobalt-glow {
    0%, 100% { filter: brightness(1) contrast(1.1); }
    50% { filter: brightness(1.3) contrast(1.2); }
}
@keyframes eye-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}
.animate-cobalt-glow {
    animation: cobalt-glow 4s infinite ease-in-out;
}
.animate-eye-blink {
    animation: eye-blink 5s infinite;
}
.ai-chat-bubble-container {
    z-index: 100 !important;
    animation: ai-float 6s infinite ease-in-out;
}
.ai-chat-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: rgba(30, 64, 175, 0.15); /* Deep Blue pulse */
    z-index: -1;
    animation: ai-pulse 3s infinite;
}

@media (min-width: 768px) {
    button.main-menu-btn.three-d-btn {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}
