/**
 * Fenêtre modale 3WCONSEILS — fiches, vidéos et PDF locaux.
 * Chargée sur tout le site par le plugin, afin que les articles en bénéficient
 * au même titre que la page index.
 */

.w3c-modal-root{
  --wm-bleu:#385D83; --wm-bleu-principal:#6184A8; --wm-ciel:#EAF2FA;
  --wm-bordure:#DCE7F2; --wm-texte:#50575E;
  position:fixed; inset:0; z-index:99999;
  display:none; align-items:center; justify-content:center;
  padding:24px;
  font-family:"Montserrat",-apple-system,"Segoe UI",sans-serif;
}
.w3c-modal-root.is-open{display:flex;}
.w3c-modal-root__backdrop{
  position:absolute; inset:0;
  background:rgba(23,42,61,.72);
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px);
}
.w3c-modal-root__box{
  position:relative;
  background:#fff;
  width:min(940px,100%); max-height:90vh;
  border-radius:16px;
  box-shadow:0 24px 70px rgba(0,0,0,.35);
  display:flex; flex-direction:column;
  overflow:hidden;
  animation:w3cModalIn .22s ease-out;
}
@keyframes w3cModalIn{from{opacity:0;transform:translateY(14px) scale(.985);}to{opacity:1;transform:none;}}

.w3c-modal-root__head{
  flex:0 0 auto;
  display:flex; align-items:center; gap:16px;
  padding:20px 24px;
  background:linear-gradient(135deg,var(--wm-bleu),var(--wm-bleu-principal));
  color:#fff;
}
.w3c-modal-root__head h2{
  margin:0; font-family:"Poppins",sans-serif; font-weight:600;
  font-size:19px; line-height:1.35; color:#fff; flex:1 1 auto;
}
.w3c-modal-root__close{
  flex:0 0 auto; width:38px; height:38px;
  border:0; border-radius:50%; cursor:pointer;
  background:rgba(255,255,255,.18); color:#fff;
  font-size:22px; line-height:1;
  display:flex; align-items:center; justify-content:center;
  transition:background .16s;
}
.w3c-modal-root__close:hover,
.w3c-modal-root__close:focus-visible{background:rgba(255,255,255,.34);outline:none;}

.w3c-modal-root__body{
  flex:1 1 auto; overflow-y:auto;
  padding:28px 32px; color:var(--wm-texte); font-size:15.5px; line-height:1.7;
}
.w3c-modal-root__body h2,
.w3c-modal-root__body h3,
.w3c-modal-root__body h4{
  font-family:"Poppins",sans-serif; font-weight:600; color:var(--wm-bleu);
  margin:1.8em 0 .6em; line-height:1.35;
}
.w3c-modal-root__body h2{font-size:20px;}
.w3c-modal-root__body h3{font-size:17.5px;}
.w3c-modal-root__body h4{font-size:16px;}
.w3c-modal-root__body p{margin:0 0 1.1em;}
.w3c-modal-root__body ul,
.w3c-modal-root__body ol{margin:0 0 1.2em; padding-left:1.4em;}
.w3c-modal-root__body li{margin-bottom:.5em;}
.w3c-modal-root__body a{color:var(--wm-bleu-principal); text-decoration:underline;}
.w3c-modal-root__body a:hover{color:var(--wm-bleu);}
.w3c-modal-root__body img{max-width:100%; height:auto; border-radius:10px; margin:1em 0;}
.w3c-modal-root__body iframe{width:100%; aspect-ratio:16/9; height:auto; border:0;
  border-radius:10px; margin:1em 0;}
.w3c-modal-root__body table{width:100%; border-collapse:collapse; margin:1.2em 0; font-size:14.5px;}
.w3c-modal-root__body th,
.w3c-modal-root__body td{border:1px solid var(--wm-bordure); padding:9px 12px; text-align:left;}
.w3c-modal-root__body th{background:var(--wm-ciel); color:var(--wm-bleu); font-weight:600;}
.w3c-modal-root__body blockquote{
  margin:1.2em 0; padding:12px 20px;
  background:var(--wm-ciel); border-left:4px solid var(--wm-bleu-principal);
  border-radius:0 8px 8px 0;
}

/* Lecteur vidéo : plein cadre, sans marge */
.w3c-modal-root__body--video{padding:0; background:#000;}
.w3c-modal-root__body--video iframe{margin:0; border-radius:0; display:block;}

/* Visionneuse PDF : occupe toute la hauteur disponible */
.w3c-modal-root__body--pdf{padding:0; background:#525659;}
.w3c-modal-root__body--pdf iframe{
  margin:0; border-radius:0; display:block;
  width:100%; height:78vh; aspect-ratio:auto;
}

/* États de chargement et d'erreur */
.w3c-modal-root__state{text-align:center; padding:60px 20px;
  color:var(--wm-bleu-principal); font-weight:600;}
.w3c-modal-root__spinner{
  width:34px; height:34px; margin:0 auto 16px;
  border:3px solid var(--wm-ciel); border-top-color:var(--wm-bleu-principal);
  border-radius:50%; animation:w3cSpin .8s linear infinite;
}
@keyframes w3cSpin{to{transform:rotate(360deg);}}
.w3c-modal-root__state a{
  display:inline-block; margin-top:14px; padding:11px 24px;
  background:var(--wm-bleu-principal); color:#fff; border-radius:999px;
  text-decoration:none; font-size:14px;
}

/* Bandeau d'attribution — obligation de la Licence Ouverte 2.0 */
.w3c-modal-root__foot{
  flex:0 0 auto;
  padding:14px 24px;
  background:#F5F9FD; border-top:1px solid var(--wm-bordure);
  font-size:12.5px; line-height:1.55; color:#7792AD;
  display:flex; flex-wrap:wrap; gap:10px; align-items:center;
  justify-content:space-between;
}
.w3c-modal-root__foot a{color:var(--wm-bleu-principal); text-decoration:underline;}
.w3c-modal-root__foot .w3c-modal-root__dl{
  text-decoration:none; background:var(--wm-bleu-principal); color:#fff;
  border-radius:999px; padding:7px 16px; font-weight:600; white-space:nowrap;
}
.w3c-modal-root__foot .w3c-modal-root__dl:hover{background:var(--wm-bleu);}

@media (max-width:767px){
  .w3c-modal-root{padding:0;}
  .w3c-modal-root__box{width:100%; max-height:100vh; height:100vh; border-radius:0;}
  .w3c-modal-root__body{padding:20px 18px;}
  .w3c-modal-root__body--pdf iframe{height:70vh;}
  .w3c-modal-root__head{padding:16px 18px;}
  .w3c-modal-root__head h2{font-size:16.5px;}
}
@media (prefers-reduced-motion:reduce){
  .w3c-modal-root__box{animation:none;}
  .w3c-modal-root__spinner{animation-duration:2s;}
}

body.w3c-modal-open{overflow:hidden;}
