/* =========================================================
   VARIABLES
========================================================= */

:root {
    --purple-950: #17121f;
    --purple-900: #21182d;
    --purple-800: #30203f;
    --purple-700: #43285a;
    --purple-500: #7650a8;

    --orange: #f28c28;
    --yellow: #ffd166;

    --white: #ffffff;
    --off-white: #f5f2f8;
    --text-dark: #21182d;
    --text-light: #f5f2f8;
    --text-muted: #c9bfd2;

    --border-dark: #4b3a58;
    --border-light: #d8d0df;

    --max-width: 1180px;
    --content-width: 760px;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 7rem;
}


/* =========================================================
   RESET
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    background: var(--off-white);
    color: var(--text-dark);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 18px;
    line-height: 1.65;

    overflow-x: hidden;
}

img {
    display: block;
    width: 100%;
    height: auto;
}

a {
    color: inherit;
}


/* =========================================================
   ACCESSIBILITY
========================================================= */

:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 4px;
}


/* =========================================================
   CONTAINER
========================================================= */

.container {
    width: min(calc(100% - 3rem), var(--max-width));
    margin: 0 auto;
}

.container.narrow {
    max-width: var(--content-width);
}


/* =========================================================
   HEADER
========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: var(--purple-950);
    color: var(--white);

    border-bottom: 1px solid var(--border-dark);
}

.header-inner {
    min-height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-name {
    color: var(--white);

    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;

    text-decoration: none;
}

.header-link {
    color: var(--yellow);

    font-size: 0.9rem;
    font-weight: 700;

    text-decoration: none;
}

.header-link:hover {
    text-decoration: underline;
}


/* =========================================================
   HERO
========================================================= */

.hero {
    background: var(--purple-950);
    color: var(--white);

    padding: 7rem 0 6rem;
}

.eyebrow {
    color: var(--yellow);

    font-size: 0.82rem;
    font-weight: 800;

    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 850px;

    margin-top: 1rem;

    font-size: clamp(3.5rem, 9vw, 7.5rem);
    line-height: 0.95;
    letter-spacing: -0.055em;
}

.hero-intro {
    max-width: 720px;

    margin-top: 2rem;

    color: var(--text-muted);

    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
    line-height: 1.45;
}

.hero-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.hero-gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.hero-media iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
    display: block;
}


.project-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 1px;

    margin-top: 4rem;

    border: 1px solid var(--border-dark);
}

.project-meta > div {
    min-height: 125px;

    padding: 1.25rem;

    background: var(--purple-900);

    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meta-label {
    color: var(--yellow);

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.1em;
}

.hero-media {
    margin-top: 4rem;

    border: 1px solid var(--border-dark);

    background: var(--purple-900);
}

.hero-media img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}


/* =========================================================
   TABLE OF CONTENTS
========================================================= */

.toc {
    position: sticky;
    top: 68px;

    z-index: 90;

    background: var(--white);

    border-bottom: 1px solid var(--border-light);
}

.toc .container {
    min-height: 70px;

    display: flex;
    align-items: center;
    gap: 2rem;

    overflow-x: auto;
}

.toc-title {
    flex: 0 0 auto;

    color: var(--purple-700);

    font-size: 0.7rem;
    font-weight: 900;

    letter-spacing: 0.1em;
}

.toc-links {
    display: flex;
    gap: 1.5rem;

    white-space: nowrap;
}

.toc a {
    color: var(--text-dark);

    font-size: 0.82rem;
    font-weight: 700;

    text-decoration: none;
}

.toc a:hover {
    color: var(--orange);
}


/* =========================================================
   SECTIONS
========================================================= */

.section {
    padding: var(--space-xl) 0;
}

.section-dark {
    background: var(--purple-950);
    color: var(--text-light);
}

.section-purple {
    background: var(--purple-800);
    color: var(--white);
}

.section-orange {
    background: var(--orange);
    color: var(--purple-950);
}

.section-number {
    margin-bottom: 1.5rem;

    color: var(--orange);

    font-size: 0.75rem;
    font-weight: 900;

    letter-spacing: 0.12em;
}

.section-dark .section-number,
.section-purple .section-number {
    color: var(--yellow);
}

.section-orange .section-number {
    color: var(--purple-950);
}

.section h2 {
    max-width: 850px;

    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.02;

    letter-spacing: -0.04em;
}

.section h3 {
    font-size: 1.5rem;
    line-height: 1.2;
}

.lead {
    max-width: 760px;

    margin-top: 2rem;

    font-size: 1.35rem;
    line-height: 1.5;
}

.body-text {
    max-width: 720px;

    margin-top: 1.5rem;
}

.max-width {
    max-width: 760px;
}


/* =========================================================
   TWO COLUMN
========================================================= */

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);

    gap: 6rem;

    align-items: start;
}


/* =========================================================
   LIST
========================================================= */

.feature-list {
    margin-top: 1.5rem;
    padding-left: 1.5rem;
}

.feature-list li {
    margin-bottom: 0.35rem;
}


/* =========================================================
   LOOP
========================================================= */

.loop {
    margin-top: 4rem;

    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr;

    align-items: stretch;

    border-top: 1px solid var(--border-dark);
    border-bottom: 1px solid var(--border-dark);
}

.loop-step {
    padding: 2rem 1.25rem;
}

.loop-step span {
    display: block;

    margin-bottom: 1rem;

    color: var(--yellow);

    font-size: 0.75rem;
    font-weight: 900;
}

.loop-step strong {
    display: block;

    font-size: 1.15rem;
}

.loop-step p {
    margin-top: 0.5rem;

    color: var(--text-muted);

    font-size: 0.9rem;
    line-height: 1.45;
}

.loop-arrow {
    display: flex;
    align-items: center;

    color: var(--orange);

    font-size: 1.5rem;
}


/* =========================================================
   DESIGN CHAIN
========================================================= */

.design-chain {
    margin-top: 3rem;

    padding: 1.5rem;

    background: var(--purple-900);

    border-left: 5px solid var(--orange);

    text-align: center;
}

.design-chain div {
    color: var(--white);

    font-size: 0.8rem;
    font-weight: 900;

    letter-spacing: 0.05em;
}

.design-chain span {
    display: block;

    margin: 0.5rem;

    color: var(--yellow);
}


/* =========================================================
   MEDIA
========================================================= */

.media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 2rem;

    margin-top: 5rem;
}

.media-card {
    margin: 0;
}

.media-card img {
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.media-card figcaption {
    margin-top: 0.75rem;

    font-size: 0.85rem;
    font-weight: 700;
}

.media-large {
    margin-top: 4rem;
    background: var(--purple-900);
}

.media-large img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.media-fit img {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 4rem;
    background: var(--purple-900);
}

.margin-top-large {
    margin-top: 6rem;
}


/* =========================================================
   SYSTEMS
========================================================= */

.systems {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 1px;

    margin-top: 5rem;

    background: var(--border-light);

    border: 1px solid var(--border-light);
}

.system {
    min-height: 250px;

    padding: 2rem;

    background: var(--white);
}

.system-number {
    margin-bottom: 2rem;

    color: var(--orange);

    font-size: 0.8rem;
    font-weight: 900;
}

.system h3 {
    margin-bottom: 0.75rem;
}

.system p {
    color: #4e4554;

    font-size: 1rem;
}


/* =========================================================
   PROCESS
========================================================= */

.process {
    display: grid;
    grid-template-columns: repeat(5, 1fr);

    gap: 1px;

    margin-top: 5rem;

    background: var(--purple-950);

    border: 1px solid var(--purple-950);
}

.process-step {
    min-height: 260px;

    padding: 2rem;

    background: var(--orange);
}

.process-step span {
    display: block;

    margin-bottom: 3rem;

    font-size: 0.75rem;
    font-weight: 900;
}

.process-step h3 {
    margin-bottom: 0.75rem;
}

.process-step p {
    font-size: 0.95rem;
    line-height: 1.5;
}


/* =========================================================
   CONTRIBUTION
========================================================= */

.role-block {
    padding: 1.5rem 0;

    border-bottom: 1px solid var(--border-light);
}

.role-block:first-child {
    padding-top: 0;
}

.role-block h3 {
    margin-bottom: 0.4rem;
}

.role-block p {
    color: #4e4554;
}

.team {
    margin-top: 5rem;

    padding: 2rem;

    background: var(--purple-900);
    color: var(--white);

    border-left: 5px solid var(--orange);
}

.team h3 {
    margin-bottom: 0.75rem;
}

.team p {
    color: var(--text-muted);

    font-size: 0.95rem;
}


/* =========================================================
   FINAL SECTION
========================================================= */

.final-section {
    padding: 8rem 0;

    background: var(--purple-700);
    color: var(--white);

    text-align: center;
}

.final-section .eyebrow {
    color: var(--yellow);
}

.final-section h2 {
    margin-top: 1.5rem;

    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.1;

    letter-spacing: -0.035em;
}

.final-text {
    max-width: 650px;

    margin: 2rem auto 0;

    color: #e1d9e6;
}


/* =========================================================
   FOOTER
========================================================= */

.footer {
    background: var(--purple-950);
    color: var(--white);

    border-top: 1px solid var(--border-dark);
}

.footer-inner {
    min-height: 120px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 2rem;
}

.footer strong,
.footer span {
    display: block;
}

.footer strong {
    font-size: 0.95rem;
}

.footer span {
    margin-top: 0.25rem;

    color: var(--text-muted);

    font-size: 0.85rem;
}

.footer a {
    color: var(--yellow);

    font-size: 0.85rem;
    font-weight: 800;

    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}


/* =========================================================
   SCROLL REVEAL
========================================================= */

.reveal {
    opacity: 0;

    transform: translateY(28px);

    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}

.reveal.is-visible {
    opacity: 1;

    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.08s;
}

.reveal-delay-2 {
    transition-delay: 0.16s;
}

.reveal-delay-3 {
    transition-delay: 0.24s;
}

.reveal-delay-4 {
    transition-delay: 0.32s;
}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;

        transition: none;
    }
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 950px) {

    .project-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .loop {
        grid-template-columns: 1fr;
    }

    .loop-arrow {
        display: none;
    }

    .process {
        grid-template-columns: repeat(2, 1fr);
    }

    .two-column {
        gap: 3rem;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    body {
        font-size: 16px;
    }

    .container {
        width: min(calc(100% - 2rem), var(--max-width));
    }

    .hero {
        padding: 5rem 0 4rem;
    }

    .hero h1 {
        font-size: clamp(3rem, 16vw, 5rem);
    }

    .project-meta {
        grid-template-columns: 1fr;
    }

    .toc {
        position: relative;
        top: auto;
    }

    .toc .container {
        padding: 1rem 0;

        display: block;
    }

    .toc-title {
        display: block;
        margin-bottom: 0.75rem;
    }

    .toc-links {
        overflow-x: auto;

        padding-bottom: 0.25rem;
    }

    .section {
        padding: 5rem 0;
    }

    .two-column {
        grid-template-columns: 1fr;

        gap: 2rem;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    .systems {
        grid-template-columns: 1fr;
    }

    .process {
        grid-template-columns: 1fr;
    }

    .process-step {
        min-height: auto;
    }

    .footer-inner {
        padding: 2rem 0;

        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   Three.js
========================================================= */
#portfolio-experience {
    width: 100%;
    min-height: calc(100vh - 68px);
    background: var(--off-white);
}

#three-scene {
    position: relative;
    width: 100%;
    height: calc(100vh - 68px);
    min-height: 500px;
    overflow: hidden;
    isolation: isolate;
}

#three-scene canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#scene-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 2rem;
    color: var(--purple-950);
    font-weight: 800;
    text-align: center;
}

@media (max-width: 700px) {
    #three-scene {
        height: calc(100vh - 68px);
        min-height: 420px;
    }
}


/* =========================================================
   BANNIÈRES DE L'EXPÉRIENCE
========================================================= */

.portfolio-banner {
    position: absolute;
    z-index: 5;
    top: 12%;
    left: 50%;
    width: min(340px, 80%);
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--yellow);
    color: var(--purple-950);
    border: 3px solid var(--purple-950);
    box-shadow: 5px 5px 0 var(--purple-950);
    text-align: center;
    opacity: 0;
    transform: translate(-50%, -25px) scaleY(0.1);
    transform-origin: top center;
    pointer-events: none;
}

.portfolio-banner strong {
    font-size: 1.5rem;
    font-weight: 900;
}

.portfolio-banner span {
    font-size: 1rem;
    font-weight: 600;
}

.portfolio-banner.is-visible {
    animation: banner-unfurl 0.6s ease-out forwards;
}

@keyframes banner-unfurl {
    0% {
        opacity: 0;
        transform: translate(-50%, -25px) scaleY(0.1);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, 5px) scaleY(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0) scaleY(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .portfolio-banner.is-visible {
        animation: none;
        opacity: 1;
        transform: translate(-50%, 0) scaleY(1);
    }
}


/* Positionnement des trois bannières en haut de l'écran */

#portfolio-experience {
    position: relative;
}

.portfolio-banner {
    top: 24px;
    left: auto;
    width: min(280px, 28%);
    box-sizing: border-box;
    transform: translateY(-25px) scaleY(0.1);
}

.portfolio-banner.is-visible {
    animation: banner-unfurl-positioned 0.6s ease-out forwards;
}

.banner-left {
    left: 3%;
}

.banner-center {
    left: 70%;
    transform: translate(-50%, -25px) scaleY(0.1);
}

.banner-right {
    right: 3%;
}

@keyframes banner-unfurl-positioned {
    0% {
        opacity: 0;
        transform: translateY(-25px) scaleY(0.1);
    }
    70% {
        opacity: 1;
        transform: translateY(5px) scaleY(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

.banner-center.is-visible {
    animation-name: banner-unfurl-center;
}

@keyframes banner-unfurl-center {
    0% {
        opacity: 0;
        transform: translate(-50%, -25px) scaleY(0.1);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, 5px) scaleY(1.05);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0) scaleY(1);
    }
}

@media (max-width: 700px) {
    .portfolio-banner {
        top: 12px;
        width: 31%;
        padding: 0.65rem 0.4rem;
    }

    .portfolio-banner strong {
        font-size: 0.9rem;
    }

    .portfolio-banner span {
        font-size: 0.75rem;
    }

    .banner-left {
        left: 2%;
    }

    .banner-right {
        right: 2%;
    }
}

/* Repli des panneaux au lancement du vol */
.portfolio-banner.is-folding {
    animation: banner-fold-away 0.45s ease-in forwards;
    pointer-events: none;
}

@keyframes banner-fold-away {
    from {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scaleY(0.05);
    }
}

.banner-center.is-folding {
    animation-name: banner-fold-center;
}

@keyframes banner-fold-center {
    from {
        opacity: 1;
        transform: translate(-50%, 0) scaleY(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px) scaleY(0.05);
    }
}


/* =========================================
   PANNEAU DE PRÉSENTATION DES PROJETS
========================================= */

.project-panel {
    display: none;
    position: absolute;
    z-index: 10;
    top: 50%;
    right: 5%;
    transform: translateY(-50%);

    width: min(390px, 35%);
    padding: 24px;

    background: var(--purple-950);
    color: var(--text-light);

    border: 2px solid var(--yellow);
    box-shadow: 8px 8px 0 rgba(23, 18, 31, 0.35);
}

.project-panel h2 {
    margin: 0 0 14px;
    color: var(--yellow);
    font-size: 1.6rem;
    line-height: 1.2;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.project-tags span {
    padding: 4px 9px;
    background: var(--purple-700);
    border: 1px solid var(--purple-500);
    font-size: 0.75rem;
}

.project-panel p {
    margin: 0 0 18px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.project-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.project-images img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--purple-500);
}

.project-button {
    display: block;
    padding: 11px 16px;
    background: var(--orange);
    color: var(--purple-950);
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.2s ease;
}

.project-button:hover {
    background: var(--yellow);
}

@media (max-width: 700px) {
    .project-panel {
        top: auto;
        bottom: 15px;
        right: 5%;
        width: 90%;
        max-height: 55%;
        overflow-y: auto;
        transform: none;
        padding: 16px;
    }
}