/* ==========================================================================
   1. Réinitialisation & Variables globales
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8b1e2f;    /* Rouge bordeaux */
    --text-color: #2d3748;       /* Gris foncé */
    --light-bg: #f7fafc;         /* Gris ultra clair */
    --dark-bg: #1a202c;          /* Anthracite */
    --border-color: #e2e8f0;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: #ffffff;
    padding-top: 70px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   2. Header & Menu Fixe
   ========================================================================== */
#main-header {
    background-color: var(--dark-bg);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
}

#main-nav ul {
    display: flex;
    list-style: none;
}

#main-nav a {
    color: #a0aec0;
    text-decoration: none;
    padding: 10px 15px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

#main-nav a:hover {
    color: #ffffff;
}

/* ==========================================================================
   3. Structures Générales & Boutons
   ========================================================================== */
.section-padding {
    padding: 80px 0;
}

.section-paddingbg {
    padding: 80px 0;
    background-color: var(--light-bg);
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #6b1422;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    margin-left: 15px;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* ==========================================================================
   4. Hero Section
   ========================================================================== */
.hero-section {
    padding: 120px 0;
    text-align: center;
    background: radial-gradient(circle at top, #ffffff 0%, var(--light-bg) 100%);
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

.pitch {
    max-width: 800px;
    margin: 0 auto 40px auto;
    font-size: 1.15rem;
}

.hero-buttons {
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   5. Grille de Compétences
   ========================================================================== */
.skills-grid {
    display: flex;
    gap: 40px;
}

.skills-col {
    flex: 1;
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--primary-color);
}

.skills-col h3 {
    margin-bottom: 20px;
}

.skills-col ul {
    list-style: none;
}

.skills-col li {
    margin-bottom: 15px;
    position: relative;
    padding-left: 20px;
}

.skills-col li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 0;
    top: -2px;
}

/* ==========================================================================
   6. Expériences (Timeline)
   ========================================================================== */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 30px;
    border-left: 2px solid var(--border-color);
}

.job-card {
    position: relative;
    margin-bottom: 40px;
    background: #ffffff;
    padding: 25px;
    border-radius: 6px;
}

.job-card::before {
    content: '';
    position: absolute;
    left: -37px;
    top: 28px;
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.job-date {
    display: inline-block;
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
    margin-bottom: 10px;
}

/* ==========================================================================
   7. Formations & Grilles d'études
   ========================================================================== */
.education-grid {
    display: flex;
    gap: 40px;
}

.education-block {
    flex: 1;
}

.education-block h3 {
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.education-block ul {
    list-style: none;
}

.education-block li {
    margin-bottom: 20px;
}

/* ==========================================================================
   8. LA GRILLE DE RÉALISATIONS (CORRIGÉE)
   ========================================================================== */
.portfolio-intro {
    text-align: center;
    max-width: 700px;
    margin: -20px auto 40px auto;
    color: #4a5568;
}

.portfolio-grid {
    display: grid !important; /* Force l'affichage en grille */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; /* Alignement horizontal automatique */
    gap: 25px !important;
    margin-bottom: 30px;
}

.portfolio-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.portfolio-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.06);
    border-color: var(--primary-color);
}

.portfolio-item img {
    width: 100%;
    height: 150px; /* Brise la hauteur native dans la grille pour harmoniser */
    object-fit: cover; /* Recadre proprement sans déformer */
    border-radius: 4px;
}

.portfolio-item-title {
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Volet de prévisualisation */
.preview-panel {
    display: none;
    background: #ffffff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 30px;
    position: relative;
    margin-top: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #a0aec0;
}

.close-btn:hover {
    color: var(--primary-color);
}

.preview-content {
    display: flex;
    gap: 30px;
    align-items: center;
}

.preview-img-box {
    flex: 0 0 320px;
    text-align: center;
    max-width: 100%;
}

.preview-img-box img {
    max-width: 100%;
    max-height: 480px; /* Protège l'affichage de vos images de 600px de haut */
    height: auto;
    object-fit: contain; /* Conserve les proportions exactes et fidèles sans distorsion */
    background: #1a202c;
    border-radius: 4px;
}

.preview-text-box {
    flex: 1;
}

.preview-text-box h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.tech-badge {
    display: inline-block;
    background: #edf2f7;
    color: var(--primary-color);
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* ==========================================================================
   9. Contact & Footer & Responsive
   ========================================================================== */
.contact-intro {
    text-align: center;
    margin-bottom: 40px;
}

.contact-wrapper {
    background: #ffffff;
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

#main-footer {
    background-color: var(--dark-bg);
    color: #718096;
    padding: 30px 0;
    text-align: center;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    #main-header .container { flex-direction: column; height: auto; padding: 15px 20px; }
    #main-nav ul { margin-top: 10px; flex-wrap: wrap; justify-content: center; }
    body { padding-top: 110px; }
    .hero-section h2 { font-size: 1.8rem; }
    .skills-grid, .education-grid, .preview-content { flex-direction: column; gap: 20px; }
    .hero-buttons { flex-direction: column; align-items: center; }
    .btn-secondary { margin-left: 0; margin-top: 15px; }
    .preview-img-box { flex: none; width: 100%; }
}