/*
  PRODUCT PAGE STYLES
  =====================
*/

#product-page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

#product-page-main-media-wrapper {
  position: relative;
}

.product-page__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 44px;
  text-align: center;
  color: #372345;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.product-page__arrow:hover {
  background-color: #ffffff;
  transform: translateY(-50%) scale(1.08);
}

.product-page__arrow--prev {
  left: 16px;
}

.product-page__arrow--next {
  right: 16px;
}

.product-page__main-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.product-page__thumbnails {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.product-page__thumbnail {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
}

.product-page__thumbnail--video {
  background-color: #372345;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-page__thumbnail.is-active {
  border-color: #553d66;
  opacity: 1;
}

.product-page__info h1 {
  font-family: var(--font-primary);
  font-size: 2.9rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #372345;
  margin: 0 0 12px 0;
}

.product-page__price {
  font-family: var(--font-body);
  font-size: 1.55rem;
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 20px;
}

.product-page__price--sale {
  color: #372345;
  font-weight: bold;
}

.product-page__price--compare {
  text-decoration: line-through;
  opacity: 0.5;
  font-size: 1.15rem;
}

.product-page__purchase-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.product-page__quantity {
  display: flex;
  align-items: center;
  border: 1px solid #d8c5d4;
  border-radius: 999px;
  overflow: hidden;
}

.product-page__quantity button {
  background: none;
  border: none;
  width: 36px;
  height: 44px;
  font-size: 1.25rem;
  cursor: pointer;
  color: #372345;
}

.product-page__quantity span {
  width: 28px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.1rem;
}

.product-page__description {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: #372345;
  line-height: 1.7;
  white-space: pre-line; /* respects line breaks typed in the Sanity text field */
  margin-bottom: 24px;
}

.product-page__buy-button {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: bold;
  font-size: 1.3rem;
  text-decoration: none;
  padding: 15px 44px;
  background-color: #372345;
  color: #ffffff;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-page__buy-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(55, 35, 69, 0.3);
}

.product-page__buy-unavailable {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: #372345;
  opacity: 0.7;
  font-style: italic;
}

@media (max-width: 749px) {
  #product-page-content {
    grid-template-columns: 1fr;
    padding: 32px 20px;
    gap: 24px;
  }
}


/* ===== CLICK-TO-ENLARGE: button + cursor on the main photo ===== */
.product-page__gallery {
  position: relative; /* anchors the enlarge button to the photo area */
}

img.product-page__main-image {
  cursor: zoom-in;
}

.product-page__enlarge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.92);
  color: #372345;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(55, 35, 69, 0.2);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.product-page__enlarge:hover {
  background-color: #ffffff;
  transform: scale(1.08);
}

/* ===== FOCUSED PHOTO VIEWER ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  background-color: #17101d; /* solid, so nothing from the page behind shows through */
}

.lightbox[hidden] {
  display: none;
}

.lightbox__stage {
  position: relative; /* lets the zoom code measure the photo against this box */
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 64px 88px;
  box-sizing: border-box;
  touch-action: none; /* this viewer handles swipes/pans itself */
}

.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.25s ease;
}

.lightbox.is-zoomed .lightbox__img {
  cursor: zoom-out;
}

.lightbox__video {
  max-width: 100%;
  max-height: 100%;
}

/* Small spinner shown while a photo that isn't downloaded yet is loading. */
.lightbox__stage.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #e6bc5c;
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}

.lightbox__counter {
  position: absolute;
  top: 26px;
  left: 28px;
  z-index: 2;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: #ffffff;
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.lightbox__toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.lightbox__btn,
.lightbox__nav {
  border: none;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.lightbox__btn {
  width: 46px;
  height: 46px;
}

.lightbox__btn:hover:not(:disabled),
.lightbox__nav:hover {
  background-color: rgba(255, 255, 255, 0.28);
}

.lightbox__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.lightbox__btn:focus-visible,
.lightbox__nav:focus-visible {
  outline: 2px solid #e6bc5c;
  outline-offset: 2px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 54px;
  height: 54px;
  font-size: 2rem;
  line-height: 1;
  padding-bottom: 4px; /* the arrow glyph sits a touch low otherwise */
}

.lightbox__nav[hidden] {
  display: none;
}

.lightbox__nav--prev {
  left: 20px;
}

.lightbox__nav--next {
  right: 20px;
}

/* One icon at a time: magnifier-plus normally, magnifier-minus while zoomed. */
.lightbox__icon-zoom-out {
  display: none;
}

.lightbox.is-zoomed .lightbox__icon-zoom-in {
  display: none;
}

.lightbox.is-zoomed .lightbox__icon-zoom-out {
  display: block;
}

@media (max-width: 749px) {
  .lightbox__stage {
    padding: 68px 12px 56px;
  }

  .lightbox__nav {
    width: 44px;
    height: 44px;
    font-size: 1.7rem;
  }

  .lightbox__nav--prev {
    left: 8px;
  }

  .lightbox__nav--next {
    right: 8px;
  }

  .lightbox__counter {
    top: 24px;
    left: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__img {
    transition: none;
  }

  .lightbox__stage.is-loading::after {
    animation: none;
  }
}
