/* ============================================================
   Atelier — Réalisations : galeries, carrousel, visionneuse
   ============================================================ */

.atl-galerie {
  margin: 0 auto 3.5em;
  max-width: 1180px;
  padding: 0 24px;
  position: relative;
  box-sizing: border-box;
}
.atl-item {
  display: block;
  line-height: 0;
  text-decoration: none !important;
  overflow: hidden;
  border-radius: 2px;
}
.atl-item img {
  width: 100%;
  height: auto;
  display: block;
  border: 0 !important;
  transition: transform .6s cubic-bezier(0.16, 1, 0.3, 1), opacity .3s ease;
}
.atl-item:hover img {
  transform: scale(1.025);
}

/* --- Grille ------------------------------------------------ */
.atl-ligne {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.atl-ligne:last-child {
  margin-bottom: 0;
}

/* Largeurs égales : la ligne prend la hauteur de la plus grande image. */
.atl-galerie--egale .atl-cellule {
  flex: 1 1 0;
  min-width: 0;
}

/* Remplissage : largeurs proportionnelles au format, hauteurs identiques. */
.atl-galerie--remplie .atl-cellule {
  flex: 0 0 auto;
  min-width: 0;
}

/* --- Carrousel --------------------------------------------- */
.atl-galerie--carrousel {
  --atl-gap: 16px;
  --atl-cols: 3;
  position: relative;
  max-width: 1180px;
  margin: 0 auto 3.5em;
  padding: 0 24px;
  overflow: hidden;
  box-sizing: border-box;
}
.atl-piste {
  display: flex;
  gap: var(--atl-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline-start: 0;
  overscroll-behavior-x: contain;
  padding: 4px 0 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.atl-piste.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto !important;
}
.atl-piste::-webkit-scrollbar {
  display: none;
}

/* Cellules du carrousel dimensionnées selon le nombre de colonnes */
.atl-galerie--carrousel .atl-cellule {
  flex: 0 0 calc((100% - (var(--atl-cols, 3) - 1) * var(--atl-gap)) / var(--atl-cols, 3));
  width: calc((100% - (var(--atl-cols, 3) - 1) * var(--atl-gap)) / var(--atl-cols, 3));
  scroll-snap-align: start;
  height: clamp(280px, 45vh, 480px);
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 3px;
}

/* Variantes spécifiques selon le nombre de colonnes choisi */
.atl-galerie--carrousel.atl-galerie--cols1 .atl-cellule {
  flex: 0 0 100%;
  width: 100%;
  height: clamp(360px, 58vh, 620px);
}
.atl-galerie--carrousel.atl-galerie--cols2 .atl-cellule {
  flex: 0 0 calc((100% - var(--atl-gap)) / 2);
  width: calc((100% - var(--atl-gap)) / 2);
  height: clamp(320px, 50vh, 540px);
}
.atl-galerie--carrousel.atl-galerie--cols3 .atl-cellule {
  flex: 0 0 calc((100% - 2 * var(--atl-gap)) / 3);
  width: calc((100% - 2 * var(--atl-gap)) / 3);
  height: clamp(280px, 44vh, 460px);
}
.atl-galerie--carrousel.atl-galerie--cols4 .atl-cellule {
  flex: 0 0 calc((100% - 3 * var(--atl-gap)) / 4);
  width: calc((100% - 3 * var(--atl-gap)) / 4);
  height: clamp(230px, 36vh, 380px);
}
.atl-galerie--carrousel.atl-galerie--cols5 .atl-cellule {
  flex: 0 0 calc((100% - 4 * var(--atl-gap)) / 5);
  width: calc((100% - 4 * var(--atl-gap)) / 5);
  height: clamp(190px, 30vh, 320px);
}

.atl-galerie--carrousel .atl-item {
  height: 100%;
  width: 100%;
  display: block;
}
.atl-galerie--carrousel .atl-item img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  display: block;
}
.atl-galerie--carrousel .atl-item:hover img {
  transform: scale(1.02);
}

.atl-fleche {
  position: absolute;
  top: calc(50% - 14px);
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.atl-fleche:hover {
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%) scale(1.05);
}
.atl-fleche[disabled] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.9);
}
.atl-fleche--prec {
  left: 34px;
}
.atl-fleche--suiv {
  right: 34px;
}
.atl-fleche svg {
  width: 18px;
  height: 18px;
  stroke: #1a1a1a;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.atl-puces {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.atl-puce {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: all .25s ease;
}
.atl-puce:hover {
  background: rgba(0, 0, 0, 0.45);
}
.atl-puce[aria-current="true"] {
  background: #111;
  width: 24px;
  border-radius: 4px;
}

/* --- Visionneuse --- */
.atl-vis {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(14, 14, 14, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.atl-vis[data-ouverte="1"] {
  opacity: 1;
  visibility: visible;
}
.atl-vis__img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  display: block;
  box-shadow: 0 8px 50px rgba(0, 0, 0, 0.5);
}
.atl-vis__barre {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  letter-spacing: .08em;
}
.atl-vis__legende {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  padding: 0 24px;
}
.atl-vis button {
  background: none;
  border: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 10px;
  line-height: 0;
  transition: color .2s ease;
}
.atl-vis button:hover {
  color: #fff;
}
.atl-vis svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.atl-vis__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.atl-vis__nav--prec {
  left: 10px;
}
.atl-vis__nav--suiv {
  right: 10px;
}
.atl-vis__nav svg {
  width: 34px;
  height: 34px;
}
body.atl-vis-ouverte {
  overflow: hidden;
}

/* --- Mobile / Tablette --- */
@media (max-width: 980px) {
  .atl-galerie--carrousel {
    --atl-gap: 12px;
    padding: 0 16px;
  }
  .atl-galerie--carrousel.atl-galerie--cols3 .atl-cellule,
  .atl-galerie--carrousel.atl-galerie--cols4 .atl-cellule,
  .atl-galerie--carrousel.atl-galerie--cols5 .atl-cellule {
    flex: 0 0 calc((100% - 12px) / 2);
    width: calc((100% - 12px) / 2);
    height: clamp(260px, 42vh, 380px);
  }
  .atl-fleche--prec {
    left: 20px;
  }
  .atl-fleche--suiv {
    right: 20px;
  }
}

@media (max-width: 640px) {
  .atl-galerie {
    padding: 0;
    max-width: none;
    margin-bottom: 2em;
  }
  .atl-galerie--carrousel {
    padding: 0 12px;
  }
  .atl-ligne {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
  }
  .atl-galerie--grille .atl-cellule {
    width: 100% !important;
    flex: 0 0 auto;
  }
  .atl-item:hover img {
    transform: none;
  }
  .atl-galerie--carrousel .atl-cellule {
    flex: 0 0 calc(100vw - 44px) !important;
    width: calc(100vw - 44px) !important;
    height: clamp(240px, 40vh, 340px) !important;
  }
  .atl-piste {
    gap: 10px;
    padding: 0 4px 6px;
  }
  .atl-fleche {
    display: none;
  }
  .atl-vis__img {
    max-width: 100vw;
    max-height: 82vh;
  }
  .atl-vis__nav {
    display: none;
  }
}
