.images {
  padding: 2rem 0;
  background-color: #fff;
}

.images__container {
  max-width: 1280px;
  width: 90%;
  margin: 0 auto;
  box-sizing: border-box;
}

.images__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 2px; /* smaller base row height reduces visible rounding gaps */
  grid-auto-flow: dense; /* fill gaps under shorter items */
  gap: 24px;
}

.images__item--hidden {
  display: none;
}

.images__image-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  overflow: visible; /* avoid clipping */
  display: flex; /* center contained image nicely */
  align-items: center;
  justify-content: center;
}

.images__image {
  display: block;
  width: 100%;
  height: auto; /* intrinsic aspect ratio preserved */
  object-fit: unset; /* no cropping */
  transition: transform 0.3s ease;
}

.images__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.images__item:hover .images__overlay {
  opacity: 1;
}

.images__overlay-content {
  color: white;
  text-align: center;
}

.images__view-icon {
  font-size: 24px;
  font-weight: bold;
  color: white;
}

/* View more button */
.images__view-more {
  text-align: center;
  margin-top: 30px;
}

.images__view-more-btn {
  background: #000;
  border: none;
  padding: 8px 12px;
  color: #fff;
  font-family: Helvetica;
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
  border-radius: 30px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.images__view-more-btn:hover {
  background: #fff;
  color: #000;
  transform: translateY(-2px);
}

.images__count {
  font-size: 14px;
  opacity: 0.8;
}

/* Lightbox styles */
.images__lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.images__lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.images__lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.images__lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.images__lightbox-image-container {
  position: relative;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.images__lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.images__lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  padding: 10px;
  transition: opacity 0.3s ease;
}

.images__lightbox-close:hover {
  opacity: 0.7;
}

.images__lightbox-prev,
.images__lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 15px 10px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.images__lightbox-prev {
  left: -60px;
}

.images__lightbox-next {
  right: -60px;
}

.images__lightbox-prev:hover,
.images__lightbox-next:hover {
  background: rgba(0, 0, 0, 0.8);
}

.images__lightbox-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: "Helvetica Neue", sans-serif;
  font-size: 16px;
}

/* Empty state */
.images__empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-family: "Helvetica Neue", sans-serif;
}

/* Responsive styles */
@media (max-width: 1200px) {
  .images__grid {
    grid-auto-rows: 2px;
  }

  .images__lightbox-prev {
    left: -50px;
  }

  .images__lightbox-next {
    right: -50px;
  }
}

@media (max-width: 768px) {
  .images {
    padding: 1.5rem 0;
  }

  .images__container {
    width: 95%;
  }

  /* Mobile: Display images one after another without grid */
  .images__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
    height: auto;
  }

  /* Reset grid layout for mobile */
  .images__item {
    grid-column: unset;
    grid-row: unset;
  }

  .images__item {
    position: relative;
    overflow: visible;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 100%;
    height: auto;
  }

  .images__item:hover {
    transform: none;
  }

  .images__image-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .images__image {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
    /* Preserve custom positioning on mobile */
  }

  .images__item:hover .images__image {
    transform: none;
  }

  .images__view-more-btn {
    padding: 12px 24px;
    font-size: 15px;
  }

  .images__lightbox-prev,
  .images__lightbox-next {
    padding: 10px 8px;
    font-size: 20px;
  }

  .images__lightbox-prev {
    left: -40px;
  }

  .images__lightbox-next {
    right: -40px;
  }
}

@media (max-width: 480px) {
  .images {
    padding: 1rem 0;
  }

  .images__container {
    width: 100%;
    padding: 0 15px;
  }

  /* Mobile: Display images one after another without grid */
  .images__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
  }

  /* Reset grid layout for mobile */
  .images__item {
    grid-column: unset;
    grid-row: unset;
  }

  .images__item {
    position: relative;
    overflow: visible;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 100%;
    height: auto;
  }

  .images__item:hover {
    transform: none;
  }

  .images__image-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .images__image {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
    /* Preserve custom positioning on mobile */
  }

  .images__item:hover .images__image {
    transform: none;
  }

  .images__view-more-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .images__view-icon {
    font-size: 20px;
  }

  .images__lightbox-prev,
  .images__lightbox-next {
    padding: 8px 6px;
    font-size: 18px;
  }

  .images__lightbox-prev {
    left: -30px;
  }

  .images__lightbox-next {
    right: -30px;
  }

  .images__lightbox-close {
    top: -40px;
    font-size: 28px;
  }
}
