.cfamv-source-hidden {
  display: none !important;
}

.cfamv-day-gallery {
  margin: 1rem 0 2rem;
}

.cfamv-day-gallery__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

/* CFAMV brand blue: #3b6396 — Twenty Twenty-Five contrast: #111111, base: #ffffff */
.cfamv-day-gallery__thumb {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #3b6396;
  background: #ffffff;
  padding: 0;
  cursor: pointer;
  border-radius: 0.4rem;
  overflow: hidden;
  display: block;
  text-decoration: none;
}

.cfamv-day-gallery__thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.cfamv-day-gallery__thumb:hover {
  border-color: #1e3f6a;
}

/* Focus indicator: 3px solid, contrast #111111 (Twenty Twenty-Five) — WCAG AA */
.cfamv-day-gallery__thumb:focus-visible,
.cfamv-modal__close:focus-visible,
.cfamv-modal__prev:focus-visible,
.cfamv-modal__next:focus-visible {
  outline: 3px solid #111111;
  outline-offset: 3px;
}

.cfamv-modal-open {
  overflow: hidden;
  /* iOS Safari : empêche le scroll du fond sans bloquer celui de la modale */
  position: fixed;
  width: 100%;
}

.cfamv-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
}

.cfamv-modal[hidden] {
  display: none;
}

.cfamv-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.cfamv-modal__dialog {
  position: relative;
  z-index: 2;
  width: 100vw;
  /* dvh s'adapte à la zone visible réelle (barre d'adresse exclue) */
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS < 13 */
  overscroll-behavior: contain;      /* empêche le scroll de remonter au fond */
  touch-action: pan-y;               /* autorise le scroll vertical tactile */
  background: #ffffff;  /* base */
  color: #111111;       /* contrast */
  border-radius: 0;
  padding: clamp(0.75rem, 1.8vw, 1.5rem);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.cfamv-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cfamv-modal__title {
  margin: 0;
  font-size: 1.2rem;
}

.cfamv-modal__close,
.cfamv-modal__prev,
.cfamv-modal__next {
  border: 2px solid #3b6396;
  background: #ffffff;
  color: #111111;
  border-radius: 0.4rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.cfamv-modal__close {
  inline-size: 2.6rem;
  block-size: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cfamv-modal__close-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.cfamv-screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.cfamv-modal__status {
  margin: 0.6rem 0 0.75rem;
  font-weight: 600;
}

.cfamv-modal__figure {
  margin: 0;
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cfamv-modal__image {
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  background: #f6f8fa;
}

.cfamv-modal__description {
  margin-top: 0.8rem;
  line-height: 1.45;
}

.cfamv-modal__copyright {
  margin-top: 0.8rem;
  font-style: italic;
}

/* Les boutons prev/next sont en position absolue dans .cfamv-modal__figure */
.cfamv-modal__controls {
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.cfamv-modal__prev,
.cfamv-modal__next {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  background: rgba(17, 17, 17, 0.52);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  min-height: unset;
}

.cfamv-modal__prev {
  left: 0.75rem;
}

.cfamv-modal__next {
  right: 0.75rem;
}

.cfamv-modal__prev[disabled] {
  opacity: 0.28;
  cursor: default;
}

.cfamv-modal__prev:hover:not([disabled]),
.cfamv-modal__next:hover:not([disabled]) {
  background: rgba(17, 17, 17, 0.72);
  transform: translateY(calc(-50% - 1px));
}

.cfamv-modal__nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  user-select: none;
}

.cfamv-modal__nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 768px) {
  .cfamv-day-gallery__list {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .cfamv-modal__dialog {
    padding: 0.65rem;
  }

  .cfamv-modal__title {
    font-size: 1rem;
  }

  .cfamv-modal__prev,
  .cfamv-modal__next {
    width: 2.6rem;
    height: 2.6rem;
  }

  .cfamv-modal__nav-icon {
    width: 1.15rem;
    height: 1.15rem;
  }
}
