/* style.css - Style Simple & Épuré avec Sidebar */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --text-main: #111111;
    --text-muted: #666666;
    --border-color: #eaeaea;
    --accent: #0071e3;
}

/* --- 1. RESET ET BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

p {
    text-align: justify;
    text-justify: inter-word;
}

/* Permet un défilement doux quand on clique sur le sommaire */
html {
    scroll-behavior: smooth;
}

/* --- 2. LAYOUT ET CONTENEURS --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

/* Navigation de retour */
.nav-back {
    padding: 20px 0;
    font-size: 0.9rem;
}

.nav-back a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-back a:hover {
    color: var(--text-main);
}

.nav-back span {
    margin-right: 5px;
}

/* --- 3. PAGE D'ACCUEIL (VITRINE) --- */
header.home-header {
    padding: 80px 0 40px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
    text-align: center;
}

header.home-header h1 {
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

header.home-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-align: center;
}

/* Grille des projets (Accueil) */
.projets-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.projet {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.projet:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.projet h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.projet p {
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-grow: 1;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--text-main);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.2s;
    width: fit-content;
}

.button:hover {
    background-color: var(--accent);
}

/* --- 4. PAGE PROJET (AVEC SIDEBAR) --- */
/* En-tête du projet (titre et date) */
.project-header {
    padding: 40px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.project-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.project-header .meta {
    color: var(--text-muted);
}

/* Layout principal pour mettre le sommaire à côté du texte */
.project-detail {
    display: flex;
    gap: 60px;
    padding-top: 40px;
    align-items: flex-start;
}

/* Le Sommaire (Sidebar) */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    /* Garde le sommaire à l'écran au défilement */
    top: 40px;
}

.toc h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 10px;
}

.toc a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: all 0.2s;
    display: block;
    padding-left: 10px;
    border-left: 2px solid transparent;
    /* Ligne invisible par défaut */
}

.toc a:hover {
    color: var(--text-main);
    border-left-color: var(--text-main);
    /* Fait apparaitre une ligne noire au survol */
}

/* Le Corps du Texte */
.content {
    flex: 1;
    /* Prend tout l'espace restant */
    max-width: 800px;
}

.content section {
    margin-bottom: 60px;
}

.content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.content h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
}

.content p {
    margin-bottom: 15px;
    color: #333;
}

.content ul {
    margin: 0 0 20px 20px;
}

.content li {
    margin-bottom: 8px;
}

/* --- 4. FOOTER --- */
footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    margin-top: 60px;
}

footer p {
    text-align: center;
}

/* --- 5. RESPONSIVE MOBILE --- */
@media (max-width: 850px) {

    /* Sur petit écran, le sommaire passe au-dessus du texte */
    .project-detail {
        flex-direction: column;
        gap: 30px;
    }

    .sidebar {
        position: static;
        width: 100%;
        background: var(--card-bg);
        padding: 20px;
        border-radius: 8px;
        border: 1px solid var(--border-color);
    }
}

/* --- IMAGES ET FIGURES --- */

/* L'image s'adapte à la largeur de son conteneur sans jamais le dépasser */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    /* Ajoute des bords légèrement arrondis pour coller à ton design */
    display: block;
    /* Évite les petits espaces blancs sous l'image */
}

/* Style pour les blocs figure */
.content figure {
    margin: 40px 0;
    /* Ajoute de l'espace au-dessus et en dessous */
    text-align: center;
    /* Centre l'image et la légende */
}

/* Style pour la légende */
.content figcaption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    /* Utilise le gris clair défini dans ton CSS */
    font-style: italic;
}

.pdf-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.download-link {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 10px;
}

.download-link a {
    color: var(--accent);
    text-decoration: underline;
}