/* ===== PERFORMANCE & UX OPTIMIZATIONS ===== */
/* Advanced improvements for better user experience and performance */

/* === BLOOD DROP SIZE OPTIMIZATION === */
/* Better visibility on mobile while maintaining proportions */
@media (max-width: 768px) {
    .blood-drop-falling {
        font-size: clamp(0.65rem, 1.4vh, 0.8rem) !important; /* Increased from 0.5-0.7rem */
    }
}

@media (max-width: 480px) {
    .blood-drop-falling {
        font-size: clamp(0.6rem, 1.3vh, 0.75rem) !important; /* Increased from 0.4-0.6rem */
    }
}

/* === THEME TOGGLE SIZE OPTIMIZATION === */
/* Better visual consistency between desktop and mobile */
@media (max-width: 768px) {
    .theme-endpoint {
        width: 36px !important; /* Reduced from 44px for better proportion */
        height: 36px !important; /* Reduced from 44px for better proportion */
        font-size: 16px !important; /* Reduced from 18px for better proportion */
    }

    .theme-transition-line {
        width: 55px !important; /* Slightly reduced from 60px */
        height: 3.5px !important; /* Slightly reduced from 4px */
    }

    .theme-line-toggle {
        padding: 8px !important; /* Slightly increased padding for better touch area */
    }
}

/* === CHOICE SECTION HOVER BLUR EFFECT === */
/* Desktop-only: Blur non-hovered sections for better focus */
@media (min-width: 769px) and (hover: hover) {
    .choices-section {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* When any choice is hovered, blur all others */
    .choices-section:hover .choice:not(:hover) {
        filter: blur(2px) brightness(0.7) saturate(0.8);
        opacity: 0.6;
        transform: scale(0.98);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Keep hovered choice sharp and prominent */
    .choices-section:hover .choice:hover {
        filter: none;
        opacity: 1;
        transform: translateY(-8px) scale(1.02);
        z-index: 10;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Also blur the divider when choices are hovered */
    .choices-section:hover .divider {
        filter: blur(1px);
        opacity: 0.4;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Keep divider normal when no choice is hovered */
    .choices-section .divider {
        filter: none;
        opacity: 1;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    /* Enhanced emergency section prominence during hover */
    .choices-section:hover .emergency-choice:hover {
        filter: none;
        opacity: 1;
        transform: translateY(-10px) scale(1.03);
        z-index: 15;
        box-shadow: 
            0 25px 50px rgba(198, 40, 40, 0.3),
            0 10px 20px rgba(0, 0, 0, 0.2);
        border-left-width: 6px;
        border-left-color: var(--primary-color);
    }
    
    /* Enhanced hero section during hover */
    .choices-section:hover .hero-choice:hover {
        filter: none;
        opacity: 1;
        transform: translateY(-8px) scale(1.02);
        z-index: 12;
        box-shadow: 
            0 20px 40px rgba(107, 139, 123, 0.25),
            0 8px 16px rgba(0, 0, 0, 0.15);
        border-left-width: 6px;
        border-left-color: var(--accent-color);
    }
}

/* === GPU ACCELERATION === */
/* Force GPU acceleration for smooth animations */
.choice,
.choice-btn,
.choice-icon-wrap,
.heart-logo,
.blood-drop-falling,
.emergency-badge,
.hero-badge {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* === EMERGENCY UX ENHANCEMENTS === */
/* Subtle urgency indicators for emergency elements */

.emergency-choice {
    position: relative;
    overflow: visible;
}

.emergency-choice::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        rgba(198, 40, 40, 0.1) 0%, 
        rgba(229, 57, 53, 0.15) 50%, 
        rgba(198, 40, 40, 0.1) 100%);
    border-radius: inherit;
    z-index: -1;
    animation: emergencyGlow 3s ease-in-out infinite;
}

@keyframes emergencyGlow {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.01);
    }
}

/* === ACCESSIBILITY ENHANCEMENTS === */
/* Better focus indicators and keyboard navigation */

.choice-btn:focus,
.theme-endpoint:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(198, 40, 40, 0.2);
}

.choice:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* High contrast focus for accessibility */
@media (prefers-contrast: high) {
    .choice-btn:focus {
        outline: 4px solid #000000;
        background: #ffffff;
        color: #000000;
    }
}

/* === MICRO-INTERACTIONS === */
/* Subtle feedback for better UX */

.choice-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.choice-btn:hover {
    transform: translateY(-1px) scale(1.02);
}

.choice-btn:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.1s;
}

/* === LOADING STATE OPTIMIZATION === */
/* Prevent layout shift during font loading */

.logo-main,
.choice h2,
.choice p {
    font-display: swap;
}

/* === REDUCED MOTION RESPECT === */
/* Better reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .emergency-choice::before {
        animation: none;
        opacity: 0.4;
    }
    
    .choice-btn:hover {
        transform: none;
    }
    
    .choice:focus-within {
        transform: none;
    }
    
    /* Disable blur effects for reduced motion */
    .choices-section:hover .choice:not(:hover),
    .choices-section:hover .choice:hover,
    .choices-section:hover .divider {
        filter: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* === MOBILE BLUR DISABLE === */
/* Disable blur effect on mobile/touch devices */
@media (max-width: 768px), (hover: none) {
    .choices-section:hover .choice:not(:hover),
    .choices-section:hover .choice:hover,
    .choices-section:hover .divider {
        filter: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* === TOUCH OPTIMIZATION === */
/* Better mobile touch experience */
@media (hover: none) and (pointer: coarse) {
    .choice-btn {
        min-height: 48px; /* Minimum touch target */
        padding: 12px 24px;
    }
    
    .choice {
        padding: 20px 16px;
    }
    
    /* Remove hover effects on touch devices */
    .choice-btn:hover {
        transform: none;
    }
}

/* === PERFORMANCE OPTIMIZATIONS === */
/* Reduce repaints and reflows */

.choice-container {
    contain: layout style paint;
}

.choice {
    contain: layout style;
}

/* Optimize animations */
@keyframes optimizedPulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.02) translateZ(0);
    }
}

/* === VISUAL HIERARCHY ENHANCEMENT === */
/* Subtle improvements to visual flow */

.emergency-choice {
    border-left-width: 4px;
    border-left-color: var(--primary-color);
}

.hero-choice {
    border-left-width: 4px;
    border-left-color: var(--accent-color);
}

/* === EMERGENCY PRIORITY VISUAL CUE === */
/* Make emergency section slightly more prominent */
.emergency-choice {
    order: -1; /* Always first */
    position: relative;
    z-index: 2;
}

.hero-choice {
    z-index: 1;
}

/* === LOADING PERFORMANCE === */
/* Critical CSS optimizations */
.choice-icon-wrap {
    font-display: swap;
    text-rendering: optimizeSpeed;
}

/* === DARK MODE OPTIMIZATIONS === */
body.dark-mode .emergency-choice::before {
    background: linear-gradient(45deg, 
        rgba(239, 68, 68, 0.1) 0%, 
        rgba(248, 113, 113, 0.15) 50%, 
        rgba(239, 68, 68, 0.1) 100%);
}

/* === PRINT OPTIMIZATION === */
@media print {
    .emergency-choice::before,
    .choice-btn:hover,
    .choice:focus-within {
        display: none;
    }
    
    .choice {
        break-inside: avoid;
    }
}
