:root {
    --bg: rgb(10, 8, 8);
    --text: #ffffff;
    --panel: rgba(12, 10, 14, 0.45);
    --panel-strong: rgba(8, 6, 10, 0.62);
    --panel-hover: rgba(130, 130, 130, 0.40);
    --border: rgba(255, 255, 255, 0.85);
    --border-soft: rgba(255, 255, 255, 0.18);
    --radius: 16px;
    --radius-lg: 28px;

    --c1: #dc6526;
    --c2: #d82b11;
    --c3: #ac1c06;
    --c4: #5a1106;

    --contrast: 3.4;
    --blur: 0.5rem;
}

* {
    box-sizing: border-box;
}

html {
    font-family: "Stack Sans Notch", sans-serif;
    color: var(--text);
    background-color: var(--bg);
    font-weight: 200;
    font-size: clamp(13px, 0.4vw + 11px, 17px);
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    /* La propriété timeline-scope a été supprimée pour éviter le conflit */
}

body {
    margin: 0;
    min-height: 100dvh;
    background-color: var(--bg);
}

a,
a:visited,
a:hover,
a:focus {
    color: var(--text);
    text-decoration: none;
}

img {
    display: block;
}

.background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background-color: var(--bg);
}

.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    will-change: transform;
}

.sphere-1 {
    width: 45vw;
    height: 45vw;
    background: linear-gradient(40deg, rgba(231, 103, 29, 0.85), rgba(94, 16, 4, 0.377));
    top: -10%;
    left: -10%;
    animation: float-1 15s ease-in-out infinite alternate;
}

.sphere-2 {
    width: 50vw;
    height: 50vw;
    background: linear-gradient(240deg, rgba(219, 32, 4, 0.85), rgba(73, 12, 3, 0.4));
    bottom: -20%;
    right: -10%;
    animation: float-2 18s ease-in-out infinite alternate;
}

.sphere-3 {
    width: 35vw;
    height: 35vw;
    background: linear-gradient(120deg, rgba(139, 27, 10, 0.55), rgba(90, 17, 6, 0.40));
    top: 55%;
    left: 18%;
    animation: float-3 20s ease-in-out infinite alternate;
}

.glow {
    position: absolute;
    width: 40vw;
    height: 40vh;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(220, 101, 38, 0.18), transparent 70%);
    filter: blur(30px);
    animation: pulse 8s infinite alternate;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.noise-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

@keyframes float-1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.1); }
}

@keyframes float-2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-10%, -5%) scale(1.15); }
}

@keyframes float-3 {
    0% { transform: translate(0, 0) scale(1); opacity: 0.3; }
    100% { transform: translate(-5%, 10%) scale(1.05); opacity: 0.6; }
}

@keyframes pulse {
    0% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    background-image: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.45) 70%,
        rgba(0, 0, 0, 0) 100%
    );
}

.brand {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 400;
    letter-spacing: 1px;
    white-space: nowrap;
}

.centered-brand {
    text-align: center;
    margin: 0 auto;
}

main {
    position: relative;
    z-index: 1;
}

.section {
    position: relative; /* Ajouté pour contenir la div absolue .content */
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.content {
    position: absolute; /* Rendu absolu pour se caler sur sa propre section, et non sur l'écran */
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    
    /* Fallback (solution de repli) pour Safari et Firefox : tout est visible par défaut */
    opacity: 1;
    visibility: visible;
    filter: none;
    transform: translateY(0);
}

/* L'animation d'apparition s'active UNIQUEMENT si le navigateur la supporte (Chrome, Edge, etc.) */
@supports (animation-timeline: view()) {
    .content {
        opacity: 0;
        visibility: hidden;
        animation: blink linear both;
        animation-timeline: view(); /* Traque l'apparition de l'élément dans la fenêtre */
        will-change: opacity, filter, transform;
    }
}

@keyframes blink {
    0% {
        opacity: 0;
        visibility: hidden;
        filter: blur(var(--blur)) contrast(var(--contrast));
        transform: translateY(40px);
    }
    6% {
        visibility: visible;
    }
    20% {
        opacity: 0.15;
        filter: blur(0.6rem) contrast(2);
        transform: translateY(24px);
    }
    35% {
        opacity: 0.6;
        filter: blur(0.22rem) contrast(1.3);
        transform: translateY(10px);
    }
    45% {
        opacity: 0.96;
        filter: blur(0.03rem) contrast(1.04);
        transform: translateY(3px);
    }
    50% {
        opacity: 1;
        filter: blur(0) contrast(1);
        transform: translateY(0);
    }
    55% {
        opacity: 0.96;
        filter: blur(0.03rem) contrast(1.04);
        transform: translateY(-3px);
    }
    65% {
        opacity: 0.6;
        filter: blur(0.22rem) contrast(1.3);
        transform: translateY(-10px);
    }
    80% {
        opacity: 0.15;
        filter: blur(0.6rem) contrast(2);
        transform: translateY(-24px);
    }
    94% {
        visibility: visible;
    }
    100% {
        opacity: 0;
        visibility: hidden;
        filter: blur(var(--blur)) contrast(var(--contrast));
        transform: translateY(-40px);
    }
}

.content-inner {
    width: min(1400px, 92vw); /* Augmenté pour accueillir confortablement 3 colonnes */
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(6rem, 13vh, 8.5rem) clamp(1rem, 3vw, 2rem) clamp(2.5rem, 7vh, 4rem);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.content-inner::-webkit-scrollbar {
    width: 8px;
}

.content-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.section-title {
    text-align: center;
    margin: 0 0 clamp(1.5rem, 4vh, 3rem);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.section-indicator {
    position: fixed;
    top: 50%;
    right: clamp(14px, 2vw, 30px);
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.section-indicator a {
    position: relative;
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background-color: transparent;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    transition: background-color 450ms ease,
                border-color 450ms ease,
                transform 450ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 450ms ease;
}

.section-indicator a:hover {
    border-color: #ffffff;
    transform: scale(1.18);
}

.section-indicator a.active {
    background-color: var(--c1);
    border-color: var(--c1);
    transform: scale(1.28);
    box-shadow: 0 0 14px var(--c1), 0 0 28px rgba(220, 101, 38, 0.35);
}

.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    flex-wrap: wrap;
}

.hero-text {
    flex: 1 1 420px;
    min-width: 280px;
}

.presentation {
    font-weight: 200;
    font-size: clamp(1.6rem, 3.4vw, 2.8rem);
    line-height: 1.2;
    margin: 0 0 1.5rem;
}

.hero-paras {
    background-color: rgba(255, 255, 255, 0);
    border-radius: 20px;
    padding: clamp(0.8rem, 2vw, 1.4rem);
    transition: background-color 400ms ease;
}

.hero-paras:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

.hero-paras p {
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.55;
    margin: 0 0 0.9rem;
    max-width: 55ch; /* Limite de caractères par ligne sur grand écran */
}

.hero-paras p:last-child {
    margin-bottom: 0;
}

.imagepresentation {
    flex: 0 1 320px;
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 60px 60px 0 0;
    object-fit: cover;
    mask-image: linear-gradient(1deg, rgba(0, 0, 0, 0) 4%, rgba(0, 0, 0, 1) 22%);
}

.projets-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2.2vw, 2rem);
}

.projets-item {
    display: flex;
    flex-direction: column;
    text-align: center;
    overflow: hidden;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--panel-strong);
    backdrop-filter: blur(6px);
    transition: background-color 400ms ease, transform 400ms ease, box-shadow 400ms ease;
}

.projets-item:hover {
    background-color: var(--panel-hover);
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.projets-item article {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.projets-item figure {
    margin: 0;
}

.projets-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.projets-item h2 {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 400;
    padding: 0.9rem 1rem 0.3rem;
    margin: 0;
}

.projets-item h3 {
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    font-weight: 200;
    opacity: 0.85;
    padding: 0 1rem;
    margin: 0.3rem 0 0.8rem;
}

.projets-item .decouvrir {
    margin: auto 1rem 1rem;
}

.projets-item .decouvrir a {
    display: inline-block;
    padding: 0.45rem 1.4rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.4);
    transition: background-color 350ms ease;
}

.projets-item .decouvrir a:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

/* Compétences alignées sur une ligne avec effet Lift */
.competences-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Aligné sur 3 colonnes */
    gap: clamp(1rem, 2vw, 1.6rem);
}

.competences-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--panel-strong);
    backdrop-filter: blur(6px);
    transition: background-color 400ms ease, transform 400ms ease, box-shadow 400ms ease; /* Effets lift ajoutés */
}

.competences-item:hover {
    background-color: var(--panel-hover);
    transform: translateY(-4px); /* Effet Lift */
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); /* Ombre Lift */
}

.competences-item img {
    width: clamp(44px, 5vw, 64px);
    height: auto;
    border-radius: 18px;
    flex-shrink: 0;
}

.competences-item h2 {
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    font-weight: 400;
    margin: 0 0 0.3rem;
}

.competences-item p {
    font-size: clamp(0.85rem, 1.1vw, 0.95rem);
    line-height: 1.45;
    margin: 0;
    opacity: 0.9;
    max-width: 35ch;
}


.grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.8rem, 1.5vw, 1.2rem);
    justify-items: center;
}

.grid-item {
    position: relative;
    width: 100%;
    max-width: 65%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 4px solid rgba(0, 0, 0, 0.6);
    transition: transform 400ms ease, box-shadow 400ms ease;
}

.grid-item:hover {
    transform: translateY(-4px); /* Effet Lift */
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); /* Ombre Lift */
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-item p {
    position: absolute;
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;

    padding: clamp(0.7rem, 3%, 1rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    font-weight: 400;
    color: #fff;
    background-color: rgba(20, 20, 25, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 400ms ease;

    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 100%;
    scrollbar-width: none;
}


.grid-item p::-webkit-scrollbar {
    display: none;
}

.grid-item:hover p {
    opacity: 1;
}

.contact-intro {
    text-align: center;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    line-height: 1.5;
    margin: 0 auto clamp(1.5rem, 4vh, 2.5rem);
    max-width: 640px;
    opacity: 0.92;
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.3rem;
    padding: clamp(1.4rem, 4vw, 2.2rem);
    margin: 0 auto;
    width: 100%;
    max-width: 620px;
    background-color: var(--panel-strong);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
}

form > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

form label {
    width: 100%;
    text-align: center;
    font-size: 1rem;
}

form input[type="email"],
form input[type="text"] {
    width: 100%;
    height: 3rem;
    padding: 0.4rem 0.9rem;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
}

form input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

form input[type="submit"] {
    width: clamp(150px, 40%, 220px);
    height: 3rem;
    margin-top: 0.4rem;
    background-color: transparent;
    color: #fff;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.15rem;
    transition: background-color 400ms ease, transform 250ms ease;
}

form input[type="submit"]:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.page {
    scroll-snap-type: none;
}

.page body {
    padding-top: 6rem;
    padding-bottom: 4rem;
}

.page main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem clamp(1rem, 6vw, 4rem) 4rem;
}

.page main > h1 {
    text-align: center;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    margin: 2rem 0;
}

.projet-card {
    width: 100%;
    max-width: 1000px;
    background-color: var(--panel-strong);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.2rem, 4vw, 2rem);
    backdrop-filter: blur(6px);
}

.projet-card h1 {
    margin: 0 0 1.2rem;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    text-align: center;
    font-weight: 300;
}

.projet-card h2 {
    margin: 1.4rem 0 0.5rem;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 400;
}

.projet-card p {
    margin: 0 0 1rem;
    padding: 0.9rem 1rem;
    line-height: 1.55;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
}

/* --- Styles du Carrousel pour les projets --- */
.carousel-wrapper {
    width: 100%;
    margin-top: 1.5rem;
}

.carousel-container {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-soft);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    height: 65vh; /* Ajuste la hauteur de l'image sur l'écran */
    max-height: 700px;
    object-fit: contain; /* Assure que l'image s'affiche en entier sans être coupée */
    padding: 10px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.6);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 18px;
    cursor: pointer;
    font-size: 1.5rem;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1.05);
}

.carousel-btn.prev {
    left: 15px;
}

.carousel-btn.next {
    right: 15px;
}

.carousel-indicators {
    text-align: center;
    margin-top: 15px;
}

.carousel-indicators .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin: 0 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.carousel-indicators .dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.carousel-indicators .dot.active {
    background: var(--c1);
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .carousel-slide {
        height: 45vh;
    }
    .carousel-btn {
        padding: 8px 12px;
        font-size: 1.2rem;
    }
}

.message-box {
    width: 100%;
    max-width: 720px;
    text-align: center;
    background-color: var(--panel-strong);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(2rem, 6vw, 3.5rem) clamp(1.2rem, 5vw, 2.5rem);
    backdrop-filter: blur(6px);
}

.message-box h1 {
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    font-weight: 300;
    margin: 0 0 1rem;
}

.message-box p {
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    opacity: 0.9;
    margin: 0;
}

/* Responsiveness ajusté pour les nouvelles structures à 3 colonnes */
@media (max-width: 1024px) {
    .projets-list,
    .competences-list,
    .grid {
        grid-template-columns: 1fr 1fr; /* Passage à 2 colonnes sur tablettes */
    }
}

@media (max-width: 768px) {
    .projets-list,
    .competences-list,
    .grid,
    .projet-gallery {
        grid-template-columns: 1fr; /* Pleine largeur sur mobile */
    }

    .hero {
        flex-direction: column-reverse;
        text-align: center;
    }

    .imagepresentation {
        max-width: 230px;
    }

    .section-indicator {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .content {
        animation: none !important;
        position: absolute;
        opacity: 1 !important;
        visibility: visible !important;
        filter: none !important;
        transform: none !important;
    }

    .section {
        height: auto;
        min-height: 100dvh;
    }

    .gradient-sphere,
    .glow {
        animation: none;
    }

    html {
        scroll-snap-type: none;
    }

    .intro-overlay {
        display: none;
    }

    body.intro-active {
        overflow: auto;
    }
}

.particles-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

body.intro-active {
    overflow: hidden;
}

.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: grid;
    place-items: center;
    overflow: hidden;
    transform: translateY(0);
    transition: transform 800ms cubic-bezier(0.76, 0, 0.24, 1);
    will-change: transform;
}

.intro-overlay.intro-sweep {
    transform: translateY(-100%);
}

.intro-sphere {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.intro-sphere canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.intro-name {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
    text-align: center;
    font-family: "Stack Sans Notch", sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 23vw, 30rem);
    line-height: 0.9;
    letter-spacing: -0.04em;
    color: #ffffff;
    mix-blend-mode: difference;
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .intro-overlay {
        display: none;
    }

    body.intro-active {
        overflow: auto;
    }
}

/* --- CORRECTIF D'EMPILEMENT --- */
/* Si le navigateur ne supporte pas l'animation au scroll (ex: Safari, Firefox ancien) */
@supports not (timeline-scope: --section) {
    .content {
        position: absolute !important; /* Retire le 'fixed' qui cause l'empilement */
        opacity: 1 !important;
        visibility: visible !important;
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }
    .section {
        position: relative !important;
    }
}