/* Mobile optimizations for better performance - Enhanced for Safari */
/* Critical CSS inlined for faster rendering */
.cover-image {
    width: 100%;
    height: 180px; /* Reduced height */
    background-image: url('images/cover-ga4-2025web.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    will-change: transform; /* Hardware acceleration hint */
    transform: translateZ(0); /* Force GPU acceleration on Safari */
    -webkit-backface-visibility: hidden; /* Safari performance fix */
    -webkit-perspective: 1000; /* Safari performance fix */
}

.avatar {
    width: 110px; /* Slightly reduced size */
    height: 110px;
    border-radius: 50%;
    border: 4px solid var(--bg-color);
    background-image: url('images/avt-toan2025.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-top: -55px; /* Adjusted for new size */
    box-shadow: 0 5px 15px var(--shadow-color);
    flex-shrink: 0;
    will-change: transform; /* Hardware acceleration hint */
    transform: translateZ(0); /* Force GPU acceleration on Safari */
    -webkit-backface-visibility: hidden; /* Safari performance fix */
    -webkit-perspective: 1000; /* Safari performance fix */
}

/* Optimize animations for mobile devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Optimize for mobile devices */
@media (max-width: 768px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
    }
    
    .avatar {
        margin-top: -55px;
        margin-bottom: 15px; /* Reduced margin */
        width: 100px;
        height: 100px;
    }
    
    .profile-info {
        margin-left: 0;
    }
    
    .contact-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .btn {
        width: auto;
        margin: 0;
        flex: 0 1 auto;
        min-width: 0;
        max-width: 110px;
        padding: 8px 12px;
    }
    
    .skills-container {
        grid-template-columns: 1fr;
    }
    
    /* Optimize rendering on mobile */
    .social-icons, .skills-section {
        contain: content; /* Improve rendering performance */
    }
}

@media (max-width: 480px) {
    .container {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
    }
    
    .cover-image {
        height: 140px; /* Reduced height */
    }
    
    .avatar {
        width: 90px;
        height: 90px;
        margin-top: -45px;
        border-width: 3px;
    }
    
    .social-icons {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr)); /* Adjusted minmax */
        gap: 12px; /* Reduced gap */
    }
    
    .contact-buttons {
        padding: 10px 10px 12px; /* Reduced padding */
    }
    
    .btn {
        padding: 8px 10px;
        font-size: 12px;
        min-width: 0;
        flex: 0 1 auto;
        max-width: 100px;
    }
    
    .btn i {
        margin-right: 4px;
        font-size: 12px;
    }
    
    /* Safari-specific fixes for small screens */
    @supports (-webkit-touch-callout: none) {
        .btn {
            /* Fix for Safari button rendering */
            -webkit-appearance: none;
            -webkit-tap-highlight-color: transparent;
        }
        
        .social-icon {
            /* Improve touch target size on Safari */
            min-width: 44px;
            min-height: 44px;
        }
    }
}

/* Print styles for better accessibility */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
    }
    
    .theme-toggle {
        display: none;
    }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for Safari scrolling performance */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix for Safari rendering issues */
    .skill-level {
        transform: translateZ(0);
    }
    
    /* Fix for Safari button rendering */
    .btn {
        -webkit-appearance: none;
    }
}