body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: linear-gradient(to bottom right, #0f2027, #203a43, #2c5364);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 20px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  width: 90%;
  max-width: 1000px;
  margin: 30px auto;
}

.card {
  background: #ffffff;
  color: #333;
  border-radius: 12px;
  overflow: hidden;
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.3s;
}

.card:hover {
  transform: scale(1.03);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 350px;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.card-front img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: opacity 0.8s ease-in-out; /* ✨ Smooth fade transition */
}

.card-front h2 {
  margin: 10px 0;
}

.card-back {
  background: #1a1a1a;
  color: white;
  transform: rotateY(180deg);
  padding: 20px;
  box-sizing: border-box;
}

footer {
  text-align: center;
  font-size: 0.9em;
  margin: 20px 0;
  color: #bbb;
}

@media (max-width: 600px) {
  .card-inner {
    height: 300px;
  }

  .card-front img {
    height: 180px;
  }
}
