/**
 * Thème Reveal.js "Méticuleux" v3
 *
 * Un système de thèmes flexible et complet basé sur des variables CSS étendues.
 * Supporte nativement les variantes : clair (défaut), sombre, bleu et rouge.
 */

/* ==========================================================================
   1. VARIABLES GLOBALES (STRUCTURE)
   ========================================================================== */

:root {
  /* Polices */
  --font-main: "Inter", system-ui, -apple-system, sans-serif;
  --font-heading: "Inter", system-ui, -apple-system, sans-serif;
  --font-code: "JetBrains Mono", "Fira Code", monospace;

  /* Tailles */
  --font-size-root: 32px;
  --font-size-h1: 2.2em;
  --font-size-h2: 1.8em;
  --font-size-h3: 1.2em;
  --font-size-small: 0.6em;

  /* Espacement & Rythme */
  --spacing-slide: 50px;
  --spacing-block: 1em;
  --line-height-main: 1.5;
  --line-height-heading: 1.1;

  /* Design Tokens */
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Reveal.js standard code mapping */
  --r-code-font: var(--font-code);
  --r-code-font-size: 0.85em;
  --r-code-line-height: 1.4;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
  --transition-fast: 0.2s ease;
  --transition-standard: 0.3s ease;
}

/* ==========================================================================
   2. DÉFINITION DES THÈMES (COULEURS)
   ========================================================================== */

/* --- THÈME CLAIR (Défaut) --- */
:root, .theme-light {
  /* Surfaces */
  --bg-main: radial-gradient(circle at center, #ffffff 0%, #e2e8f0 100%);
  --bg-card: #ffffff;
  --bg-code: #1e1e1e;
  --bg-transition: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-highlight: rgba(245, 158, 11, 0.2);

  /* Texte */
  --color-main: #1e293b;
  --color-heading: #0f172a;
  --color-muted: #64748b;
  --color-on-transition: #f8fafc;

  /* Accents */
  --color-primary: #2563eb;
  --color-secondary: #64748b;
  --color-accent: #f59e0b;
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* Mappage Reveal.js standard */
  --r-background-color: var(--bg-main);
  --r-main-color: var(--color-main);
  --r-heading-color: var(--color-heading);
  --r-link-color: var(--color-primary);
  --r-link-color-hover: var(--color-accent);
  --r-selection-background-color: var(--bg-highlight);
  --r-selection-color: var(--color-main);

  /* Code standards */
  --r-code-background-color: var(--bg-code);
}

/* --- THÈME SOMBRE --- */
.theme-dark {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-code: #000000;
  --bg-transition: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-highlight: rgba(245, 158, 11, 0.3);

  --color-main: #e2e8f0;
  --color-heading: #f8fafc;
  --color-muted: #94a3b8;
  --color-on-transition: #ffffff;

  --color-primary: #3b82f6;
  --color-secondary: #94a3b8;

  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.5);
}

/* --- THÈME BLEU --- */
.theme-blue {
  --bg-main: #eff6ff;
  --bg-card: #ffffff;
  --bg-code: #1e293b;
  --bg-transition: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

  --color-main: #1e3a8a;
  --color-heading: #172554;
  --color-muted: #60a5fa;

  --color-primary: #2563eb;
  --color-secondary: #3b82f6;
}

/* --- THÈME ROUGE --- */
.theme-red {
  --bg-main: #fff1f2;
  --bg-card: #ffffff;
  --bg-code: #450a0a;
  --bg-transition: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

  --color-main: #7f1d1d;
  --color-heading: #450a0a;
  --color-muted: #fb7185;

  --color-primary: #e11d48;
  --color-secondary: #f43f5e;
}

/* ==========================================================================
   3. BASE REVEAL.JS & STRUCTURE
   ========================================================================== */

.reveal-viewport {
  background: var(--bg-main);
  background-color: var(--bg-main);
}

/* Forcer le fond des slides de transition via Reveal.js background layer */
.reveal .backgrounds .slide-background.slide-transition {
  background: var(--bg-transition) !important;
}

.reveal {
  font-family: var(--font-main);
  font-size: var(--font-size-root);
  color: var(--color-main);
}

.reveal .slides section {
  text-align: left;
  padding: var(--spacing-slide);
  box-sizing: border-box;
}

/* Typographie standard */
.reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--color-heading);
  margin-bottom: 0.5em;
  line-height: var(--line-height-heading);
  text-transform: none;
}

.reveal h1 { font-size: var(--font-size-h1); }
.reveal h2 { font-size: var(--font-size-h2); color: var(--color-primary); margin-bottom: 1.5em }
.reveal h3 { font-size: var(--font-size-h3); }

.reveal p, .reveal li {
  line-height: var(--line-height-main);
  margin-bottom: 0.8em;
}

.reveal strong, .reveal b {
  font-weight: 800;
  color: var(--color-primary);
}

.reveal em, .reveal i {
  font-style: italic;
}

/* Liens */
.reveal a {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
}

.reveal a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Listes */
.reveal ul, .reveal ol {
  display: inline-block;
  text-align: left;
  margin: 0 0 0 1.2em;
}

.reveal ul { list-style-type: disc; }
.reveal ol { list-style-type: decimal; }

.reveal li > ul, .reveal li > ol {
  display: block;
  margin-left: 1.5em;
  font-size: 0.95em;
  opacity: 0.9;
}

/* Tableaux */
.reveal table {
  margin: var(--spacing-block) auto;
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  font-size: 0.85em;
}

.reveal table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.reveal table th, .reveal table td {
  text-align: left;
  padding: 0.75em;
  border-bottom: 1px solid var(--color-muted);
}

.reveal table th {
  font-weight: 800;
  color: var(--color-primary);
  border-bottom: 3px solid var(--color-primary);
}

/* Citations (Blockquote standard) */
.reveal blockquote {
  display: block;
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border-left: 8px solid var(--color-accent);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  margin: 1.5em 0;
  padding: 1em 1em;
  font-size: 0.85em;
  border-left-width: 4px;
  background: rgba(0, 0, 0, 0.02);
  font-style: normal;
}

/* Citation d'article spécifique */
.reveal .article-quote {
}
.reveal .article-quote .title {
  display: block;
  font-weight: 700;
  color: var(--color-heading);
  font-style: italic;
  margin-bottom: 0.2em;
}
.reveal .article-quote .reference {
  display: block;
  font-size: 0.7em;
  color: var(--color-muted);
}
.reveal .article-quote .reference a {
  text-decoration: underline;
  font-weight: 600;
  color: var(--color-primary);
}

/* ==========================================================================
   4. INTERFACE REVEAL.JS (CONTRÔLES & PROGRESSION)
   ========================================================================== */

.reveal .controls {
  color: var(--color-primary);
}

.reveal .progress {
  background: rgba(0, 0, 0, 0.1);
  color: var(--color-primary);
  height: 6px;
}

.reveal .slide-number {
  background: transparent;
  color: var(--color-muted);
  font-size: 0.6em;
}

/* ==========================================================================
   5. TYPOLOGIES DE DIAPOSITIVES PERSONNALISÉES
   ========================================================================== */

/* 1. Ouverture (Title) */
.slide-title {
  display: flex !important; flex-direction: column !important;
  justify-content: center !important; align-items: center !important;
  text-align: center !important; height: 100% !important;
}
.slide-title h1 { color: var(--color-primary); margin-bottom: 0.1em; margin-top: auto; }
.slide-title .subtitle {
  font-size: 1.2em !important;
  color: var(--color-muted);
  font-weight: 500;
  margin-bottom: 1.5em !important;
  text-transform: none;
}
.slide-title .meta {
  display: flex;
  flex-direction: row;
  gap: 20px;
  font-size: 0.6em;
  color: var(--color-muted);
  margin-top: auto;
}
html.reveal-print .slide-title .meta {
  display: block;
  margin-top: 5em;
}
.slide-title .meta-item {
  color: var(--color-muted);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}
.slide-title .meta-item:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* 2. Intercalaire (Transition) */
.slide-transition {
  color: var(--color-on-transition) !important;
  display: flex !important; flex-direction: column !important;
  justify-content: center !important; align-items: center !important;
  text-align: center !important;
}
.slide-transition h1, .slide-transition h2 {
  color: var(--color-on-transition) !important;
  font-size: 2.5em;
}

/* 4. Colonnes */
.columns { display: flex; gap: 40px; align-items: flex-start; width: 100%; }
.col-2 > .column { flex: 1; }
.col-3 > .column { flex: 1; }

/* 5. Chiffres Clés */
.stats-container { display: flex; justify-content: space-around; gap: 20px; margin-top: 1em; width: 100%; }
.stat-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  padding: 30px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); text-align: center; flex: 1;
  border-top: 5px solid var(--color-primary);
}
.stat-number { font-size: 2.2em; font-weight: 900; color: var(--color-primary); display: block; }
.stat-label { font-size: 0.7em; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }

/* 6. Focus */
.slide-focus {
  display: flex !important; justify-content: center !important; align-items: center !important;
  text-align: center !important; height: 100% !important;
}
.slide-focus .message { font-size: 3.5em; font-weight: 900; line-height: 1; letter-spacing: -0.05em; color: var(--color-primary); }

/* 7. Pleine Page (Sans padding global) */
.slide-fullscreen {
  padding: 0 !important; /* Supprime le padding de 50px hérité */
  width: 100%;
  height: 100%;
}
.slide-fullscreen .comp-media {
  margin: 0;
  padding: 20px; /* Petit padding de sécurité interne */
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.slide-fullscreen img, .slide-fullscreen video {
  max-width: 100%;
  max-height: 90%; /* Laisse 10% pour la légende */
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* ==========================================================================
   6. COMPOSANTS RÉUTILISABLES
   ========================================================================== */

/* Callout */
.comp-callout {
  margin: 1em 0; padding: 35px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-left: 6px solid var(--color-primary);
  box-shadow: var(--shadow-sm); font-size: 0.9em;
}
.comp-callout.success { border-left-color: var(--color-success); }
.comp-callout.success strong, .comp-callout.success b { color: var(--color-success); }
.comp-callout.error { border-left-color: var(--color-error); }
.comp-callout.error strong, .comp-callout.error b { color: var(--color-error); }
.comp-callout.info { border-left-color: var(--color-info); }
.comp-callout.info strong, .comp-callout.info b { color: var(--color-info); }

/* Média */
.comp-media { margin: 1em 0; text-align: center; }
.comp-media img, .comp-media video, .comp-media svg {
  max-width: 100%; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.comp-caption {
  font-size: 0.65em; color: var(--color-muted); margin-top: 0.8em; font-style: italic;
}

/* Code */
.reveal pre {
  display: block;
  position: relative;
  width: 100%;
  margin: var(--spacing-block) auto;
  text-align: left;
  font-size: var(--r-code-font-size);
  font-family: var(--r-code-font);
  line-height: var(--r-code-line-height);
  word-wrap: break-word;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  overflow: auto;
}

.reveal pre code {
  display: block;
  padding: 20px;
  overflow: auto;
  max-height: 500px;
  word-wrap: normal;
}

/* Inline Code */
.reveal code {
  font-family: var(--r-code-font);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: none;
}

/* Utilitaires */
.u-success { color: var(--color-success) !important; }
.u-error { color: var(--color-error) !important; }
.u-info { color: var(--color-info) !important; }
.u-highlight { background: var(--bg-highlight); padding: 2px 6px; border-radius: var(--radius-sm); font-weight: 600; }
.u-center { text-align: center !important; }
.u-overflow { overflow-y: auto !important; max-height: 100% !important; }

/* ==========================================================================
   7. EXPORT & PRINT
   ========================================================================== */

@media print {
  .slide-transition { display: none !important; }
  .reveal-viewport { background: #fff !important; }
}

/* 9. Introduction / Profil */
.slide-intro {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  height: 100% !important;
}

.slide-intro .columns {
  align-items: flex-start; /* Aligne le contenu vers le haut */
}

.slide-intro .column-portrait {
  flex: 0 0 35%;
  text-align: center;
}

.slide-intro .column-info {
  flex: 1;
}

.slide-intro .user-name {
  margin-top: 0;
  margin-bottom: 1em; /* Plus d'espace sous le nom */
  font-size: 1.8em;
}

.slide-intro .profile-pic {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 50%;
  /* Suppression de la bordure */
  box-shadow: var(--shadow-lg);
}

.slide-intro ul {
  margin-bottom: 1.5em;
  list-style-type: none; /* Nettoyage des puces pour un look plus moderne */
  margin-left: 0;
}

.slide-intro li {
  padding-left: 1.2em;
  position: relative;
  margin-bottom: 0.8em;
}

/* Ajout d'une flèche personnalisée pour les fragments de l'intro */
.slide-intro li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 800;
}

/* 8. Conclusion & Contacts */
.slide-conclusion {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  height: 100% !important;
}

.slide-conclusion h1 {
  margin-bottom: 0.2em !important;
}

.slide-conclusion .columns {
  margin-top: 1.5em;
  align-items: center;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 2.5em;
}

.contact-item {
  display: flex;
  align-items: center;
  font-size: 0.85em;
}

.contact-item a {
  color: var(--color-muted);
  text-decoration: none;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.contact-item a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.icon-box {
  width: 1.5em;
  height: 1.5em;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 20px;
  flex-shrink: 0;
}

.icon-box svg {
  width: 1.1em;
  height: 1.1em;
  fill: var(--color-primary);
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.qr-image {
  width: 450px;
  height: 450px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  object-fit: contain;
}

.url-display {
  font-family: var(--font-code);
  font-size: 0.6em;
  color: var(--color-muted);
  padding: 5px 0;
  text-decoration: none;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.url-display:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
