.detail-gallery {
  margin: 1rem auto 3rem;
  color: #1c1917;
  font-family: "Lora", Georgia, serif;
}

.detail-gallery__intro {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.detail-gallery__heading {
  font-size: 1.75rem;
  margin: 0;
}

.detail-gallery__subheading {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.detail-gallery__grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.detail-gallery__thumb {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  border: 1px solid rgba(120, 113, 108, 0.3);
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.detail-gallery__thumb:focus-visible {
  outline: 2px solid rgba(87, 83, 78, 0.6);
  outline-offset: 3px;
}

.detail-gallery__thumb img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.detail-gallery__thumb:hover img,
.detail-gallery__thumb:focus-visible img {
  transform: scale(1.05);
}

.detail-gallery__thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 10, 9, 0) 30%, rgba(12, 10, 9, 0.45) 100%);
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.detail-gallery__thumb:hover .detail-gallery__thumb-overlay,
.detail-gallery__thumb:focus-visible .detail-gallery__thumb-overlay {
  opacity: 1;
}

.detail-gallery__modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.detail-gallery__modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-gallery__modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.8);
}

.detail-gallery__modal-dialog {
  position: relative;
  z-index: 1;
  width: min(90vw, 960px);
  max-height: 90vh;
  background: #fff;
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 40px 90px rgba(12, 10, 9, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detail-gallery__modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 113, 108, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #44403c;
  cursor: pointer;
  transition: background 0.25s ease;
}

.detail-gallery__modal-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.detail-gallery__modal-close:hover,
.detail-gallery__modal-close:focus-visible {
  background: #fff;
  outline: none;
}

.detail-gallery__modal-stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-gallery__modal-image {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 1.25rem;
  background: #f5f5f4;
}

.detail-gallery__modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 113, 108, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #44403c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease;
}

.detail-gallery__modal-nav svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.detail-gallery__modal-nav:hover,
.detail-gallery__modal-nav:focus-visible {
  background: #fff;
  outline: none;
}

.detail-gallery__modal-nav--prev {
  left: 1rem;
}

.detail-gallery__modal-nav--next {
  right: 1rem;
}

.detail-gallery__modal-caption {
  margin: 1.25rem 0 0 0;
  text-align: center;
  color: #57534e;
  font-size: 0.9rem;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.detail-gallery__modal-thumbs {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.detail-gallery__modal-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 0.9rem;
  border: 1px solid rgba(120, 113, 108, 0.3);
  overflow: hidden;
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.detail-gallery__modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-gallery__modal-thumb[aria-current="true"] {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.25);
}

.detail-gallery__modal-thumb:focus-visible {
  outline: 2px solid rgba(87, 83, 78, 0.6);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .detail-gallery__intro {
    text-align: center;
  }

  .detail-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .detail-gallery__thumb img {
    height: 180px;
  }

  .detail-gallery__modal-dialog {
    padding: 1.5rem;
    width: min(94vw, 720px);
  }

  .detail-gallery__modal-nav--prev {
    left: 0.5rem;
  }

  .detail-gallery__modal-nav--next {
    right: 0.5rem;
  }
}
