html {
    scroll-behavior: smooth;
}

:root {
    /* Couleurs Principales */
    --mainbg: aliceblue;
    --secondbg: #292929;
    --main: #333; /* Noir plus doux */
    --second: white;
    --accent: #5dade2;
    --gold-project: #b7950b;

    /* Couleurs Tags */
    --devbg: #fcf3cf; --dev: #b7950b;
    --gestionbg: #d5f5e3; --gestion: #148f77;
    --commbg: #f8bbd0; --comm: #d81b60;
    --anglaisbg: #e1bee7; --anglais: #8e24aa;
    --autrebg: #eaeded; --autre: #717d7e;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--mainbg);
    overflow-x: hidden;
    font-family: "Poppins", sans-serif;
    color: var(--main);
}

/* --- 1. HEADER GLASSMORPHISM --- */
header {
    position: fixed;
    top: 0;
    height: 70px;
    width: 100%;
    /* Effet Verre */
    background: rgba(41, 41, 41, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.logo {
    color: var(--second);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

/* Navigation Menu */
.nav-menu ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.nav-menu ul li a {
    color: var(--second);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    position: relative;
    padding: 5px 0;
    transition: color 0.3s;
}

/* Animation Hover (Underline) */
.nav-menu ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent);
    transition: width 0.3s ease-in-out;
}

.nav-menu ul li a:hover,
.nav-menu ul li a.active-link, .nav-menu ul li a:focus {
    color: var(--accent);
}

.nav-menu ul li a:hover::after,
.nav-menu ul li a.active-link::after {
    width: 100%;
}

/* Burger Menu (Hidden by default) */
.burger-menu {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--second);
    border-radius: 5px;
    transition: all 0.3s ease;
}

/* Responsive Navigation */
@media screen and (max-width: 900px) {
    .burger-menu {
        display: flex;
        z-index: 101;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%; /* Pleine largeur sur mobile */
        height: 100vh;
        background: rgba(41, 41, 41, 0.98);
        backdrop-filter: blur(15px);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        z-index: 100;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu ul {
        flex-direction: column;
        align-items: center;
        gap: 40px;
    }

    .nav-menu ul li a {
        font-size: 1.5rem;
    }

    /* Animation Burger to Cross */
    .burger-menu.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .burger-menu.active .bar:nth-child(2) {
        opacity: 0;
    }

    .burger-menu.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* --- 2. BOUTON RETOUR EN HAUT --- */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s ease;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    background-color: #3498db;
    transform: scale(1.1);
}

/* --- 3. HERO SECTION (Image principale) --- */
.image {
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(../media/imageNature.jpeg);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    padding-top: 30vh;
    padding-bottom: 10vh;
    text-align: center;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-top {
    margin-bottom: 10vh;
}

.scroll-container {
    width: 90%;
    max-width: 500px;
    height: 70px;
    margin-bottom: 50px;
    overflow: hidden;
    display: flex;
    align-items: center;
    mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
}

.scroll-track {
    display: flex;
    width: max-content;
    animation: scroll 15s linear infinite;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.scroll-texts {
    color: var(--second);
    min-width: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    white-space: nowrap;
}

.image a { display: inline-block; margin-top: 20px; }
.scroll { filter: invert(100%); width: 3rem; animation: bump 2s ease-in-out infinite; transition: 0.3s; }
.scroll:hover { transform: scale(1.1); }
@keyframes bump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }

/* --- 4. MAIN LAYOUT & SECTIONS (Glassmorphism) --- */
main {
    margin: 0;
}

.main {
    max-width: 1400px;
    margin: 80px auto 50px;
}

#topic:target, #exp-studies:target, #experiences:target, #skills:target, #projects:target { scroll-margin-top: 90px; }

/* Sections avec effet Glass */
section {
    display: flex;
    flex-direction: column;
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 20px;

    /* Glassmorphism settings */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Animation Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Effet global sur les sections (sauf Projets) */
section:not(.projects):hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    background: rgba(255, 255, 255, 0.9);
}

section .title, .separator {
    border-bottom: 3px solid var(--accent);
    width: 100%;
    margin-bottom: 30px;
    padding-bottom: 15px;
    text-align: left;
}

h1 { margin: 0; font-size: 1.8rem; font-weight: 700; color: var(--accent); }
h3 { font-weight: 600; color: var(--accent); }

section .paragraph { width: 100%; text-align: justify; line-height: 1.8; font-size: 1rem; color: #444; }

/* Listes et Tags */
section ul { list-style: none; padding: 0; }
ul.tags { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0 20px 0; }
ul.tags li { padding: 6px 14px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

ul.tags li.dev { color: var(--dev); background-color: var(--devbg); }
ul.tags li.gestion { color: var(--gestion); background-color: var(--gestionbg); }
ul.tags li.comm { color: var(--comm); background-color: var(--commbg); }
ul.tags li.ang { color: var(--anglais); background-color: var(--anglaisbg); }
ul.tags li.autre { color: var(--autre); background-color: var(--autrebg); }


/* --- 4bis. STUDY ITEMS & LOGOS --- */
.study-list {
    list-style: none;
    padding: 0;
}

.study-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.study-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.study-logo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 3px solid var(--accent);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.study-logo img {
    width: 75%;
    height: auto;
    object-fit: contain;
}

.study-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.study-content {
    flex-grow: 1;
}

.study-date {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
    color: var(--main);
}

@media screen and (max-width: 600px) {
    .study-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .study-content ul.tags {
        justify-content: center;
    }
}


/* --- 5. PROJETS (GRID) --- */
.legend, .legend .tags {
    display: flex;
    flex-direction: column;
    align-items: center;
}

section.projects div.cards {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

article.card {
    background: white;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: 0.3s;
    box-sizing: border-box;
    border: 1px solid rgba(0,0,0,0.03);
}

article.card img {
    border-radius: 10px;
    width: 100%;
    height: 180px;
    object-fit: cover;
    margin-bottom: 15px;
    transition: transform 0.5s ease;
}

article.card img.forceleft { object-position: left; }
article.card:hover img { transform: scale(1.02); }
article.card h3 { margin-top: 0; }
article.card p { flex-grow: 1; margin-bottom: 20px; font-size: 0.95rem; }

article.card.projContainer:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    cursor: pointer;
}

article.card#gold { border: 2px solid var(--gold-project); position: relative; overflow: hidden; }
article.card#gold::before { content: "★"; position: absolute; top: 10px; right: 10px; color: var(--gold-project); font-size: 20px; }

/* --- 6. COMPETENCES (ICON GRID) --- */
.skills .paragraph {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    padding: 20px 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.skill-card {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.icon-box {
    position: relative;
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 35px;
    color: #333;
    z-index: 2;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#skills { position: relative; z-index: 50; }
#projects { position: relative; z-index: 1; }

.content.glass {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    width: 220px;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
    pointer-events: none;
    transition: 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.skill-card:hover .icon-box, .skill-card:active .icon-box {
    color: white;
    background: var(--clr);
    box-shadow: 0 0 25px var(--clr);
    transform: scale(1.15);
}
.skill-card:hover .content.glass, .skill-card:active .content.glass {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 65px) scale(1);
}
.content h3 { font-size: 1rem; margin: 0 0 5px; color: var(--main); }
.content p { font-size: 0.8rem; color: #555; margin: 0; }

/* --- 6bis. CONTACT ---*/
.contact-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 50px;
    padding: 20px;
}

.contact-photo img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--second);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.contact-photo img:hover { transform: scale(1.05) rotate(3deg); }

.contact-details h2 { margin: 0 0 10px 0; font-size: 2rem; color: var(--accent); }
.contact-details p { margin: 0 0 20px 0; font-size: 1.1rem; color: #555; font-weight: 500; }
.contact-details { width: 550px; }

.social-links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: flex-start; }

.social-links a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 50px;
    max-width: 50px;
    height: 50px;
    background-color: var(--second);
    border-radius: 50px;
    text-decoration: none;
    color: var(--main);
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: max-width 0.5s ease, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.social-links a i { min-width: 50px; display: flex; justify-content: center; align-items: center; }

.social-links a .link-text {
    opacity: 0;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 500;
    padding-right: 0;
    transition: opacity 0.3s ease 0.1s, padding-right 0.3s ease;
}

.social-links a:hover {
    max-width: 300px;
    background-color: var(--accent);
    color: white;
    box-shadow: 0 10px 20px rgba(93, 173, 226, 0.4);
}

.social-links a:hover .link-text { opacity: 1; padding-right: 20px; }

/* --- 7. FOOTER --- */
footer {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--secondbg);
    color: #888;
    width: 100%;
    padding: 20px 0;
    font-size: 0.85rem;
}
footer a { color: var(--accent); text-decoration: none; transition: 0.3s; }
footer a:hover { color: white; }

/* --- 8. LOADER STYLE --- */
.banter-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
}

.pl { width: 6em; height: 6em; }
.pl__ring { animation: ringA 2s linear infinite; }
.pl__ring--a { stroke: #f42f25; }
.pl__ring--b { animation-name: ringB; stroke: #f49725; }
.pl__ring--c { animation-name: ringC; stroke: #255ff4; }
.pl__ring--d { animation-name: ringD; stroke: #f42582; }

@keyframes ringA {
    from, 4% { stroke-dasharray: 0 660; stroke-width: 20; stroke-dashoffset: -330; }
    12% { stroke-dasharray: 60 600; stroke-width: 30; stroke-dashoffset: -335; }
    32% { stroke-dasharray: 60 600; stroke-width: 30; stroke-dashoffset: -595; }
    40%, 54% { stroke-dasharray: 0 660; stroke-width: 20; stroke-dashoffset: -660; }
    62% { stroke-dasharray: 60 600; stroke-width: 30; stroke-dashoffset: -665; }
    82% { stroke-dasharray: 60 600; stroke-width: 30; stroke-dashoffset: -925; }
    90%, to { stroke-dasharray: 0 660; stroke-width: 20; stroke-dashoffset: -990; }
}

@keyframes ringB {
    from, 12% { stroke-dasharray: 0 220; stroke-width: 20; stroke-dashoffset: -110; }
    20% { stroke-dasharray: 20 200; stroke-width: 30; stroke-dashoffset: -115; }
    40% { stroke-dasharray: 20 200; stroke-width: 30; stroke-dashoffset: -195; }
    48%, 62% { stroke-dasharray: 0 220; stroke-width: 20; stroke-dashoffset: -220; }
    70% { stroke-dasharray: 20 200; stroke-width: 30; stroke-dashoffset: -225; }
    90% { stroke-dasharray: 20 200; stroke-width: 30; stroke-dashoffset: -305; }
    98%, to { stroke-dasharray: 0 220; stroke-width: 20; stroke-dashoffset: -330; }
}

@keyframes ringC {
    from { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: 0; }
    8% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -5; }
    28% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -175; }
    36%, 58% { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: -220; }
    66% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -225; }
    86% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -395; }
    94%, to { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: -440; }
}

@keyframes ringD {
    from, 8% { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: 0; }
    16% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -5; }
    36% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -175; }
    44%, 50% { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: -220; }
    58% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -225; }
    78% { stroke-dasharray: 40 400; stroke-width: 30; stroke-dashoffset: -395; }
    86%, to { stroke-dasharray: 0 440; stroke-width: 20; stroke-dashoffset: -440; }
}

/* --- 9. RESPONSIVE MOBILE --- */
@media screen and (max-width: 768px) {
    main { margin: 70px 15px 30px; }
    section { padding: 25px 20px; }
    .scroll-texts { font-size: 28px; min-width: 200px; }
    .skill-card:hover .content.glass { width: 260px; z-index: 100; transform: translate(-50%, 60px) scale(1); }
    h1 { font-size: 1.5rem; }
    .contact-content { flex-direction: column; text-align: center; gap: 20px; }
    .contact-details { width: auto; }
    .social-links { justify-content: center; }
}

.hidden { display: none; }

.old, .mentionsLegales {
    max-width: 1400px;
    margin: 100px auto 0;
    padding: 0 40px 50px;
    min-height: calc(100vh - 130px);
}

.old section, .mentionsLegales section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
}

.main-back {
    display: inline-block;
    margin-top: 20px;
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.main-back:hover {
    background-color: #3498db;
    transform: scale(1.05);
}

/* --- 10. POPUP STYLE --- */
.popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; }

.popup-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.popup-card {
    position: relative;
    width: 80%; height: 80%;
    background: rgba(41, 41, 41, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) rgba(255, 255, 255, 0.1);
}

.popup-card::-webkit-scrollbar { width: 8px; }
.popup-card::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 0 20px 20px 0; }
.popup-card::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

.popup-image-container {
    width: 100%; height: 80%;
    position: relative;
    flex-shrink: 0;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-image-container img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.popup-content { padding: 40px; color: white; display: flex; flex-direction: column; gap: 20px; }
.popup-content h2 { margin: 0; font-size: 2.5rem; color: var(--accent); }
.popup-content h3 { margin: 0; font-size: 1.2rem; font-style: italic; color: #ccc; font-weight: 400; }
.popup-desc { line-height: 1.8; font-size: 1.1rem; color: #eee; text-align: justify; }

.popup-actions { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 10px; }

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--accent);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    width: fit-content;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.close-popup-btn, .main-back { background-color: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }
.close-popup-btn:hover, .main-back:hover { background-color: rgba(255, 255, 255, 0.2) !important; }
.popup-link:hover { background-color: #3498db; transform: scale(1.05); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media screen and (max-width: 900px) {
    .popup-card { width: 95%; height: 90%; }
    .popup-content { padding: 25px; }
    .popup-content h2 { font-size: 1.8rem; }
}
