/*!
 * MED Consent : styles du bandeau.
 *
 * Tout est sous la classe .medc avec des sélecteurs à deux classes, pour passer
 * devant les styles du thème (bouton, paragraphe, liste) sans !important.
 * Tailles en pixels : le bandeau garde ses proportions quel que soit le thème.
 * Couleurs réglables : variables --medc-* écrites par le script du bandeau.
 */

.medc {
  --medc-bg: #ffffff;
  --medc-text: #1b1b1b;
  --medc-primary: #1b1b1b;
  --medc-primary-text: #ffffff;
  --medc-accent: #ff4e00;

  /* Teintes dérivées, valeurs de repli pour les navigateurs sans color-mix(). */
  --medc-muted: #5f5f5f;
  --medc-line: #dcdcdc;
  --medc-soft: #f3f3f3;
  --medc-off: #8d8d8d;
  --medc-primary-hover: #404040;

  --medc-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --medc-enter: cubic-bezier(0, 0, 0.2, 1);
  --medc-exit: cubic-bezier(0.4, 0, 1, 1);

  box-sizing: border-box;
  color: var(--medc-text);
  font-family: inherit;
  font-size: 15px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.5;
  text-align: start;
  text-transform: none;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .medc {
    --medc-muted: color-mix(in srgb, var(--medc-text) 70%, var(--medc-bg));
    --medc-line: color-mix(in srgb, var(--medc-text) 15%, var(--medc-bg));
    --medc-soft: color-mix(in srgb, var(--medc-text) 5%, var(--medc-bg));
    --medc-off: color-mix(in srgb, var(--medc-text) 50%, var(--medc-bg));
    --medc-primary-hover: color-mix(in srgb, var(--medc-primary) 84%, var(--medc-bg));
  }
}

.medc *,
.medc *::before,
.medc *::after {
  box-sizing: border-box;
}

/* Conteneur hors du flux : ajouté en tête de <body>, il ne déplace rien dans la page. */
#medc-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  /* Valeur la plus haute possible : rien ne doit recouvrir le choix du visiteur. */
  z-index: 2147483647;
}

.medc .medc-title {
  margin: 0;
  color: var(--medc-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 24px;
}

.medc .medc-text {
  margin: 0;
  color: var(--medc-muted);
  font-size: 14px;
  line-height: 21px;
}

.medc .medc-link {
  color: var(--medc-text);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 150ms var(--medc-ease);
}

.medc .medc-link:hover {
  color: var(--medc-accent);
}

.medc .medc-link:focus-visible,
.medc .medc-btn:focus-visible,
.medc .medc-close:focus-visible,
.medc .medc-switch:focus-visible,
.medc .medc-fab:focus-visible,
.medc .medc-services summary:focus-visible {
  outline: 2px solid var(--medc-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------------ */
/* Boutons                                                                  */
/* ------------------------------------------------------------------------ */

.medc .medc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  /* Retour du bouton : léger rebond. L'appui, lui, est plus rapide (voir :active). */
  transition:
    background-color 150ms var(--medc-ease),
    border-color 150ms var(--medc-ease),
    color 150ms var(--medc-ease),
    transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.medc .medc-btn:active {
  transform: scale(0.97);
  transition-duration: 60ms;
}

/* « Tout refuser » et « Tout accepter » partagent ce style : même poids visuel. */
.medc .medc-btn--main {
  background-color: var(--medc-primary);
  border-color: var(--medc-primary);
  color: var(--medc-primary-text);
}

.medc .medc-btn--main:hover {
  background-color: var(--medc-primary-hover);
  border-color: var(--medc-primary-hover);
  color: var(--medc-primary-text);
}

.medc .medc-btn--ghost {
  background-color: transparent;
  border-color: var(--medc-line);
  color: var(--medc-text);
}

.medc .medc-btn--ghost:hover {
  background-color: var(--medc-soft);
  border-color: var(--medc-off);
  color: var(--medc-text);
}

.medc .medc-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.medc .medc-actions__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ------------------------------------------------------------------------ */
/* Bandeau                                                                  */
/* ------------------------------------------------------------------------ */

.medc .medc-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  background-color: var(--medc-bg);
  border: 1px solid var(--medc-line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 195ms var(--medc-exit), transform 195ms var(--medc-exit);
}

.medc .medc-banner.medc-in {
  opacity: 1;
  transform: none;
  transition: opacity 225ms var(--medc-enter), transform 225ms var(--medc-enter);
}

.medc .medc-banner .medc-title {
  margin-bottom: 6px;
}

.medc--bottom-right .medc-banner {
  right: 24px;
  left: auto;
}

@media (min-width: 900px) {
  .medc--bottom .medc-banner {
    right: 24px;
    left: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: center;
    gap: 24px;
    width: auto;
    max-width: 1000px;
    margin: 0 auto;
  }

  .medc--bottom .medc-banner .medc-actions {
    margin-top: 0;
  }
}

/* ------------------------------------------------------------------------ */
/* Fenêtre des préférences                                                  */
/* ------------------------------------------------------------------------ */

.medc .medc-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 195ms var(--medc-exit);
}

.medc .medc-overlay.medc-in {
  opacity: 1;
  transition: opacity 200ms var(--medc-enter);
}

.medc .medc-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  background-color: var(--medc-bg);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  outline: none;
  transform: translateY(8px) scale(0.98);
  transition: transform 195ms var(--medc-exit);
}

.medc .medc-overlay.medc-in .medc-modal {
  transform: none;
  transition: transform 225ms var(--medc-enter);
}

.medc .medc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 12px 8px 20px;
}

.medc .medc-close {
  appearance: none;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  background-color: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  color: var(--medc-text);
  cursor: pointer;
  transition: background-color 150ms var(--medc-ease), transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.medc .medc-close:hover {
  background-color: var(--medc-soft);
}

.medc .medc-close:active {
  transform: scale(0.94);
  transition-duration: 60ms;
}

.medc .medc-modal__body {
  padding: 0 20px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.medc .medc-modal__foot {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.35fr);
  gap: 8px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--medc-line);
}

.medc .medc-cats {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.medc .medc-cat {
  margin: 0;
  padding: 10px 0 14px;
  border-top: 1px solid var(--medc-line);
  list-style: none;
}

.medc .medc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.medc .medc-cat__title {
  color: var(--medc-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
}

.medc .medc-cat__desc {
  margin: 0;
  color: var(--medc-muted);
  font-size: 14px;
  line-height: 21px;
}

.medc .medc-always {
  flex: none;
  color: var(--medc-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

/* Interrupteur : zone de clic de 52 x 44 px autour d'une piste de 44 x 24 px. */
.medc .medc-switch {
  appearance: none;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 44px;
  margin: 0 -4px 0 0;
  padding: 0;
  background-color: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
}

.medc .medc-switch__track {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;
  background-color: var(--medc-off);
  border-radius: 12px;
  transition: background-color 150ms var(--medc-ease);
}

.medc .medc-switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 150ms var(--medc-ease);
}

.medc .medc-switch[aria-checked="true"] .medc-switch__track {
  background-color: var(--medc-accent);
}

.medc .medc-switch[aria-checked="true"] .medc-switch__knob {
  transform: translateX(20px);
}

.medc .medc-services {
  margin: 4px 0 0;
}

.medc .medc-services summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 4px;
  color: var(--medc-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.medc .medc-services ul {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.medc .medc-services li {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 8px 0;
  border-top: 1px dashed var(--medc-line);
  font-size: 13px;
  line-height: 20px;
  list-style: none;
}

.medc .medc-service__name {
  color: var(--medc-text);
  font-weight: 600;
}

.medc .medc-service__cookies {
  color: var(--medc-muted);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------------ */
/* Bouton de rappel                                                         */
/* ------------------------------------------------------------------------ */

.medc .medc-fab {
  appearance: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  background-color: var(--medc-bg);
  border: 1px solid var(--medc-line);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  color: var(--medc-text);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 195ms var(--medc-exit),
    color 150ms var(--medc-ease),
    transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.medc .medc-fab.medc-in {
  opacity: 1;
  transform: none;
}

.medc .medc-fab:hover {
  color: var(--medc-accent);
}

.medc .medc-fab.medc-in:active {
  transform: scale(0.94);
  transition-duration: 60ms;
}

.medc--bottom-right .medc-fab {
  right: 16px;
  left: auto;
}

/* ------------------------------------------------------------------------ */
/* Contenu bloqué (vidéo, carte)                                            */
/* ------------------------------------------------------------------------ */

iframe[data-medc-src] {
  display: none !important;
}

.medc.medc-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 12px;
  background-color: #151515;
  border-radius: inherit;
  text-align: center;
}

.medc .medc-placeholder__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}

.medc.medc-placeholder .medc-text {
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 18px;
}

/* Le bloc prend la place d'une vidéo, parfois petite : bouton à 44 px, même sur téléphone. */
.medc.medc-placeholder .medc-btn {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 14px;
}

.medc.medc-placeholder .medc-btn--main {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #1b1b1b;
}

.medc.medc-placeholder .medc-btn--main:hover {
  background-color: #e6e6e6;
  border-color: #e6e6e6;
  color: #1b1b1b;
}

/* La page ne défile pas derrière la fenêtre des préférences. */
html.medc-lock {
  overflow: hidden;
}

/* ------------------------------------------------------------------------ */
/* Téléphone                                                                */
/* ------------------------------------------------------------------------ */

@media (max-width: 640px) {
  .medc .medc-banner,
  .medc--bottom-right .medc-banner {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 24px);
    padding: 16px;
  }

  .medc .medc-title {
    font-size: 16px;
    line-height: 22px;
  }

  .medc .medc-btn {
    min-height: 48px;
  }

  /* Feuille qui monte du bas de l'écran. */
  .medc .medc-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .medc .medc-modal {
    max-width: none;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(24px);
  }

  .medc .medc-modal__foot {
    grid-template-columns: 1fr;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .medc .medc-fab {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
  }

  .medc--bottom-right .medc-fab {
    right: 12px;
    left: auto;
  }
}

/* Petit téléphone : le bandeau se resserre pour laisser plus de la moitié de l'écran à la page. */
@media (max-width: 640px) and (max-height: 700px) {
  .medc .medc-banner,
  .medc--bottom-right .medc-banner {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: 8px;
    padding: 12px;
  }

  .medc .medc-banner .medc-title {
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 20px;
  }

  .medc .medc-banner .medc-text {
    font-size: 13px;
    line-height: 18px;
  }

  .medc .medc-banner .medc-actions {
    gap: 6px;
    margin-top: 10px;
  }

  .medc .medc-banner .medc-btn {
    min-height: 44px;
    padding: 8px 12px;
  }
}

/* ------------------------------------------------------------------------ */
/* Mouvement réduit                                                         */
/* ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .medc .medc-banner,
  .medc .medc-banner.medc-in,
  .medc .medc-overlay,
  .medc .medc-overlay.medc-in,
  .medc .medc-modal,
  .medc .medc-overlay.medc-in .medc-modal,
  .medc .medc-fab,
  .medc .medc-btn,
  .medc .medc-close,
  .medc .medc-switch__track,
  .medc .medc-switch__knob {
    transition-duration: 0.01ms;
  }

  .medc .medc-banner,
  .medc .medc-modal,
  .medc .medc-fab,
  .medc .medc-btn:active,
  .medc .medc-close:active,
  .medc .medc-fab.medc-in:active {
    transform: none;
  }
}
