:root {
    --bg: #fafaf7;
    --surface: #ffffff;
    --surface-2: #f2f2ee;
    --text: #16181d;
    --muted: #5b606b;
    --line: #e4e4de;
    --accent: #2f54eb;
    --accent-soft: #e9edff;
    --accent-text: #2440c4;
    --ok: #1f8a5b;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(16, 20, 30, .04), 0 12px 32px -12px rgba(16, 20, 30, .12);
    --max: 1120px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1015;
        --surface: #161920;
        --surface-2: #1d2029;
        --text: #eceef2;
        --muted: #9aa1ae;
        --line: #2a2e38;
        --accent: #6f8cff;
        --accent-soft: #1d2440;
        --accent-text: #9db0ff;
        --ok: #4cc38a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1d2029;
    --text: #eceef2;
    --muted: #9aa1ae;
    --line: #2a2e38;
    --accent: #6f8cff;
    --accent-soft: #1d2440;
    --accent-text: #9db0ff;
    --ok: #4cc38a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }

h1, h2, h3, h4 {
    font-family: "Manrope", "Inter", system-ui, sans-serif;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin: 0 0 .5em;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; letter-spacing: -.035em; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 700; }

.wrap { width: min(var(--max), 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }

/* En-tête */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}

.header .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }

.brand { display: flex; align-items: center; gap: 10px; font-family: "Manrope", sans-serif; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: .85rem; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-size: .94rem; font-weight: 500; padding: 8px 12px; border-radius: 10px; transition: color .2s, background .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

@media (max-width: 860px) {
    .menu-btn { display: grid; }
    .nav {
        display: none;
        position: absolute; top: 68px; left: 0; right: 0;
        flex-direction: column; gap: 0;
        background: var(--bg); border-bottom: 1px solid var(--line);
        padding: 8px 16px 16px;
    }
    .nav.open { display: flex; }
    .nav a { padding: 12px; }
    .theme-btn { margin-left: auto; }
}

/* Boutons */
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 13px 22px; border-radius: 12px;
    font-weight: 600; font-size: .96rem; text-decoration: none;
    border: 1px solid transparent; transition: transform .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); }
.btn svg { width: 18px; height: 18px; }

/* Sections */
section { padding: 96px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }

.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent-text); margin-bottom: 16px;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }

.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.muted { color: var(--muted); }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 48px; flex-wrap: wrap; }
.section-head p { margin: 0; }

/* Accueil */
.hero { padding: 88px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 56px; align-items: center; }
.hero h1 span { color: var(--muted); }
.hero .lead { margin: 24px 0 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.status {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 10px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
    font-size: .88rem; color: var(--muted); margin-bottom: 28px;
}
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }

.id-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
    padding: 28px; box-shadow: var(--shadow);
}
.id-card .avatar {
    width: 72px; height: 72px; border-radius: 20px; margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent), #8a5cf6);
    color: #fff; display: grid; place-items: center;
    font: 800 1.6rem "Manrope", sans-serif;
}
.id-card dl { margin: 0; display: grid; gap: 14px; }
.id-card dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.id-card dd { margin: 2px 0 0; font-weight: 600; }

@media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; gap: 40px; }
    section { padding: 72px 0; }
}

/* Cartes génériques */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 28px;
}
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: 8px; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

/* Projets */
.project {
    display: grid; grid-template-columns: 1.1fr .9fr; gap: 0;
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
    overflow: hidden; text-decoration: none; margin-bottom: 24px;
    transition: border-color .25s, transform .25s, box-shadow .25s;
}
.project:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.project-shot { background: var(--surface-2); padding: 28px 0 0 28px; overflow: hidden; display: flex; align-items: end; min-height: 300px; }
.project-shot img { border-radius: 12px 0 0 0; border: 1px solid var(--line); border-right: 0; border-bottom: 0; object-fit: cover; object-position: top left; width: 100%; height: 100%; max-height: 360px; }
.project-body { padding: 36px; display: flex; flex-direction: column; }
.project-body h3 { font-size: 1.6rem; }
.project-body .more { margin-top: auto; padding-top: 20px; font-weight: 600; color: var(--accent-text); display: inline-flex; gap: 8px; align-items: center; }
.project-body .more svg { width: 18px; transition: transform .2s; }
.project:hover .more svg { transform: translateX(4px); }
.project-shot.diagram { padding: 28px; align-items: center; justify-content: center; }

@media (max-width: 860px) {
    .project { grid-template-columns: 1fr; }
    .project-shot { min-height: 0; order: -1; }
    .project-body { padding: 24px; }
}

.meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
.meta span:not(:last-child)::after { content: "·"; margin-left: 8px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; }
.tags li { font-size: .8rem; font-weight: 500; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Parcours */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 36px 44px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--accent);
}
.timeline li.todo::before { border-style: dashed; border-color: var(--muted); }
.timeline .when { font-size: .85rem; font-weight: 600; color: var(--accent-text); }
.timeline li.todo .when { color: var(--muted); }
.timeline h3 { margin: 4px 0 6px; }
.timeline p { color: var(--muted); margin: 0; }

/* Compétences */
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.skills h3 { font-size: 1rem; margin-bottom: 14px; }
.skills ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: var(--muted); font-size: .95rem; }
@media (max-width: 860px) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .skills { grid-template-columns: 1fr; } }

/* Contact */
.contact {
    background: var(--text); color: var(--bg); border-radius: 28px; padding: clamp(32px, 6vw, 64px);
    display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; align-items: center;
}
.contact .lead { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.contact .btn-primary { background: var(--bg); color: var(--text); }
.contact .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.contact-list a { display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 600; }
.contact-list svg { width: 20px; height: 20px; opacity: .7; flex: none; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }

.footer { padding: 40px 0; color: var(--muted); font-size: .9rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Étude de cas */
.case-hero { padding: 72px 0 48px; }
.back { display: flex; width: fit-content; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: .92rem; margin-bottom: 32px; }
.back:hover { color: var(--text); }
.back svg { width: 16px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 40px; }
.facts div { background: var(--surface); padding: 18px 22px; }
.facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; }
@media (max-width: 760px) { .facts { grid-template-columns: repeat(2, 1fr); } }

.shot { border-radius: 18px; border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); background: var(--surface-2); }
.shot figcaption, figure figcaption { font-size: .88rem; color: var(--muted); padding: 12px 4px 0; }
figure { margin: 0; }
.shots { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; margin: 8px 0 0; }
@media (max-width: 760px) { .shots { grid-template-columns: 1fr; } .shots figure:last-child { max-width: 260px; } }

.case { display: grid; grid-template-columns: 220px 1fr; gap: 48px; padding: 56px 0; border-top: 1px solid var(--line); }
.case > h2 { font-size: 1.35rem; position: sticky; top: 96px; align-self: start; }
.case-body { max-width: 720px; }
.case-body > :last-child { margin-bottom: 0; }
.case-body ul { padding-left: 1.2em; }
.case-body li { margin-bottom: .45em; }
.case-body li::marker { color: var(--accent); }
@media (max-width: 760px) { .case { grid-template-columns: 1fr; gap: 16px; padding: 40px 0; } .case > h2 { position: static; } }

.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 16px 20px; border-radius: 0 12px 12px 0; margin: 20px 0; }
.callout p:last-child { margin: 0; }

.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: step; margin: 8px 0 24px; }
.flow div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; position: relative; }
.flow div::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: .82rem; margin-bottom: 10px; }
.flow strong { display: block; margin-bottom: 4px; }
.flow span { font-size: .88rem; color: var(--muted); line-height: 1.5; display: block; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }

.next { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0 96px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Tableau de synthèse */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 820px; font-size: .92rem; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
thead th.c { text-align: center; width: 9%; }
tbody tr:last-child td { border-bottom: 0; }
td.c { text-align: center; }
td strong { display: block; }
td .muted { font-size: .85rem; }
.yes { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); font-weight: 800; }
.legend { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 32px; font-size: .9rem; color: var(--muted); }
.legend b { color: var(--text); margin-right: 6px; }
@media (max-width: 760px) { .legend { grid-template-columns: 1fr; } }

/* Veille */
.topic { border-top: 1px solid var(--line); padding: 56px 0; }
.topic-head { display: flex; gap: 20px; align-items: start; margin-bottom: 28px; }
.topic-num { flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font: 800 1.2rem "Manrope", sans-serif; }
.topic-head p { margin: 0; color: var(--muted); max-width: 680px; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.points .card { padding: 22px; }
.points h4 { font-size: 1rem; margin-bottom: 6px; }
.points p { font-size: .94rem; color: var(--muted); }
@media (max-width: 860px) { .points { grid-template-columns: 1fr; } }
.sources { margin-top: 20px; font-size: .9rem; color: var(--muted); }
.sources a { color: var(--accent-text); }

/* Apparition au défilement */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .btn, .project { transition: none; }
}

@media print {
    .header, .footer, .hero-actions, .menu-btn, .theme-btn { display: none !important; }
    .reveal { opacity: 1; transform: none; }
    section { padding: 32px 0; }
}
