* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #fff;
  font-family: sans-serif;
}

.grid {
  display: grid;
  align-items: center;
  justify-items: center;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  margin-top: 30px;
}

/* Image container */
.image-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.image-container:hover img {
  transform: scale(1.05);
}

/* Overlay text */
.overlay-text {
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;

  width: 100%;
  height: 60px;
  padding: 0 15px;

  position: absolute;
  top: 0;
  left: 0;

  background: white;
  color: black;
  font-size: 1.2rem;
  font-weight: bold;

  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;

  border-top: 2px solid black;
  border-bottom: 2px solid black;
}

.image-container:hover .overlay-text {
  opacity: 1;
  transform: scale(1);
}

/* Optional: spacing tweak */
.explanation h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: bold;

}
