#clients {
  padding: 100px;
  margin-top: 100px;
}

/* .filters {
  display: flex;
  flex-wrap: wrap;
  text-align: left;
  align-items: flex-start;
  margin: 1rem 0 2rem;
  gap: 0.5rem;
  background: white;
  padding: 10px;
}

.filters button {
  padding: 0.5rem 1rem;
  border: none;
  background: white;
  cursor: pointer;
  border-radius: 5px;
  transition: 0.3s;
  flex: 1 1 120px;
}

.filters button.active,
.filters button:hover,
.filters button:focus {
  /* background: #333; */
  /* color: #3957eb;
  font-weight: 900;
  outline: none;
} */

.clients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: center;
  width: 100%;
  height: inherit;
}

.clients-grid img {
  width: 100%;
  height: 300px;
  object-fit: contain;
  padding: 20px;
  background: white;
  border-radius: 6px;
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* .project-section {
  margin-bottom: 2rem;
} */
#projects-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: flex-start;
}

.project-section {
  width: calc(33.33% - 16px); /* 5 in a row with gap */
  display: flex;
  background: white;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 0 20px;
  border-radius: 8px;
  height: 400px;
}

.gallery-img-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  /* border-radius: 8px; */
  cursor: pointer;
  align-content: center;
}

.gallery-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.more-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1; /* always visible */
  pointer-events: none; /* allows clicks to pass through */
}

.gallery-caption {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  text-align: center;
}

.client-button {
    -ms-flex-preferred-size: 0;
    flex-basis: 0;
    -ms-flex-positive: 1;
    flex-grow: 1;
    max-width: 100%;
    padding: 100px 0 0 0;
}

.image-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.image-modal.hidden {
  display: none;
}

.image-modal img {
  max-height: 80vh;
  max-width: 90vw;
  margin-bottom: 10px;
}

.modal-controls {
  color: white;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
}

.modal-controls span {
  margin: 0 20px;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 25px;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

#modalCounter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 20;
}

.gallery-img-wrapper {
  position: relative;
  display: inline-block;
  margin: 5px;
  cursor: pointer;
}

/* Let images retain their natural dimensions */
.gallery-img-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* Overlay for the 5th image */
/* .more-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
} */

.view-all-img:hover .more-overlay {
  background-color: rgba(0, 0, 0, 0.8);
}

/* ---------- fixed modal arrows ---------- */
#prevImage,#nextImage{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:42px;height:42px;
  border-radius:50%;
  background:rgba(0,0,0,.65);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:1001;
  user-select:none;
}
#prevImage{left:12px;}
#nextImage{right:12px;}


@media (max-width: 768px) {
  .clients-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .clients-grid img {
  width: 100%;
  height: 150px;
  padding: 10px;
}
.page-section#clients {
  padding: 50px;
}

 .gallery-img-wrapper {
    height: 200px;
  }

  .project-section {
    width: 100%;
    height: 280px;
  }

  #categoryFilters {
    justify-content: flex-start;
    overflow-x: auto;
  }

  #categoryFilters button {
    white-space: nowrap;
  }

  #imageModal img {
    max-width: 95vw;
    max-height: 70vh;
  }

  .modal-close,
  #prevImage,
  #nextImage {
    font-size: 1.5rem;
  }
}