/* ============================================================
   Design System v2 « Éditorial Cyber » — Eliott Moineau
   Tokens, base, navbar, footer, composants partagés.
   Voir DESIGN.md pour les règles d'usage.
   ============================================================ */

@import url('fonts.css');

/* ── Tokens ── */
:root {
    --paper: #E8E6E1;
    --paper-raised: #F4F3EF;
    --coal: #0B0B0D;
    --coal-raised: #131316;
    --ink: #121214;
    --ink-soft: #57575E;
    --bone: #F2F1ED;
    --bone-soft: #9C9CA4;
    --blue: #3E6FF4;
    --blue-bright: #6FA0FF;
    --line: rgba(18, 18, 20, .16);
    --line-dark: rgba(255, 255, 255, .14);
    --font-display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ── Reset & base ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3.display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.0;
}

/* Pas d'italique synthétique : les <em> deviennent des accents visuels. */
em {
    font-style: normal;
}

/* Accent des titres : mot en contour (fil rouge avec ghost numbers et marquee).
   --em-stroke est basculé sur --bone par les contextes sombres ci-dessous. */
h1 em, h2 em {
    font-style: normal;
    color: transparent;
    -webkit-text-stroke: 1.4px var(--em-stroke, var(--ink));
}

/* Accent des sous-titres display : bleu, sans contour (trop fin à petite taille) */
h3 em, h4 em, .display em {
    font-style: normal;
    color: var(--em-accent, var(--blue));
}

/* Contextes sombres : contour os + accent bleu clair */
.hero, .page-header, .footer, .missions, .innovations,
.project-hero, .project-skills, .about-box, .cta-final,
.experience, .project-media {
    --em-stroke: var(--bone);
    --em-accent: var(--blue-bright);
}

@supports not (-webkit-text-stroke: 1px black) {
    h1 em, h2 em {
        color: var(--em-accent, var(--blue));
    }
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

strong {
    font-weight: 600;
    color: inherit;
}

::selection {
    background: var(--blue);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--paper);
}

::-webkit-scrollbar-thumb {
    background: #B9B7B1;
    border: 3px solid var(--paper);
    border-radius: 8px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ── Kicker (label mono + carré bleu) ── */
.kicker,
.section-number {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .28em;
    color: var(--ink-soft);
    margin-bottom: 20px;
}

.kicker::before,
.section-number::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--blue);
    flex-shrink: 0;
}

/* ── Navbar — pill verre dépoli sombre ── */
.navbar {
    position: fixed;
    top: 16px;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 20px;
    transition: top .3s var(--ease);
}

.navbar.scrolled {
    top: 10px;
}

.navbar-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 10px 12px 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .09);
    background: rgba(11, 11, 13, .62);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    box-shadow: 0 18px 50px -20px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
    transition: background .3s ease, box-shadow .3s ease;
}

.navbar.scrolled .navbar-container {
    background: rgba(11, 11, 13, .82);
}

.navbar-logo {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--bone);
    line-height: 1;
}

.navbar-logo span {
    font-weight: 400;
}

.navbar-logo i {
    font-style: normal;
    color: var(--blue-bright);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--bone-soft);
    padding: 9px 14px;
    border-radius: 999px;
    transition: color .25s ease, background .25s ease;
}

.nav-link:hover {
    color: var(--bone);
    background: rgba(255, 255, 255, .07);
}

.nav-link.active {
    color: var(--bone);
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.nav-contact {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--ink);
    background: var(--bone);
    border: none;
    cursor: pointer;
    padding: 11px 20px;
    border-radius: 999px;
    transition: background .25s ease, color .25s ease, transform .25s ease;
}

.nav-contact:hover {
    background: var(--blue);
    color: #fff;
    transform: translateY(-1px);
}

/* ── En-tête de section éditorial ── */
.section-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 48px;
    margin-bottom: clamp(56px, 8vw, 88px);
}

.section-header h2 {
    font-size: clamp(32px, 5vw, 62px);
    max-width: 14em;
}

.section-header .section-description,
.section-description {
    max-width: 380px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink-soft);
    padding-bottom: 8px;
}

/* Ghost number derrière un en-tête de section (parent: position relative) */
.section-ghost {
    position: absolute;
    top: -0.18em;
    right: -0.04em;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(140px, 24vw, 300px);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px var(--line);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

/* ── Boutons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .14em;
    padding: 17px 28px;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    transition: background .3s ease, color .3s ease, border-color .3s ease, transform .3s ease;
}

.btn::after {
    content: '→';
    font-family: var(--font-mono);
    transition: transform .3s var(--ease);
}

.btn:hover::after {
    transform: translateX(5px);
}

.btn-primary {
    background: var(--ink);
    color: var(--paper-raised);
}

.btn-primary:hover {
    background: var(--blue);
    color: #fff;
}

.btn-light {
    background: var(--bone);
    color: var(--ink);
}

.btn-light:hover {
    background: var(--blue);
    color: #fff;
}

.btn-ghost,
.btn-secondary {
    background: transparent;
    color: inherit;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent);
}

.btn-ghost:hover,
.btn-secondary:hover {
    box-shadow: inset 0 0 0 1px currentColor;
}

/* ── Chips (tags mono, neutres au contexte clair/sombre) ── */
.chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .12em;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
    color: inherit;
    transition: border-color .25s ease, background .25s ease;
}

.chip:hover {
    border-color: currentColor;
}

/* ── Hairline ── */
.hairline {
    border: none;
    border-top: 1px solid var(--line);
}

/* ── Grain photographique (sections sombres) ── */
.grain {
    position: relative;
}

.grain::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    opacity: .08;
    pointer-events: none;
    z-index: 1;
}

.grain > * {
    position: relative;
    z-index: 2;
}

/* ── Marquee ── */
.marquee {
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 22px 0;
    background: var(--paper);
}

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

.marquee-track span {
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: clamp(26px, 4vw, 48px);
    line-height: 1;
    white-space: nowrap;
    padding-right: .6em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(18, 18, 20, .45);
}

.marquee--dark {
    background: var(--coal);
    border-color: var(--line-dark);
}

.marquee--dark .marquee-track span {
    -webkit-text-stroke: 1px rgba(242, 241, 237, .4);
}

@keyframes marquee-scroll {
    to {
        transform: translateX(-50%);
    }
}

/* ── Page header (pages secondaires) ── */
.page-header {
    position: relative;
    padding: 190px 0 88px;
    background: var(--coal);
    color: var(--bone);
    border-bottom: 1px solid var(--line-dark);
    overflow: hidden;
}

.page-header .kicker,
.page-header .section-number {
    color: var(--bone-soft);
}

.page-header h1 {
    font-size: clamp(40px, 7vw, 92px);
    margin-bottom: 28px;
}

.page-header-desc {
    font-size: 17px;
    color: var(--bone-soft);
    max-width: 560px;
    line-height: 1.75;
}

.page-ghost {
    position: absolute;
    top: 90px;
    right: -20px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(160px, 26vw, 320px);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, .1);
    pointer-events: none;
    user-select: none;
}

/* ── Footer éditorial ── */
.footer {
    position: relative;
    background: var(--coal);
    color: var(--bone);
    padding: clamp(88px, 11vw, 140px) 0 40px;
    overflow: hidden;
}

.footer::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    opacity: .08;
    pointer-events: none;
}

.footer .container {
    position: relative;
    z-index: 2;
}

.footer .kicker {
    color: var(--bone-soft);
}

.footer-cta {
    padding-bottom: clamp(56px, 8vw, 96px);
}

.footer-cta h2 {
    font-size: clamp(36px, 7vw, 96px);
    margin-bottom: 36px;
}

.footer-mail {
    font-family: var(--font-mono);
    font-size: clamp(14px, 2.2vw, 20px);
    letter-spacing: .04em;
    color: var(--bone);
    border-bottom: 1px solid var(--line-dark);
    padding-bottom: 8px;
    transition: color .3s ease, border-color .3s ease;
}

.footer-mail:hover {
    color: var(--blue-bright);
    border-color: var(--blue-bright);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line-dark);
    padding-top: 28px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--bone-soft);
}

.footer-links {
    display: flex;
    gap: 28px;
}

.footer-links a {
    color: var(--bone-soft);
    position: relative;
    transition: color .25s ease;
}

.footer-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 1px;
    background: var(--blue-bright);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .3s var(--ease);
}

.footer-links a:hover {
    color: var(--bone);
}

.footer-links a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ── Reveal au scroll ── */
html.js [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .9s var(--ease), transform .9s var(--ease);
}

html.js [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

html.js [data-reveal-delay="2"] { transition-delay: .09s; }
html.js [data-reveal-delay="3"] { transition-delay: .18s; }
html.js [data-reveal-delay="4"] { transition-delay: .27s; }
html.js [data-reveal-delay="5"] { transition-delay: .36s; }
html.js [data-reveal-delay="6"] { transition-delay: .45s; }

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    html.js [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .marquee-track {
        animation: none;
    }

    * {
        animation-duration: .01ms !important;
    }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .navbar {
        top: 10px;
        padding: 0 12px;
    }

    .navbar-container {
        padding: 10px 12px 10px 18px;
        display: grid;
        grid-template-columns: 1fr auto;
        row-gap: 8px;
        border-radius: 24px;
    }

    .navbar-logo {
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }

    .nav-contact {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: center;
        padding: 9px 14px;
        font-size: 10px;
    }

    /* Les 6 liens tiennent sur 2 lignes centrées — plus de troncature ni de scroll */
    .navbar-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 2px;
        padding-top: 2px;
        border-top: 1px solid var(--line-dark);
    }

    .nav-link {
        flex: 0 0 auto;
        font-size: 10px;
        letter-spacing: .11em;
        padding: 7px 9px;
    }

    .page-header {
        padding: 150px 0 64px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* ── Transitions de page (cross-document, progressif) ── */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation-duration: .18s;
}

::view-transition-new(root) {
    animation-duration: .18s;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

/* ── Palette de commandes (js/palette.js) ── */
.nav-palette {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .08em;
    color: var(--bone-soft);
    background: transparent;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    padding: 6px 9px;
    cursor: pointer;
    transition: color .25s ease, border-color .25s ease;
}

.nav-palette:hover {
    color: var(--bone);
    border-color: rgba(255, 255, 255, .32);
}

/* [hidden] doit l'emporter sur le display:flex, sinon l'overlay reste au-dessus
   de la page et intercepte tous les clics (navbar comprise). */
.palette[hidden] {
    display: none;
}

.palette {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: min(16vh, 140px) 20px 20px;
}

.palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 11, 13, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .2s ease;
}

.palette.open .palette-backdrop {
    opacity: 1;
}

.palette-box {
    position: relative;
    width: min(560px, 100%);
    background: var(--coal-raised);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 4px;
    box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .8);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(.985);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.palette.open .palette-box {
    opacity: 1;
    transform: none;
}

.palette-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line-dark);
    outline: none;
    padding: 18px 20px;
    font-family: var(--font-body);
    font-size: 15.5px;
    color: var(--bone);
}

.palette-input::placeholder {
    color: var(--bone-soft);
}

.palette-list {
    max-height: min(46vh, 380px);
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
}

.palette-group {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: var(--bone-soft);
    padding: 12px 12px 6px;
}

.palette-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 3px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--bone);
}

.palette-item.is-sel {
    background: rgba(255, 255, 255, .07);
}

.palette-item-l {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.palette-item-d {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .04em;
    color: var(--bone-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.palette-item-ext {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--bone-soft);
}

.palette-item.is-sel .palette-item-ext {
    color: var(--blue-bright);
}

.palette-foot {
    display: flex;
    gap: 18px;
    border-top: 1px solid var(--line-dark);
    padding: 10px 20px;
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--bone-soft);
}

.palette-foot b {
    font-weight: 500;
    color: var(--bone);
    margin-right: 4px;
}

@media (max-width: 768px) {
    .nav-palette {
        display: none;
    }

    .palette {
        padding: 12vh 12px 12px;
    }
}

/* ── Figures photographiques (composant partagé) ──
   <figure class="figure">
     <div class="figure-frame"><img …></div>
     <figcaption class="figure-caption"><span>Légende</span><span>Lieu — année</span></figcaption>
   </figure>
   Les contextes sombres basculent --fig-line / --fig-caption. */
.figure {
    position: relative;
    margin: 0;
}

.figure-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--fig-line, var(--line));
    border-radius: 2px;
    background: var(--coal-raised);
}

.figure-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(.35) contrast(1.04);
    transition: filter .6s ease, transform 1.4s var(--ease);
}

.figure:hover .figure-frame img,
a:hover .figure-frame img {
    filter: none;
    transform: scale(1.025);
}

.figure-caption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .16em;
    line-height: 1.5;
    color: var(--fig-caption, var(--ink-soft));
}

.figure-caption span:last-child {
    flex-shrink: 0;
    text-align: right;
    opacity: .7;
}

.hero, .page-header, .footer, .missions, .innovations,
.project-hero, .project-skills, .about-box, .cta-final,
.experience, .project-media {
    --fig-line: var(--line-dark);
    --fig-caption: var(--bone-soft);
}

/* ── Carte certification (badge + PDF) ── */
.cert-card {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 28px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 26px 28px;
    background: var(--paper-raised);
    transition: border-color .3s ease;
}

.cert-card:hover {
    border-color: color-mix(in srgb, var(--ink) 45%, transparent);
}

.cert-badge {
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.cert-badge img {
    width: 100%;
    display: block;
}

.cert-body h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 21px;
    letter-spacing: -.01em;
    line-height: 1.15;
    margin-bottom: 8px;
}

.cert-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--ink-soft);
    margin-bottom: 16px;
}

.cert-meta b {
    font-weight: 500;
    color: var(--blue);
}

.cert-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding-bottom: 4px;
    transition: color .25s ease, border-color .25s ease;
}

.cert-link::after {
    content: '↗';
    transition: transform .3s var(--ease);
}

.cert-link:hover {
    color: var(--blue);
    border-color: var(--blue);
}

.cert-link:hover::after {
    transform: translate(3px, -3px);
}

@media (max-width: 480px) {
    .cert-card {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cert-badge {
        width: 96px;
    }
}
