/* Critical: Prevent CLS - Set dimensions and layout early */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    /* Prevent layout shift during font load */
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

section {
    display: block;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix deprecated H1UserAgentFontSizeInSection - explicit font-size for H1 */
h1 {
    font-size: 3rem;
    line-height: 1.2;
}
@media (min-width: 1024px) {
    h1 {
        font-size: 4.5rem;
    }
}

.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.gradient-text {
    background: linear-gradient(135deg, #2563eb 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-gradient {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.97) 0%, rgba(29, 78, 216, 0.93) 50%, rgba(37, 99, 235, 0.9) 100%);
    background-size: cover;
    background-position: center;
    background-attachment: scroll; /* Changed from fixed for mobile performance */
    /* Optimize for FCP/LCP */
    will-change: auto;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-3d:hover {
    transform: translateY(-8px) scale(1.02);
}

.stat-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.trust-badge {
    animation: float 6s ease-in-out infinite;
}

.service-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}

.testimonial-card {
    background: linear-gradient(to bottom right, #ffffff, #f8fafc);
}

@media (max-width: 768px) {
    .hero-gradient { background-attachment: scroll; }
}

/* Prevent CLS from AOS - show content immediately, no transforms */
[data-aos] {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important; /* Prevent layout shift before AOS loads */
}

/* Desktop: Enable AOS animations when library loads - Smooth & Modern */
@media (min-width: 769px) {
    html.aos-enabled [data-aos] {
        opacity: 0;
        transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                   transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        will-change: opacity, transform;
    }
    
    /* GPU acceleration for hero elements - AOS handles all transforms */
    html.aos-enabled .hero-badge,
    html.aos-enabled .hero-headline,
    html.aos-enabled .hero-subheadline,
    html.aos-enabled .hero-value-card,
    html.aos-enabled .hero-cta-primary,
    html.aos-enabled .hero-cta-secondary,
    html.aos-enabled .hero-form {
        /* GPU acceleration without affecting layout - AOS handles transforms */
        backface-visibility: hidden;
        -webkit-font-smoothing: antialiased;
    }
    
    /* Smooth hover effects for hero elements */
    .hero-cta-primary:hover,
    .hero-cta-secondary:hover {
        transform: scale(1.05) translateY(-2px);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .hero-value-card:hover {
        transform: translateY(-4px);
        transition: all 0.3s ease;
    }
    
    /* Ensure hero cards maintain position - prevent layout shift */
    .hero-value-card {
        position: relative;
        /* Prevent layout shift from AOS transforms */
        contain: layout style;
    }
    
    /* Ensure grid container doesn't shift */
    .hero-value-props {
        contain: layout;
    }
    
    /* Hero decorative orbs - Smooth floating animation */
    .hero-orb-1 {
        animation: heroFloat1 12s ease-in-out infinite;
        will-change: transform;
    }
    .hero-orb-2 {
        animation: heroFloat2 15s ease-in-out infinite;
        animation-delay: 2s;
        will-change: transform;
    }
    
    @keyframes heroFloat1 {
        0%, 100% { transform: translate(0, 0) scale(1) translateZ(0); }
        25% { transform: translate(30px, -40px) scale(1.15) translateZ(0); }
        50% { transform: translate(-20px, -60px) scale(0.9) translateZ(0); }
        75% { transform: translate(-35px, -30px) scale(1.1) translateZ(0); }
    }
    
    @keyframes heroFloat2 {
        0%, 100% { transform: translate(0, 0) scale(1) translateZ(0); }
        33% { transform: translate(-40px, 30px) scale(1.2) translateZ(0); }
        66% { transform: translate(25px, 50px) scale(0.85) translateZ(0); }
    }
}

/* Mobile: Always show content (no AOS, no animations) */
@media (max-width: 768px) {
    [data-aos] {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        transition: none !important;
    }
    
    /* Ensure hero cards don't shift on mobile */
    .hero-value-card,
    .hero-badge,
    .hero-headline,
    .hero-subheadline,
    .hero-cta-primary,
    .hero-cta-secondary,
    .hero-form {
        transform: none !important;
        opacity: 1 !important;
        position: static !important;
    }
}

html:not(.aos-enabled) [data-aos] {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* Prevent layout shift from animations */
.animate-float,
.animate-pulse,
.animate-pulse-slow,
.animate-ping,
.animate-bounce-slow {
    will-change: transform, opacity;
    transform: translateZ(0); /* GPU acceleration */
}

/* Font loading optimization - prevent CLS */
body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reserve space for icons to prevent shift - Ensure Font Awesome loads properly */
.fas, .fab, .far, .fa {
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth icon rendering in stats section */
.stat-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-container i {
    display: block;
    line-height: 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile performance optimizations - Critical for FCP/LCP */
@media (max-width: 768px) {
    /* Disable all animations on mobile for better performance */
    .animate-float,
    .animate-pulse-slow,
    .animate-ping,
    .animate-bounce-slow,
    .animate-pulse {
        animation: none !important;
    }
    /* Optimize backdrop filters on mobile */
    .backdrop-blur-md,
    .backdrop-blur-xl,
    .backdrop-blur-2xl,
    .backdrop-blur-3xl {
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
    }
    /* Reduce blur effects on mobile */
    .filter.blur-3xl,
    .blur-3xl {
        filter: blur(20px) !important;
    }
    /* Simplify complex gradients on mobile */
    .bg-gradient-to-br {
        background: linear-gradient(135deg, rgba(30, 58, 138, 0.98) 0%, rgba(37, 99, 235, 0.95) 100%) !important;
    }
    /* Disable transform effects on mobile */
    .card-3d:hover {
        transform: none !important;
    }
    
    /* Force fonts and colors on mobile for Why Choose Us section */
    #why-choose-us h2,
    #why-choose-us .text-white,
    #why-choose-us .text-slate-200 {
        color: #ffffff !important;
        font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-weight: 700 !important;
    }
    
    #why-choose-us .text-accent-400 {
        color: #34d399 !important;
    }
    
    #why-choose-us .bg-white {
        background-color: #ffffff !important;
    }
    
    #why-choose-us .text-slate-900 {
        color: #0f172a !important;
    }
    
    #why-choose-us .text-slate-700 {
        color: #334155 !important;
    }
    
    #why-choose-us .text-accent-500 {
        color: #10b981 !important;
    }
    
    #why-choose-us .bg-primary-600,
    #why-choose-us .bg-accent-600,
    #why-choose-us .bg-red-600,
    #why-choose-us .bg-indigo-600 {
        color: #ffffff !important;
    }
    
    /* Ensure font families load on mobile */
    #why-choose-us * {
        font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    }
    
    #why-choose-us h2,
    #why-choose-us h3 {
        font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-weight: 700 !important;
    }
    
    /* Force colors on mobile for Pain Points Section (Ransomware, Downtime, HIPAA) */
    /* Target cards by their gradient classes - use attribute selector for multiple classes */
    [class*="from-primary-50"][class*="to-white"] {
        background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%) !important;
    }
    
    [class*="from-accent-50"][class*="to-white"] {
        background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%) !important;
    }
    
    [class*="from-yellow-50"][class*="to-white"] {
        background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%) !important;
    }
    
    /* Primary colors (Ransomware card) */
    [class*="bg-primary-100"] {
        background-color: #dbeafe !important;
    }
    
    [class*="border-primary-100"] {
        border-color: #dbeafe !important;
    }
    
    [class*="text-primary-600"] {
        color: #2563eb !important;
    }
    
    /* Accent colors (Downtime card) */
    [class*="bg-accent-50"] {
        background-color: #ecfdf5 !important;
    }
    
    [class*="border-accent-100"] {
        border-color: #d1fae5 !important;
    }
    
    [class*="text-accent-600"] {
        color: #059669 !important;
    }
    
    /* Yellow colors (HIPAA card) */
    [class*="bg-yellow-100"] {
        background-color: #fef3c7 !important;
    }
    
    [class*="border-yellow-100"] {
        border-color: #fef3c7 !important;
    }
    
    [class*="text-yellow-600"] {
        color: #ca8a04 !important;
    }
    
    [class*="text-yellow-700"] {
        color: #a16207 !important;
    }
    
    /* Ensure text colors are visible on mobile for Pain Points section */
    /* Target all text-slate classes within the pain points cards */
    [class*="from-primary-50"] [class*="text-slate-900"],
    [class*="from-accent-50"] [class*="text-slate-900"],
    [class*="from-yellow-50"] [class*="text-slate-900"] {
        color: #0f172a !important;
    }
    
    [class*="from-primary-50"] [class*="text-slate-600"],
    [class*="from-accent-50"] [class*="text-slate-600"],
    [class*="from-yellow-50"] [class*="text-slate-600"] {
        color: #475569 !important;
    }
    
    /* Force icon colors in pain points section */
    [class*="from-primary-50"] [class*="text-primary-600"],
    [class*="from-accent-50"] [class*="text-accent-600"],
    [class*="from-yellow-50"] [class*="text-yellow-600"] {
        color: inherit !important;
    }
    
    [class*="from-primary-50"] .fa-exclamation-triangle {
        color: #2563eb !important;
    }
    
    [class*="from-accent-50"] .fa-hourglass-half {
        color: #059669 !important;
    }
    
    [class*="from-yellow-50"] .fa-gavel {
        color: #ca8a04 !important;
    }
    
    /* Force check icon color in solution text */
    [class*="text-primary-600"] .fa-check,
    [class*="text-accent-600"] .fa-check,
    [class*="text-yellow-700"] .fa-check {
        color: #10b981 !important;
    }
    
    /* Mobile text sizing for Why Choose Us */
    #why-choose-us h2 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    #why-choose-us h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    #why-choose-us p {
        font-size: 0.875rem !important;
        line-height: 1.6 !important;
    }
    
    #why-choose-us .text-sm {
        font-size: 0.875rem !important;
    }
    
    /* Force Font Awesome icons to display on mobile */
    #why-choose-us .fas,
    #why-choose-us .fab,
    #why-choose-us .far,
    #why-choose-us i[class*="fa-"] {
        display: inline-block !important;
        font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
        font-weight: 900 !important;
        font-style: normal !important;
        font-variant: normal !important;
        text-rendering: auto !important;
        line-height: 1 !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure icon colors work on mobile */
    #why-choose-us .text-white {
        color: #ffffff !important;
    }
    
    #why-choose-us .text-accent-400 {
        color: #34d399 !important;
    }
    
    #why-choose-us .text-accent-500 {
        color: #10b981 !important;
    }
    
    /* Ensure icon containers are visible */
    #why-choose-us .bg-gradient-to-br {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Force Font Awesome icons to display on mobile (better than Original) */
    #why-choose-us .fas,
    #why-choose-us .fab,
    #why-choose-us .far,
    #why-choose-us i[class*="fa-"] {
        display: inline-block !important;
        font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
        font-weight: 900 !important;
        font-style: normal !important;
        font-variant: normal !important;
        text-rendering: auto !important;
        line-height: 1 !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Prevent layout shift from loading content */
section {
    min-height: 200px;
    contain: layout style paint;
}

/* Optimize repaints */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.fas, .fab, .far {
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
}

.trust-badge .fa-shield {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.trust-badge:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease;
}
