/* Promotion window: centred over a dark background on computers and tablets,
   small panel at the bottom of the screen on phones */

.vg-promo[hidden] {
  display: none;
}
.vg-promo {
  position: fixed;
  inset: 0;
  /* Above the Avis Garantis badge and the cookie icon, which use the highest values */
  z-index: 2147483647;
}
.vg-promo-fond {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.3s;
}
.vg-promo-boite {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(90vw, 640px);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, -46%);
  transition: opacity 0.3s, transform 0.3s;
}
.vg-promo-visible .vg-promo-fond {
  opacity: 1;
}
.vg-promo-visible .vg-promo-boite {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.vg-promo-boite img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
}
.vg-promo-fermer {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  color: #222;
  font-size: 26px;
  line-height: 36px;
  cursor: pointer;
}
.vg-promo-fermer:hover,
.vg-promo-fermer:focus-visible {
  background: #659B7A;
  color: #fff;
}

/* Phones: no dark background, the page stays visible and usable above the panel */
@media (max-width: 767px) {
  .vg-promo.vg-promo-panneau {
    inset: auto 0 0 0;
    pointer-events: none;
  }
  .vg-promo-panneau .vg-promo-fond {
    display: none;
  }
  /* The panel takes the width of the image, without white bands on the sides */
  .vg-promo-panneau .vg-promo-boite {
    position: relative;
    top: auto;
    left: auto;
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 0 auto 12px;
    pointer-events: auto;
    transform: translateY(30px);
  }
  .vg-promo-panneau.vg-promo-visible .vg-promo-boite {
    transform: none;
  }
  .vg-promo-panneau .vg-promo-boite img {
    width: auto;
    max-width: 100%;
    max-height: 30vh;
  }
  .vg-promo-panneau .vg-promo-fermer {
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vg-promo-fond,
  .vg-promo-boite {
    transition: none;
  }
}
