/* Optimisations spécifiques pour mobile - JSPI Portfolio */

/* Amélioration de la performance mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permettre la sélection de texte dans les paragraphes */
p,
span,
div,
h1,
h2,
h3,
h4,
h5,
h6 {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Optimisation des transitions pour mobile */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Amélioration de la navigation mobile */
@media (max-width: 991px) {
    .navbar-collapse {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .navbar-nav .nav-link {
        position: relative;
        overflow: hidden;
    }

    .navbar-nav .nav-link::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.05), transparent);
        transition: left 0.5s ease;
    }

    .navbar-nav .nav-link:hover::before {
        left: 100%;
    }
}

/* Amélioration des boutons pour mobile */
@media (max-width: 768px) {

    .btn-discover-missions,
    .btn-view-all,
    .btn-contact {
        position: relative;
        overflow: hidden;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    .btn-discover-missions::before,
    .btn-view-all::before,
    .btn-contact::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.6s ease, height 0.6s ease;
    }

    .btn-discover-missions:active::before,
    .btn-view-all:active::before,
    .btn-contact:active::before {
        width: 300px;
        height: 300px;
    }
}

/* Amélioration des cartes pour mobile */
@media (max-width: 768px) {

    .service-card,
    .project-card {
        transform: translateZ(0);
        backface-visibility: hidden;
        will-change: transform;
    }

    .service-card:active,
    .project-card:active {
        transform: scale(0.98) translateZ(0);
    }
}

/* Amélioration des images pour mobile */
@media (max-width: 768px) {

    .project-image img,
    .about-preview-image img {
        transform: translateZ(0);
        backface-visibility: hidden;
        will-change: transform;
    }

    .project-image img:active,
    .about-preview-image img:active {
        transform: scale(0.98) translateZ(0);
    }
}

/* Amélioration de la performance des animations */
@media (max-width: 768px) {
    .page-load-animation {
        will-change: opacity, transform;
    }

    .floating-logo {
        will-change: transform, opacity;
    }
}

/* Optimisation des icônes sociales pour mobile */
@media (max-width: 768px) {
    .social-links .social-icon {
        transform: translateZ(0);
        backface-visibility: hidden;
        will-change: transform;
    }

    .social-links .social-icon:active {
        transform: scale(0.9) translateZ(0);
    }
}

/* Amélioration de l'accessibilité mobile */
@media (max-width: 768px) {

    .nav-link,
    .btn-discover-missions,
    .btn-view-all,
    .btn-contact,
    .social-icon {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Optimisation des espacements pour mobile */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .row {
        margin-left: -7.5px;
        margin-right: -7.5px;
    }

    .col-md-4,
    .col-lg-6 {
        padding-left: 7.5px;
        padding-right: 7.5px;
    }
}

/* Amélioration de la lisibilité sur mobile */
@media (max-width: 768px) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }

    .section-title,
    .main-title,
    .about-title {
        text-rendering: optimizeLegibility;
        font-feature-settings: "kern" 1;
    }
}

/* Optimisation des grilles pour mobile */
@media (max-width: 768px) {

    .services-grid,
    .projects-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        justify-items: center;
        align-items: center;
    }

    .service-card,
    .project-card {
        width: 100%;
        max-width: 450px;
        box-sizing: border-box;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {

    .services-grid,
    .projects-grid {
        max-width: 400px;
        gap: 18px;
    }

    .service-card,
    .project-card {
        max-width: 380px;
    }
}

@media (max-width: 360px) {

    .services-grid,
    .projects-grid {
        max-width: 350px;
        gap: 15px;
    }

    .service-card,
    .project-card {
        max-width: 330px;
    }
}

/* Amélioration de la navigation par clavier */
@media (max-width: 768px) {

    .nav-link:focus,
    .btn-discover-missions:focus,
    .btn-view-all:focus,
    .btn-contact:focus,
    .social-icon:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
        border-radius: 4px;
    }
}

/* Optimisation des transitions pour les écrans tactiles */
@media (hover: none) and (pointer: coarse) {

    .service-card:hover,
    .project-card:hover,
    .btn-discover-missions:hover,
    .btn-view-all:hover,
    .btn-contact:hover {
        transform: none;
        box-shadow: inherit;
    }

    .service-card:active,
    .project-card:active,
    .btn-discover-missions:active,
    .btn-view-all:active,
    .btn-contact:active {
        transform: scale(0.98);
    }
}

/* Amélioration de la performance sur les appareils à faible puissance */
@media (max-width: 480px) {
    .floating-logo {
        will-change: auto;
    }

    .page-load-animation {
        will-change: auto;
    }

    .service-card,
    .project-card {
        will-change: auto;
    }
}

/* Support pour les écrans haute densité */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .nav-logo,
    .footer-logo-img,
    .floating-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Optimisation pour les écrans très larges sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        height: 60px;
    }

    .cover {
        height: 60vh;
    }

    .hero-image-container {
        height: 60vh;
    }

    .about-content-wrapper {
        margin-top: -80px;
    }
}

/* Amélioration de la performance des animations sur mobile */
@media (max-width: 768px) {
    .mission-item {
        will-change: opacity, transform;
    }

    .mission-item.visible {
        will-change: auto;
    }
}



/* Optimisation pour les appareils avec des écrans de différentes tailles */
@media (max-width: 768px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
        text-align: center;
    }

    .row {
        margin-left: 0;
        margin-right: 0;
        justify-content: center;
    }

    .col-md-4,
    .col-lg-6 {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
    }

    .services-preview-section .container,
    .projects-preview-section .container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Amélioration de la navigation tactile */
@media (max-width: 768px) {
    .navbar-nav .nav-link {
        touch-action: manipulation;
    }

    .btn-discover-missions,
    .btn-view-all,
    .btn-contact {
        touch-action: manipulation;
    }

    .social-icon {
        touch-action: manipulation;
    }
}

/* Optimisation pour les appareils avec des écrans de très petite taille */
@media (max-width: 320px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .navbar {
        padding: 5px 10px;
    }

    .navbar-brand {
        margin-right: 0;
    }

    .nav-logo {
        width: 60px;
    }
}

/* Support pour les appareils avec des écrans de très grande taille sur mobile */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        max-width: 800px;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        max-width: 800px;
    }
}
