/* =========================
   Card Grid Layout
========================= */
#cards {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
  padding: 20px;
}

/* Tablet */
@media screen and (min-width: 600px) {
  #cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop */
@media screen and (min-width: 1200px) {
  #cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================
   Card Container
========================= */
#cards a {
  text-decoration: none;
  color: inherit;
}

article {
  perspective: 1000px;
}

/* =========================
   Flip Card
========================= */
figure {
  position: relative;
  width: 100%;
  height: 300px;
  margin: 0;

  transform-style: preserve-3d;
  transition: transform 0.6s;

  overflow: hidden;
  border-radius: 12px;
}


/* Back side */
figure figcaption {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
}
figure figcaption h3 {
  margin-bottom: 10px;
}
/* Flip on hover */
article:hover div{
  transform: rotateY(180deg);
}

/* =========================
   Images (Front & Back)
========================= */
figure img {

  width: 100%;
  height: 100%;
  object-fit: cover;
  top: 0;
  left: 0;
  backface-visibility: hidden;
}

/* Front image */
figure img:first-child {
  /* z-index: 2; */
}

/* Back image */
.top {
  transform: rotateY(180deg);
  position: absolute;
}

/* =========================
   Text Section
========================= */
#cards section {
  padding: 10px 5px;
}

#cards h3 {
  margin: 10px 0 0;
  font-size: 1.1rem;
}