/* ===== Image Slider Section ===== */
.section-image-slider {
  width: 100%;
  padding: 100px 20px;
  box-sizing: border-box;
  color: #1f2937;
}

.image-slider-container {
  width: 100%;
  margin: 0 auto;
}

.image-slider-title {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  margin: 0 0 60px 0;
  line-height: 1.2;
  text-align: center;
  color: #1f2937;
}

.image-slider-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #2c5aa0 #f1f1f1;
  padding-bottom: 8px;
}

.image-slider-wrapper::-webkit-scrollbar {
  height: 8px;
}

.image-slider-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.image-slider-wrapper::-webkit-scrollbar-thumb {
  background: #2c5aa0;
  border-radius: 4px;
}

.image-slider-wrapper::-webkit-scrollbar-thumb:hover {
  background: #1e40af;
}

.image-slider-grid {
  display: flex;
  gap: 24px;
  width: 100%;
  min-width: 100%;
}

.image-slider-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  width: calc((100% - (var(--items-per-row-pc, 3) - 1) * 24px) / var(--items-per-row-pc, 3));
  min-width: calc((100% - (var(--items-per-row-pc, 3) - 1) * 24px) / var(--items-per-row-pc, 3));
}

/* 높이가 설정된 경우 높이 기준으로 크기 조정 */
.image-slider-wrapper.has-custom-height-pc .image-slider-item {
  height: var(--item-height-pc, auto);
}

@media (max-width: 768px) {
  .image-slider-wrapper.has-custom-height-mobile .image-slider-item {
    height: var(--item-height-mobile, auto);
  }
}

.image-slider-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.image-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* fill-thumbnail 클래스가 없을 때 (체크 해제 시) contain 사용 */
.image-slider-wrapper:not(.fill-thumbnail) .image-thumbnail {
  object-fit: contain;
}

/* fill-thumbnail 클래스가 있을 때 (체크됨) cover 사용 - 높이 설정 여부와 관계없이 */
.image-slider-wrapper.fill-thumbnail .image-thumbnail {
  object-fit: cover;
}

/* 높이가 설정된 경우 썸네일은 높이 기준으로 크기 유지 */
.image-slider-wrapper.has-custom-height-pc .image-slider-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* fill-thumbnail 클래스가 없을 때만 contain 사용 */
.image-slider-wrapper.has-custom-height-pc:not(.fill-thumbnail) .image-thumbnail {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

/* fill-thumbnail 클래스가 있을 때는 cover 사용 */
.image-slider-wrapper.has-custom-height-pc.fill-thumbnail .image-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .image-slider-wrapper.has-custom-height-mobile .image-slider-item {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* fill-thumbnail 클래스가 없을 때만 contain 사용 */
  .image-slider-wrapper.has-custom-height-mobile:not(.fill-thumbnail) .image-thumbnail {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* fill-thumbnail 클래스가 있을 때는 cover 사용 */
  .image-slider-wrapper.has-custom-height-mobile.fill-thumbnail .image-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.image-item-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

/* 이미지 모달 스타일 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.image-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.image-modal-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  z-index: 10001;
  background-color: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.image-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  transition: all 0.3s ease;
}

.image-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.image-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.image-modal-nav:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.image-modal-nav:disabled {
  cursor: not-allowed;
}

.image-modal-prev {
  left: 16px;
}

.image-modal-next {
  right: 16px;
}

.image-modal-viewer {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.image-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.image-modal-title {
  padding: 16px 20px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 768px) {
  .section-image-slider {
    padding: 80px 20px;
  }

  .image-slider-title {
    font-size: clamp(28px, 6vw, 36px);
    margin-bottom: 48px;
  }

  .image-slider-grid {
    gap: 16px;
  }

  .image-slider-item {
    width: calc((100% - (var(--items-per-row-mobile, 2) - 1) * 16px) / var(--items-per-row-mobile, 2));
    min-width: calc((100% - (var(--items-per-row-mobile, 2) - 1) * 16px) / var(--items-per-row-mobile, 2));
  }

  .image-modal-content {
    max-height: 80vh;
    border-radius: 8px;
  }

  .image-modal-close {
    width: 36px;
    height: 36px;
    top: 12px;
    right: 12px;
  }

  .image-modal-nav {
    width: 40px;
    height: 40px;
  }

  .image-modal-prev {
    left: 8px;
  }

  .image-modal-next {
    right: 8px;
  }
}

