.ealbox-open {
  overflow: hidden !important;
}

.ealbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.90);
}

.ealbox-overlay.is-open {
  display: flex;
}

.ealbox-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ealbox-image {
  display: block;
  max-width: min(96vw, 1800px);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

.ealbox-close {
  position: fixed;
  top: 72px !important;
  right: max(14px, env(safe-area-inset-right));
  z-index: 1000000;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255,255,255,.96);
  color: #111;
  font: 400 34px/1 Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.30);
}

.ealbox-close:hover,
.ealbox-close:focus-visible {
  background: #fff;
  outline: 3px solid rgba(255,255,255,.45);
  outline-offset: 3px;
}

.ealbox-caption {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 900px;
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

.ealbox-caption:empty {
  display: none;
}

@media (max-width: 640px) {
  .ealbox-overlay {
    padding: 12px;
  }

  .ealbox-image {
    max-width: 96vw;
    max-height: 86vh;
    border-radius: 2px;
  }

  .ealbox-close {
    width: 44px;
    height: 44px;
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ealbox-overlay,
  .ealbox-image,
  .ealbox-close {
    scroll-behavior: auto;
    transition: none !important;
    animation: none !important;
  }
}

/* Pendant l'ouverture de la lightbox, masquer les commandes de lecture
   flottantes du site afin qu'elles ne passent pas au-dessus de l'image. */
html.ealbox-open #font-controls,
body.ealbox-open #font-controls,
html.ealbox-open #reading-position-indicator,
body.ealbox-open #reading-position-indicator {
  display: none !important;
}
