/**
 * Main Stylesheet for Legion Muyue Projects Website
 *
 * Table of Contents:
 * -----------------------------------------------------------------------------
 * 1. CSS Variables (Custom Properties)
 * 2. Reset & Base Styles
 * 3. Typography
 * 4. Layout (Container, Header, Footer, Main Content)
 * 5. Navigation (Main Menu & Mobile Toggle)
 * 6. Common UI Elements (Buttons, Links, Lists, Badges)
 * 7. Page Specific: Projects Page Styles
 * 8. Utility Classes (sr-only)
 * 9. Media Queries (Responsive Design including Mobile Nav)
 * -----------------------------------------------------------------------------
 */


/* ==========================================================================
   1. CSS Variables (Custom Properties) - Pour Legion Muyue
   ========================================================================== */

:root {
    /* Palette vert/gris */
    --color-primary: #28a745;         /* Vert */
    --color-primary-dark: #218838;   /* Vert foncé */
    --color-secondary: #6c757d;      /* Gris secondaire */
    --color-success: var(--color-primary); /* Vert pour succès */
    --color-success-dark: var(--color-primary-dark);
    --color-warning: #ffc107;        /* Jaune pour status */
    --color-info: #17a2b8;           /* Cyan pour status "info" */
    --color-light-gray: #f8f9fa;    /* Fond clair */
    --color-medium-gray: #e9ecef;   /* Fond moyen */
    --color-border-gray: #dee2e6;    /* Couleur bordure */
    --color-dark-gray: #6c757d;      /* Texte gris */
    --color-darker-gray: #495057;   /* Texte gris plus foncé */
    --color-heading-dark: #212529;   /* Noir presque pur pour titres */
    --color-text: #343a40;          /* Texte principal */
    --color-white: #fff;            /* Blanc */
    --color-footer-bg: #212529;     /* Footer très foncé */
    --color-header-bg: #212529;     /* Header très foncé (identique footer) */
    --color-footer-text: #adb5bd;    /* Texte footer/header */
    --color-code-bg: #f5f2f0;        /* Fond bloc code */
    --color-code-bash-bg: #2d2d2d;  /* Fond bloc bash */
    --color-code-bash-text: #f8f8f2; /* Texte bloc bash */

    --font-family-base: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-family-monospace: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    --font-size-base: 1rem;          /* Approx 16px */
    --line-height-base: 1.6;

    --container-max-width: 1200px;   /* Conteneur large */
    --border-radius-base: 4px;       /* Coins légèrement arrondis */
    --spacing-unit: 1rem;           /* Unité d'espacement */
}


/* ==========================================================================
   2. Reset & Base Styles
   ========================================================================== */

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

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-family-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-light-gray);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
    display: block;
}


/* ==========================================================================
   3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin-top: calc(var(--spacing-unit) * 1.5);
    margin-bottom: var(--spacing-unit);
    color: var(--color-heading-dark);
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-unit);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

ul, ol {
    margin-bottom: var(--spacing-unit);
    padding-left: calc(var(--spacing-unit) * 1.5);
}

li {
    margin-bottom: calc(var(--spacing-unit) * 0.4);
}

strong, b {
    font-weight: bold;
}

em, i {
    font-style: italic;
}

pre[class*="language-"] {
    padding: var(--spacing-unit);
    margin-top: calc(var(--spacing-unit) * 0.5);
    margin-bottom: var(--spacing-unit);
    overflow: auto;
    border-radius: calc(var(--border-radius-base) * 0.6);
    background: var(--color-code-bg);
    border: 1px solid var(--color-border-gray);
    font-size: 0.9em;
    line-height: 1.5;
}

code[class*="language-"] {
    font-family: var(--font-family-monospace);
}

:not(pre) > code[class*="language-"] {
    padding: .2em .4em;
    margin: 0;
    font-size: 85%;
    background-color: var(--color-medium-gray);
    border-radius: 3px;
}

pre[class*="language-bash"] {
    background-color: var(--color-code-bash-bg);
    color: var(--color-code-bash-text);
    border: none;
}


/* ==========================================================================
   4. Layout (Container, Header, Footer, Main Content)
   ========================================================================== */

.container {
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-unit);
    padding-right: var(--spacing-unit);
    width: 100%;
}

/* --- Site Header --- */
.site-header {
    background-color: var(--color-header-bg);
    color: var(--color-white);
    padding: var(--spacing-unit) 0;
    border-bottom: 3px solid var(--color-primary); /* Ligne verte */
    position: relative; /* Pour positionner le menu mobile */
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-unit);
}

.site-header .logo h1 {
    margin: 0;
    font-size: 2rem;
}

.site-header .logo h1 a {
    color: var(--color-white);
    text-decoration: none;
}
.site-header .logo h1 a:hover {
    color: var(--color-footer-text);
    text-decoration: none;
}

.site-header .logo .subtitle {
    font-size: 0.9rem;
    color: var(--color-footer-text);
    margin-top: -5px;
    margin-bottom: 0;
}

/* --- Main Content Area --- */
.site-content {
    flex-grow: 1;
    padding-top: calc(var(--spacing-unit) * 2);
    padding-bottom: calc(var(--spacing-unit) * 2);
}

/* Default styling for sections */
.site-content section {
    margin-bottom: calc(var(--spacing-unit) * 2);
    background-color: var(--color-white);
    padding: calc(var(--spacing-unit) * 1.5);
    border-radius: var(--border-radius-base);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--color-border-gray);
}

.site-content section h2 {
    margin-top: 0;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    padding-bottom: calc(var(--spacing-unit) * 0.5);
    border-bottom: 1px solid var(--color-border-gray);
    color: var(--color-heading-dark);
    font-size: 1.8rem;
}

/* --- Site Footer --- */
.site-footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: calc(var(--spacing-unit) * 1.5) 0;
    margin-top: auto;
    font-size: 0.9rem;
    text-align: center;
}

.site-footer .copyright {
    margin: 0;
}


/* ==========================================================================
   5. Navigation (Main Menu & Mobile Toggle)
   ========================================================================== */

/* Conteneur de la navigation principale */
.main-nav-wrapper {
     /* Style par défaut pour grand écran - la nav est visible */
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    gap: calc(var(--spacing-unit) * 0.5);
}

.main-nav li {
    margin-bottom: 0;
}

.main-nav a {
    color: var(--color-white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-base);
    display: block;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
    background-color: var(--color-darker-gray);
    text-decoration: none;
}

/* Bouton pour menu mobile */
.mobile-nav-toggle {
    display: none; /* Caché par défaut */
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
}

.mobile-nav-toggle .icon-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--color-white);
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}


/* ==========================================================================
   6. Common UI Elements (Buttons, Links, Lists, Badges)
   ========================================================================== */

.button { display: inline-block; padding: 0.7rem 1.4rem; border: none; border-radius: var(--border-radius-base); font-weight: bold; text-align: center; text-decoration: none; cursor: pointer; transition: background-color 0.2s ease, transform 0.1s ease; font-size: 0.95rem; line-height: 1.5; }
.button:hover { text-decoration: none; }
.button:active { transform: translateY(1px); }
.button, .button.button-primary { background-color: var(--color-primary); color: var(--color-white); }
.button:hover, .button.button-primary:hover { background-color: var(--color-primary-dark); color: var(--color-white); }
.button.button-secondary { background-color: var(--color-secondary); color: var(--color-white); }
.button.button-secondary:hover { background-color: var(--color-darker-gray); color: var(--color-white); }
.status-badge { display: inline-block; padding: 0.4rem 0.8rem; border-radius: 15px; font-size: 0.8rem; font-weight: bold; line-height: 1; }
.status-badge.status-warning { background-color: var(--color-warning); color: var(--color-heading-dark); }
.status-badge.status-info { background-color: var(--color-info); color: var(--color-white); }
.status-badge.status-success { background-color: var(--color-success); color: var(--color-white); }


/* ==========================================================================
   7. Page Specific: Projects Page Styles
   ========================================================================== */

.projects-page #projects-intro { text-align: center; background-color: transparent; box-shadow: none; padding-bottom: var(--spacing-unit); border: none; } /* Pas de bordure/ombre */
.projects-page .projects-grid { display: grid; grid-template-columns: 1fr; gap: calc(var(--spacing-unit) * 2); }
@media (min-width: 600px) { .projects-page .projects-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }

.projects-page .project-item { border-left: 5px solid var(--color-primary); overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.projects-page .project-item h3 { font-size: 1.5rem; margin-top: 0; margin-bottom: var(--spacing-unit); padding-bottom: calc(var(--spacing-unit) * 0.5); border-bottom: 1px solid var(--color-border-gray); color: var(--color-heading-dark); }
.projects-page .project-content { display: grid; grid-template-columns: 1fr; gap: calc(var(--spacing-unit) * 1.5); flex-grow: 1; }
@media (min-width: 992px) { .projects-page .project-content { grid-template-columns: 250px 1fr; align-items: flex-start; } }
.projects-page .project-image img { border-radius: var(--border-radius-base); border: 1px solid var(--color-border-gray); }
.projects-page .project-description { display: flex; flex-direction: column; height: 100%; }
.projects-page .project-description p { margin-bottom: var(--spacing-unit); line-height: 1.7; flex-grow: 1; }
.projects-page .project-description p:last-of-type { margin-bottom: 0; }
.projects-page .project-description strong { color: var(--color-heading-dark); }
.projects-page .project-links { margin-top: auto; padding-top: var(--spacing-unit); display: flex; flex-wrap: wrap; gap: calc(var(--spacing-unit) * 0.5); align-items: center; }

/* Style projet futur */
.projects-page .project-item.project-item-future { opacity: 0.75; border-left-color: var(--color-dark-gray); }
.projects-page .project-item.project-item-future:hover { opacity: 1; }
.placeholder-image { width: 100%; height: 150px; background: var(--color-medium-gray); display: flex; align-items: center; justify-content: center; color: var(--color-dark-gray); font-style: italic; border-radius: var(--border-radius-base); border: 1px solid var(--color-border-gray); text-align: center; padding: var(--spacing-unit); }


/* ==========================================================================
   8. Utility Classes
   ========================================================================== */

.sr-only { /* Pour cacher du texte visuellement mais le garder pour les lecteurs d'écran */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ==========================================================================
   9. Media Queries (Responsive Design including Mobile Nav)
   ========================================================================== */

/* --- Tablet and Smaller (Max Width 768px) --- */
@media (max-width: 768px) {

    /* Ajustement du header pour mobile */
    .site-header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* Afficher le bouton hamburger */
    .mobile-nav-toggle {
        display: block;
    }

    /* Cacher la navigation normale et préparer l'animation */
    .main-nav-wrapper {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);

        /* Positionnement et style du menu déroulant */
        position: absolute;
        top: 94px;
        left: 0;
        right: 0;
        background-color: var(--color-header-bg); /* Utiliser la var du header */
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 1000;
        width: 100%;
    }

    /* Style du menu quand il est ouvert */
    .main-nav-wrapper.is-open {
        max-height: 500px; /* Hauteur suffisante */
    }

    /* Transformer l'icône hamburger en croix (X) */
    .mobile-nav-toggle[aria-expanded="true"] .icon-bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .mobile-nav-toggle[aria-expanded="true"] .icon-bar:nth-child(2) {
        opacity: 0;
    }
    .mobile-nav-toggle[aria-expanded="true"] .icon-bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Adapter la liste de navigation pour mobile */
    .main-nav ul {
        flex-direction: column;
        width: 100%;
        margin-top: 0;
        gap: 0;
        padding: calc(var(--spacing-unit) * 0.5) 0;
    }

    /* Style des liens mobiles */
    .main-nav li {
        margin-left: 0;
        margin-bottom: 0;
        width: 100%;
        border-bottom: 1px solid var(--color-darker-gray);
    }
    .main-nav li:last-child {
        border-bottom: none;
    }

    .main-nav a {
        display: block;
        text-align: center;
        padding: calc(var(--spacing-unit) * 0.8) var(--spacing-unit);
        color: var(--color-white);
        border-radius: 0;
    }
    .main-nav a:hover,
    .main-nav a.active {
        background-color: var(--color-darker-gray);
    }

    /* --- Autres ajustements responsive --- */
    .projects-page .project-content { grid-template-columns: 1fr; }
}

/* --- Mobile Specific (Optional - Max Width ~480px) --- */
@media (max-width: 480px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    .site-content section { padding: var(--spacing-unit); }
    .button { padding: 0.6rem 1.2rem; font-size: 0.9rem;}

    pre[class*="language-"] {
         white-space: pre-wrap;
         word-wrap: break-word;
     }
}
