html {
    --color-primary: #5f6b48;
    --color-secondary: #5f6b482a;

    --font-size-title: 64px;
    --font-size-subtitle: 32px;
    --font-size-text: 18px;

    font-family: 'Barlow';
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    list-style: none;
    text-decoration: none;
    color: black;
}

*::selection {
    background: var(--color-secondary);
}

p,
a {
    font-size: var(--font-size-text);
}

h1 {
    font-size: var(--font-size-subtitle);
}

h2 {
    font-size: var(--font-size-subtitle);
    margin-bottom: 1rem;
    text-align: center;
}

/* NAVBAR */

nav {
    max-height: calc(120px + 1rem);
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 2rem;
    width: calc(100% - 4rem);
    position: fixed;
    top: 0;
    left: 0;
    background-color: white;
    z-index: 10;
    padding: 2rem;
    border-bottom: 1px solid var(--color-primary);

    transition: max-height 0.3s;
}

nav.open {
    max-height: 1000px;
}

.nav {
    width: 100%;
    max-width: calc(768px - 2rem);
    margin: 0 auto;
}


.background {
    display: none;
}

.nav h1 {
    margin-bottom: 1rem;
}

.nav ul {
    margin: 2rem 0;
}

.nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav ul li a {
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    transition: color 0.3s ease-in-out;
}

.nav-line {
    display: block;
    content: "";
    width: 1rem;
    height: 1px;
    background-color: var(--color-primary);
    transition: width 0.3s ease-in-out;
}

.nav ul li a:hover .nav-line,
.nav ul li a.active .nav-line {
    width: 3rem;
    color: black;
}

.nav ul li a:hover,
.nav ul li a.active {
    color: black;
}

.nav-header {
    display: flex;
}

/* --- Bouton burger --- */
.burger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 17px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    z-index: 20;
}

.burger span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger.active span:nth-child(2) {
    opacity: 0;
}

.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* GSAP */
.split {
    position: relative;
    overflow: hidden;
    padding-bottom: 12px;
}

.line {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 6px;
    width: 0%;
    background-color: black;
    z-index: 1;
    margin-bottom: 1rem;
}

/* MAIN */
main {
    margin-top: 116px;
    padding: 2rem;
}

section {
    position: relative;
    scroll-margin: calc(120px + 6rem);
    margin: 4rem 0;
}

.section-content {
    width: 100%;
}

/* ABOUT */
.counter-number {
    color: var(--color-primary);
}

/* PROJECTS */
.projects {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.project {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(114, 129, 85, 0.15);
    border-radius: 1rem;
    transition: all 0.4s ease-in-out;
    overflow: hidden;
    position: relative;
}

.project::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.4) 50%,
            transparent 100%);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.project:hover {
    border: 1px solid rgba(114, 129, 85, 0.15);
    background-color: var(--color-secondary);
    box-shadow: 0px 8px 16px rgba(114, 129, 85, 0.25);
    /*scale: 1.01;*/
}

.project:hover::before {
    left: 125%;
}

.project ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project ul li {
    background-color: var(--color-primary);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 1rem;
}

/* TOOLS */
.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    grid-gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
    padding: 1em 0;
}

.tool {
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px;
    border-radius: 30px;
    position: relative;
    overflow: hidden;
    border: 1px solid #dbdbdb70;
    box-shadow: 0px 0px 10px #dbdbdb70;
    transition: all 0.4s;
}

/* Fond flou derrière */
.tool::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--bg);
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    opacity: 0;
    transform: scale(1.2);
    /* zoom pour éviter les bords flous */
    z-index: 0;
    transition: all 0.4s;
}

.tool:hover::before {
    opacity: 0.5;
}

.tool:hover {
    transform: scale(1.1);
}

/* Image réelle par-dessus */
.tool-image {
    position: relative;
    z-index: 1;
    width: fit-content;
    height: 100%;
    object-fit: contain;
    -webkit-filter: drop-shadow(0px 0px 12px #8a8a8acc);
    filter: drop-shadow(0px 0px 12px #8a8a8acc);
}

.tool-image.horizontal {
    height: fit-content;
    width: 100%;
}

.tool-image.rounded {
    border-radius: 16px;
}

.tooltip {
    position: absolute;
    bottom: 10px;
    left: 50%;
    top: 50%;
    height: fit-content;
    transform: translate(-50%, 0%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.tool:hover .tooltip {
    opacity: 1;
}

/* CONTACTS */
.contacts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact {
    width: fit-content;
    margin: 0 auto;
}

.contact-img {
    display: flex;
    align-items: center;
    color: white;
    background-color: black;
    width: fit-content;
}

.contact-img img {
    width: auto;
    height: 40px;
    border: 2px solid black;
    padding: 1rem;
    background-color: white;
}

.contact-img p {
    color: white;
    border: 3px solid black;
    background-color: black;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    padding: 0 1rem;
}

.contact-img p.subcontact {
    font-size: 12px;
    font-weight: normal;
}

footer {
    margin-top: 4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

a.cta {
    color: var(--color-primary);
    text-decoration: wavy underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: margin 0.2s ease-in-out;
}

a.cta:hover {
    margin: 0 3px;
}

/* Medium devices (landscape tablets) */
@media only screen and (min-width: 768px) {
    body {
        padding: 0 2rem;
        max-width: 768px;
        margin: 0 auto;
    }
}

/* Large devices (laptops/desktops) */
@media only screen and (min-width: 1280px) {
    body {
        padding: 0 4rem;
        max-width: calc(1440px - 8rem);
        margin: 0 auto;
    }

    h1 {
        font-size: var(--font-size-title);
    }

    h2 {
        text-align: left;
    }

    .background {
        display: block;
        width: 200px;
        flex: 1;
        width: auto;
        overflow: hidden;
    }

    .background img {
        height: 100%;
    }

    nav {
        align-items: inherit;
        flex-direction: column;
        width: 500px;
        left: auto;
        height: calc(100vh - 8rem);
        padding: 4rem 0;
        max-height: 1000px;
        border: none;
    }

    .burger {
        display: none;
    }

    main {
        margin-top: 0;
        margin-left: 500px;
    }

    section {
        min-height: 100vh !important;
        margin: 0 1rem;
        scroll-margin: 0;
    }

    #about .section-content,
    #contact .section-content {
        position: absolute;
        transform: translate(-50%, -50%);
        top: 50%;
        left: 50%;
    }

    #projects {
        scroll-margin: 4rem;
        margin: 8rem 1rem;
    }

    #tools {
        scroll-margin: 4rem;
    }

    .contact {
        margin: 0;
    }

    footer {
        text-align: left;
    }
}