/* Réinitialisation et variables globales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #ffffff;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --accent-color: #3498db;
    --card-bg: #f8f9fa;
    --border-color: #e0e0e0;
    --code-bg: #272822;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-color: #5dade2;
    --card-bg: #2a2a2a;
    --border-color: #3a3a3a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s, color 0.3s;
}

/* === Styles Généraux & Utilitaires === */
body {
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    background-color: #faf9f6;
    color: #222;
    margin: 0;
    line-height: 1.6;
    
    /* Ajouts pour le positionnement du footer */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 20px; /* Padding horizontal uniquement */
    box-sizing: border-box;
}

h1, h2, h3 {
    font-family: 'Georgia', 'Inter', serif;
    font-weight: 600;
}

main {
    flex-grow: 1; /* Fait en sorte que le contenu principal pousse le footer vers le bas */
    padding-top: 80px; /* Espace pour la nav fixe */
}

/* Styles spécifiques Homepage */
.homepage-body {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 0 20px;
    box-sizing: border-box; /* Inclut le padding dans le calcul de la hauteur */
}

.homepage-title {
    font-size: 2.5rem;
    margin-top: 30px;
    margin-bottom: 10px;
    letter-spacing: -1px;
}


a {
    color: #222;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #9e2a2b;
}

.subtitle {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 30px;
    color: #444;
}

.profile-img {
    display: block;
    margin-bottom: 20px; /* Espace sous l'image, sans perturber le centrage vertical */
    border-radius: 50%;
    width: 270px;
    height: 250px;
    object-fit: cover;  /* Encore plus grand */
}

/* --- Styles pour le conteneur de la page d'accueil --- */
.homepage-body main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}
/* === Barre de Navigation === */
.main-nav {
    display: flex;
    gap: 24px;
    background: rgba(255, 255, 255, 0.85);
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: fixed;
    top: 20px;
    right: 15px;
    z-index: 1000;
}

.main-nav a {
    font-weight: 500;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-switch {
    margin-left: 16px;
    border-left: 1px solid #ccc;
    padding-left: 24px;
}

.lang-switch a {
    font-weight: 700;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}

/* === Bouton Dark Mode === */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.dark-mode-toggle i {
    font-size: 28px;
    color: #9e2a2b;
}

/* === Mode Sombre === */
body.dark-mode {
    background-color: #222;
    color: #eee;
}

/* Nav en mode sombre */
body.dark-mode .main-nav {
    background-color: rgba(50, 50, 50, 0.85);
}

body.dark-mode .main-nav a {
    color: #eee;
}

body.dark-mode .main-nav a:hover {
    color: #9e2a2b;
}

body.dark-mode .lang-switch {
    border-left-color: #555;
}

/* Icône mode sombre */
body.dark-mode .dark-mode-toggle i {
    color: #eee;
}

/* --- Styles spécifiques Homepage --- */
.social-icons {
    margin-bottom: 30px;
    text-align: center;
}
.social-icons a {
    display: inline-block; /* Important pour que la transformation fonctionne */
    color: #222;
    font-size: 1.5rem;
    margin: 0 10px;
    transition: color 0.2s, transform 0.2s ease-out;
}
.social-icons a:hover {
    color: #9e2a2b;
    transform: scale(1.2); /* Agrandit l'icône de 20% */
}

.button {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 1.08rem;
    padding: 10px 28px;
    margin: 10px 8px;
    border-radius: 30px;
    border: none;
    background: #fff;
    color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, color 0.2s;
}

.button:hover {
    color: #9e2a2b;
    background: #f3eaea;
}

.section {
    max-width: 500px;
    margin: 20px auto;
    text-align: center;
}

/* Styles spécifiques aux pages en mode sombre */
/* Homepage */
body.dark-mode h1,
body.dark-mode .subtitle,
body.dark-mode .social-icons a {
    color: #eee;
}
body.dark-mode .social-icons a:hover {
    color: #9e2a2b;
}

body.dark-mode .subtitle {
    color: #ccc;
}

body.dark-mode .section,
body.dark-mode .button {
    background: #333;
    color: #eee;
}

body.dark-mode .button:hover {
    background: #444;
    color: #9e2a2b;
}

/* --- Fin Styles Homepage --- */

/* Blog & Portfolio */
body.dark-mode .project-card,
body.dark-mode .page-title,
body.dark-mode .article-card h3,
body.dark-mode .read-post {
    color: #eee;
}

body.dark-mode .article-card h3:hover,
body.dark-mode .read-post:hover {
    color: #9e2a2b;
}

body.dark-mode .article-card .date {
    color: #bbb;
}

body.dark-mode .project-card {
    background-color: #2c2c2c;
    border-color: #444;
}

body.dark-mode .project-card h3 {
    color: #d46a6a;
}

/* About Page */
body.dark-mode .about-pitch {
    color: #bbb;
}

body.dark-mode .about-section h2 {
    color: #eee; /* Le titre de section hérite déjà, mais c'est plus explicite */
}

body.dark-mode .skill-category h3 {
    color: #eee;
}

body.dark-mode .skill-tag {
    background-color: #3a3a3a;
    color: #ddd;
}


/* === Styles Page Blog === */
.page-title {
    font-size: 2.5rem;
    font-family: 'Georgia', 'Inter', serif;
    font-weight: 600;
    letter-spacing: -1px;
    text-align: center;
    margin-bottom: 40px;
    
}

.article-list {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.article-card-link {
    display: block;
    color: inherit;
}

.article-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 0;
    border-bottom: 1px dashed #bbb;
    transition: background-color 0.2s;
}

.article-card h3 {
    font-size: 1.5rem;
    font-family: 'Georgia', 'Inter', serif;
    font-weight: 600;
    margin: 0 0 4px 0;
    transition: color 0.2s;
    text-decoration: underline dotted #222 1px;
}

.article-card-link:hover .article-card h3 {
    color: #9e2a2b;
    text-decoration: underline solid #9e2a2b 2px;
}

.article-card .date {
    font-size: 1rem;
    color: #888;
    margin-bottom: 8px;
}

.read-post {
    margin-left: 32px;
    white-space: nowrap;
}

body.dark-mode .article-card-link:hover .article-card {
    background-color: rgba(255, 255, 255, 0.05);
}

/* === Styles Page Article de Blog === */
.blog-post {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.blog-post-header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 2rem;
}

.blog-post-title {
    font-size: 2.8rem;
    font-family: 'Georgia', serif;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.blog-post-meta {
    font-size: 1rem;
    color: #888;
}

.blog-post-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #9e2a2b;
    padding-bottom: 8px;
    display: inline-block;
}

.blog-post-content p, .blog-post-content ul {
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: justify;
}

.blog-post-content ul {
    padding-left: 25px;
}

.blog-post-content a {
    color: #9e2a2b;
    text-decoration: underline;
}

.sources-section {
    margin-top: 4rem;
    padding: 1.5rem;
    background-color: #f9f9f9;
    border-left: 4px solid #9e2a2b;
}

.back-to-blog {
    display: inline-block;
    margin-top: 3rem;
    font-weight: 600;
}

/* Mode sombre pour l'article */
body.dark-mode .blog-post-header { border-color: #444; }
body.dark-mode .blog-post-meta { color: #aaa; }
body.dark-mode .blog-post-content a { color: #d46a6a; }
body.dark-mode .sources-section { background-color: #2c2c2c; }

/* Styles pour les blocs de code Prism.js */
.blog-post-content pre[class*="language-"] {
    border-radius: 8px;
    /* Le fond est géré par le thème Prism (Okaidia), mais on s'assure que le texte est lisible */
    color: #f8f8f2;
}

/* === Styles Page Portfolio (Modern) === */
.projects-grid {
    display: grid;
    /* Crée des colonnes de 350px minimum, qui s'adaptent à la largeur */
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.project-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    text-align: left;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease; /* Transition pour l'ombre uniquement */
}

.project-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Transition rapide pour le survol */
}

.project-card h3 {
    color: #9e2a2b;
    margin-top: 0;
    font-family: 'Georgia', serif;
}

.project-card p {
    flex-grow: 1; /* Pousse les outils et le lien vers le bas */
}

.project-tools {
    margin-top: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-tag {
    background-color: #f3eaea;
    color: #9e2a2b;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.project-link {
    font-weight: 600;
    align-self: flex-start; /* Aligne le lien à gauche */
}

/* === Styles Page About === */
.about-page-content {
    max-width: 800px; /* Définit la largeur maximale */
    margin: 4rem auto; /* Centre le contenu avec des marges verticales */
    padding: 0 20px; /* Ajoute un padding horizontal */
}

.about-pitch {
    font-size: 1.3rem; /* Légèrement plus grand */
    color: #444;      /* Un peu plus sombre pour une meilleure lisibilité */
    text-align: center;
    margin-bottom: 3rem;
    font-family: 'Georgia', serif;
    font-weight: 500; /* Un peu plus gras que la normale (400) */
}

.about-section {
    margin-bottom: 2.5rem;
}

.about-section h2 {
    border-bottom: 2px solid #9e2a2b;
    display: inline-block;
    padding-bottom: 8px;
    margin-bottom: 1.5rem;
}

.about-section p {
    text-align: justify;
    hyphens: auto; /* Améliore la césure pour un meilleur rendu */
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-category h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #222;
}

.skill-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tag {
    background-color: #f0f0f0;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* === Animations à l'apparition (Scroll) === */
.fade-in-element {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-element.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out; /* Transition lente pour l'apparition */
}

/* === Animations de transition de page (Swup) === */
.transition-fade {
    transition: opacity 0.4s;
}
html.is-animating .transition-fade {
    opacity: 0;
}
html.is-leaving .transition-fade {
    opacity: 0;
}

/* === Pied de page (Footer) === */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.7;
    border-top: 1px solid rgba(128, 128, 128, 0.1);
}

footer p {
    margin: 0;
    font-weight: 400;
}

/* Mode sombre */
body.dark-mode footer {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

/* === Menu Hamburger & Panneau Mobile (cachés sur bureau) === */
.hamburger-btn {
    display: none; /* Caché par défaut */
}

.mobile-nav-panel {
    display: none; /* Caché par défaut */
}

/* Overlay pour assombrir la page quand le menu est ouvert */
.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998; /* Juste en dessous du panneau de menu */
}


/* === Media Queries pour la Responsivité (Mobile) === */
@media (max-width: 768px) {
    body {
        padding: 0 15px; /* Ajustement du padding */
    }

    /* --- Navigation & Boutons fixes --- */
    .main-nav {
        display: none; /* Cache la nav de bureau sur mobile */
    }

    .hamburger-btn {
        display: block; /* Affiche le bouton hamburger */
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1001; /* Au-dessus de tout */
        background: none;
        border: none;
        cursor: pointer;
        font-size: 24px;
        color: #222;
    }

    .mobile-nav-panel {
        display: flex;
        flex-direction: column;
        gap: 20px;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100%;
        background-color: #fff;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
        padding: 80px 30px 30px 30px;
    }

    .mobile-nav-panel.is-open {
        transform: translateX(0);
    }

    .mobile-nav-panel a {
        font-size: 1.2rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .overlay.is-active {
        display: block;
    }

    /* Styles pour le mode sombre du menu mobile */
    body.dark-mode .hamburger-btn { color: #eee; }
    body.dark-mode .mobile-nav-panel { background-color: #2c2c2c; }
    body.dark-mode .mobile-nav-panel a { color: #eee; }

    .dark-mode-toggle {
        left: 15px;
    }

    /* --- Page d'accueil --- */
    .profile-img {
        width: 180px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    /* --- Pages Blog & Portfolio --- */
    .page-title {
        font-size: 2.2rem; /* Déjà présent, mais on le garde pour la clarté */
    }

    .projects-grid {
        /* Passe à une seule colonne sur mobile */
        grid-template-columns: 1fr;
        padding: 0 10px;
        gap: 1.5rem;
    }
}

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

    .page-title {
        font-size: 1.75rem;
    }

    .mobile-nav-panel {
        width: 100%;
    }
}

/* Date de publication plus discrète avec temps de lecture */
.post-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-bottom: 2rem;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.post-meta i {
    font-size: 0.75rem;
    opacity: 0.6;
}

.separator {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* Mode sombre */
body.dark-mode .post-meta {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .post-tags {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .tag {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .tag:hover {
    background: rgba(255, 255, 255, 0.15);
}

body.dark-mode .back-link {
    color: rgba(255, 255, 255, 0.6);
}

/* Swup Transitions */
.transition-fade {
    transition: opacity 0.3s;
    opacity: 1;
}

html.is-animating .transition-fade {
    opacity: 0;
}