/* Bordure autour des images des projets */
.projet.card img {
    border: 3px solid #00bcd4;
}

/* Nettoyage : règles mobiles spécifiques seront définies dans la media query plus bas */

/* Project images: responsive and consistent styling */
.project-image {
    width: 100%;
    height: auto;
    max-width: 320px;
    border-radius: 8px;
    display: block;
    object-fit: cover;
}

@media (max-width: 768px) {
    .project-image {
        max-width: 95vw !important;
        width: 95vw !important;
        height: auto !important;
        object-fit: contain !important; /* show entire image on mobile */
        border-radius: 8px !important;
    }
}
/* Remonte le bouton Télécharger le CV (force sur desktop et mobile si besoin) */
.resume-cv-btn.desktop-cv-btn {
    margin-top: 0px !important;
    /* grand décalage appliqué uniquement au desktop */
    transform: translateY(-20px) !important;
    position: relative !important;
    z-index: 20 !important;
}
.resume-cv-btn.mobile-cv-btn {
    margin-top: 0px !important;
    /* annuler le translate pour mobile afin de pouvoir ajuster via top/margin */
    transform: none !important;
    position: relative !important;
    z-index: 20 !important;
}

/* Si le transform ne fonctionne pas (héritage/overflow), forcer avec top/margin négatif
   et s'assurer que la section autorise l'overflow visible. */
.resume-section {
    position: relative !important;
    overflow: visible !important;
}
.resume-section .resume-cv-btn.desktop-cv-btn {
    /* redondance : top + margin pour déplacer si transform est ignoré */
    top: -20px !important;
    margin-top: -20px !important;
    transform: translateY(0) !important;
    z-index: 9999 !important;
}
.resume-section .resume-cv-btn.mobile-cv-btn {
    /* par défaut réduire l'effet, laisser le flux naturel */
    top: 0 !important;
    margin-top: 0 !important;
}

/* Ajustement spécifique pour mobile : descendre le bouton un peu */
@media (max-width: 900px) {
    .resume-section .resume-cv-btn.mobile-cv-btn {
        top: 12px !important;
        margin-top: 12px !important;
    }
}
@media (max-width: 768px) {
    footer {
        text-align: center;
        padding: 1rem 0.5rem;
        font-size: 0.98em;
        border-radius: 0 0 10px 10px;
        margin: 0.5rem 0 0 0;
        width: 100%;
    }
}
@media (max-width: 768px) {
    .projects-section {
        padding-right: 8vw !important;
    }
}
@media (max-width: 768px) {
    .projects-section {
        padding: 1.2rem 0.5rem;
        text-align: center;
        border-radius: 10px;
        margin: 0.5rem 0;
    }
    .projects-section h2 {
        font-size: 1.1em;
        margin-bottom: 0.7em;
    }
    .projets-list {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.7rem !important;
    }
    /* Réduire l'espace vertical pour la section projets sur mobile */
    .projets-list {
        margin-top: 12px !important; /* moins d'espace au-dessus */
    }
    .projet.card {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        font-size: 0.98em;
        padding: 0.7rem 0.7rem;
        border-radius: 8px;
    }
    /* Cartes projets : même style que desktop, centrées, multi-colonnes si possible */
    .projets-list {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.9rem !important; /* réduire l'écart entre cartes */
        margin-top: 4px !important; /* très réduit pour mobile */
    }
    .projet.card {
        box-sizing: border-box !important;
        /* Keep desktop-like card sizing on mobile */
        width: auto !important;
        min-width: 220px !important;
        max-width: 260px !important;
        margin: 0.2rem auto !important;
        font-size: 0.96em;
        padding: 0.6rem 0.8rem; /* slightly larger padding to match desktop */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(12px); /* descendre davantage la carte */
    }
    /* Make images fill the card and not rely on viewport widths */
    .projet.card img, .project-image {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        border-radius: 12px !important;
        display: block !important;
        margin: 0 auto 0.3rem auto !important;
        object-fit: cover !important; /* cover within the card dimensions */
        border: 3px solid #00bcd4 !important;
    }

    /* Ensurer que la liste ne force pas un grand top margin ailleurs */
    .projects-section {
        margin-top: 0 !important;
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }
    .projet.card img, .project-image {
        /* Afficher l'image en entier sur mobile (pas de crop) */
        width: 59vw !important;
        max-width: 64vw !important;
        height: auto !important;
        max-height: none !important; /* laisser l'image s'afficher en totalité */
        border-radius: 12px !important;
        display: block !important;
    margin: 12px auto 0.3rem auto !important; /* nudger davantage vers le bas pour centrer visuellement */
        object-fit: contain !important;
    }

    /* Réduire l'espace autour du titre de la section projets */
    .projects-section h2 {
        margin-top: 0.2rem !important;
        margin-bottom: 0.5rem !important;
        padding-top: 0 !important;
    }

    /* Slightly nudge the Projects title to the right on mobile for visual alignment */
    .projects-section h2 {
        transform: translateX(16px) !important; /* increased right shift */
        transition: transform 240ms ease-in-out !important; /* slightly slower smooth on resize */
    }

    /* Réduire l'espace global de la section projets */
    .projects-section {
        padding-top: 0.4rem !important;
        padding-bottom: 0.4rem !important;
        margin: 0 0 !important; /* enlever marge verticale */
        margin-top: 0 !important; /* forcer en haut */
    }
}
@media (max-width: 768px) {
    .skills-section {
        padding: 1.2rem 0.5rem;
        text-align: center;
        border-radius: 10px;
        margin: 0.5rem 0;
    }
    .skills-section h2 {
        font-size: 1.1em;
        margin-top: 4em;
        margin-bottom: 0.7em;
    }
    .skills-list {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.7rem !important;
    }
    .skills-list .skill {
        font-size: 0.98em;
        padding: 0.3rem 0.7rem;
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .skills-list .skill img {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }
}
@media (max-width: 768px) {
    .resume-section {
        padding: 1.2rem 0.5rem;
        text-align: center;
        border-radius: 10px;
        margin: 0.5rem 0;
    }
    .resume-section h2 {
        font-size: 1.1em;
        margin-bottom: 0.7em;
    }

    /* Create extra space between resume title and first item on mobile */
    .resume-section h2 {
        margin-bottom: 1.4rem !important; /* larger gap on mobile */
    }
    }
    .resume-block ul, .resume-skills {
        gap: 0.5rem;
        font-size: 0.98em;
    }
    .resume-skills li {
        font-size: 0.95em;
        padding: 0.3rem 0.7rem;
    }

@media (max-width: 768px) {
    .profile-section {
        align-items: center;
        padding: 1.2rem 0.5rem;
        text-align: center;
    }
    .profile-section h2 {
        font-size: 1.1em;
        margin-bottom: 0.7em;
    }
    .profile-section p {
        font-size: 1em;
        margin-bottom: 0.7em;
    }
}
@media (max-width: 768px) {
    .mobile-nav .sidebar-avatar {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 1.2rem;
    }
}
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
}
@media (max-width: 768px) {
    .mobile-nav {
        width: 100vw !important;
        left: 0 !important;
        border-radius: 0 !important;
        min-width: 0 !important;
        max-width: 100vw !important;
        box-shadow: none !important;
        padding: 2.5rem 1rem 1rem 1rem !important;
    }
    .mobile-nav .sidebar-title, .mobile-nav .sidebar-avatar {
        display: block !important;
    }
    .mobile-nav .sidebar-nav, .mobile-nav .sidebar-icons {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }
}
@media (max-width: 768px) {
    main {
        max-width: 100vw;
        margin: 1rem 2vw 1rem 2vw;
        padding: 1.2rem 2vw;
        min-height: 60vh;
        border-radius: 12px;
    }
    .content {
        margin-left: 0;
        width: 100vw;
        min-width: 0;
        padding: 0;
    }
    .resume-section, .skills-section, .projects-section, .contact-section {
        padding: 1rem 2vw;
        border-radius: 10px;
        margin: 0.5rem 0;
    }
    h1, h2, h3 {
        font-size: 1.1em;
    }
    .sidebar {
        display: none !important;
    }
    .sidebar-nav, .sidebar-icons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .sidebar-title, .sidebar-avatar {
        display: none;
    }
}
/* --- Suppression des grands espaces latéraux sur desktop --- */
.main-wrapper {
    max-width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
}

.content {
    max-width: 100%;
    margin: 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 180px;
    }
    .content {
        margin-left: 180px;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}
@media (max-width: 1024px) {
    .sidebar {
        width: 180px;
    }
        .content {
            margin-left: 180px;
            padding-left: 20px;
            padding-right: 20px;
        }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        width: 100vw;
        height: auto;
        top: 0;
        left: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        z-index: 1000;
    }
    .sidebar-avatar, .sidebar-title {
        display: none;
    }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        gap: 10px;
    }
    .sidebar-icons {
        flex-direction: row;
        gap: 10px;
    }
    .main-wrapper {
        flex-direction: column;
    }
    .content {
        margin-left: 0;
        margin-top: 80px;
        padding-left: 5px !important;
        padding-right: 5px !important;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    .sidebar {
        padding: 6px 8px;
    }
    .sidebar-nav a {
        font-size: 0.95rem;
        padding: 6px 8px;
    }
    .content {
        margin-top: 60px;
        padding-left: 2px !important;
        padding-right: 2px !important;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    h1, h2, h3 {
        font-size: 1.1em;
    }
    .resume-block, .skills-list, .projets-list {
        padding: 0;
    }
}
.resume-section {
    text-align: left;
    margin: 0 auto 2.5rem auto;
        max-width: 1200px;
        background: #23283a;
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0,188,212,0.07);
        padding: 2.5rem 2rem 2rem 2rem;
        padding: 3rem 3rem 2.5rem 3rem;
}
.resume-block h3 {
    color: #00bcd4;
    margin-top: 1.5rem;
    margin-bottom: 0.7rem;
    font-size: 1.2rem;
    font-weight: 600;
}
.resume-block ul {
    list-style: disc inside;
    margin: 0 0 1.2rem 0.5rem;
    padding: 0;
}
.resume-block li {
    margin-bottom: 0.7rem;
    line-height: 1.5;
}
.resume-desc {
    color: #b2ebf2;
    font-size: 0.98rem;
    display: block;
    margin-top: 0.2rem;
}
.resume-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    list-style: none;
    margin: 0.5rem 0 0 0;
    padding: 0;
}
.resume-skills li {
    background: #181c24;
    color: #00bcd4;
    border-radius: 6px;
    padding: 0.4rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0,188,212,0.07);
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #181c24;
    color: #e6e6e6;
    min-height: 100vh;
    display: flex;
}

/* Smooth anchor scrolling for nicer navigation transitions */
html {
    scroll-behavior: smooth;
}

.sidebar {
    width: 250px;
    background: #23283a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1rem 1rem 1rem;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    z-index: 100;
}
.sidebar-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #00bcd4;
    margin-bottom: 1.2rem;
    margin-top: 16px !important; /* force avatar slightly down on desktop */
}
.sidebar-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2rem;
    letter-spacing: 1px;
    text-align: center;
}

/* Remove hover effect for the profile title in the sidebar (desktop & mobile) */
.sidebar-title {
    /* keep normal appearance but disable hover transition */
    transition: none !important;
}
.sidebar-title:hover {
    /* neutralize any hover styles so title stays visually stable */
    color: inherit !important;
    transform: none !important;
    cursor: default !important;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
    align-items: center;
    position: relative; /* nécessaire pour placer l'indicateur animé */
}
.sidebar-nav a {
    color: #00bcd4;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    /* Smooth transition for background, color and movement */
    transition: background 0.28s ease, color 0.28s ease, transform 0.28s ease;
    will-change: background, color, transform;
    display: inline-block;
}
.sidebar-nav a:hover, .sidebar-nav a:focus {
    background: #00bcd4;
    color: #23283a;
    /* No transform here: keep the link static so the indicator handles movement */
}

/* Make icons use the same blue hover visual */
.sidebar-icons a, .sidebar-icons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    color: #b2ebf2;
}
.sidebar-icons a:hover, .sidebar-icons a:focus, .sidebar-icons button:hover, .sidebar-icons button:focus {
    background: #00bcd4;
    color: #23283a;
}
.sidebar-nav a svg, .sidebar-nav a i {
    transition: color 0.22s ease, transform 0.22s ease;
}
.sidebar-nav a:hover svg, .sidebar-nav a:focus svg, .sidebar-nav a:hover i, .sidebar-nav a:focus i {
    color: #23283a;
}

/* Hover underline animation (keeps links fixed; indicator remains the primary mover) */
.sidebar-nav a {
    position: relative; /* for pseudo-element underline */
    overflow: visible;
}
.sidebar-nav a::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -6px;
    height: 2px;
    background: #e6fbff;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 220ms cubic-bezier(.2,.8,.2,1), opacity 160ms ease;
    opacity: 0.0;
}
.sidebar-nav a:hover::after, .sidebar-nav a:focus::after {
    transform: scaleX(1);
    opacity: 1.0;
}
.sidebar-nav a:hover, .sidebar-nav a:focus {
    color: #ffffff;
}

/* Style pour le lien actif dans la navigation */
.sidebar-nav a.active {
    /* Don't apply hover-style when active from scroll; keep link appearance stable.
       The moving indicator shows the active section visually. */
    background: transparent;
    color: inherit;
    font-weight: 600;
}

/* Animated moving indicator behind the active sidebar link */
.sidebar-nav .sidebar-indicator {
    position: absolute;
    left: 8px;
    width: calc(100% - 16px);
    height: 36px; /* valeur de base, sera mise à jour par JS */
    background: linear-gradient(90deg,#00bcd4,#0097a7);
    border-radius: 8px;
    transform: translateY(0);
    transition: transform 300ms cubic-bezier(.2,.8,.2,1), height 200ms ease, opacity 200ms ease;
    z-index: 1;
    pointer-events: none;
    opacity: 0; /* start hidden, JS will show it when appropriate */
}
.sidebar-nav a { position: relative; z-index: 2; }

.content {
    margin-left: 250px;
    width: calc(100vw - 250px);
    min-height: 100vh;
    background: #181c24;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

main {
    max-width: 100vw;
        margin: 2rem 2vw 10px calc(4vw + 2px);
    padding: 2.5rem 1vw;
    background: #23283a;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.13);
    min-height: 85vh;
}

@media (max-width: 1300px) {
    main {
        max-width: 100vw;
        margin-top: 1.5rem;
        margin-bottom: 10px;
        margin-left: calc(3vw + 2px);
        margin-right: 1vw;
        padding-left: 1vw;
        padding-right: 1vw;
    }
}

@media (max-width: 900px) {
    main {
        max-width: 100vw;
        margin-left: 0.5vw;
        margin-right: 0.5vw;
        padding-left: 0.5vw;
        padding-right: 0.5vw;
    }
}

.section {
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(.4,0,.2,1), transform 0.8s cubic-bezier(.4,0,.2,1);
    text-align: center;
}
.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    animation: fadeInDown 1.2s;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}
.highlight {
    color: #00bcd4;
    font-weight: bold;
    background: linear-gradient(90deg, #23283a 60%, #181c24 100%);
    border-radius: 4px;
    padding: 0 4px;
}

.skills-section {
    margin-top: 1.5rem;
}
.skills-list {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}
.skill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    color: #e6e6e6;
}
.skill img {
    width: 48px;
    height: 48px;
    margin-bottom: 0.2rem;
    filter: brightness(0.9) drop-shadow(0 0 2px #00bcd4);
}

.projects-section {
    margin-top: -3rem;
}
.projects-section .projets-list {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: -10rem;
}
/* Réduire l'espace au-dessus du titre Projects */
.projects-section h2 {
    margin-top: 0;
}

/* Sur desktop, descendre légèrement le titre "Projets récents" pour le placer sous les logos */
@media (min-width: 900px) {
    .projects-section h2 {
        margin-top: 4rem !important;
    }
}

/* Règle très spécifique pour forcer le déplacement sur desktop si d'autres règles écrasent */
@media (min-width: 900px) {
    .content .projects-section h2 {
        margin-top: 4rem !important;
        padding-top: 0 !important;
    }
}

/* Force encore plus le titre vers le bas sur desktop */
@media (min-width: 900px) {
    .content .projects-section h2 {
    position: relative !important;
    top: 4rem !important;
        margin-top: 0 !important;
    }
}
.card {
    
    
    border-radius: 12px;
    padding: 1.2rem 1rem;
    flex: 1 1 220px;
    min-width: 220px;
    max-width: 260px;
    
    transition: transform 0.25s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
    text-align: left;
    color: #e6e6e6;
}
.card:hover {
    transform: translateY(-8px) scale(1.03);
    
    border-color: #b2ebf2;
}

.contact-section form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 350px;
    margin: 0 auto;
}
input, textarea {
    padding: 0.6rem;
    border: 1px solid #00bcd4;
    border-radius: 6px;
    font-size: 1rem;
    background: #23283a;
    color: #e6e6e6;
    transition: border 0.2s;
}
input:focus, textarea:focus {
    border: 1.5px solid #b2ebf2;
    outline: none;
}

/* Contact textarea: only allow vertical resizing and keep fixed left/right width */
.contact-section textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    resize: vertical; /* user can resize only vertically */
    min-height: 160px;
    overflow: auto;
}

/* Espace entre le champ message et le bouton envoyer */
.contact-section textarea {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .contact-section textarea {
        margin-bottom: 1.2rem;
    }
}
button {
    background: linear-gradient(90deg, #00bcd4 60%, #0097a7 100%);
    color: #fff;
    border: none;
    padding: 0.85rem;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 1px;
    transition: background 0.2s, transform 0.2s;
}
button:hover {
    background: linear-gradient(90deg, #0097a7 60%, #00bcd4 100%);
    transform: scale(1.04);
}

footer {
    text-align: center;
    padding: 1.2rem 0;
    background: none;
    color: #b2ebf2;
    margin-top: 2.5rem;
    border-radius: 0 0 16px 16px;
    box-shadow: none;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .content {
        margin-left: 200px;
        width: calc(100vw - 200px);
    }
    .sidebar {
        width: 200px;
        padding: 2rem 0.5rem 1rem 0.5rem;
    }
    main {
        padding: 1rem 0.5rem;
    }
    .projects-section .projets-list {
        .main-block, .main-content, .profile-section {
            max-width: 1100px;
            margin: 40px auto 0 auto;
            background: #1b2232;
            border-radius: 20px;
            box-shadow: 0 2px 16px 0 #00000030;
            padding: 40px 50px 30px 50px;
        }

        @media (max-width: 1200px) {
            .main-block, .main-content, .profile-section {
                max-width: 98vw;
                padding-left: 15px;
                padding-right: 15px;
            }
        }

        @media (max-width: 768px) {
            .main-block, .main-content, .profile-section {
                max-width: 100vw;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
        justify-content: flex-start;
        align-items: center;
        min-height: unset;
        height: auto;
        box-shadow: none;
        padding: 1rem 0.5rem;
    }
    .sidebar-avatar {
        width: 64px;
        height: 64px;
        margin-bottom: 0;
        margin-right: 1rem;
        margin-top: 12px !important; /* force avatar slightly down on mobile */
    }
    .sidebar-title {
        font-size: 1.1rem;
        margin-bottom: 0;
        margin-right: 1rem;
    }
    .sidebar-nav {
        flex-direction: row;
        gap: 0.7rem;
        width: auto;
    }
    .content {
        margin-left: 0;
        width: 100vw;
    }
    main {
        padding: 0.5rem;
    }
    .projects-section .projets-list {
        flex-direction: column;
        align-items: center;
    }
    .card {
        min-width: 100%;
        max-width: 100%;
    }
    .skills-list {
        gap: 1rem;
    }
}

/* Smaller scroll-to-top button on mobile devices */
@media (max-width: 768px) {
    #scrollToTopBtn {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.4rem !important;
    bottom: 34px !important; /* légèrement plus haut */
    right: 24px !important; /* se décale un peu vers la gauche */
        box-shadow: 0 1px 6px rgba(0,0,0,0.12) !important;
    }
    #scrollToTopBtn svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* Ensure sections scroll below the fixed mobile top nav */
    section[id] {
        scroll-margin-top: 96px; /* height of .mobile-top-nav (80px) + small gap */
    }
}

/* Extra-small screens: slightly smaller */
@media (max-width: 480px) {
    #scrollToTopBtn {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
    bottom: 30px !important; /* légèrement plus haut */
    right: 20px !important; /* se décale un peu vers la gauche */
    }
    #scrollToTopBtn svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* Extra-small screens: slightly smaller radius and remove image borders to save vertical space */
@media (max-width: 480px) {
    .projet.card, .project-image {
        border-radius: 10px !important;
        overflow: hidden !important;
    }
    /* Re-enable decorative border on project images for mobile as requested */
    .projet.card img, .project-image {
        border: 3px solid #00bcd4 !important;
        box-sizing: border-box !important;
    }
}

/* Mobile: unify border-radius and ensure cards/images are clipped to their rounded corners */
@media (max-width: 768px) {
    /* Apply consistent rounded corners and clipping for project cards and images */
    .projet.card, .project-image {
        border-radius: 12px !important;
        overflow: hidden !important; /* ensure child images don't spill outside rounded corners */
    }

    /* Make sure the actual img elements also respect the radius and display as block */
    .projet.card img {
        border-radius: 12px !important;
        display: block !important;
    }

    /* Slightly smaller nudge on extra-small screens */
    @media (max-width: 480px) {
        .projects-section h2 {
            transform: translateX(10px) !important; /* slightly smaller nudge on extra-small */
        }
    }
}

/* Prevent double-tap zoom on project images on mobile while preserving pinch zoom */
@media (max-width: 768px) {
    .projects-section .project-image,
    .projects-section .projet.card img {
        /* Hint browsers that taps are for interaction, not zoom */
        touch-action: manipulation !important;
        -ms-touch-action: manipulation !important;
        /* Avoid long-press/selection that can trigger zoom UI on some browsers */
        -webkit-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        /* Remove tap highlight for a cleaner feel */
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
}

