/* --- Variables et Styles Globaux --- */
:root {
    --color-black: #1A1A1A;
    --color-white: #F5F5F0;
    --color-accent: #D32F2F;
    --color-gray: #757575;
    --color-light-gray: #e0e0e0;

    --font-slab: 'Roboto Slab', 'Rockwell', serif;
    --font-sans: 'Lato', 'Open Sans', sans-serif;

    --sidebar-width-collapsed: 60px;
    --sidebar-width-expanded: 240px;
    --header-height: 60px;
    --border-radius: 4px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-black);
    background-color: var(--color-white);
}

.container {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* --- Typographie et Charte Graphique du Contenu --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-slab);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-black);
    margin-bottom: 0.8em;
}

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: 1.1rem; }

p {
    margin-bottom: 1.2em;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: text-decoration 0.2s ease-in-out;
}

a:hover {
    text-decoration: underline;
}

ul, ol {
    padding-left: 2em;
    margin-bottom: 1.2em;
}

ul li {
    list-style-type: none;
    position: relative;
    padding-left: 1.2em;
}
ul li::before {
    content: '■';
    color: var(--color-accent);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.8em;
}

ol {
    list-style: decimal;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--color-light-gray);
    padding: 0.2em 0.4em;
    border-radius: var(--border-radius);
    font-size: 0.9em;
}

blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: 1.5em;
    margin: 1.5em 0;
    color: var(--color-gray);
    font-style: italic;
}
blockquote p {
    margin-bottom: 0.5em;
}
blockquote cite {
    display: block;
    text-align: right;
    font-size: 0.9em;
}

/* --- Tableaux --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95em;
}

th, td {
    padding: 0.8em 1em;
    text-align: left;
    border-bottom: 1px solid #ccc;
}

th {
    font-family: var(--font-slab);
    font-weight: 700;
    background-color: var(--color-light-gray);
}

/* --- Formulaires --- */
fieldset {
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    padding: 1.5em;
    margin-bottom: 1.5em;
}

legend {
    font-family: var(--font-slab);
    font-weight: 700;
    padding: 0 0.5em;
    color: var(--color-black);
}

label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.8em;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    font-family: var(--font-sans);
    font-size: 1rem;
    background-color: var(--color-white);
}

textarea {
    resize: vertical;
}

button, .btn-submit {
    background-color: var(--color-accent);
    color: var(--color-white);
    border: none;
    padding: 0.8em 1.5em;
    border-radius: var(--border-radius);
    font-family: var(--font-slab);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    display: inline-block;
}

button:hover, .btn-submit:hover {
    background-color: #b71c1c;
}

/* --- Header --- */
header {
    background-color: var(--color-black);
    color: var(--color-white);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1em;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1em;
}

.logo img {
    height: 40px;
    width: auto;
}

.slogan {
    font-family: var(--font-slab);
    font-size: 1rem;
    display: none; /* Caché sur mobile */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1em;
}

.language-selector select {
    background-color: var(--color-black);
    color: var(--color-white);
    border: 1px solid var(--color-gray);
    padding: 0.4em;
}

/* --- Menu Toggle (Mobile) --- */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 2em;
    height: 2em;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-toggle span {
    width: 2em;
    height: 3px;
    background: var(--color-white);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* --- Sidebar Navigation --- */
.sidebar {
    background-color: var(--color-black);
    color: var(--color-white);
    width: var(--sidebar-width-expanded);
    height: 100%;
    position: fixed;
    top: var(--header-height);
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
    z-index: 999;
    overflow-x: hidden;
}

/* --- Exception pour la liste de navigation de la sidebar --- */
.sidebar .nav-list li {
    list-style-type: none; /* On s'assure qu'il n'y a pas de style par défaut */
    padding-left: 0; /* On réinitialise le padding pour enlever l'espace de la puce */
}
.sidebar .nav-list li::before {
    display: none; /* On cache explicitement le pseudo-élément (le carré rouge) */
}

.sidebar.is-open {
    transform: translateX(0);
}

.sidebar-toggle {
    display: none; /* Caché par défaut */
    background: none;
    border: none;
    color: var(--color-white);
    padding: 1em;
    cursor: pointer;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1em;
    color: var(--color-white);
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
    gap: 1em;
}

.nav-link:hover, .nav-link.active {
    background-color: #333;
}

.nav-link svg {
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
}

/* --- Main Content --- */
.main-content-grid {
    flex-grow: 1;
    padding: 2em;
    display: grid;
    gap: 2em;
    /* La grille est définie dans les media queries */
}

article {
    background-color: #fff;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    padding: 1.5em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.meta {
    font-size: 0.9em;
    color: var(--color-gray);
}

.author {
    font-weight: 600;
}

.read-more {
    display: inline-block;
    margin-top: 1em;
    font-weight: 600;
}

/* --- Footer --- */
footer {
    background-color: var(--color-black);
    color: var(--color-white);
    padding: 2em 1em;
    margin-top: 3em;
}

.footer-content {
    display: grid;
    gap: 2em;
}

.footer-section h3 {
    font-family: var(--font-slab);
    font-size: 1.5rem;
    color: var(--color-white);
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}
.footer-section ul li {
    margin-bottom: 0.5em;
}
.footer-section ul li a {
    color: var(--color-white);
    font-weight: normal;
}
.footer-section ul li a:hover {
    color: var(--color-accent);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5em;
}

.team-member {
    text-align: center;
}
.team-member img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5em;
    border: 2px solid var(--color-accent);
}
.team-member h4 {
    font-family: var(--font-slab);
    font-size: 1.1rem;
    margin-bottom: 0.2em;
    color: var(--color-white);
}
.team-member p {
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 0;
}

.footer-form .form-group {
    margin-bottom: 1em;
}

.footer-bottom {
    text-align: center;
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid #333;
    font-size: 0.9em;
    color: #aaa;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin: 3em 0;
    font-family: var(--font-slab);
}

.page-link {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 2.5em;
    height: 2.5em;
    padding: 0 0.75em;
    border: 1px solid var(--color-light-gray);
    border-radius: var(--border-radius);
    color: var(--color-black);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.page-link:hover {
    background-color: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}

.page-link.active {
    background-color: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
    cursor: default;
    font-weight: bold;
}

.page-ellipsis {
    padding: 0 0.5em;
    color: var(--color-gray);
}

/* --- Media Queries pour le Responsive Design --- */

/* --- Smartphone (une colonne, menu escamotable) --- */
@media (max-width: 767px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 80%;
        max-width: 300px;
    }

    .main-content-grid {
        grid-template-columns: 1fr; /* Force une seule colonne */
        margin-left: -.75rem !important; /* Annule tout décalage potentiel hérité du style desktop */
        padding: 1em;   /* Assure une marge intérieure pour que le texte ne touche pas les bords de l'écran */
    }
    .pagination .page-link:not(.prev-link):not(.next-link),
    .pagination .page-ellipsis {
        display: none; /* Cache tous les liens de numéros et les ellipsis */
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* On cache les sections du footer sur mobile */
    .footer-section:first-child, /* Cible "Nous Contacter" */
    .footer-section:nth-child(2) { /* Cible "Notre Équipe" */
        display: none;
    }

    /* On réorganise l'ordre des sections du footer sur mobile */
    .footer-section:first-child {
        order: 3; /* Met le formulaire en dernier sur mobile */
    }
    .footer-section:nth-child(2) {
        order: 2;
    }
    .footer-section:nth-child(3) {
        order: 1;
    }

    /* Styles pour les tableaux sur mobile */
    thead {
        display: none;
    }

    .tr {
        display: block;
        margin-bottom: 2em;
        border: 1px solid var(--color-light-gray);
        border-radius: var(--border-radius);
        padding: 1em;
    }

    td {
        display: block;
        text-align: right;
        padding: 0.5em 0;
        border-bottom: 1px solid #eee;
    }

    td:last-child {
        border-bottom: none;
    }

    td:before {
        content: "Colonne " counter(cell) " : ";
        counter-increment: cell;
        font-weight: bold;
        float: left;
        color: var(--color-gray);
    }

    tr {
        counter-reset: cell;
    }
}

/* --- Tablette (colonne menu avec icônes, agrandissable) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .slogan {
        display: block;
    }

    .sidebar {
        width: var(--sidebar-width-collapsed);
        transform: translateX(0);
    }

    .sidebar.is-expanded {
        width: var(--sidebar-width-expanded);
    }

    .sidebar-toggle {
        display: block;
    }

    .nav-text {
        display: none;
    }

    .sidebar.is-expanded .nav-text {
        display: block;
    }

    .main-content-grid {
        margin-left: var(--sidebar-width-collapsed);
        transition: margin-left 0.3s ease-in-out;
        grid-template-columns: 1fr;
    }

    .sidebar.is-expanded ~ .main-content-grid {
        margin-left: var(--sidebar-width-expanded);
    }

    .pagination .page-link:nth-child(n+1):nth-child(-n+2), /* Cache 1, 2 */
    .pagination .page-link:nth-child(n+11),               /* Cache 87, 88 */
    .pagination .page-ellipsis {
        display: none; /* Cache les premières pages, les dernières et les ellipsis */
    }

    footer {
        margin-left: var(--sidebar-width-collapsed);
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    /* On cache les sections du footer sur tablette */
    .footer-section:first-child,
    .footer-section:nth-child(2) {
        display: none;
    }
}

/* --- Ordinateur Portable (colonne menu avec icônes et texte) --- */
@media (min-width: 1024px) and (max-width: 1439px) {
    .menu-toggle {
        display: none;
    }

    .sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    .nav-text {
        display: block;
    }

    .main-content-grid {
        margin-left: var(--sidebar-width-expanded);
        grid-template-columns: 1fr;
        max-width: 800px;
    }

    footer {
        margin-left: var(--sidebar-width-expanded);
    }

    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 2em;
    }
}

/* --- Grand Écran (grille de contenu dynamique) --- */
@media (min-width: 1440px) {
    .slogan {
        display: block;
    }

    .menu-toggle {
        display: none;
    }

    .sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    .nav-text {
        display: block;
    }

    .main-content-grid {
        margin-left: var(--sidebar-width-expanded);
        grid-template-columns: repeat(auto-fit, minmax(650px, 792px));
        justify-content: start;
    }

    footer {
        margin-left: var(--sidebar-width-expanded);
    }

    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 3em;
    }
}

/* --- Styles globaux (hors media queries) --- */

/* Style pour l'état actif du menu hamburger */
.sidebar.is-open ~ .main-content-grid {
    margin-left: 0;
}

/* Animation pour le menu hamburger */
.menu-toggle.is-open span:nth-child(1) {
    transform: rotate(45deg);
}
.menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.is-open span:nth-child(3) {
    transform: rotate(-45deg);
}

/* --- Styles pour l'impression --- */
@media print {
    /* Étape 1 : Masquer tous les éléments superflus */
    body > *,
    .container > header,
    .container > .sidebar,
    .container > nav.pagination,
    .container > footer {
        display: none !important;
    }

    /* Étape 2 : S'assurer que le contenu principal est visible */
    .container,
    .container > main,
    .container > main > article {
        display: block !important;
        visibility: visible !important;
    }

    /* Étape 3 : Optimiser la mise en page pour le papier */
    main {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
    }

    article {
        margin-bottom: 1.5em; /* Un peu d'espace entre les articles */
        page-break-inside: avoid; /* Évite qu'un article soit coupé sur deux pages */
        border-bottom: 1px solid #ccc; /* Une bordure simple pour séparer */
    }

    /* Étape 4 : Assurer une bonne lisibilité */
    body {
        font-size: 12pt; /* Taille de lisible sur papier */
        line-height: 1.4;
        color: black; /* Forcer le texte en noir */
        background: white; /* Forcer le fond en blanc */
    }

    h1, h2, h3, h4, h5, h6 {
        color: black !important;
        page-break-after: avoid; /* Évite qu'un titre se retrouve tout en bas d'une page */
    }

    a {
        color: black !important;
        text-decoration: underline; /* Souligner les liens pour les identifier */
    }

    /* Afficher l'URL de TOUS les liens */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.9em;
        word-break: break-all;
    }

    /* FAIRE UNE EXCEPTION pour les ancres de page */
    a[href^="#"]:after {
        content: "" !important;
    }

    /* Étape 5 : Gérer les tableaux et les images */
    /* Forcer le tableau à reprendre son apparence normale */
    thead {
        display: table-header-group !important; /* Réaffiche l'en-tête */
        clip-path: none;
        height: auto;
        margin: 0;
        overflow: visible;
        padding: 0;
        position: static;
        width: auto;
    }

     tbody,tr, td, th {
        display: revert !important; /* Rétablit l'affichage par défaut (table, table-row-group, table-row, table-cell) */
        width: auto !important;
        height: auto !important;
        padding: 8px !important;
        text-align: left !important;
        border: 1px solid #ccc !important;
    }

    /* Cacher les pseudo-éléments ajoutés pour le mode mobile */
    td:before {
        display: none !important;
    }

    table {
        border-collapse: collapse;
        width: 100%;
        margin-bottom: 1em;
    }


    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid; /* Évite de couper une image */
    }
}


/* Style du conteneur principal du menu déroulant */
.dropdown {
    position: relative; /* Indispensable pour positionner le menu par rapport à ce bloc */
    display: inline-block; /* S'adapte à la largeur de son contenu */
}

/* Style du bouton qui déclenche le menu (le lien avec le globe) */
.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px; /* Espace entre l'icône et le texte "Langue" */
    padding: 10px 15px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-family: sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.dropdown-toggle:hover {
    background-color: #e0e0e0;
}

/* Style de la liste des langues (votre <ul>) */
.language-list {
    list-style: none; /* Supprime les puces */
    margin: 0;
    padding: 0;

    /* --- La magie du menu déroulant --- */
    position: absolute; /* Positionne la liste par rapport au .dropdown (parent) */
    top: 100%; /* Place la liste juste en dessous du bouton */
    right: 0;
    background-color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 5px;
    min-width: 150px;

    /* Cache le menu par défaut */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

/* --- Au survol du conteneur .dropdown, on affiche la liste --- */
.dropdown:hover .language-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Style des éléments de la liste (<li>) */
.language-list li {
    text-decoration:none;
    border-bottom: 1px solid #eee;
}
.language-list li:before {
    content:none;
}
.language-list li:last-child {
    border-bottom: none;
}

/* Style des liens dans la liste */
.language-list li a {
    display: block; /* Pour que le lien occupe toute la largeur */
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

/* Style au survol d'un lien de langue */
.language-list li a:hover {
    background-color: #f5f5f5;
}

/* Style pour l'élément actif */
.language-list li.active a {
    font-weight: bold;
    color: #007bff;
}
