/* ==========================================================================
   GRAND CALAIS RP WIKI - Feuille de style principale
   --------------------------------------------------------------------------
   Design system inspire de l'identite Grand Calais : bleu marine profond,
   bleu ocean, bleu clair, blanc. Ambiance maritime et administrative moderne.

   Sommaire :
     1.  Tokens (variables CSS)
     2.  Reset et bases
     3.  Utilitaires et mise en page
     4.  Boutons
     5.  Badges et pastilles
     6.  Formulaires
     7.  En-tete et navigation
     8.  Recherche
     9.  Pied de page
     10. Cartes et grilles
     11. Page d'accueil
     12. Article (contenu riche)
     13. Sommaire lateral
     14. Pagination
     15. Messages flash
     16. Profil
     17. Connexion Discord
     18. Pages d'erreur
     19. Accessibilite et impression
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   Les variables --brand-* sont injectees par le serveur (ThemeService) a
   partir des parametres d'administration : couleur principale, secondaire,
   accent, arrondis et largeur de contenu.
   ========================================================================== */

:root {
    /* Valeurs de repli si le bloc serveur n'est pas charge */
    --brand-primary: #12467F;
    --brand-primary-rgb: 18, 70, 127;
    --brand-primary-dark: #0E3663;
    --brand-primary-light: #4C7BB0;
    --brand-secondary: #1C7BC4;
    --brand-secondary-rgb: 28, 123, 196;
    --brand-secondary-dark: #16629D;
    --brand-accent: #4FB3E8;
    --brand-accent-rgb: 79, 179, 232;
    --brand-accent-dark: #3B86AE;

    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --content-width: 1240px;

    /* Palette claire (par defaut) */
    --bg: #F2F7FC;
    --bg-gradient: radial-gradient(1200px 600px at 12% -10%, rgba(var(--brand-accent-rgb), .16), transparent 60%),
                   radial-gradient(1000px 500px at 100% 0%, rgba(var(--brand-primary-rgb), .12), transparent 55%);
    --surface: #FFFFFF;
    --surface-2: #EBF2F9;
    --surface-3: #DFEAF5;
    --surface-hover: #F6FAFE;
    --text: #0D2137;
    --text-strong: #071627;
    --text-muted: #5A7189;
    --text-inverse: #FFFFFF;
    --border: #D8E4F0;
    --border-strong: #BDD0E4;

    --success: #0F8A4D;
    --success-bg: #E4F6EC;
    --warning: #B46B00;
    --warning-bg: #FDF1DE;
    --danger: #C0392B;
    --danger-bg: #FCEAE8;
    --info: #1668A8;
    --info-bg: #E6F1FA;

    --shadow-xs: 0 1px 2px rgba(13, 33, 55, .06);
    --shadow-sm: 0 2px 8px rgba(13, 33, 55, .07);
    --shadow-md: 0 8px 24px rgba(13, 33, 55, .10);
    --shadow-lg: 0 18px 48px rgba(13, 33, 55, .14);
    --ring: 0 0 0 3px rgba(var(--brand-accent-rgb), .40);

    --header-height: 68px;
    --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace;

    --transition: 180ms cubic-bezier(.4, 0, .2, 1);

    color-scheme: light;
}

/* Palette sombre : appliquee soit par preference systeme, soit par choix
   explicite (attribut data-theme sur <html>). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #061220;
        --bg-gradient: radial-gradient(1200px 620px at 10% -12%, rgba(var(--brand-secondary-rgb), .20), transparent 60%),
                       radial-gradient(900px 480px at 100% 0%, rgba(var(--brand-primary-rgb), .28), transparent 58%);
        --surface: #0D1F31;
        --surface-2: #132B41;
        --surface-3: #1A3A57;
        --surface-hover: #16334C;
        --text: #E4EDF6;
        --text-strong: #FFFFFF;
        --text-muted: #92A9C1;
        --text-inverse: #071627;
        --border: #1E3A55;
        --border-strong: #2C516F;

        --success: #4ADE80;
        --success-bg: rgba(74, 222, 128, .12);
        --warning: #FBBF24;
        --warning-bg: rgba(251, 191, 36, .12);
        --danger: #F87171;
        --danger-bg: rgba(248, 113, 113, .12);
        --info: #60B8F0;
        --info-bg: rgba(96, 184, 240, .12);

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
        --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #061220;
    --bg-gradient: radial-gradient(1200px 620px at 10% -12%, rgba(var(--brand-secondary-rgb), .20), transparent 60%),
                   radial-gradient(900px 480px at 100% 0%, rgba(var(--brand-primary-rgb), .28), transparent 58%);
    --surface: #0D1F31;
    --surface-2: #132B41;
    --surface-3: #1A3A57;
    --surface-hover: #16334C;
    --text: #E4EDF6;
    --text-strong: #FFFFFF;
    --text-muted: #92A9C1;
    --text-inverse: #071627;
    --border: #1E3A55;
    --border-strong: #2C516F;

    --success: #4ADE80;
    --success-bg: rgba(74, 222, 128, .12);
    --warning: #FBBF24;
    --warning-bg: rgba(251, 191, 36, .12);
    --danger: #F87171;
    --danger-bg: rgba(248, 113, 113, .12);
    --info: #60B8F0;
    --info-bg: rgba(96, 184, 240, .12);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);

    color-scheme: dark;
}

/* ==========================================================================
   2. RESET ET BASES
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

/*
 * L'attribut HTML "hidden" doit toujours masquer l'element.
 * Sans cette regle, n'importe quelle declaration "display" d'auteur
 * (par exemple .alert{display:flex} ou img{display:block}) prend le pas
 * sur la feuille de style du navigateur et l'element reste visible.
 * Concerne notamment la fenetre de la mediatheque, la banniere de
 * restauration de brouillon et les apercus d'images de l'administration.
 */
[hidden] {
    display: none !important;
}

a {
    color: var(--brand-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--brand-accent);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .6em;
    line-height: 1.25;
    color: var(--text-strong);
    font-weight: 700;
    letter-spacing: -.015em;
}

h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h3 { font-size: clamp(1.18rem, 1rem + .7vw, 1.45rem); }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.1em; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }

hr {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 2rem 0;
}

code, pre, kbd {
    font-family: var(--font-mono);
    font-size: .9em;
}

::selection {
    background: rgba(var(--brand-accent-rgb), .35);
    color: var(--text-strong);
}

/* Barre de defilement discrete */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--brand-secondary); background-clip: content-box; }

/* ==========================================================================
   3. UTILITAIRES ET MISE EN PAGE
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 860px;
}

.page {
    padding: 32px 0 72px;
    min-height: 60vh;
}

.stack > * + * { margin-top: 1rem; }

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .875rem; }
.text-tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.75rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.75rem; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    background: var(--brand-primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 0 0 var(--radius-md) 0;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
    color: #fff;
}

/* Titre de section */
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.section-head h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-head .section-link {
    font-size: .9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.section-sub {
    color: var(--text-muted);
    margin: -8px 0 20px;
    font-size: .95rem;
}

/* Fil d'Ariane */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    font-size: .85rem;
    color: var(--text-muted);
}

.breadcrumb li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb li + li::before { content: "/"; opacity: .5; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand-secondary); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* Etat vide */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}

.empty-state .icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    opacity: .5;
}

.empty-state h3 { color: var(--text); margin-bottom: .3em; }

/* ==========================================================================
   4. BOUTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), transform var(--transition),
                box-shadow var(--transition);
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-secondary), var(--brand-primary));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-secondary));
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text-strong);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { filter: brightness(1.08); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); color: #fff; }

.btn-sm {
    padding: 7px 13px;
    min-height: 36px;
    font-size: .84rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 30px;
    min-height: 52px;
    font-size: 1.02rem;
}

.btn-block { width: 100%; }

.btn[disabled],
.btn.is-disabled {
    opacity: .55;
    pointer-events: none;
}

.btn .icon { width: 18px; height: 18px; flex: none; }

/* Bouton Discord */
.btn-discord {
    background: #5865F2;
    color: #fff;
    box-shadow: 0 8px 24px rgba(88, 101, 242, .32);
}

.btn-discord:hover {
    background: #4752C4;
    color: #fff;
    box-shadow: 0 12px 32px rgba(88, 101, 242, .42);
}

/* Bouton icone seul */
.btn-icon {
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-icon:hover {
    background: var(--surface-2);
    color: var(--brand-secondary);
    border-color: var(--border-strong);
}

/* ==========================================================================
   5. BADGES ET PASTILLES
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-primary { background: rgba(var(--brand-primary-rgb), .12); color: var(--brand-primary); }
.badge-accent  { background: rgba(var(--brand-accent-rgb), .16); color: var(--brand-accent-dark); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

:root[data-theme="dark"] .badge-primary,
:root[data-theme="dark"] .badge-accent {
    color: var(--brand-accent);
}

/* Pastille de categorie coloree */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.category-chip:hover {
    border-color: currentColor;
    transform: translateY(-1px);
}

.category-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

/* Etiquettes */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
    transition: all var(--transition);
}

.tag:hover {
    background: rgba(var(--brand-accent-rgb), .14);
    border-color: var(--brand-accent);
    color: var(--brand-secondary);
}

/* ==========================================================================
   6. FORMULAIRES
   ========================================================================== */

.field { margin-bottom: 18px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

label,
.label {
    display: block;
    margin-bottom: 7px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
}

.label-hint {
    display: block;
    font-weight: 400;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 3px;
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    min-height: 44px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    appearance: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%235A7189' d='M7 9 0 2l2-2 5 5 5-5 2 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: var(--ring);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: .75; }

input[type="color"] {
    width: 58px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
}

.color-field {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-field input[type="text"] { max-width: 140px; font-family: var(--font-mono); }

/* Case a cocher personnalisee */
.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    cursor: pointer;
    font-weight: 500;
    font-size: .92rem;
    margin-bottom: 0;
    padding: 4px 0;
}

.checkbox input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    flex: none;
    margin: 1px 0 0;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.checkbox input[type="checkbox"]:checked {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.checkbox input[type="checkbox"]:focus-visible { box-shadow: var(--ring); outline: none; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

/* Message d'erreur de champ */
.field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: .82rem;
    font-weight: 500;
}

.has-error input,
.has-error select,
.has-error textarea {
    border-color: var(--danger);
}

/* Barre de filtres */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.filters .field { margin: 0; flex: 1 1 170px; min-width: 0; }
.filters label { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.filters .filter-actions { display: flex; gap: 8px; }

/* ==========================================================================
   7. EN-TETE ET NAVIGATION
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

@supports not (backdrop-filter: blur(1px)) {
    .site-header { background: var(--surface); }
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    height: var(--header-height);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    color: var(--text-strong);
    font-weight: 800;
}

.brand:hover { color: var(--brand-secondary); }

.brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: contain;
    flex: none;
    box-shadow: 0 2px 10px rgba(var(--brand-primary-rgb), .25);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 1.02rem; letter-spacing: -.02em; }
.brand-sub {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--brand-secondary);
}

/* Menu principal */
.main-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border-radius: var(--radius-md);
    font-size: .92rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text-strong);
}

.nav-link.is-active {
    color: var(--brand-secondary);
    background: rgba(var(--brand-accent-rgb), .12);
}

.nav-link .icon { width: 17px; height: 17px; opacity: .85; }

/* Sous-menu */
.nav-item { position: relative; }

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all var(--transition);
    z-index: 60;
}

.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
}

.nav-dropdown a:hover { background: var(--surface-2); color: var(--brand-secondary); }

/* Actions d'en-tete */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

/* Bouton de recherche compact */
.header-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 14px 0 12px;
    height: 42px;
    min-width: 190px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .88rem;
    cursor: pointer;
    transition: all var(--transition);
}

.header-search-btn:hover {
    border-color: var(--brand-accent);
    background: var(--surface);
    color: var(--text);
}

.header-search-btn .icon { width: 17px; height: 17px; }
.header-search-btn kbd {
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-size: .7rem;
    color: var(--text-muted);
}

/* Menu utilisateur */
.user-menu { position: relative; }

.user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 4px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    font-family: inherit;
}

.user-trigger:hover { background: var(--surface); border-color: var(--brand-accent); }

.user-trigger img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex: none;
    object-fit: cover;
}

.user-trigger .user-name {
    font-size: .88rem;
    font-weight: 600;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 268px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 120;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.98);
    transform-origin: top right;
    transition: all var(--transition);
}

.user-menu.is-open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px 13px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 7px;
}

.user-dropdown-head img { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.user-dropdown-head .name { font-weight: 700; font-size: .95rem; color: var(--text-strong); }
.user-dropdown-head .role { font-size: .76rem; color: var(--brand-secondary); font-weight: 600; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
}

.dropdown-item:hover { background: var(--surface-2); color: var(--brand-secondary); }
.dropdown-item .icon { width: 18px; height: 18px; opacity: .7; flex: none; }
.dropdown-item.is-danger:hover { background: var(--danger-bg); color: var(--danger); }

.dropdown-sep { height: 1px; background: var(--border); margin: 7px 4px; }

.dropdown-label {
    padding: 8px 12px 4px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}

/* Selecteur de theme */
.theme-switch {
    display: flex;
    gap: 3px;
    padding: 3px;
    margin: 2px 8px 4px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
}

.theme-switch button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-switch button:hover { color: var(--text); }

.theme-switch button.is-active {
    background: var(--surface);
    color: var(--brand-secondary);
    box-shadow: var(--shadow-xs);
}

.theme-switch .icon { width: 15px; height: 15px; }

/* Bouton hamburger */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    cursor: pointer;
    color: var(--text);
}

.nav-toggle:hover { background: var(--surface-3); }

.nav-toggle .bars {
    position: relative;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: background var(--transition);
}

.nav-toggle .bars::before,
.nav-toggle .bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--transition);
}

.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   8. RECHERCHE
   ========================================================================== */

.search-form { position: relative; width: 100%; }

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap > .icon {
    position: absolute;
    left: 18px;
    width: 21px;
    height: 21px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 60px;
    padding: 0 120px 0 52px;
    font-size: 1.02rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.search-input:focus {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-lg), var(--ring);
}

.search-submit {
    position: absolute;
    right: 7px;
    height: 46px;
    padding: 0 22px;
    border-radius: 999px;
}

.search-hint {
    margin-top: 12px;
    font-size: .85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Suggestions */
.search-suggestions {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    max-height: 420px;
    overflow-y: auto;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 90;
    display: none;
    text-align: left;
}

.search-suggestions.is-open { display: block; }

.suggestion {
    display: block;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text);
    transition: background var(--transition);
}

.suggestion:hover,
.suggestion.is-highlighted {
    background: var(--surface-2);
    color: var(--text-strong);
}

.suggestion-title { font-weight: 600; font-size: .93rem; display: block; }
.suggestion-meta { font-size: .78rem; color: var(--text-muted); display: block; margin-top: 2px; }
.suggestion-all {
    display: block;
    text-align: center;
    padding: 11px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    font-weight: 600;
    color: var(--brand-secondary);
}

/* Resultats */
.result-item {
    display: block;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    transition: all var(--transition);
    color: var(--text);
}

.result-item:hover {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text);
}

.result-item h3 { margin: 0 0 6px; font-size: 1.12rem; color: var(--brand-secondary); }
.result-item p { margin: 0 0 10px; color: var(--text-muted); font-size: .92rem; line-height: 1.65; }
.result-item mark {
    background: rgba(var(--brand-accent-rgb), .28);
    color: var(--text-strong);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}
.result-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: .78rem; color: var(--text-muted); }
.result-url { font-size: .78rem; color: var(--success); margin-bottom: 8px; word-break: break-all; }

/* ==========================================================================
   9. PIED DE PAGE
   ========================================================================== */

.site-footer {
    margin-top: 64px;
    padding: 52px 0 28px;
    background: linear-gradient(180deg, transparent, rgba(var(--brand-primary-rgb), .07));
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr repeat(auto-fit, minmax(160px, 1fr));
    gap: 40px;
    margin-bottom: 36px;
}

.footer-brand { max-width: 380px; }

.footer-brand .brand { margin-bottom: 14px; }

.footer-brand p {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.7;
    margin: 0;
}

.footer-col h3 {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: var(--text); font-size: .9rem; }
.footer-col a:hover { color: var(--brand-secondary); }

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    font-size: .83rem;
    color: var(--text-muted);
}

.footer-bottom p { margin: 0; }

/* ==========================================================================
   10. CARTES ET GRILLES
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card-body { padding: 22px; }
.card-pad { padding: 22px; }

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-accent);
}

.grid {
    display: grid;
    gap: 18px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

/* Carte d'article */
.page-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    color: var(--text);
}

.page-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-accent);
    color: var(--text);
}

.page-card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    overflow: hidden;
}

.page-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.page-card:hover .page-card-cover img { transform: scale(1.04); }

.page-card-cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, .85);
}

.page-card-cover-fallback .icon { width: 52px; height: 52px; }

.page-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px 20px;
    gap: 10px;
}

.page-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-strong);
}

.page-card:hover .page-card-title { color: var(--brand-secondary); }

.page-card-excerpt {
    margin: 0;
    font-size: .88rem;
    line-height: 1.6;
    color: var(--text-muted);
    flex: 1;
}

.page-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: .76rem;
    color: var(--text-muted);
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.page-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.page-card-meta .icon { width: 14px; height: 14px; opacity: .7; }

/* Liste compacte */
.page-list { display: flex; flex-direction: column; gap: 2px; }

.page-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
    color: var(--text);
}

.page-list-item:hover { background: var(--surface-2); color: var(--text); }

.page-list-icon {
    width: 40px;
    height: 40px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(var(--brand-accent-rgb), .13);
    color: var(--brand-secondary);
}

.page-list-icon .icon { width: 20px; height: 20px; }

.page-list-main { flex: 1; min-width: 0; }
.page-list-title { font-weight: 600; font-size: .94rem; display: block; }
.page-list-meta { font-size: .78rem; color: var(--text-muted); display: block; margin-top: 1px; }

/* Carte de categorie */
.category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: all var(--transition);
    color: var(--text);
    height: 100%;
}

.category-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--cat-color, var(--brand-secondary));
    transition: width var(--transition);
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--cat-color, var(--brand-accent));
    color: var(--text);
}

.category-card:hover::before { width: 6px; }

.category-card-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: color-mix(in srgb, var(--cat-color, var(--brand-secondary)) 15%, transparent);
    color: var(--cat-color, var(--brand-secondary));
}

.category-card-icon .icon { width: 23px; height: 23px; }

.category-card h3 { margin: 0; font-size: 1.04rem; }
.category-card p { margin: 0; font-size: .86rem; color: var(--text-muted); line-height: 1.6; flex: 1; }

.category-card-count {
    font-size: .78rem;
    font-weight: 600;
    color: var(--cat-color, var(--brand-secondary));
}

.category-card-children {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.category-card-children a {
    font-size: .76rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
}

.category-card-children a:hover { background: var(--surface-3); color: var(--brand-secondary); }

/* Statistiques */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 14px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.stat-icon {
    width: 46px;
    height: 46px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: rgba(var(--brand-accent-rgb), .14);
    color: var(--brand-secondary);
}

.stat-icon .icon { width: 23px; height: 23px; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-strong);
    letter-spacing: -.02em;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}

/* ==========================================================================
   11. PAGE D'ACCUEIL
   ========================================================================== */

.hero {
    position: relative;
    padding: 64px 0 56px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    top: -180px;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 460px;
    background: radial-gradient(circle, rgba(var(--brand-accent-rgb), .20), transparent 65%);
    pointer-events: none;
    z-index: -1;
}

.hero-logo {
    width: 118px;
    height: 118px;
    margin: 0 auto 22px;
    border-radius: 50%;
    box-shadow: 0 14px 44px rgba(var(--brand-primary-rgb), .32);
    background: var(--surface);
}

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.9rem, 1.2rem + 3vw, 3.1rem);
    letter-spacing: -.03em;
    background: linear-gradient(120deg, var(--brand-primary), var(--brand-secondary) 55%, var(--brand-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

:root[data-theme="dark"] .hero h1 {
    background: linear-gradient(120deg, #FFFFFF, var(--brand-accent) 70%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-tagline {
    max-width: 640px;
    margin: 0 auto 32px;
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
    color: var(--text-muted);
    line-height: 1.7;
}

.hero-search { max-width: 680px; margin: 0 auto; }

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 26px;
}

/* Bandeau de bienvenue */
.welcome-panel {
    position: relative;
    padding: 34px 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 48px;
}

.welcome-panel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(var(--brand-accent-rgb), .13), transparent 70%);
    pointer-events: none;
}

.welcome-panel h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.welcome-panel h2 .icon { width: 26px; height: 26px; color: var(--brand-accent); flex: none; }

.welcome-panel p { color: var(--text-muted); line-height: 1.8; margin-bottom: 0; max-width: 78ch; }

/* Raccourcis */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: .92rem;
    color: var(--text);
    transition: all var(--transition);
}

.shortcut:hover {
    border-color: var(--brand-accent);
    background: var(--surface-hover);
    color: var(--brand-secondary);
    transform: translateX(3px);
}

.shortcut .icon { width: 20px; height: 20px; color: var(--brand-secondary); flex: none; }
.shortcut .arrow { margin-left: auto; opacity: .4; width: 16px; height: 16px; }

.section { margin-bottom: 52px; }

/* ==========================================================================
   12. ARTICLE (CONTENU RICHE)
   ========================================================================== */

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 44px;
    align-items: start;
}

.article-layout.no-toc { grid-template-columns: minmax(0, 1fr); max-width: 900px; }

.article-header { margin-bottom: 30px; }

.article-header h1 { margin-bottom: 14px; }

.article-cover {
    width: 100%;
    aspect-ratio: 21 / 9;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 26px;
    box-shadow: var(--shadow-md);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-muted);
}

.article-meta > span,
.article-meta > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-meta .icon { width: 15px; height: 15px; opacity: .75; }

.article-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text);
}

.article-author img { width: 26px; height: 26px; border-radius: 50%; }

.article-lead {
    font-size: 1.08rem;
    line-height: 1.8;
    color: var(--text-muted);
    padding: 18px 22px;
    background: var(--surface-2);
    border-left: 4px solid var(--brand-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 24px 0 30px;
}

/* --- Corps de l'article --------------------------------------------------- */

.prose {
    font-size: 1.02rem;
    line-height: 1.8;
    color: var(--text);
    word-wrap: break-word;
}

.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }

.prose h2 {
    margin: 2.4em 0 .8em;
    padding-bottom: .35em;
    border-bottom: 2px solid var(--border);
    scroll-margin-top: calc(var(--header-height) + 24px);
}

.prose h3 {
    margin: 2em 0 .7em;
    scroll-margin-top: calc(var(--header-height) + 24px);
}

.prose h4 {
    margin: 1.6em 0 .6em;
    color: var(--brand-secondary);
    scroll-margin-top: calc(var(--header-height) + 24px);
}

.prose h2::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: .78em;
    margin-right: 11px;
    vertical-align: -1px;
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-secondary));
    border-radius: 3px;
}

.prose a {
    color: var(--brand-secondary);
    text-decoration: underline;
    text-decoration-color: rgba(var(--brand-secondary-rgb), .35);
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    transition: all var(--transition);
}

.prose a:hover {
    color: var(--brand-accent);
    text-decoration-color: currentColor;
}

.prose ul,
.prose ol { padding-left: 1.5em; margin: 1.2em 0; }

.prose li { margin-bottom: .5em; }
.prose li::marker { color: var(--brand-secondary); font-weight: 700; }

.prose ul ul,
.prose ol ol,
.prose ul ol,
.prose ol ul { margin: .5em 0; }

.prose blockquote {
    margin: 1.7em 0;
    padding: 16px 22px;
    border-left: 4px solid var(--brand-accent);
    background: var(--surface-2);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
    font-style: italic;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
    padding: .16em .45em;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: .88em;
    color: var(--brand-secondary);
    word-break: break-word;
}

:root[data-theme="dark"] .prose code { color: var(--brand-accent); }

.prose pre {
    margin: 1.6em 0;
    padding: 18px 20px;
    background: #0B1B2B;
    border: 1px solid #1E3A55;
    border-radius: var(--radius-md);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.prose pre code {
    padding: 0;
    background: none;
    border: 0;
    color: #D8E6F5;
    font-size: .875rem;
    line-height: 1.7;
    display: block;
}

.prose img,
.prose .wiki-image {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 1.6em auto;
    max-width: 100%;
}

.prose figure { margin: 1.8em 0; }
.prose figcaption {
    text-align: center;
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.prose hr {
    margin: 2.6em 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.prose mark {
    background: rgba(var(--brand-accent-rgb), .3);
    color: var(--text-strong);
    padding: .05em .28em;
    border-radius: 4px;
}

.prose kbd {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface-2);
    font-size: .82em;
    color: var(--text);
}

.prose sup, .prose sub { font-size: .72em; }

/* Tableaux */
.wiki-table-wrapper,
.prose .table-wrapper {
    overflow-x: auto;
    margin: 1.8em 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    -webkit-overflow-scrolling: touch;
}

.prose table,
.wiki-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    background: var(--surface);
    min-width: 460px;
}

.prose th,
.wiki-table th {
    padding: 13px 16px;
    text-align: left;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    font-weight: 700;
    font-size: .84rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.prose td,
.wiki-table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

.prose tbody tr:nth-child(even),
.wiki-table tbody tr:nth-child(even) { background: var(--surface-2); }

.prose tbody tr:hover,
.wiki-table tbody tr:hover { background: var(--surface-hover); }

/* Encadres */
.callout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 1.8em 0;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    border: 1px solid;
    border-left-width: 4px;
    background: var(--info-bg);
    border-color: var(--info);
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: .95rem;
    color: var(--info);
}

.callout-title::before {
    content: "i";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 21px;
    height: 21px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
    color: var(--surface);
    font-size: .78rem;
    font-weight: 800;
    font-style: italic;
}

.callout-body { color: var(--text); font-size: .96rem; }
.callout-body > *:last-child { margin-bottom: 0; }
.callout-body > *:first-child { margin-top: 0; }

.callout-info    { background: var(--info-bg);    border-color: var(--info); }
.callout-info .callout-title { color: var(--info); }

.callout-warning { background: var(--warning-bg); border-color: var(--warning); }
.callout-warning .callout-title { color: var(--warning); }
.callout-warning .callout-title::before { content: "!"; font-style: normal; }

.callout-danger  { background: var(--danger-bg);  border-color: var(--danger); }
.callout-danger .callout-title { color: var(--danger); }
.callout-danger .callout-title::before { content: "\00d7"; font-style: normal; font-size: 1rem; }

.callout-success { background: var(--success-bg); border-color: var(--success); }
.callout-success .callout-title { color: var(--success); }
.callout-success .callout-title::before { content: "\2713"; font-style: normal; }

.callout-note    { background: var(--surface-2);  border-color: var(--border-strong); }
.callout-note .callout-title { color: var(--text-muted); }
.callout-note .callout-title::before { content: "\270E"; font-style: normal; }

/* Boutons dans le contenu */
.wiki-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    margin: .4em .4em .4em 0;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: .95rem;
    text-decoration: none !important;
    transition: all var(--transition);
}

.wiki-button-primary {
    background: linear-gradient(135deg, var(--brand-secondary), var(--brand-primary));
    color: #fff !important;
    box-shadow: var(--shadow-sm);
}

.wiki-button-primary:hover {
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-secondary));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: #fff !important;
}

.wiki-button-ghost {
    background: var(--surface-2);
    color: var(--text) !important;
    border: 1px solid var(--border);
}

/* Videos integrees */
.wiki-embed {
    position: relative;
    margin: 1.8em 0;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    background: #000;
}

.wiki-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Details / summary */
.prose details {
    margin: 1.4em 0;
    padding: 14px 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.prose summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand-secondary);
    list-style-position: inside;
}

.prose details[open] summary { margin-bottom: 12px; }

/* Pied d'article */
.article-footer {
    margin-top: 46px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

.article-footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.article-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 26px;
}

.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: all var(--transition);
}

.article-nav-item:hover {
    border-color: var(--brand-accent);
    background: var(--surface-hover);
    color: var(--text);
}

.article-nav-item .label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 700;
}

.article-nav-item .title { font-weight: 600; font-size: .93rem; }

/* ==========================================================================
   13. SOMMAIRE LATERAL
   ========================================================================== */

.toc {
    position: sticky;
    top: calc(var(--header-height) + 22px);
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.toc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-muted);
}

.toc-title .icon { width: 15px; height: 15px; }

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

.toc li { margin: 0; }

.toc a {
    display: block;
    padding: 6px 12px;
    border-left: 2px solid var(--border);
    font-size: .855rem;
    line-height: 1.5;
    color: var(--text-muted);
    transition: all var(--transition);
}

.toc a:hover {
    color: var(--brand-secondary);
    border-left-color: var(--brand-accent);
    background: var(--surface-2);
}

.toc a.is-active {
    color: var(--brand-secondary);
    border-left-color: var(--brand-secondary);
    background: rgba(var(--brand-accent-rgb), .1);
    font-weight: 600;
}

.toc .level-3 a { padding-left: 26px; font-size: .82rem; }
.toc .level-4 a { padding-left: 40px; font-size: .8rem; }

/* Version mobile repliable */
.toc-mobile {
    display: none;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.toc-mobile summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 18px;
    cursor: pointer;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
    list-style: none;
}

.toc-mobile summary::-webkit-details-marker { display: none; }

.toc-mobile summary::after {
    content: "";
    margin-left: auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--transition);
}

.toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }

.toc-mobile .toc-mobile-body {
    padding: 0 12px 14px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* ==========================================================================
   14. PAGINATION
   ========================================================================== */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 36px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    transition: all var(--transition);
}

.pagination a:hover {
    border-color: var(--brand-accent);
    background: var(--surface-hover);
    color: var(--brand-secondary);
}

.pagination .is-current {
    background: linear-gradient(135deg, var(--brand-secondary), var(--brand-primary));
    border-color: transparent;
    color: #fff;
}

.pagination .is-disabled { opacity: .4; pointer-events: none; }

.pagination-info {
    text-align: center;
    margin-top: 14px;
    font-size: .84rem;
    color: var(--text-muted);
}

/* ==========================================================================
   15. MESSAGES FLASH
   ========================================================================== */

.flash-stack {
    position: fixed;
    top: calc(var(--header-height) + 14px);
    right: 18px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 36px));
    pointer-events: none;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid;
    border-left-width: 4px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: .9rem;
    line-height: 1.55;
    pointer-events: auto;
    animation: flash-in 320ms cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes flash-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.flash.is-leaving {
    opacity: 0;
    transform: translateX(30px);
    transition: all 260ms ease;
}

.flash .icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.flash-message { flex: 1; word-break: break-word; }

.flash-close {
    flex: none;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flash-close:hover { background: var(--surface-2); color: var(--text); }

.flash-success { border-color: var(--success); color: var(--text); }
.flash-success .icon { color: var(--success); }
.flash-error   { border-color: var(--danger); }
.flash-error .icon { color: var(--danger); }
.flash-warning { border-color: var(--warning); }
.flash-warning .icon { color: var(--warning); }
.flash-info    { border-color: var(--info); }
.flash-info .icon { color: var(--info); }

/* Encart d'alerte statique (dans le flux) */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 18px;
    border-radius: var(--radius-md);
    border: 1px solid;
    border-left-width: 4px;
    margin-bottom: 20px;
    font-size: .92rem;
    line-height: 1.6;
}

.alert .icon { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--text); }
.alert-success { background: var(--success-bg); border-color: var(--success); color: var(--text); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--text); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--text); }
.alert strong { color: var(--text-strong); }

/* ==========================================================================
   16. PROFIL
   ========================================================================== */

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .10), rgba(var(--brand-accent-rgb), .10));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 4px solid var(--surface);
    box-shadow: var(--shadow-md);
    flex: none;
}

.profile-identity { flex: 1; min-width: 200px; }
.profile-identity h1 { margin: 0 0 4px; font-size: 1.65rem; }
.profile-identity .handle { color: var(--text-muted); font-size: .9rem; font-family: var(--font-mono); }

.profile-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

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

.info-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--text-muted); }
.info-list .v { font-weight: 600; text-align: right; word-break: break-word; }

.role-id-list { display: flex; flex-wrap: wrap; gap: 6px; }

.role-id {
    font-family: var(--font-mono);
    font-size: .74rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.role-id.is-admin {
    background: rgba(var(--brand-accent-rgb), .16);
    border-color: var(--brand-accent);
    color: var(--brand-secondary);
    font-weight: 700;
}

/* ==========================================================================
   17. CONNEXION DISCORD
   ========================================================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 44px 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-lg) + 6px);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-logo {
    width: 104px;
    height: 104px;
    margin: 0 auto 22px;
    border-radius: 50%;
    box-shadow: 0 12px 36px rgba(var(--brand-primary-rgb), .28);
}

.auth-card h1 { font-size: 1.5rem; margin-bottom: 10px; }
.auth-card > p { color: var(--text-muted); margin-bottom: 28px; line-height: 1.7; }

.auth-steps {
    text-align: left;
    margin: 26px 0 0;
    padding: 20px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    font-size: .87rem;
    color: var(--text-muted);
}

.auth-steps h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px; }
.auth-steps ol { margin: 0; padding-left: 20px; }
.auth-steps li { margin-bottom: 7px; }
.auth-steps li:last-child { margin-bottom: 0; }

.auth-back { display: inline-block; margin-top: 22px; font-size: .88rem; color: var(--text-muted); }

/* ==========================================================================
   18. PAGES D'ERREUR
   ========================================================================== */

.error-page {
    min-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px;
}

.error-inner { max-width: 560px; }

.error-code {
    font-size: clamp(4.5rem, 3rem + 8vw, 8rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.05em;
    background: linear-gradient(135deg, var(--brand-secondary), var(--brand-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.error-page h1 { font-size: 1.6rem; margin-bottom: 12px; }
.error-page p { color: var(--text-muted); line-height: 1.75; margin-bottom: 28px; }

.error-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.error-trace {
    margin-top: 32px;
    padding: 18px;
    background: #0B1B2B;
    color: #D8E6F5;
    border-radius: var(--radius-md);
    text-align: left;
    font-family: var(--font-mono);
    font-size: .78rem;
    line-height: 1.65;
    overflow: auto;
    max-height: 340px;
}

/* ==========================================================================
   19. ICONES
   ========================================================================== */

.icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
    flex: none;
}

.icon-filled { fill: currentColor; stroke: none; }

/* ==========================================================================
   20. RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .toc { display: none; }
    .toc-mobile { display: block; }
}

@media (max-width: 940px) {
    .header-search-btn { min-width: 0; width: 44px; padding: 0; justify-content: center; }
    .header-search-btn span,
    .header-search-btn kbd { display: none; }
}

@media (max-width: 860px) {
    :root { --header-height: 62px; }

    .nav-toggle { display: inline-flex; }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 18px;
        margin: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 260ms cubic-bezier(.4, 0, .2, 1);
        z-index: 99;
    }

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

    .nav-link {
        padding: 14px 16px;
        font-size: 1rem;
        border-radius: var(--radius-md);
    }

    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--border);
        border-radius: 0;
        margin: 2px 0 6px 16px;
        padding: 0;
        min-width: 0;
    }

    .brand-sub { display: none; }
    .brand img { width: 38px; height: 38px; }
    .user-trigger .user-name { display: none; }
    .user-trigger { padding: 4px; }

    .footer-grid { grid-template-columns: 1fr; gap: 30px; }

    .flash-stack {
        left: 12px;
        right: 12px;
        width: auto;
        top: calc(var(--header-height) + 10px);
    }
}

@media (max-width: 640px) {
    body { font-size: 15.5px; }

    .container { padding: 0 15px; }
    .page { padding: 22px 0 52px; }

    .hero { padding: 40px 0 34px; }
    .hero-logo { width: 92px; height: 92px; }

    .search-input { height: 54px; padding: 0 16px 0 46px; font-size: .96rem; }
    .search-input-wrap > .icon { left: 15px; width: 19px; height: 19px; }
    .search-submit { display: none; }

    .welcome-panel { padding: 24px 20px; }
    .card-body, .card-pad { padding: 17px; }

    .prose { font-size: 1rem; }
    .prose pre { padding: 14px; border-radius: var(--radius-sm); }
    .prose h2::before { height: .7em; margin-right: 8px; }

    .article-meta { gap: 6px 14px; font-size: .8rem; }
    .article-cover { aspect-ratio: 16 / 9; }

    .profile-header { padding: 22px; gap: 18px; }
    .profile-avatar { width: 76px; height: 76px; }

    .stat-card { padding: 15px; gap: 12px; }
    .stat-value { font-size: 1.35rem; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-icon .icon { width: 20px; height: 20px; }

    .filters { padding: 13px; }
    .filters .field { flex-basis: 100%; }
    .filters .filter-actions { width: 100%; }
    .filters .filter-actions .btn { flex: 1; }

    .auth-card { padding: 32px 22px; }

    .pagination a,
    .pagination span { min-width: 38px; height: 38px; padding: 0 10px; font-size: .85rem; }

    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 380px) {
    .container { padding: 0 12px; }
    .brand-title { font-size: .92rem; }
    .btn { padding: 10px 15px; font-size: .9rem; }
}

/* ==========================================================================
   21. ACCESSIBILITE ET IMPRESSION
   ========================================================================== */

:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    .site-header,
    .site-footer,
    .toc,
    .toc-mobile,
    .flash-stack,
    .article-nav,
    .breadcrumb,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 11.5pt;
    }

    .prose a::after { content: " (" attr(href) ")"; font-size: .82em; color: #555; }
    .article-layout { display: block; }
    .prose pre { border: 1px solid #999; background: #f5f5f5; color: #000; }
    .prose pre code { color: #000; }
}
