/* ==========================================================================
   Visionneuse d'images (lightbox) — ajoutée pour la version statique.
   N'existait pas sur le site d'origine : cliquer une photo ouvrait
   directement le fichier d'origine (1 Mo en moyenne, jusqu'à 10 Mo).

   Principe : l'image s'ouvre par-dessus la page ; le navigateur choisit
   lui-même la résolution adaptée à l'écran (srcset/sizes). Sur ordinateur on
   navigue au clavier et à la molette ; sur mobile au doigt (balayage, pincement).
   ========================================================================== */

body.lb-open {
  overflow: hidden;
}

.lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
}

.lb[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- stage */

.lb__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: none; /* we handle pan/pinch ourselves */
}

/*
 * The image is positioned absolutely on purpose. As a flex child its
 * max-height:100% depended on the stage height while the stage height depended
 * on the image, so browsers ignored the percentage and the image overflowed the
 * screen on narrow viewports. Out of flow there is no cycle, and
 * inset:0 + margin:auto centres it.
 */
.lb__img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  will-change: transform;
  cursor: zoom-in;
  -webkit-user-drag: none;
  user-select: none;
  opacity: 0;
  transition: opacity .18s ease-out;
}

.lb.is-zoomed .lb__img {
  cursor: grab;
}

.lb.is-panning .lb__img {
  cursor: grabbing;
}

.lb.is-loaded .lb__img {
  opacity: 1;
}

.lb__spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border: 2px solid #444;
  border-top-color: #ff0;
  border-radius: 50%;
  animation: lb-spin .8s linear infinite;
  pointer-events: none;
}

.lb.is-loaded .lb__spinner {
  display: none;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------ navigation */

.lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, opacity .15s;
}

.lb__nav--prev { left: 10px; }
.lb__nav--next { right: 10px; }

.lb__nav:hover,
.lb__nav:focus-visible {
  background: #ff0;
  color: #000;
  outline: none;
}

.lb__nav[disabled] {
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ bars */

.lb__top,
.lb__bottom {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #000;
}

.lb__top {
  justify-content: space-between;
  padding-top: calc(8px + env(safe-area-inset-top));
}

.lb__bottom {
  flex-wrap: wrap;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.lb__count {
  color: #ff0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb__cap {
  flex: 1 1 100%;
  margin: 0;
  color: #ddd;
  font-size: 14px;
  line-height: 1.35;
}

.lb__cap:empty {
  display: none;
}

.lb__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.lb__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.lb__btn:hover {
  background: #ff0;
  border-color: #ff0;
  color: #000;
}

/* A visible focus ring rather than a full yellow fill, so the focused control
   is obvious without looking permanently "pressed". */
.lb__btn:focus-visible,
.lb__nav:focus-visible {
  outline: 2px solid #ff0;
  outline-offset: 2px;
}

.lb__btn--close {
  font-size: 18px;
}

.lb__zoom[aria-pressed="true"] {
  background: #ff0;
  border-color: #ff0;
  color: #000;
}

.lb__orig[hidden] {
  display: none;
}

/* Hidden by default, shown on wide screens further down. Declared here so the
   media queries below can override it. */
.lb__hint {
  display: none;
  color: #777;
  font-size: 12px;
}

/* --------------------------------------------------------------- desktop */

/* Wider screens: arrows over the image and a keyboard hint. Keyed on width
   only -- a desktop browser does not always report pointer:fine, and the touch
   overrides below win when it does. */
@media (min-width: 800px) {
  .lb__nav {
    width: 60px;
    height: 60px;
    font-size: 36px;
    background: rgba(0, 0, 0, .4);
  }

  .lb__nav--prev { left: 20px; }
  .lb__nav--next { right: 20px; }

  .lb__top,
  .lb__bottom {
    padding: 10px 18px;
  }

  .lb__cap {
    flex: 0 1 auto;
    font-size: 15px;
  }

  .lb__hint {
    display: inline;
  }
}

/* Touch devices: bigger targets, no keyboard hint, arrows dimmed so they do
   not fight with the swipe gesture. */
@media (pointer: coarse) {
  .lb__nav {
    width: 46px;
    height: 46px;
    font-size: 26px;
    opacity: .5;
  }

  .lb__count,
  .lb__cap {
    font-size: 15px;
  }

  .lb__hint {
    display: none;
  }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lb__img,
  .lb__nav,
  .lb__btn {
    transition: none;
  }

  .lb__spinner {
    animation: none;
  }
}
