.detail-page {
  overflow: hidden;
}
.detail-hero {
  height: 798px;
  background: #222;
}
.detail-hero img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
}
.detail-page__container {
  width: min(100% - 40px, 1120px);
}
.detail-title {
  max-width: 700px;
  font-size: 32px;
  line-height: 40px;
}
.detail-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin: 80px 0;
  padding: 24px 0;
}

.detail-gallery img {
  width: 100%;
  height: 200px;
  aspect-ratio: 1.25;
  object-fit: cover;
  border-radius: 12px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 80px 0;
  padding: 24px 0;
  color: var(--blaze-color-black);
}

.detail-content {
  text-align: justify;
  font-size: 16px;
  line-height: 24px;
}
.detail-content > *:first-child {
  margin-top: 0;
}
.detail-content img {
  max-width: 100%;
  height: auto;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.detail-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  width: 51px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2ded5;
  font-size: 8px;
  border-radius: 4px;
}
@media (max-width: 700px) {
  .detail-page__container {
    width: min(100% - 30px, 480px);
  }
  .detail-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 28px 0;
  }
  .detail-tags {
    gap: 8px;
    margin-top: 28px;
  }
}

@media (max-width: 480px) {
  .detail-hero {
    height: 316px;
  }
  .detail-gallery {
    margin: 16px 0;
    padding: 16px 0;
    min-height: 135px;
    min-width: 288px;
    gap: 16px;
  }
  .detail-gallery img {
    height: 100%;
  }

  .detail-gallery > :nth-last-child(-n + 2) {
    display: none;
  }
  .detail-section {
    margin: 16px 0;
    padding: 16px 0;
    gap: 16px;
  }

  .detail-title {
    margin-top: 16px;
    font-size: 20px;
    font-weight: 600;
  }

  .detail-content {
    font-size: 14px;
    line-height: 18px;
  }

  .detail-tags {
    margin-top: 0;
  }
}

/* --- GALLERY MODAL CSS --- */
.gallery-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(8px); /* Blur dark gray overlay */
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.gallery-modal-overlay.active {
  opacity: 1;
}

.gallery-modal-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 90vh; /* Big enough to place the image */
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Ensures the whole image is visible */
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

/* Navigation Buttons */
.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}
.modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}
.modal-nav-btn svg {
  width: 24px;
  height: 24px;
}
.modal-prev {
  left: 20px;
}
.modal-next {
  right: 20px;
}

/* Close Button */
.modal-close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s;
}
.modal-close-btn:hover {
  transform: rotate(90deg);
}

/* Make gallery items clickable */
.gallery-item {
  cursor: pointer;
  transition: transform 0.2s;
}
.gallery-item:hover {
  transform: scale(1.02);
}

/* --- RESPONSIVE MODAL --- */
@media (max-width: 700px) {
  .gallery-modal-content {
    height: 80vh;
  }
  .modal-nav-btn {
    width: 40px;
    height: 40px;
  }
  .modal-prev {
    left: 5px;
  }
  .modal-next {
    right: 5px;
  }
  .modal-close-btn {
    top: -35px;
    font-size: 30px;
  }
}
