/* ----------------------------------------------------------------------
   DESIGN SYSTEM - RECONSTRUCTION MINIMALISTE INTERNATIONALE ACCESSIBLE
   ---------------------------------------------------------------------- */
:root {
    --bg-main: #F5F3EF;       /* Teinte papier mat haut de gamme */
    --bg-card: #FFFFFF;
    --text-main: #1A1D21;     /* Contraste élevé certifié WCAG 2.2 */
    --text-muted: #535961;
    --primary: #1E2A38;       /* Bleu institutionnel et de commandement */
    --secondary: #8C6A43;     /* Teinte bronze de rappel d'autorité */
    --border: #D1CBC4;
    --success: #1E4620;
    --font-titles: 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Source Serif 4', Georgia, serif;
}

[data-theme="dark"] {
    --bg-main: #111418;       /* Immersion obscure pour la fatigue oculaire */
    --bg-card: #1A1D21;
    --text-main: #ECECEC;     /* Gris adouci pour l'affichage émetteur de lumière */
    --text-muted: #A3AAB4;
    --primary: #384E68;
    --secondary: #C5A073;
    --border: #2D3239;
}

/* Règle d'Accessibilité Majeure : Respect des choix utilisateurs de réduction d'animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 {
    font-family: var(--font-titles);
    color: var(--primary);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 1rem;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; margin-top: 2rem; }

.container { width: 100%; max-w: 1140px; margin: 0 auto; padding: 0 1.5rem; }
.card { background-color: var(--bg-card); border: 1px solid var(--border); padding: 2rem; border-radius: 4px; }

/* Styles UI des Composants Principaux */
.site-header { border-bottom: 1px solid var(--border); background-color: var(--bg-card); padding: 1rem 0; }
.header-wrapper { display: flex; justify-content: space-between; align-items: center; }
.site-logo { font-family: var(--font-titles); font-weight: 800; font-size: 1.25rem; color: var(--text-main); text-decoration: none; text-transform: uppercase; letter-spacing: 0.05em; }
.main-nav ul { display: flex; list-style: none; gap: 2rem; }
.main-nav a { font-family: var(--font-titles); font-size: 0.95rem; font-weight: 500; color: var(--text-muted); text-decoration: none; }
.main-nav a:hover { color: var(--primary); }

.theme-btn { background: none; border: 1px solid var(--border); color: var(--text-main); cursor: pointer; padding: 0.5rem; border-radius: 4px; }
[data-theme="light"] .moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }

/* Styles UI de la Section de Lecture et de l'Article */
.prose-container { max-w: 720px; margin: 0 auto; }
.article-header { margin-bottom: 3rem; border-bottom: 1px solid var(--border); padding-bottom: 2rem; }
.article-meta-info { font-family: var(--font-titles); font-size: 0.875rem; color: var(--text-muted); margin-top: 0.5rem; }
.article-summary-lead { font-size: 1.35rem; color: var(--text-muted); font-style: italic; margin-top: 1.5rem; line-height: 1.6; }
.article-body-content p { margin-bottom: 1.5rem; text-align: justify; }

/* Boutons et Éléments de Formulaire */
.btn { display: inline-flex; align-items: center; padding: 0.75rem 1.5rem; font-family: var(--font-titles); font-size: 0.95rem; font-weight: 600; text-decoration: none; border-radius: 4px; cursor: pointer; border: none; }
.btn-primary { background-color: var(--primary); color: #FFFFFF; }
.btn-primary:hover { opacity: 0.9; }
.form-control { width: 100%; padding: 0.75rem; border: 1px solid var(--border); background-color: var(--bg-main); color: var(--text-main); font-family: inherit; border-radius: 4px; }

/* Lien d'évitement WCAG invisible par défaut */
.skip-link { position: absolute; top: -100px; left: 0; background: var(--secondary); color: #FFF; padding: 1rem; z-index: 100; transition: top 0.2s; }
.skip-link:focus { top: 0; }

/* Traitement Adaptatif de l'intégration PDF en fonction de la largeur de l'écran */
@media (max-width: 768px) {
    .pdf-viewer-container { display: none; } /* Suppression complète de l'objet lourd figé sur terminaux mobiles */
}

/* ==========================================================================
   CONFIGURATION DU GÉNÉRATEUR PDF INTERNE (CSS PRINT)
   ========================================================================== */
@media print {
    /* 1. Masquer les éléments web inutiles pour la Doctrine */
    header, 
    footer, 
    .no-print, 
    .nav, 
    .admin-bar, 
    button, 
    #sidebar {
        display: none !important;
    }

    /* 2. Configurer le format de la page A4 */
    @page {
        size: A4 portrait;
        margin: 25mm 20mm 25mm 20mm; /* Marges académiques de 2,5 cm */
    }

    /* 3. Style du document de recherche */
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Georgia', 'Times New Roman', serif !important;
        font-size: 11pt;
        line-height: 1.6;
    }

    #main-content, .card {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    /* En-tête de l'article */
    h1 {
        font-size: 26pt;
        margin-top: 0;
        margin-bottom: 10px;
        text-align: left;
    }

    /* Typographie des titres de sections */
    h2 {
        font-size: 16pt;
        margin-top: 30px;
        border-bottom: 0.5pt solid #000000;
        padding-bottom: 5px;
        page-break-after: avoid; /* Interdit de laisser un titre seul en bas de page */
    }

    h3 {
        font-size: 13pt;
        margin-top: 20px;
        page-break-after: avoid;
    }

    p {
        text-align: justify; /* Alignement rigoureux de la doctrine */
        margin-bottom: 12pt;
    }

    /* Citations et extraits de textes */
    blockquote {
        margin: 20px 0;
        padding-left: 15px;
        border-left: 3pt solid #333333;
        font-style: italic;
        color: #222222;
        page-break-inside: avoid;
    }

    /* Gérer proprement les infographies insérées */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid; /* L'infographie ne sera jamais coupée en deux horizontalement */
        margin: 20px auto;
        display: block;
    }
}

/* Style de base (Mode Clair) */
.pdf-download-zone {
    margin: 2rem 0;
    padding: 1rem;
    border: 1px solid #eee;
    background: #fafafa;
}
.pdf-download-zone p {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

/* Style adaptatif (Mode Sombre) */
@media (prefers-color-scheme: dark) {
    .pdf-download-zone {
        background: #1e1e1e;
        border-color: #333;
    }
    .pdf-download-zone p {
        color: #aaa;
    }
}