.instagram-gallery {
  padding: 10px 5%;
  text-align: center;
  background: #f8f9fa;
}

.instagram-gallery h2 {
  font-size: 2rem;
  margin-bottom: 30px;
  font-weight: 700;
  color: #222;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Grid Layout */
.insta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
  justify-content: center;
  align-items: center;
}

/* Fixed-Size Box */
.insta-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* Keeps perfect square */
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.insta-item a {
  display: block;
  width: 100%;
  height: 100%;
}

.insta-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Crops to fill the box */
  transition: transform 0.4s ease;
}

/* Hover effects */
.insta-item:hover img {
  transform: scale(1.08);
}
.insta-item:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* ========== Responsive Breakpoints ========== */

/* Large screens */
@media (min-width: 1200px) {
  .insta-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Medium screens (tablets, small laptops) */
@media (min-width: 768px) and (max-width: 1199px) {
  .insta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Small screens (phones in landscape or large phones) */
@media (min-width: 480px) and (max-width: 767px) {
  .insta-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .instagram-gallery {
    padding: 40px 20px;
  }

  .instagram-gallery h2 {
    font-size: 1.6rem;
  }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 479px) {
  .insta-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .insta-item {
    border-radius: 10px;
  }

  .instagram-gallery h2 {
    font-size: 1.4rem;
  }

  .instagram-gallery {
    padding: 30px 15px;
  }
}

/* Optional smooth fade-in */
.insta-item img {
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}
