/* ===================================================================
 * Styles additionnels pour remplacer les plugins JS
 * Optimisé pour HTTP/3 et performances
 * =================================================================== */

/* Placeholder styling (pour anciens navigateurs) */
.placeholder {
    color: #999;
    font-style: italic;
}

input.placeholder,
textarea.placeholder {
    color: #999 !important;
}

/* Lettering - Amélioration de l'animation des caractères */
.kern-this span[class^="char"] {
    display: inline-block;
    position: relative;
}

/* Animation optionnelle pour les lettres */
@keyframes letterFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kern-this.animate span[class^="char"] {
    animation: letterFadeIn 0.5s ease-out forwards;
    opacity: 0;
}

/* Délai progressif pour chaque lettre (max 20 lettres) */
.kern-this.animate .char1 { animation-delay: 0.05s; }
.kern-this.animate .char2 { animation-delay: 0.10s; }
.kern-this.animate .char3 { animation-delay: 0.15s; }
.kern-this.animate .char4 { animation-delay: 0.20s; }
.kern-this.animate .char5 { animation-delay: 0.25s; }
.kern-this.animate .char6 { animation-delay: 0.30s; }
.kern-this.animate .char7 { animation-delay: 0.35s; }
.kern-this.animate .char8 { animation-delay: 0.40s; }
.kern-this.animate .char9 { animation-delay: 0.45s; }
.kern-this.animate .char10 { animation-delay: 0.50s; }
.kern-this.animate .char11 { animation-delay: 0.55s; }
.kern-this.animate .char12 { animation-delay: 0.60s; }
.kern-this.animate .char13 { animation-delay: 0.65s; }
.kern-this.animate .char14 { animation-delay: 0.70s; }
.kern-this.animate .char15 { animation-delay: 0.75s; }
.kern-this.animate .char16 { animation-delay: 0.80s; }
.kern-this.animate .char17 { animation-delay: 0.85s; }
.kern-this.animate .char18 { animation-delay: 0.90s; }
.kern-this.animate .char19 { animation-delay: 0.95s; }
.kern-this.animate .char20 { animation-delay: 1.00s; }

/* Particleground - Canvas styling */
.pg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Assurer que le contenu est au-dessus du canvas */
.main-content-particle-js .content-wrap {
    position: relative;
    z-index: 2;
}

/* Optimisation pour performance - Réduire les repaints */
.pg-canvas,
.shadow-overlay {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Menu transitions optimisées */
#menu-nav-wrap,
.main-header,
#main-404-content {
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
}

/* Preloader - Amélioration des transitions */
#preloader {
    transition: opacity 0.5s ease-out;
}

#loader {
    transition: opacity 0.5s ease-out;
}

/* Responsive - Ajustements pour mobile */
@media screen and (max-width: 768px) {
    /* Réduire la densité des particules sur mobile via CSS n'est pas possible,
       mais on peut optimiser le rendu */
    .pg-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Simplifier les animations sur mobile */
    .kern-this.animate span[class^="char"] {
        animation-duration: 0.3s;
    }
}

/* Performance hints pour le navigateur */
@media (prefers-reduced-motion: reduce) {
    /* Respect des préférences utilisateur pour les animations */
    .kern-this.animate span[class^="char"] {
        animation: none;
        opacity: 1;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Support du mode sombre (si activé) */
@media (prefers-color-scheme: dark) {
    .placeholder {
        color: #666;
    }
    
    input.placeholder,
    textarea.placeholder {
        color: #666 !important;
    }
}

/* GPU Acceleration pour les éléments animés */
.main-content h1,
.kern-this,
#main-404-content,
#menu-nav-wrap {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Focus styles améliorés pour l'accessibilité */
.menu-toggle:focus,
input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Cache les éléments visuellement mais garde l'accessibilité */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading state pour lazy loading */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .pg-canvas,
    #preloader,
    .menu-toggle,
    #menu-nav-wrap {
        display: none !important;
    }
}
