/* Optimisations de performance et accessibilité */

/* Optimisation du rendu */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimisation des images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading pour les images */
img[loading="lazy"] {
    opacity: 1;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Optimisation des animations pour les appareils à faible performance */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Amélioration de l'accessibilité */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible pour l'accessibilité */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
    :root {
        --text-muted: #000000;
        --border-light: #000000;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --background-light: #1a202c;
        --background-white: #2d3748;
        --text-dark: #f7fafc;
        --text-muted: #a0aec0;
        --border-light: #4a5568;
    }
    
    .header {
        background: rgba(26, 32, 44, 0.95);
    }
    
    .experience-card,
    .feature-item {
        background: var(--background-white);
        border-color: var(--border-light);
    }
}

/* Optimisation pour les écrans haute résolution */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-placeholder,
    .image-placeholder {
        background-size: cover;
        background-repeat: no-repeat;
    }
}

/* Optimisation pour les connexions lentes */
@media (prefers-reduced-data: reduce) {
    .hero-placeholder::before,
    .loft-hero::before,
    .nature-hero::before {
        display: none;
    }
    
    .animate-float,
    .animate-pulse,
    .particles {
        animation: none;
    }
}

/* Optimisation pour les petits écrans */
@media (max-width: 480px) {
    .hero {
        padding: 80px 1rem 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .feature-item {
        padding: 1.5rem;
    }
}

/* Optimisation pour les très grands écrans */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
}

/* Optimisation du scroll */
html {
    scroll-padding-top: 100px;
}

/* Optimisation des transitions */
.experience-card,
.feature-item,
.btn-primary,
.btn-secondary {
    will-change: transform;
}

/* Optimisation de la performance des gradients */
.gradient-bg {
    background-attachment: fixed;
}

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

/* Optimisation du chargement des polices */
/* Les polices Google Fonts utilisent déjà font-display: swap */

/* Optimisation des ombres */
.shadow-optimized {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Optimisation pour l'impression */
@media print {
    .header,
    .footer,
    .cta-button,
    .btn-primary,
    .btn-secondary {
        display: none;
    }
    
    .hero,
    .experiences,
    .about {
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black;
        background: white;
    }
}

/* Optimisation pour les lecteurs d'écran */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Amélioration de la lisibilité */
p, li {
    max-width: 70ch;
}

/* Optimisation des interactions tactiles */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .cta-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-menu a {
        padding: 1rem;
    }
}

/* Optimisation de la bande passante */
.low-bandwidth {
    .hero-placeholder::before,
    .particles,
    .animate-float {
        display: none;
    }
}

/* Indicateur de chargement */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
