/* Bannière cookies Digiflow : thème par variables --dgf-*, trois directions (data-dgf-direction="1|2|3").
   Les variables se posent sur :root (ou sur .dgf-cc, .dgf-embed) dans la feuille du site.
   Sélecteurs à une classe : ils l'emportent sur les styles d'éléments du site (h2, p, button…). */

.dgf-cc,
.dgf-embed {
  --_fond: var(--dgf-fond, #fff);
  --_texte: var(--dgf-texte, #202124);
  --_doux: var(--dgf-texte-doux, color-mix(in srgb, var(--_texte) 76%, var(--_fond)));
  --_accent: var(--dgf-accent, #202124);
  --_sur: var(--dgf-sur-accent, #fff);
  --_bord: var(--dgf-bordure, color-mix(in srgb, var(--_texte) 16%, var(--_fond)));
  --_rayon: var(--dgf-rayon, 14px);
  --_rbtn: var(--dgf-rayon-bouton, var(--_rayon));
  --_ombre: var(--dgf-ombre, 0 18px 48px -12px rgb(0 0 0 / .28));
  --_esp: var(--dgf-espace, max(1rem, 16px));
  --_marge: var(--dgf-marge, max(1rem, 16px));
  --_focus: var(--dgf-focus, var(--_accent));
  --_cfond: var(--dgf-choix-fond, var(--_accent));
  --_ctexte: var(--dgf-choix-texte, var(--_sur));
  --_cbord: var(--dgf-choix-bordure, var(--_cfond));
  --_ep: var(--dgf-epaisseur, 1px);
}

.dgf-cc[hidden],
.dgf-cc [hidden] { display: none !important; }

.dgf-cc *,
.dgf-cc *::before,
.dgf-cc *::after,
.dgf-embed *,
.dgf-embed *::before { box-sizing: border-box; }

/* ---------- Boîte commune ---------- */
.dgf-cc__boite {
  position: fixed;
  z-index: var(--dgf-z, 2147483000);
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  max-height: calc(100dvh - 2 * var(--_marge));
  background: var(--_fond);
  color: var(--_texte);
  border: var(--_ep) solid var(--_bord);
  box-shadow: var(--_ombre);
  font-family: var(--dgf-police-texte);
  font-size: max(.9375rem, 14px);
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
}
.dgf-cc__boite:focus { outline: none; }

/* « Continuer sans accepter » au-dessus du titre, en haut à droite (sur la même ligne en barre large). */
.dgf-cc__tete {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: .375em;
}

.dgf-cc__titre {
  margin: 0;
  padding: 0;
  font-family: var(--dgf-police-titre, var(--dgf-police-texte));
  font-size: 1.25em;
  font-weight: var(--dgf-poids-titre, 600);
  font-style: var(--dgf-style-titre, normal);
  line-height: 1.2;
  letter-spacing: var(--dgf-chasse-titre, normal);
  text-transform: var(--dgf-casse-titre, none);
  color: inherit;
}

.dgf-cc__fermer {
  flex: none;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: .45em;
  min-height: 32px;
  margin: -.25em -.5em 0 0;
  padding: .25em .5em;
  background: none;
  border: 0;
  border-radius: var(--_rbtn);
  color: var(--_doux);
  font: inherit;
  font-size: .875em;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  cursor: pointer;
}
.dgf-cc__fermer:hover { color: var(--_texte); }
.dgf-cc__fermer svg {
  width: .7em;
  height: .7em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.dgf-cc__texte,
.dgf-cc__liens,
.dgf-cc__finalite p,
.dgf-embed__ph p {
  margin: .5em 0 0;
  padding: 0;
  font-size: 1em;
  line-height: 1.5;
  color: inherit;
  max-width: 68ch;
}
.dgf-cc__liens { display: flex; flex-wrap: wrap; gap: .25em 1.25em; font-size: .875em; }
.dgf-cc a {
  color: inherit;
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
.dgf-cc a:hover { text-decoration-thickness: 2px; }

/* ---------- Boutons : « Tout refuser » et « Tout accepter » partagent la même classe ---------- */
.dgf-cc__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625em;
  margin: calc(var(--_esp) * 1.25) 0 0;
}
.dgf-cc__actions > .dgf-cc__btn--lien,
.dgf-cc__actions > .dgf-cc__btn--second { grid-column: 1 / -1; }

.dgf-cc__btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: .6em 1.1em;
  border-radius: var(--_rbtn);
  font-family: var(--dgf-police-bouton, var(--dgf-police-texte));
  font-size: 1em;
  font-weight: var(--dgf-poids-bouton, 600);
  font-style: normal;
  line-height: 1.2;
  letter-spacing: var(--dgf-chasse-bouton, normal);
  text-transform: var(--dgf-casse-bouton, none);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.dgf-cc__btn--choix {
  background: var(--_cfond);
  color: var(--_ctexte);
  border: var(--_ep) solid var(--_cbord);
  box-shadow: var(--dgf-ombre-bouton, none);
}
.dgf-cc__btn--choix:hover { background: var(--dgf-choix-survol, color-mix(in srgb, var(--_cfond) 86%, var(--_texte))); }
.dgf-cc__btn--choix:active { transform: translateY(1px); }
.dgf-cc__btn--second {
  background: transparent;
  color: var(--_texte);
  border: var(--_ep) solid currentColor;
}
.dgf-cc__btn--second:hover { background: color-mix(in srgb, var(--_texte) 8%, transparent); }
.dgf-cc__btn--lien {
  background: none;
  border: 0;
  padding-inline: .5em;
  color: var(--_texte);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
}
.dgf-cc__btn--lien:hover { text-decoration-thickness: 2px; }

.dgf-cc__btn:focus-visible,
.dgf-cc__fermer:focus-visible,
.dgf-cc a:focus-visible,
.dgf-cc__switch:focus-visible {
  outline: 2px solid var(--_focus);
  outline-offset: 3px;
}

/* ---------- Écran « Personnaliser » ---------- */
.dgf-cc__finalites {
  list-style: none;
  margin: var(--_esp) 0 0;
  padding: 0;
}
.dgf-cc__finalite {
  margin: 0;
  padding: .85em 0;
  border-top: 1px solid var(--_bord);
}
.dgf-cc__finalite:last-child { border-bottom: 1px solid var(--_bord); }
.dgf-cc__ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}
.dgf-cc__nom { font-weight: 600; cursor: pointer; }
span.dgf-cc__nom { cursor: default; }
.dgf-cc__etat,
.dgf-cc__finalite p { color: var(--_doux); font-size: .875em; }
.dgf-cc__finalite p { margin-top: .2em; }

.dgf-cc__switch {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  position: relative;
  width: 2.75em;
  height: 1.6em;
  margin: 0;
  border: 2px solid var(--_doux);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.dgf-cc__switch::before {
  content: '';
  position: absolute;
  top: 50%;
  left: .2em;
  width: 1em;
  height: 1em;
  margin-top: -.5em;
  border-radius: 50%;
  background: var(--_doux);
  transition: transform .2s, background-color .2s;
}
/* Zones de clic portées à 44 px sans rien changer au rendu : un ::after transparent centré. */
.dgf-cc__fermer,
.dgf-cc__btn--lien { position: relative; }
.dgf-cc__fermer::after,
.dgf-cc__btn--lien::after,
.dgf-cc__switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
.dgf-cc__switch:checked { background: var(--_accent); border-color: var(--_accent); }
.dgf-cc__switch:checked::before { transform: translateX(1.15em); background: var(--_sur); }

/* ---------- Direction 1 : barre basse ---------- */
.dgf-cc[data-dgf-direction="1"] .dgf-cc__boite {
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  border-width: var(--_ep) 0 0;
  border-radius: 0;
  padding: calc(var(--_esp) * 1.25) max(var(--_marge), calc(50vw - 37rem)) calc(var(--_esp) * 1.25 + env(safe-area-inset-bottom, 0px));
}
.dgf-cc[data-dgf-direction="1"] .dgf-cc__titre { font-size: 1.125em; }
@media (min-width: 56rem) {
  .dgf-cc[data-dgf-direction="1"] .dgf-cc__tete {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--_esp);
  }
  .dgf-cc[data-dgf-direction="1"] [data-dgf-vue="1"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 3rem;
    align-items: center;
  }
  .dgf-cc[data-dgf-direction="1"] [data-dgf-vue="1"] .dgf-cc__actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    grid-template-columns: repeat(2, minmax(9.5em, 1fr)) auto;
    margin: 0;
  }
  .dgf-cc[data-dgf-direction="1"] [data-dgf-vue="1"] .dgf-cc__btn--lien { grid-column: auto; }
  .dgf-cc[data-dgf-direction="1"] .dgf-cc__finalites {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0 2rem;
  }
  .dgf-cc[data-dgf-direction="1"] .dgf-cc__finalite { border-bottom: 1px solid var(--_bord); }
  .dgf-cc[data-dgf-direction="1"] [data-dgf-vue="2"] .dgf-cc__actions {
    grid-template-columns: repeat(3, minmax(10em, auto));
    justify-content: end;
  }
  .dgf-cc[data-dgf-direction="1"] [data-dgf-vue="2"] .dgf-cc__btn--second { grid-column: auto; }
}

/* ---------- Direction 2 : carte flottante ---------- */
.dgf-cc[data-dgf-direction="2"] .dgf-cc__boite {
  left: var(--_marge);
  bottom: calc(var(--_marge) + env(safe-area-inset-bottom, 0px));
  width: min(var(--dgf-largeur, 25.5rem), calc(100vw - 2 * var(--_marge)));
  border-radius: var(--_rayon);
  padding: calc(var(--_esp) * 1.5);
}
.dgf-cc[data-dgf-direction="2"] .dgf-cc__titre { font-size: 1.375em; }
@media (max-width: 30rem) {
  .dgf-cc[data-dgf-direction="2"] .dgf-cc__boite {
    --_marge: var(--dgf-marge, 10px);
    padding: calc(var(--_esp) * .875) calc(var(--_esp) * 1);
  }
  .dgf-cc[data-dgf-direction="2"] .dgf-cc__titre { font-size: 1.25em; }
}

/* ---------- Petits écrans : premier niveau compact, toutes directions ----------
   Cible : direction 2 à 40 % de l'écran au plus à 375 px, 50 % à 320 px. */
@media (max-width: 30rem) {
  .dgf-cc__boite { font-size: max(.875rem, 14px); line-height: 1.45; }
  .dgf-cc__texte,
  .dgf-cc__liens { margin-top: .375em; line-height: 1.45; }
  .dgf-cc__tete { gap: 0; }
  .dgf-cc__fermer { min-height: 26px; padding-block: 0; }
  .dgf-cc__actions { gap: .5em; margin-top: calc(var(--_esp) * .75); }
  .dgf-cc__btn--choix { padding-inline: .5em; white-space: nowrap; }
  .dgf-cc__actions > .dgf-cc__btn--lien { min-height: 32px; padding-block: 0; }
}

/* ---------- Direction 3 : panneau latéral (feuille basse sur mobile) ---------- */
.dgf-cc[data-dgf-direction="3"] .dgf-cc__boite {
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(var(--dgf-largeur, 28rem), 100vw);
  max-height: none;
  border-width: 0 0 0 var(--_ep);
  border-radius: 0;
  padding: calc(var(--_esp) * 1.75) calc(var(--_esp) * 2) calc(var(--_esp) * 2);
}
.dgf-cc[data-dgf-direction="3"] .dgf-cc__tete { gap: calc(var(--_esp) * 2.5); }
.dgf-cc[data-dgf-direction="3"] .dgf-cc__titre { font-size: 2.125em; line-height: 1.08; }
.dgf-cc[data-dgf-direction="3"] .dgf-cc__vue {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}
.dgf-cc[data-dgf-direction="3"] .dgf-cc__texte { margin-top: var(--_esp); }
.dgf-cc[data-dgf-direction="3"] .dgf-cc__actions {
  grid-template-columns: 1fr;
  margin-top: auto;
  padding-top: calc(var(--_esp) * 1.5);
}
@media (max-width: 40rem) {
  .dgf-cc[data-dgf-direction="3"] .dgf-cc__boite {
    top: auto;
    left: 0;
    width: auto;
    max-height: 88dvh;
    border-width: var(--_ep) 0 0;
    border-radius: var(--_rayon) var(--_rayon) 0 0;
    padding: calc(var(--_esp) * 1.25) calc(var(--_esp) * 1.25) calc(var(--_esp) * 1.25 + env(safe-area-inset-bottom, 0px));
  }
  .dgf-cc[data-dgf-direction="3"] .dgf-cc__tete { gap: calc(var(--_esp) * .75); }
  .dgf-cc[data-dgf-direction="3"] .dgf-cc__titre { font-size: 1.75em; }
  .dgf-cc[data-dgf-direction="3"] .dgf-cc__actions { grid-template-columns: 1fr 1fr; padding-top: var(--_esp); }
}

/* ---------- Apparition (désactivée si l'utilisateur réduit les animations) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .dgf-cc__boite { animation: dgf-entree .38s cubic-bezier(.2, .8, .2, 1) both; }
  .dgf-cc[data-dgf-direction="1"] .dgf-cc__boite { --_de: translateY(100%); }
  .dgf-cc[data-dgf-direction="2"] .dgf-cc__boite { --_de: translateY(1.25rem); }
  .dgf-cc[data-dgf-direction="3"] .dgf-cc__boite { --_de: translateX(100%); }
  @media (max-width: 40rem) {
    .dgf-cc[data-dgf-direction="3"] .dgf-cc__boite { --_de: translateY(100%); }
  }
}
@keyframes dgf-entree {
  from { transform: var(--_de, none); opacity: 0; }
}

/* ---------- Bloc « contenu tiers » (iframe YouTube, Maps, widget) ----------
   Règle de base dans sa propre couche : toute CSS du site l'emporte, y compris les utilitaires
   Tailwind 4 (@layer utilities), qu'une règle hors couche écraserait quelle que soit sa spécificité
   (hidden md:block, w-1/2, rounded-none…). Le kit étant importé avant globals.css, la couche
   dgf-consent est déclarée la première, donc la plus faible ; l'ordre des couches du site ne bouge pas. */
@layer dgf-consent {
  .dgf-embed {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--_rayon);
    font-family: var(--dgf-police-texte);
    font-size: max(.9375rem, 14px);
    line-height: 1.5;
    color: var(--_texte);
  }
}
.dgf-embed > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
}
/* aspect-ratio: auto : l'iframe reste dans le flux. Sans hauteur donnée au bloc, elle garde au
   moins 150 px au lieu de tomber à 0. */
.dgf-embed--auto > iframe { position: relative; display: block; min-height: 150px; }
/* Bloc pas encore affiché : seul l'encart se voit, même si un script partagé (Elfsight) a déjà
   rempli le widget qu'il contient. */
.dgf-embed[data-dgf-consent]:not(.dgf-embed--actif) > :not(.dgf-embed__ph) { display: none !important; }
.dgf-embed__ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .9em;
  padding: 1.25em;
  text-align: center;
  background: color-mix(in srgb, var(--_texte) 5%, var(--_fond));
  border: 1px solid var(--_bord);
  border-radius: inherit;
}
.dgf-embed__ph p { margin: 0; max-width: 34ch; }
.dgf-embed__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .25em .75em;
}
