.fiches {
  display: flex;
  flex-wrap: wrap;
  gap: 2.4em 3%;
  justify-content: center;
  position: relative;
}

.eachFiche {
  flex: 0 0 100%;
  position: relative;
  overflow: auto; /* let Flip position absolutely while animating */
  will-change: transform;
}

.eachFiche.open {
  position: fixed; /* Flip animates from old position to this state */
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  overflow: auto;
  background: #fff; /* so it feels like an overlay */
  scrollbar-gutter: stable;
}

.fiche-placeholder {
  flex: 0 0 100%;
  visibility: hidden; /* keeps space, not visible */
  pointer-events: none;
  /* height is set inline from JS */
}
@media (min-width: 1000px) {
  .fiche-placeholder {
    flex: 0 0 30%;
  }
}

@supports (height: 100dvh) {
  .eachFiche.open {
    height: 100dvh;
  }
}

.eachFiche img {
  width: 100%;
  height: auto;
}

.eachFiche .innerContent {
  height: 0;
  overflow: hidden;
  background-color: #fafafa;
  padding: 0;
}

.eachFiche.open .innerContent {
  padding: 3em 20px;
  height: auto;
}

@media (min-width: 1000px) {
  .eachFiche.open .innerContent {
    padding: 3em 5em;
  }
}

.eachFiche .card {
  position: relative;
  height: 16em;
  overflow: hidden;
  transition: 0.3s all ease-in-out;
  cursor: pointer;
}

.eachFiche.open .card {
  height: 30em;
  cursor: auto;
}

.eachFiche .closeFiche {
  cursor: pointer;
  padding: 0 0.75em;
  background: #263640;
  width: 2.5em;
  color: #fff;
  border-radius: 50%;
  aspect-ratio: 1;
  display: grid;
  font-size: 1em;
  justify-items: center;
  align-items: center;
  text-decoration: none;
  transition: all 0.3s ease-in-out;
  border: none;
  position: fixed;
  right: 2em;
  top: 2em;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

.eachFiche.open .closeFiche {
  opacity: 1;
  pointer-events: all;
}

.eachFiche .closeFiche:hover {
  background: #68bbbf;
}

.eachFiche .card img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s all ease-in-out;
}

.eachFiche .card h3 {
  max-width: none;
  padding: 30px 26px;
  background: black;
  background: -webkit-linear-gradient(transparent, black);
  background: -o-linear-gradient(transparent, black);
  background: -moz-linear-gradient(transparent, black);
  background: linear-gradient(transparent, black);
  color: #fff;
  position: absolute;
  bottom: 0;
  left: 0;
  margin: 0;
  width: 100%;
  transition: 0.3s all ease-in-out;
}

.eachFiche .card:hover h3 {
  padding: 50px 26px;
}

.eachFiche.open .card h3 {
  padding: 30px 20px;
}

@media (min-width: 1000px) {
  .eachFiche.open .card h3 {
    padding: 50px 5rem;
  }
}

@media screen and (min-width: 1000px) {
  .eachFiche {
    flex: 0 0 30%;
  }
}

/* Prevent background scroll while a fiche is open */
.no-scroll {
  overflow: hidden;
}
