/* --- RESET & GLOBALS --- */
:root {
    --primary: #2c5282;
    --secondary: #4a5568;
    --accent: #edf2f7;
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --text: #2d3748;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px; /* Plus grand que le print pour le web */
    padding: 20px;
}

/* --- CONTENEUR PRINCIPAL (Effet Carte) --- */
.web-container {
    max-width: 1000px; /* Largeur max sur PC */
    margin: 0 auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* --- BOUTONS D'ACTION --- */
.action-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Permet aux boutons de passer à la ligne sur mobile */
    gap: 15px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--accent);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    color: white;
    background: var(--secondary);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.email-btn { background: var(--primary); }
.call-btn { background: #48bb78; }
.linkedin-btn { background: #0077b5; }
.download-btn { background: #ed8936; }

/* --- HEADER --- */
.header-container {
    margin-bottom: 30px;
    text-align: center; /* Centré par défaut sur le web */
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.photo {
    width: 100px;
    height: 120px;
    border-radius: 8px;
    border: 3px solid var(--primary);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }

.header-text { text-align: left; }
.header-text h1 {
    font-size: 32px;
    color: var(--primary);
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 5px;
    letter-spacing: 1px;
}
.header-text .subtitle {
    font-size: 16px;
    color: var(--secondary);
    font-weight: 500;
}

.contact-bar {
    display: inline-block;
    background: var(--accent);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
}

/* --- SECTIONS GLOBALES --- */
.section-full, .section { margin-bottom: 35px; }

.section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 15px;
    padding-bottom: 5px;
    letter-spacing: 0.5px;
}

.profile-text {
    text-align: justify;
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
}

/* --- LAYOUT COLONNES (Flexbox) --- */
.main-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}
.left-column { flex: 1.6; } /* 60% approx */
.right-column { flex: 1; }  /* 40% approx */

/* --- ITEMS & LISTES --- */
.experience-item { margin-bottom: 25px; }

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.job-title { font-weight: 700; color: #1a202c; font-size: 16px; }
.company { font-weight: 600; color: var(--primary); font-size: 14px; }
.date { font-size: 13px; color: #718096; font-style: italic; }

.experience-desc { font-size: 14px; color: var(--secondary); padding-left: 0; }
.experience-desc ul { list-style: none; }
.experience-desc li { margin-bottom: 5px; }

/* --- GRILLES --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.skill-box {
    background: var(--accent);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    transition: transform 0.2s;
}
.skill-box:hover { transform: translateX(5px); }
.skill-box strong { display: block; color: var(--primary); margin-bottom: 5px; text-transform: uppercase; font-size: 13px; }

.languages-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.lang-item {
    background: var(--accent);
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    font-size: 14px;
}

/* --- LISTES À PUCES --- */
.compact-list { list-style: none; }
.compact-list li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
}
.compact-list li::before {
    content: "•";
    color: var(--primary);
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 18px;
    line-height: 18px;
}

.formation-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cbd5e0;
}
.formation-title { font-weight: 700; display: block; }
.formation-school { color: var(--primary); font-size: 14px; }

.web-footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #a0aec0;
}

/* =========================================
   MEDIA QUERIES (VERSION MOBILE)
========================================= */
@media screen and (max-width: 768px) {
    body { padding: 10px; }
    
    .web-container {
        padding: 20px;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    /* Header empilé */
    .header-top {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    .header-text { text-align: center; }
    
    .contact-bar {
        display: flex;
        flex-direction: column;
        gap: 5px;
        border-radius: 12px;
    }
    .separator { display: none; }

    /* Colonnes empilées */
    .main-container {
        flex-direction: column;
        gap: 30px;
    }
    
    .left-column, .right-column {
        width: 100%;
        flex: none;
    }

    /* Ajustements Grilles Mobile */
    .skills-grid { grid-template-columns: 1fr; } /* 1 colonne sur mobile */
    
    .experience-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .date { margin-bottom: 5px; }

    .action-btn {
        width: 100%; /* Boutons pleine largeur */
        justify-content: center;
    }
}

/* --- GRAPHIQUES --- */
.charts-container { display: flex; justify-content: space-around; gap: 20px; margin-top: 20px; flex-wrap: wrap; }
.chart-wrapper { width: 140px; text-align: center; cursor: pointer; transition: transform 0.2s; background: white; padding: 10px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.chart-wrapper:hover { transform: scale(1.05); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.chart-label { margin-top: 10px; font-weight: bold; font-size: 13px; color: var(--secondary); }
.chart-hint { text-align: center; font-size: 11px; color: #a0aec0; margin-top: 10px; font-style: italic; }

/* --- MODALE --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 25px; width: 90%; max-width: 800px; border-radius: 8px; max-height: 90vh; overflow-y: auto; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover { color: #000; }

/* --- CONTENU WRITE-UPS --- */
.ctf-item { padding: 10px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.read-btn { background: var(--primary); color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.back-btn { background: #edf2f7; color: var(--secondary); border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; margin-bottom: 15px; font-weight: bold; }

.writeup-content { text-align: left; line-height: 1.6; color: #2d3748; }
.writeup-content h1, .writeup-content h2, .writeup-content h3 { color: var(--primary); margin-top: 20px; }
.writeup-content img { max-width: 100%; border-radius: 4px; margin: 10px 0; }
.writeup-content pre { background: #1e1e1e; padding: 10px; border-radius: 6px; overflow-x: auto; color: #d4d4d4; }
.badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; color: white; background: #718096; margin-left: 5px; }
.badge.Easy { background: #48bb78; }
.badge.Medium { background: #ed8936; }
.badge.Hard { background: #e53e3e; }

/* --- LÉGENDE --- */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    font-size: 12px;
    color: #4a5568;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* --- COULEURS DES DIFFICULTÉS --- */
/* On définit les couleurs ici pour qu'elles matchent le JS et les Badges */
.dot.easy { background-color: #2ecc71; }   /* Vert */
.dot.medium { background-color: #f1c40f; } /* Jaune/Orange */
.dot.hard { background-color: #e74c3c; }   /* Rouge */
.dot.insane { background-color: #8e44ad; } /* Violet */


/* --- LE VIEWER DE WRITE-UP --- */
.writeup-content {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

/* Le Header généré dynamiquement (Titre + Badges) */
.writeup-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.writeup-title {
    font-size: 2.2em;
    color: #1a202c;
    margin-bottom: 10px;
    font-weight: 800;
}

.writeup-meta {
    display: flex;
    gap: 10px;
    font-size: 0.9em;
}

/* Le corps du texte (Markdown converti) */
#markdownBody {
    line-height: 1.8; /* Plus aéré pour la lecture */
    font-size: 16px;
}

#markdownBody h1 { font-size: 1.8em; margin-top: 40px; border-bottom: 1px solid #eee; padding-bottom: 10px; color: var(--primary); }
#markdownBody h2 { font-size: 1.5em; margin-top: 30px; color: #2d3748; }
#markdownBody h3 { font-size: 1.2em; margin-top: 25px; color: #4a5568; }
#markdownBody p { margin-bottom: 20px; }

#markdownBody ul, #markdownBody ol { margin-bottom: 20px; padding-left: 25px; }
#markdownBody li { margin-bottom: 8px; }

#markdownBody blockquote {
    border-left: 4px solid var(--primary);
    background: #f7fafc;
    margin: 20px 0;
    padding: 15px 20px;
    font-style: italic;
    color: #555;
}

#markdownBody img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* Bouton Retour amélioré */
.back-btn {
    background: white;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.back-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateX(-2px);
}

/* Gestion des images dans les writeups */
.writeup-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto; /* Centrées avec marge */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

/* --- BOUTON RECRUTEUR (SUR LE CV) --- */
.portfolio-cta {
    margin: 30px 0;
    text-align: center; /* Centré pour l'impact */
}

.btn-recruteur {
    display: inline-block;
    background-color: #2c3e50; /* Bleu nuit professionnel (pas noir, pas bleu flashy) */
    color: #ffffff;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #34495e;
}

.btn-recruteur:hover {
    background-color: #34495e;
    transform: translateY(-2px); /* Petit effet de levée */
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-recruteur .icon {
    margin-right: 10px;
}

.cta-subtext {
    margin-top: 8px;
    font-size: 0.85em;
    color: #7f8c8d;
    font-style: italic;
}