:root {
    --color-bg: #fafafa;
    --color-text: #1a1a1a;
    --color-text-secondary: #555;
    --color-subtitle: #666;
    --color-border: #e5e5e5;
    --color-card-bg: #fff;
    --color-accent: #2563eb;
    --color-accent-hover-shadow: rgba(37, 99, 235, 0.1);
    --circle-color: rgb(0, 0, 0);
    --nav-height: 3rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121212;
        --color-text: #e0e0e0;
        --color-text-secondary: #aaa;
        --color-subtitle: #999;
        --color-border: #333;
        --color-card-bg: #1e1e1e;
        --color-accent: #60a5fa;
        --color-accent-hover-shadow: rgba(96, 165, 250, 0.15);
        --circle-color: rgb(255, 255, 255);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* ── Navigation ──────────────────────────────────────────── */

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--color-bg);
    box-shadow: 0 1px 0 var(--color-border);
}

.nav-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-inner a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.2s;
}

.nav-inner a:hover,
.nav-inner a.active {
    color: var(--color-text);
}

.nav-inner a.active {
    font-weight: 600;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    line-height: 1;
    margin-left: auto;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.hero-inner {
    max-width: 800px;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--color-subtitle);
    margin-top: 0.5rem;
}

.hero-links {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.hero-link {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.95rem;
}

.hero-link:hover {
    text-decoration: underline;
}

.hero-sep {
    color: var(--color-border);
}

/* ── Main ────────────────────────────────────────────────── */

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 4rem;
}

section {
    margin-bottom: 3rem;
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

/* ── À propos ────────────────────────────────────────────── */

.bio p {
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

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

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.skill-group h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.skill-pills,
.project-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.skill-pills li,
.project-tags li {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    color: var(--color-text);
}

/* ── Timeline ────────────────────────────────────────────── */

.timeline {
    list-style: none;
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.75rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-1.5rem - 5px);
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-accent);
}

.timeline-item h3 {
    font-size: 1rem;
    font-weight: 600;
}

.timeline-org {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-top: 0.1rem;
}

.timeline-org a {
    color: inherit;
    text-decoration: none;
}

.timeline-org a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.timeline-meta {
    font-size: 0.8rem;
    color: var(--color-subtitle);
    margin-top: 0.1rem;
}

.timeline-period {
    font-size: 0.8rem;
    color: var(--color-subtitle);
    margin-top: 0.15rem;
}

/* ── Cards ───────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card {
    display: block;
    padding: 1.25rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px var(--color-accent-hover-shadow);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ── Projets personnels — sous-sections ──────────────────── */

.subsection-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    margin-top: 1.75rem;
}

#projets > .card-grid {
    margin-bottom: 0;
}

/* ── Footer ──────────────────────────────────────────────── */

footer {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 2.5rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.footer-sep {
    color: var(--color-border);
}

.footer-source {
    color: var(--color-text-secondary);
}

.footer-copyright {
    color: var(--color-subtitle);
}

footer a {
    color: var(--color-accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ── Fond animé ──────────────────────────────────────────── */

.bg-circles {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    color: var(--circle-color);
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--color-bg);
        border-top: 1px solid var(--color-border);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        padding: 0.4rem 0;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        padding: 0.65rem 1.5rem;
        font-size: 0.95rem;
        white-space: normal;
    }
}

/* ── Pages de projet ─────────────────────────────────────── */

.project-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    height: var(--nav-height);
}

.project-header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.project-back {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.project-back:hover {
    text-decoration: underline;
}

.project-type {
    font-size: 0.8rem;
    color: var(--color-subtitle);
    white-space: nowrap;
}

.project-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.project-hero {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2.5rem;
}

.project-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.project-subtitle {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.25rem;
}

.project-meta {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.project-meta a {
    color: var(--color-accent);
    text-decoration: none;
}

.project-meta a:hover {
    text-decoration: underline;
}

.project-body {
    padding-bottom: 3rem;
}

.project-body h2 {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-subtitle);
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

.project-body p {
    color: var(--color-text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.project-figure {
    margin: 2rem 0;
}

.project-figure img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.project-figure figcaption {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--color-subtitle);
    text-align: center;
    font-style: italic;
}

img.lightbox-trigger {
    cursor: zoom-in;
}

/* ── Lightbox ──────────────────────────────────────────────── */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    cursor: default;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
