/* ═══════════════════════════════════════════════════════════
   MammouthQuebec.com — Feuille de style commune
   Mode nuit forcé sur la page d'index ; les sous-sites gèrent
   leur propre bascule jour/nuit.
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-page:        #0d1418;
  --bg-header:      #0a1f2e;
  --bg-header-btn:  #14507a;
  --bg-header-btn-hover: #1d6ea3;
  --bg-panel:       #1a2329;
  --border-panel:   #2c3a44;
  --shadow-panel:   rgba(0,0,0,0.5);
  --text-default:   #d8e0e6;
  --text-muted:     #8a98a4;
  --text-accent:    #6cb6ee;
  --bg-modal:       #1e2830;
  --bg-modal-overlay: rgba(0,0,0,0.75);
  --border-modal-divider: #354450;
  --bg-modal-source: #28333b;
  /* Voile par-dessus la vidéo de fond — assombri pour bonne lisibilité du contenu */
  --veil-intro: rgba(13, 20, 24, 0.50);
  --veil-loop:  rgba(13, 20, 24, 0.72);
}

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

html, body {
  height: 100%;
  width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d1418;
  color: var(--text-default);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ═══════════════════════════════════════════════════════════
   VIDÉO DE FOND
   ═══════════════════════════════════════════════════════════ */
.bg-video {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}
.bg-video.active { opacity: 1; }

/* Voile assombrissant au-dessus de la vidéo. La couleur est ajustée
   par JS selon que l'intro joue (#veil) ou que la boucle joue. */
#veil {
  position: fixed;
  inset: 0;
  background: var(--veil-intro);
  z-index: 1;
  pointer-events: none;
  transition: background 0.6s ease-in-out;
}
#veil.deeper { background: var(--veil-loop); }

/* Marque centrée affichée AVANT la vidéo. z-index négatif = derrière la vidéo. */
#brand-fallback {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1418;
  color: rgba(108, 182, 238, 0.18);
  font-size: 64px;
  font-weight: 700;
  letter-spacing: 2px;
  pointer-events: none;
  text-align: center;
}

#boot-msg {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  z-index: 25;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   BOUTON "PASSER L'INTRO"
   ═══════════════════════════════════════════════════════════ */
#skip-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  background: rgba(10, 61, 98, 0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.1s;
  display: none;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
#skip-btn:hover {
  background: rgba(30, 92, 139, 0.95);
  transform: translateY(-1px);
}
#skip-btn .skip-arrow {
  font-size: 14px;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   BOUTON SON
   ═══════════════════════════════════════════════════════════ */
#mute-btn {
  position: fixed;
  right: 18px;
  bottom: 60px;
  z-index: 50;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 61, 98, 0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.1s;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#mute-btn:hover {
  background: rgba(30, 92, 139, 0.95);
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════
   BOUTON LANGUE
   z-index volontairement plus élevé que la modale du disclaimer
   (4000) pour permettre aux anglophones de basculer en anglais
   pendant qu'ils lisent l'avis de non-responsabilité.
   ═══════════════════════════════════════════════════════════ */
#lang-btn {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 5000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1px solid var(--border-panel);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
  text-decoration: none;
  font-family: inherit;
}
#lang-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  background: #243038;
}

/* ═══════════════════════════════════════════════════════════
   MENU CENTRAL (3 ministères)
   ═══════════════════════════════════════════════════════════ */
#menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: rgba(26, 35, 41, 0.92);
  border: 2px solid var(--text-accent);
  border-radius: 14px;
  padding: 32px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: center;
  min-width: 380px;
  max-width: 92vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease-in-out;
}
#menu.visible {
  opacity: 1;
  pointer-events: auto;
}
#menu h1 {
  color: var(--text-accent);
  font-size: 22px;
  margin: 0 0 22px 0;
  letter-spacing: 0.3px;
}
.menu-btn {
  display: block;
  width: 100%;
  padding: 13px 22px;
  margin: 9px 0;
  background: var(--bg-header-btn);
  color: #fff;
  border: 1px solid #2c3a44;
  border-radius: 7px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  text-align: center;
  font-family: inherit;
}
.menu-btn:hover:not(.disabled) {
  background: var(--bg-header-btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 182, 238, 0.35);
}
.menu-btn.disabled {
  background: #2a3942;
  color: #6b7680;
  cursor: not-allowed;
  opacity: 0.7;
}
.menu-btn .badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  vertical-align: 1px;
}
.menu-btn.disabled .badge {
  background: rgba(255,255,255,0.06);
  color: #8a98a4;
}

/* ═══════════════════════════════════════════════════════════
   MODALE AVIS DE NON-RESPONSABILITÉ
   ═══════════════════════════════════════════════════════════ */
#disclaimer-modal {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 4000;
  justify-content: center;
  align-items: center;
}
#disclaimer-modal.hidden { display: none; }
/* Anti-flash : masque l'avis légal dès le rendu si déjà accepté (classe posée
   par le script inline du <head> avant le premier paint). */
html.disclaimer-ok #disclaimer-modal { display: none !important; }

#disclaimer-content {
  background: var(--bg-modal);
  color: var(--text-default);
  border-radius: 12px;
  overflow: hidden;
  max-width: 720px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
  border: 2px solid var(--text-accent);
}
#disclaimer-scroll {
  overflow-y: auto;
  padding: 28px 32px 20px 32px;
  flex: 1 1 auto;
  min-height: 0;
}
#disclaimer-content h1 {
  color: var(--text-accent);
  font-size: 19px;
  margin: 0 0 18px 0;
  text-align: center;
  padding: 0 30px;
}
#disclaimer-content h2 {
  color: var(--text-accent);
  font-size: 13px;
  margin: 14px 0 4px 0;
}
#disclaimer-content p {
  font-size: 12.5px;
  line-height: 1.55;
  margin: 4px 0 8px 0;
  color: var(--text-default);
}
#disclaimer-content .brand-mark {
  font-weight: 700;
  color: var(--text-accent);
}
#disclaimer-content .final-acknowledgement {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--bg-modal-source);
  border-left: 3px solid var(--text-accent);
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-default);
  text-align: center;
}
.disclaimer-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 14px 24px 22px 24px;
  border-top: 1px solid var(--border-modal-divider);
  background: var(--bg-page);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.disclaimer-btn {
  border: none;
  padding: 11px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  min-width: 150px;
  font-family: inherit;
}
.disclaimer-btn-accept { background: #43a047; color: #fff; }
.disclaimer-btn-accept:hover { background: #2e7d32; transform: translateY(-1px); }
.disclaimer-btn-refuse { background: #d81b60; color: #fff; }
.disclaimer-btn-refuse:hover { background: #ad1457; transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════════
   BLOCAGE MOBILE
   ═══════════════════════════════════════════════════════════ */
#mobile-block {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #0a0e1a;
  color: #e6edf7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
#mobile-block .mb-card {
  max-width: 480px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#mobile-block .mb-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
}
#mobile-block h2 {
  font-size: 22px;
  margin: 0 0 12px 0;
  color: #fff;
  line-height: 1.3;
}
#mobile-block p {
  margin: 12px 0;
  line-height: 1.55;
  font-size: 15px;
  color: #c5cbd6;
}
#mobile-block .mb-detail {
  font-size: 13px;
  color: #8b95a8;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
@media (max-width: 900px) {
  #mobile-block { display: flex; }
  body > *:not(#mobile-block) { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   PAGES D'ERREUR (404, 403, 500, etc.)
   ═══════════════════════════════════════════════════════════ */
body.error-page {
  background: #0d1418;
  color: var(--text-default);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  overflow: auto;
}

/* L'image originale est très claire — on l'assombrit pour qu'elle reste
   en arrière-plan discret mais qu'on devine encore les motifs. */
.error-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('assets/error-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.55) saturate(0.95) contrast(1.05);
  pointer-events: none;
}
.error-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(13,20,24,0.35) 0%, rgba(13,20,24,0.78) 85%),
    linear-gradient(to bottom, rgba(13,20,24,0.40) 0%, rgba(13,20,24,0.65) 100%);
}

.error-card {
  position: relative;
  z-index: 1;
  max-width: 560px;
  background: rgba(26, 35, 41, 0.85);
  border: 1px solid var(--border-panel);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.error-code {
  font-size: 88px;
  font-weight: 800;
  color: var(--text-accent);
  line-height: 1;
  letter-spacing: 2px;
  margin: 0 0 12px 0;
  text-shadow: 0 4px 18px rgba(108, 182, 238, 0.25);
}
.error-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-default);
  margin: 0 0 16px 0;
}
.error-message {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 28px 0;
}
.error-message strong {
  color: var(--text-default);
}
.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.error-btn {
  display: inline-block;
  padding: 11px 24px;
  background: var(--bg-header-btn);
  color: #fff;
  border: 1px solid var(--border-panel);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}
.error-btn:hover {
  background: var(--bg-header-btn-hover);
  transform: translateY(-1px);
}
.error-btn.secondary {
  background: transparent;
  color: var(--text-accent);
}
.error-btn.secondary:hover {
  background: rgba(108, 182, 238, 0.10);
}
.error-brand {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-panel);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.error-brand a {
  color: var(--text-accent);
  text-decoration: none;
}
.error-brand a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   SCROLLBARS
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
::-webkit-scrollbar-thumb {
  background: rgba(180, 195, 210, 0.4);
  border-radius: 7px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 215, 230, 0.65);
  background-clip: padding-box;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 180, 200, 0.5) rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════
   MESSAGE D'ACCUEIL — OBJECTIF DU PROJET (portail maître)
   Déplacé depuis les modales d'accueil des sections (MSSS/MEQ/MTMD)
   pour devenir le message d'accueil unique du portail.
   ═══════════════════════════════════════════════════════════ */
#welcome-modal {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 4500; /* au-dessus du menu, sous l'avis légal (4000) une fois accepté */
  justify-content: center;
  align-items: center;
}
#welcome-modal.hidden { display: none; }

#welcome-content {
  background: var(--bg-modal);
  color: var(--text-default);
  border-radius: 12px;
  overflow: hidden;
  max-width: 720px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
  border: 2px solid var(--text-accent);
}
#welcome-close-x {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
}
#welcome-close-x:hover { background: rgba(255,255,255,0.10); color: var(--text-default); }
#welcome-scroll {
  overflow-y: auto;
  padding: 30px 34px 22px 34px;
  flex: 1 1 auto;
  min-height: 0;
}
#welcome-content h1 {
  color: var(--text-accent);
  font-size: 22px;
  margin: 0 0 18px 0;
  text-align: center;
  padding: 0 26px;
}
#welcome-content p {
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0 0 14px 0;
  color: var(--text-default);
}
.welcome-actions {
  display: flex;
  justify-content: center;
  padding: 14px 24px 22px 24px;
  border-top: 1px solid var(--border-modal-divider);
  background: var(--bg-page);
  flex-shrink: 0;
}
.welcome-btn {
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: var(--bg-header-btn);
  color: #fff;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.welcome-btn:hover { background: var(--bg-header-btn-hover); transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR PERSONNALISÉE FIREFOX (overlay) — voir js/index.js
   Évite le rognage de la scrollbar native FF par les coins
   arrondis + overflow:hidden de la modale (avis légal, accueil).
   Couleurs claires (le portail est en thème sombre).
   ═══════════════════════════════════════════════════════════ */
.ff-scrollbar {
  width: 11px;
  display: flex;
  flex-direction: column;
  z-index: 99999;
  pointer-events: none;
  user-select: none;
  background: transparent;
}
.ff-scrollbar.ff-sb-active { pointer-events: auto; }
.ff-sb-btn {
  flex-shrink: 0;
  height: 14px;
  width: 11px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
}
.ff-sb-btn:hover { background: rgba(255,255,255,0.13); }
.ff-sb-btn svg { display: block; }
.ff-sb-track {
  flex: 1;
  background: rgba(255,255,255,0.04);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.ff-sb-thumb {
  position: absolute;
  left: 1px; right: 1px;
  min-height: 28px;
  background: rgba(160, 185, 210, 0.45);
  border-radius: 4px;
  cursor: grab;
  transition: background 0.12s;
}
.ff-sb-thumb:hover,
.ff-sb-thumb.dragging { background: rgba(180, 205, 230, 0.68); }
