/*
Theme Name: Scientia
Theme URI: https://scientia-theme.com
Author: Scientia Team
Author URI: https://scientia-theme.com
Description: Plateforme WordPress complète pour revues scientifiques internationales à comité de lecture. Prend en charge les articles WordPress déjà publiés. Gestion des volumes et numéros, DOI, ORCID, licences Creative Commons, export de citations (BibTeX, RIS, EndNote, CSL-JSON), moissonnage OAI-PMH, dépôt Crossref, contrôle d'accès, soumission en ligne, multilinguisme (FR/EN/AR/ES) et design éditorial moderne.
Version: 3.5.1
Requires at least: 6.2
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: scientia
Tags: academic, education, science, journal, research, rtl-language, translation-ready, custom-colors, custom-logo, custom-menu, featured-images, full-width-template, block-styles, wide-blocks, theme-options, two-columns, three-columns, accessibility-ready
*/

/* =====================================================================
   SCIENTIA 3.0 — DESIGN TOKENS & BASE LAYER
   ---------------------------------------------------------------------
   1.  Design tokens (couleurs, typographie fluide, espace, élévation)
   2.  Thème sombre
   3.  Reset & base
   4.  Typographie éditoriale
   5.  Contenu savant (tableaux, figures, équations, citations)
   6.  Mise en page & conteneurs
   7.  Utilitaires
   8.  Accessibilité & mouvement
   9.  Animations
   10. Responsive
   ===================================================================== */

/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */
:root {
  /* --- Primitives : bleu académique (Oxford) --- */
  --blue-50:  #f2f6fb;
  --blue-100: #dfe9f5;
  --blue-200: #bed3ea;
  --blue-300: #8fb2d9;
  --blue-400: #5b8bc4;
  --blue-500: #366aa8;
  --blue-600: #23528b;
  --blue-700: #1a4070;
  --blue-800: #133055;
  --blue-900: #0d2340;
  --blue-950: #08182c;

  /* --- Primitives : or éditorial --- */
  --gold-50:  #fdf8ec;
  --gold-100: #f9edcf;
  --gold-200: #f2d999;
  --gold-300: #e8c065;
  --gold-400: #d9a93f;
  --gold-500: #c08d24;
  --gold-600: #9c701c;
  --gold-700: #78551a;

  /* --- Primitives : teal scientifique (données, métriques) --- */
  --teal-50:  #eefaf8;
  --teal-100: #d2f1ec;
  --teal-200: #a3e2da;
  --teal-300: #6bcbc0;
  --teal-400: #38ada2;
  --teal-500: #16867e;
  --teal-600: #0e6b66;
  --teal-700: #0d5551;

  /* --- Primitives : neutres papier --- */
  --paper-0:   #ffffff;
  --paper-50:  #fbfbf9;
  --paper-100: #f5f5f1;
  --paper-200: #ecece6;
  --paper-300: #dcdcd4;
  --paper-400: #b8b8ae;
  --paper-500: #8d8d84;
  --paper-600: #66665f;
  --paper-700: #4a4a45;
  --paper-800: #2c2c29;
  --paper-900: #1a1a18;

  /* --- Primitives : encre nocturne --- */
  --night-900: #0b1220;
  --night-850: #101a2b;
  --night-800: #16233a;
  --night-700: #1e3050;
  --night-600: #2a4165;
  --night-100: #e6ecf5;
  --night-200: #c3cfe0;
  --night-300: #94a5bd;

  /* === PALETTE SÉMANTIQUE (compatibilité v2 conservée) === */
  --color-primary:        var(--brand-primary,   var(--blue-900));
  --color-primary-light:  var(--brand-primary-light, var(--blue-700));
  --color-primary-dark:   var(--blue-950);
  --color-primary-soft:   var(--blue-50);
  --color-accent:         var(--brand-accent,    var(--gold-500));
  --color-accent-light:   var(--brand-accent-light, var(--gold-400));
  --color-accent-soft:    var(--gold-50);
  --color-secondary:      var(--brand-secondary, var(--blue-600));
  --color-secondary-soft: var(--blue-100);
  --color-tertiary:       var(--teal-600);
  --color-tertiary-soft:  var(--teal-50);

  --color-success:        #12764f;
  --color-success-soft:   #e7f5ee;
  --color-warning:        var(--gold-600);
  --color-warning-soft:   var(--gold-50);
  --color-danger:         #a52121;
  --color-danger-soft:    #fbeded;
  --color-info:           var(--blue-600);
  --color-info-soft:      var(--blue-50);

  /* === NEUTRES === */
  --color-bg:             var(--paper-50);
  --color-bg-alt:         var(--paper-100);
  --color-bg-sunken:      var(--paper-200);
  --color-surface:        var(--paper-0);
  --color-surface-alt:    var(--paper-50);
  --color-surface-raised: var(--paper-0);
  --color-border:         var(--paper-300);
  --color-border-light:   var(--paper-200);
  --color-border-strong:  var(--paper-400);
  --color-text:           var(--paper-900);
  --color-text-muted:     var(--paper-600);
  /* paper-500 (#8d8d84) ne donnait que 3,1:1 sur --color-bg-alt :
     ce gris atteint 4,9:1 (AA petit texte) sans changer de teinte. */
  --color-text-light:     #6b6b64;
  --color-text-invert:    #ffffff;
  --color-on-primary:     #ffffff;
  --color-on-accent:      #1a1206;

  /* === DARK MODE (valeurs sources) === */
  --color-dark-bg:      var(--night-900);
  --color-dark-surface: var(--night-800);
  --color-dark-border:  var(--night-600);
  --color-dark-text:    var(--night-100);

  /* === TYPOGRAPHIE === */
  --font-display: var(--brand-font-display, 'Newsreader'), 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    var(--brand-font-body, 'Source Serif 4'), Georgia, 'Times New Roman', serif;
  --font-ui:      var(--brand-font-ui, 'Inter'), -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --font-arabic:  'Noto Naskh Arabic', 'Amiri', 'Scheherazade New', 'Geeza Pro',
                  'Traditional Arabic', 'Segoe UI', Tahoma, serif;

  /* Échelle fluide — clamp(min, préféré, max) */
  --text-xs:   clamp(0.72rem, 0.70rem + 0.10vw, 0.78rem);
  --text-sm:   clamp(0.83rem, 0.80rem + 0.14vw, 0.90rem);
  --text-base: clamp(1.00rem, 0.97rem + 0.15vw, 1.08rem);
  --text-lg:   clamp(1.10rem, 1.05rem + 0.26vw, 1.25rem);
  --text-xl:   clamp(1.25rem, 1.16rem + 0.42vw, 1.50rem);
  --text-2xl:  clamp(1.45rem, 1.30rem + 0.72vw, 1.90rem);
  --text-3xl:  clamp(1.70rem, 1.45rem + 1.20vw, 2.40rem);
  --text-4xl:  clamp(2.00rem, 1.60rem + 1.90vw, 3.05rem);
  --text-5xl:  clamp(2.35rem, 1.75rem + 2.80vw, 3.85rem);
  --text-6xl:  clamp(2.70rem, 1.85rem + 3.90vw, 4.75rem);

  --leading-tight:  1.15;
  --leading-snug:   1.32;
  --leading-normal: 1.6;
  --leading-relaxed:1.78;
  --leading-prose:  1.82;

  --tracking-tighter: -0.03em;
  --tracking-tight:   -0.018em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.09em;
  --tracking-widest:  0.16em;

  --weight-light:    300;
  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-black:    800;

  /* === ESPACEMENT === */
  --space-0:  0;
  --space-px: 1px;
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-7:  1.75rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Rythme vertical fluide des sections */
  --section-y:    clamp(3.5rem, 2.2rem + 5vw, 7rem);
  --section-y-sm: clamp(2.25rem, 1.6rem + 2.6vw, 4rem);
  --gutter:       clamp(1rem, 0.55rem + 1.9vw, 2rem);

  /* === MISE EN PAGE === */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1240px;
  --container-2xl: 1440px;
  --measure:       68ch;   /* longueur de ligne optimale en lecture */
  --measure-wide:  78ch;
  --sidebar-width: 320px;
  --toc-width:     250px;
  --header-h:      74px;

  /* === FORMES === */
  --radius-xs:   3px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 9999px;

  /* === ÉLÉVATION === */
  --shadow-xs: 0 1px 2px rgba(11,18,32,.05);
  --shadow-sm: 0 1px 3px rgba(11,18,32,.07), 0 1px 2px rgba(11,18,32,.05);
  --shadow-md: 0 4px 14px rgba(11,18,32,.08), 0 2px 5px rgba(11,18,32,.05);
  --shadow-lg: 0 12px 30px rgba(11,18,32,.10), 0 4px 10px rgba(11,18,32,.05);
  --shadow-xl: 0 24px 56px rgba(11,18,32,.13), 0 10px 20px rgba(11,18,32,.07);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.6);
  /* Anneau de focus : liseré de fond + trait plein, lisible (≥ 3:1)
     sur fond clair comme sombre — l'ancien halo à 35 % plafonnait à 1,9:1. */
  --ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-secondary);

  /* === MOUVEMENT === */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --transition-fast:   140ms var(--ease-out);
  --transition-base:   240ms var(--ease-out);
  --transition-slow:   420ms var(--ease-out);
  --transition-bounce: 520ms var(--ease-spring);

  /* === PROFONDEUR (z-index) === */
  --z-base:     1;
  --z-sticky:   100;
  --z-dropdown: 200;
  --z-header:   300;
  --z-overlay:  400;
  --z-modal:    500;
  --z-toast:    600;

  /* === DÉGRADÉS SIGNATURE === */
  --gradient-primary: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 55%, var(--teal-700) 130%);
  --gradient-accent:  linear-gradient(135deg, var(--gold-500) 0%, var(--gold-300) 100%);
  --gradient-surface: linear-gradient(180deg, var(--paper-0) 0%, var(--paper-50) 100%);
  --gradient-hairline: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

/* =========================================================
   2A. THÈME CLAIR EXPLICITE
   ---------------------------------------------------------
   Rejoue la palette claire sur l'élément qui porte
   data-theme="light", afin que le basculement soit fiable quel
   que soit l'élément marqué (html ou body).
   ========================================================= */
[data-theme="light"] {
  --color-bg:             var(--paper-50);
  --color-bg-alt:         var(--paper-100);
  --color-bg-sunken:      var(--paper-200);
  --color-surface:        var(--paper-0);
  --color-surface-alt:    var(--paper-50);
  --color-surface-raised: var(--paper-0);
  --color-border:         var(--paper-300);
  --color-border-light:   var(--paper-200);
  --color-border-strong:  var(--paper-400);
  --color-text:           var(--paper-900);
  --color-text-muted:     var(--paper-600);
  --color-text-light:     #6b6b64;

  --color-primary:        var(--brand-primary,   var(--blue-900));
  --color-primary-light:  var(--brand-primary-light, var(--blue-700));
  --color-primary-soft:   var(--blue-50);
  --color-secondary:      var(--brand-secondary, var(--blue-600));
  --color-secondary-soft: var(--blue-100);
  --color-accent:         var(--brand-accent,    var(--gold-500));
  --color-accent-light:   var(--brand-accent-light, var(--gold-400));
  --color-accent-soft:    var(--gold-50);
  --color-tertiary:       var(--teal-600);
  --color-tertiary-soft:  var(--teal-50);
  --color-success:        #12764f;
  --color-success-soft:   #e7f5ee;
  --color-warning:        var(--gold-600);
  --color-warning-soft:   var(--gold-50);
  --color-danger:         #a52121;
  --color-danger-soft:    #fbeded;
  --color-info:           var(--blue-600);
  --color-info-soft:      var(--blue-50);
  --color-on-primary:     #ffffff;
  --color-on-accent:      #1a1206;

  --shadow-xs: 0 1px 2px rgba(11,18,32,.05);
  --shadow-sm: 0 1px 3px rgba(11,18,32,.07), 0 1px 2px rgba(11,18,32,.05);
  --shadow-md: 0 4px 14px rgba(11,18,32,.08), 0 2px 5px rgba(11,18,32,.05);
  --shadow-lg: 0 12px 30px rgba(11,18,32,.10), 0 4px 10px rgba(11,18,32,.05);
  --shadow-xl: 0 24px 56px rgba(11,18,32,.13), 0 10px 20px rgba(11,18,32,.07);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.6);

  --gradient-primary: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 55%, var(--teal-700) 130%);
  --gradient-surface: linear-gradient(180deg, var(--paper-0) 0%, var(--paper-50) 100%);
  color-scheme: light;
}

/* =========================================================
   2. THÈME SOMBRE
   ========================================================= */
[data-theme="dark"] {
  --color-bg:             var(--night-900);
  --color-bg-alt:         var(--night-850);
  --color-bg-sunken:      #070d17;
  --color-surface:        var(--night-800);
  --color-surface-alt:    var(--night-850);
  --color-surface-raised: var(--night-700);
  --color-border:         var(--night-600);
  --color-border-light:   var(--night-700);
  --color-border-strong:  #375077;
  --color-text:           var(--night-100);
  --color-text-muted:     var(--night-200);
  --color-text-light:     var(--night-300);

  --color-primary:        #cfe0f5;
  --color-primary-light:  #eaf1fb;
  --color-primary-soft:   rgba(91,139,196,.16);
  --color-secondary:      #7fb0e8;
  --color-secondary-soft: rgba(91,139,196,.18);
  --color-accent:         var(--gold-300);
  --color-accent-light:   var(--gold-200);
  --color-accent-soft:    rgba(217,169,63,.14);
  --color-tertiary:       var(--teal-300);
  --color-tertiary-soft:  rgba(56,173,162,.15);
  --color-success:        #4cc38a;
  --color-success-soft:   rgba(76,195,138,.14);
  --color-danger:         #f08d8d;
  --color-danger-soft:    rgba(240,141,141,.13);
  --color-warning:        var(--gold-300);
  --color-warning-soft:   rgba(217,169,63,.14);
  --color-info:           #7fb0e8;
  --color-info-soft:      rgba(127,176,232,.14);
  --color-on-primary:     var(--night-900);
  --color-on-accent:      var(--night-900);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow-md: 0 4px 14px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 30px rgba(0,0,0,.55);
  --shadow-xl: 0 24px 56px rgba(0,0,0,.6);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.05);

  --gradient-primary: linear-gradient(135deg, #08182c 0%, #133055 55%, #0d5551 130%);
  --gradient-surface: linear-gradient(180deg, var(--night-800) 0%, var(--night-850) 100%);
  color-scheme: dark;
}

/* Respect du réglage système lorsque l'utilisateur n'a pas choisi (data-theme="auto") */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --color-bg:             var(--night-900);
    --color-bg-alt:         var(--night-850);
    --color-bg-sunken:      #070d17;
    --color-surface:        var(--night-800);
    --color-surface-alt:    var(--night-850);
    --color-surface-raised: var(--night-700);
    --color-border:         var(--night-600);
    --color-border-light:   var(--night-700);
    --color-border-strong:  #375077;
    --color-text:           var(--night-100);
    --color-text-muted:     var(--night-200);
    --color-text-light:     var(--night-300);

    /* Jeu complet, identique à [data-theme="dark"] : un jeton oublié
       ici gardait sa valeur claire (fonds « soft », alertes, ombres). */
    --color-primary:        #cfe0f5;
    --color-primary-light:  #eaf1fb;
    --color-primary-soft:   rgba(91,139,196,.16);
    --color-secondary:      #7fb0e8;
    --color-secondary-soft: rgba(91,139,196,.18);
    --color-accent:         var(--gold-300);
    --color-accent-light:   var(--gold-200);
    --color-accent-soft:    rgba(217,169,63,.14);
    --color-tertiary:       var(--teal-300);
    --color-tertiary-soft:  rgba(56,173,162,.15);
    --color-success:        #4cc38a;
    --color-success-soft:   rgba(76,195,138,.14);
    --color-danger:         #f08d8d;
    --color-danger-soft:    rgba(240,141,141,.13);
    --color-warning:        var(--gold-300);
    --color-warning-soft:   rgba(217,169,63,.14);
    --color-info:           #7fb0e8;
    --color-info-soft:      rgba(127,176,232,.14);
    --color-on-primary:     var(--night-900);
    --color-on-accent:      var(--night-900);

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
    --shadow-md: 0 4px 14px rgba(0,0,0,.5);
    --shadow-lg: 0 12px 30px rgba(0,0,0,.55);
    --shadow-xl: 0 24px 56px rgba(0,0,0,.6);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,.05);

    --gradient-primary: linear-gradient(135deg, #08182c 0%, #133055 55%, #0d5551 130%);
    --gradient-surface: linear-gradient(180deg, var(--night-800) 0%, var(--night-850) 100%);
    color-scheme: dark;
  }
}

/* =========================================================
   3. RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-6));
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-feature-settings: "kern" 1, "liga" 1;
  transition: background-color var(--transition-base), color var(--transition-base);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > .site-content { flex: 1 0 auto; }

img, picture, video, canvas, svg, iframe { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul, ol { list-style-position: outside; }
hr { border: 0; height: 1px; background: var(--gradient-hairline); margin: var(--space-10) 0; }
::selection { background: color-mix(in srgb, var(--color-accent) 32%, transparent); color: var(--color-text); }

/* Barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--color-border-strong); background-clip: content-box; }

/* Direction RTL */
[dir="rtl"] body { font-family: var(--font-arabic), var(--font-body); }
[dir="rtl"] .scientia-container { direction: rtl; }
[lang="ar"], .lang-ar, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { font-family: var(--font-arabic), var(--font-display); }

/* =========================================================
   4. TYPOGRAPHIE ÉDITORIALE
   ========================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-primary);
  text-wrap: balance;
  font-variant-numeric: lining-nums;
}
h1 { font-size: var(--text-5xl); letter-spacing: var(--tracking-tighter); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); line-height: var(--leading-snug); }
h4 { font-size: var(--text-xl);  line-height: var(--leading-snug); }
h5 { font-size: var(--text-lg);  font-family: var(--font-ui); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-normal); }
h6 {
  font-size: var(--text-xs); font-family: var(--font-ui); font-weight: var(--weight-bold);
  text-transform: uppercase; letter-spacing: var(--tracking-wider); color: var(--color-text-muted);
}

p { margin-bottom: var(--space-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-secondary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}
a:hover { color: var(--color-accent); }
a:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

strong, b { font-weight: var(--weight-bold); }
em, i { font-style: italic; }
small { font-size: var(--text-sm); }
sup, sub { font-size: .72em; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.5em; } sub { bottom: -0.25em; }
abbr[title] { text-decoration: underline dotted; cursor: help; }
mark { background: var(--color-accent-soft); color: inherit; padding: 0 .18em; border-radius: var(--radius-xs); }

/* =========================================================
   5. CONTENU SAVANT
   ========================================================= */
.prose, .entry-content, .article-content {
  font-size: var(--text-base);
  line-height: var(--leading-prose);
  color: var(--color-text);
  hyphens: auto;
}
.prose > * + *, .entry-content > * + *, .article-content > * + * { margin-top: var(--space-5); }
.prose h2, .entry-content h2, .article-content h2 { margin-top: var(--space-12); font-size: var(--text-2xl); }
.prose h3, .entry-content h3, .article-content h3 { margin-top: var(--space-10); font-size: var(--text-xl); }
.prose h4, .entry-content h4, .article-content h4 { margin-top: var(--space-8); font-size: var(--text-lg); }
.prose ul, .prose ol,
.entry-content ul, .entry-content ol,
.article-content ul, .article-content ol { padding-inline-start: var(--space-6); }
.prose li + li, .entry-content li + li, .article-content li + li { margin-top: var(--space-2); }
.prose li::marker, .entry-content li::marker { color: var(--color-accent); }

/* Citation en exergue */
blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-7);
  border-inline-start: 3px solid var(--color-accent);
  background: var(--color-bg-alt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-muted);
}
blockquote cite { display: block; margin-top: var(--space-3); font-style: normal; font-family: var(--font-ui); font-size: var(--text-sm); color: var(--color-text-light); }

/* Code & données */
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .88em; font-variant-ligatures: none; }
:not(pre) > code {
  background: var(--color-bg-alt); color: var(--color-primary);
  padding: .14em .4em; border-radius: var(--radius-xs); border: 1px solid var(--color-border-light);
  word-break: break-word;
}
pre {
  background: var(--night-900); color: var(--night-100);
  padding: var(--space-5); border-radius: var(--radius-md);
  overflow-x: auto; line-height: 1.6; font-size: var(--text-sm);
  border: 1px solid var(--color-border);
}
pre code { background: none; border: 0; padding: 0; color: inherit; }

/* Tableaux scientifiques */
.entry-content table, .article-content table, table.scientia-table {
  width: 100%; border-collapse: collapse; margin: var(--space-8) 0;
  font-family: var(--font-ui); font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
  display: block; overflow-x: auto; white-space: nowrap;
}
@media (min-width: 768px) {
  .entry-content table, .article-content table, table.scientia-table { display: table; white-space: normal; }
}
.entry-content th, .article-content th, table.scientia-table th {
  text-align: start; font-weight: var(--weight-semibold); color: var(--color-primary);
  background: var(--color-bg-alt); padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-border-strong);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide);
}
.entry-content td, .article-content td, table.scientia-table td {
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}
.entry-content tbody tr:hover, .article-content tbody tr:hover { background: var(--color-bg-alt); }
.entry-content caption, .article-content caption {
  caption-side: bottom; padding-top: var(--space-3); text-align: start;
  font-size: var(--text-sm); color: var(--color-text-muted); font-family: var(--font-ui);
}

/* Figures & légendes */
figure { margin: var(--space-8) 0; }
figure img { border-radius: var(--radius-md); box-shadow: var(--shadow-sm); width: 100%; }
figcaption, .wp-caption-text {
  margin-top: var(--space-3); font-family: var(--font-ui); font-size: var(--text-sm);
  color: var(--color-text-muted); line-height: var(--leading-normal);
  padding-inline-start: var(--space-3); border-inline-start: 2px solid var(--color-accent);
}

/* Équations */
.scientia-equation {
  margin: var(--space-8) 0; padding: var(--space-5); text-align: center;
  background: var(--color-bg-alt); border-radius: var(--radius-md);
  overflow-x: auto; font-family: var(--font-mono);
}
.scientia-equation-number { float: inline-end; color: var(--color-text-light); font-family: var(--font-ui); }

/* Note de bas de page / renvoi bibliographique */
a.footnote-ref, a.ref-link {
  font-family: var(--font-ui); font-size: .72em; font-weight: var(--weight-semibold);
  color: var(--color-secondary); padding: 0 .15em; vertical-align: super;
}

/* Lettrine optionnelle */
.has-dropcap::first-letter {
  float: inline-start; font-family: var(--font-display); font-size: 3.6em;
  line-height: .82; padding-inline-end: .08em; padding-top: .05em;
  color: var(--color-primary); font-weight: var(--weight-bold);
}

/* =========================================================
   6. MISE EN PAGE & CONTENEURS
   ========================================================= */
.scientia-container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.scientia-container--narrow { max-width: var(--container-lg); }
.scientia-container--reading { max-width: 780px; }
.scientia-container--wide   { max-width: var(--container-2xl); }
.scientia-container--full   { max-width: none; }

.site-content { display: block; }
.section-spacing     { padding-block: var(--section-y); }
.section-spacing--sm { padding-block: var(--section-y-sm); }
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-8); }

.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }

/* =========================================================
   7. UTILITAIRES
   ========================================================= */
.text-primary { color: var(--color-primary); }
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-text-muted); }
.text-light   { color: var(--color-text-light); }
.text-center  { text-align: center; }
.text-balance { text-wrap: balance; }
.measure      { max-width: var(--measure); }
.font-ui      { font-family: var(--font-ui); }
.font-mono    { font-family: var(--font-mono); }
.tabular      { font-variant-numeric: tabular-nums lining-nums; }
.bg-primary   { background: var(--color-primary); color: var(--color-on-primary); }
.bg-accent    { background: var(--color-accent);  color: var(--color-on-accent); }
.bg-surface   { background: var(--color-surface); }
.bg-alt       { background: var(--color-bg-alt); }
.bg-gradient  { background: var(--gradient-primary); color: #fff; }
.rounded      { border-radius: var(--radius-lg); }
.shadow       { box-shadow: var(--shadow-md); }
.hairline     { height: 1px; background: var(--gradient-hairline); border: 0; }
.hidden       { display: none !important; }
.no-scroll    { overflow: hidden; }

.eyebrow {
  display: inline-block; font-family: var(--font-ui); font-size: var(--text-xs);
  font-weight: var(--weight-bold); text-transform: uppercase;
  letter-spacing: var(--tracking-wider); color: var(--color-accent);
}

/* =========================================================
   8. ACCESSIBILITÉ
   ========================================================= */
.sr-only, .screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: var(--space-4); top: -100px; z-index: var(--z-toast);
  background: var(--color-primary); color: var(--color-on-primary); font-family: var(--font-ui);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  padding: var(--space-3) var(--space-5); border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 0; color: var(--color-on-primary); }

:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

/* Mode « couleurs forcées » (Windows) : les box-shadow disparaissent,
   l'anneau de focus doit redevenir un contour système. */
@media (forced-colors: active) {
  a:focus-visible, button:focus-visible, .btn:focus-visible,
  input:focus, select:focus, textarea:focus, summary:focus-visible {
    outline: 2px solid CanvasText; outline-offset: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .animate-in, .animate-fade, .animate-scale { opacity: 1 !important; transform: none !important; animation-delay: 0s !important; }
}
/* Contraste renforcé : valeurs distinctes par thème. Posées sur :root
   seul, elles s'appliquaient aussi au thème sombre (texte #2c2c29 sur
   fond nuit, illisible). */
@media (prefers-contrast: more) {
  :root, [data-theme="light"] { --color-border: var(--paper-600); --color-text-muted: var(--paper-800); --color-text-light: var(--paper-700); }
  :root[data-theme="dark"], [data-theme="dark"] { --color-border: var(--night-300); --color-text-muted: var(--night-100); --color-text-light: var(--night-200); }
  .btn, .badge { border-width: 2px; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  [data-theme="auto"] { --color-border: var(--night-300); --color-text-muted: var(--night-100); --color-text-light: var(--night-200); }
}

/* =========================================================
   9. ANIMATIONS
   ========================================================= */
@keyframes fadeInUp   { from { opacity:0; transform: translateY(18px); } to { opacity:1; transform:none; } }
@keyframes fadeIn     { from { opacity:0; } to { opacity:1; } }
@keyframes slideInLeft{ from { opacity:0; transform: translateX(-26px); } to { opacity:1; transform:none; } }
@keyframes scaleIn    { from { opacity:0; transform: scale(.96); } to { opacity:1; transform:none; } }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(217,169,63,.45); } 50% { box-shadow: 0 0 0 9px rgba(217,169,63,0); } }
@keyframes shimmer    { 0% { background-position:-200% 0; } 100% { background-position:200% 0; } }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes marquee    { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.animate-in { animation: fadeInUp .62s var(--ease-out) forwards; opacity: 0; }
.animate-fade { animation: fadeIn .5s var(--ease-out) forwards; opacity: 0; }
.animate-scale { animation: scaleIn .5s var(--ease-out) forwards; opacity: 0; }
.animate-delay-1 { animation-delay: .07s; }
.animate-delay-2 { animation-delay: .14s; }
.animate-delay-3 { animation-delay: .21s; }
.animate-delay-4 { animation-delay: .28s; }
.animate-delay-5 { animation-delay: .35s; }
.animate-delay-6 { animation-delay: .42s; }

.skeleton {
  background: linear-gradient(90deg, var(--color-bg-alt) 25%, var(--color-border-light) 50%, var(--color-bg-alt) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm);
  color: transparent !important;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--color-border); border-top-color: var(--color-primary);
  animation: spin .7s linear infinite; display: inline-block;
}

/* =========================================================
   10. RESPONSIVE
   ========================================================= */
/* 1023 px : même seuil que la bascule navigation complète / tiroir. */
@media (max-width: 1023px) { :root { --header-h: 66px; } }
@media (max-width: 640px)  { :root { --header-h: 60px; } body { line-height: var(--leading-normal); } }
