/* ProductDetails.cshtml: gallery + thumbnails + lightbox, stone tables,
   variant selection (sub-product "set" choices, size/color), pricing blocks,
   tabs, comments, customization modal, related/visited product rows. */

.product-detail__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding-block: var(--space-md) var(--space-xl);
}
@media (min-width: 1024px) {
  .product-detail__layout {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }
}

.products-breadcrumb { padding-block: var(--space-sm); }
.products-breadcrumb__list {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: var(--space-3xs);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.products-breadcrumb__list > li {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.products-breadcrumb__list > li:not(:last-child)::after {
  content: "/";
  margin-inline-start: var(--space-3xs);
  color: var(--color-border);
}
.products-breadcrumb__list a { color: var(--color-text-muted); }
.products-breadcrumb__list a:hover { color: var(--color-gold-text); }

/* Gallery column */
.product-gallery-column {
  position: relative;
}
.product-detail__actions {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}
.product-detail__actions .product-card__action {
  background: var(--color-surface);
}

.product-gallery {
  aspect-ratio: 1 / 1;
  background: var(--color-bg-raised);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.product-gallery .carousel__track {
  height: 100%;
}
.product-gallery .carousel__slide {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}
.product-gallery .carousel__slide img,
.product-gallery .carousel__slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-gallery__slide--zoomable {
  cursor: zoom-in;
}

.product-gallery__thumbs {
  display: flex;
  gap: var(--space-2xs);
  margin-block-start: var(--space-sm);
  overflow-x: auto;
}
.product-gallery__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--color-bg-raised);
}
.product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-gallery__thumb.is-active {
  border-color: var(--color-gold);
}

dialog.lightbox {
  border: 0;
  padding: 0;
  background: rgba(10, 8, 5, 0.96);
  width: 96vw;
  height: 94vh;
  max-width: 1400px;
  max-height: 94vh;
  overflow: hidden;
}
dialog.lightbox::backdrop {
  background: rgba(10, 8, 5, 0.9);
}
.lightbox__content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-lg) clamp(52px, 6vw, 88px);
  overflow: auto;
}
.lightbox__content img,
.lightbox__content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
.lightbox__content video { cursor: default; }
.lightbox__content.is-zoomed {
  display: block;
}
.lightbox__content.is-zoomed img {
  display: block;
  width: 200%;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  cursor: zoom-out;
}
.lightbox__close {
  position: fixed;
  top: var(--space-sm);
  inset-inline-end: var(--space-sm);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: var(--fs-xl);
  line-height: 1;
  z-index: 1;
}
.lightbox__zoom {
  position: absolute;
  inset-block-start: var(--space-sm);
  inset-inline-start: var(--space-sm);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.lightbox__zoom svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}
.lightbox__zoom:disabled {
  display: none;
}
.lightbox__nav {
  position: absolute;
  inset-block-start: 50%;
  z-index: 2;
  width: 46px;
  height: 56px;
  transform: translateY(-50%);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 38px;
  line-height: 1;
}
.lightbox__nav--prev { inset-inline-start: var(--space-sm); }
.lightbox__nav--next { inset-inline-end: var(--space-sm); }
.lightbox__nav:hover,
.lightbox__zoom:hover,
.lightbox__close:hover { background: rgba(255, 255, 255, 0.24); }
@media (max-width: 639px) {
  .lightbox__content { padding-inline: 44px; }
  .lightbox__nav { width: 38px; height: 48px; }
  .lightbox__nav--prev { inset-inline-start: var(--space-3xs); }
  .lightbox__nav--next { inset-inline-end: var(--space-3xs); }
}

/* Standalone ProductDetails gallery (independent from carousel.css). */
.pd-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-bg-raised);
}
.pd-gallery__stage,
.pd-gallery__slide {
  width: 100%;
  height: 100%;
}
.pd-gallery__stage { position: relative; }
.pd-gallery__slide {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.pd-gallery__slide.is-active { display: flex; }
.pd-gallery__slide[hidden] { display: none !important; }
.pd-gallery__slide.is-entering-next {
  z-index: 2;
  animation: pd-slide-in-next 300ms cubic-bezier(.22, .61, .36, 1) both;
}
.pd-gallery__slide.is-entering-prev {
  z-index: 2;
  animation: pd-slide-in-prev 300ms cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes pd-slide-in-next {
  from { opacity: 0; transform: translateX(8%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pd-slide-in-prev {
  from { opacity: 0; transform: translateX(-8%); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .pd-gallery__slide.is-entering-next,
  .pd-gallery__slide.is-entering-prev,
  .pd-lightbox__canvas.is-entering-next,
  .pd-lightbox__canvas.is-entering-prev { animation-duration: 1ms; }
}
.pd-gallery__slide img,
.pd-gallery__slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pd-gallery__play {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding-inline-start: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  font-size: 24px;
}
.pd-gallery__nav,
.pd-lightbox__nav {
  position: absolute;
  inset-block-start: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 54px;
  transform: translateY(-50%);
  border-radius: var(--radius-sm);
  color: #fff;
  background: rgba(0, 0, 0, 0.38);
  font-size: 36px;
  line-height: 1;
}
.pd-gallery__nav--prev,
.pd-lightbox__nav--prev { inset-inline-start: var(--space-xs); }
.pd-gallery__nav--next,
.pd-lightbox__nav--next { inset-inline-end: var(--space-xs); }
.pd-gallery__nav:hover,
.pd-lightbox__nav:hover { background: rgba(0, 0, 0, 0.62); }
.pd-lightbox__nav[hidden] { display: none !important; }

/* Main gallery controls appear only while the large image is being explored. */
.pd-gallery__nav {
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--color-gold) 35%, transparent);
  border-radius: 50%;
  color: var(--color-gold);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.86);
  backdrop-filter: blur(5px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}
.pd-gallery:hover .pd-gallery__nav,
.pd-gallery:focus-within .pd-gallery__nav {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
.pd-gallery .pd-gallery__nav:hover {
  color: var(--color-gold);
  background: rgba(255, 255, 255, 0.9);
}

dialog.pd-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: #fff;
  background: rgba(8, 8, 8, 0.98);
}
dialog.pd-lightbox::backdrop { background: rgba(0, 0, 0, 0.9); }
.pd-lightbox__viewport {
  position: absolute;
  inset: 60px 56px 60px;
  overflow: hidden;
  contain: layout paint;
  touch-action: none;
  cursor: default;
}
.pd-lightbox__viewport.is-zoomed { cursor: grab; }
.pd-lightbox__viewport.is-dragging { cursor: grabbing; }
.pd-lightbox__canvas {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}
.pd-lightbox__canvas.is-entering-next {
  animation: pd-lightbox-in-next 300ms cubic-bezier(.22, .61, .36, 1) both;
}
.pd-lightbox__canvas.is-entering-prev {
  animation: pd-lightbox-in-prev 300ms cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes pd-lightbox-in-next {
  from { opacity: 0; transform: translateX(5%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pd-lightbox-in-prev {
  from { opacity: 0; transform: translateX(-5%); }
  to { opacity: 1; transform: translateX(0); }
}
.pd-lightbox__canvas img,
.pd-lightbox__canvas video {
  display: block;
  flex: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pd-lightbox__canvas img {
  transform-origin: center;
  transition: transform 120ms ease-out;
  user-select: none;
  will-change: transform;
}
.pd-lightbox__viewport.is-dragging img { transition: none; }
.pd-lightbox__toolbar {
  position: absolute;
  inset-block-start: var(--space-xs);
  inset-inline-start: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
  padding: 4px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
}
.pd-lightbox__toolbar button,
.pd-lightbox__close {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding-inline: 8px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: transparent;
}
.pd-lightbox__toolbar button:hover,
.pd-lightbox__close:hover { background: rgba(255, 255, 255, 0.15); }
.pd-lightbox__toolbar output {
  min-width: 54px;
  text-align: center;
  font-size: var(--fs-xs);
}
.pd-lightbox.is-video .pd-lightbox__toolbar { display: none; }
.pd-lightbox__close {
  position: absolute;
  inset-block-start: var(--space-xs);
  inset-inline-end: var(--space-xs);
  z-index: 7;
  font-size: 30px;
}
.pd-lightbox__caption {
  position: absolute;
  inset-block-end: var(--space-xs);
  inset-inline: 64px;
  margin: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sm);
}
@media (max-width: 639px) {
  .pd-lightbox__viewport { inset: 56px 40px 56px; }
  .pd-gallery__nav,
  .pd-lightbox__nav { width: 36px; height: 48px; }
  .pd-gallery__nav { height: 36px; }
  .pd-gallery__nav--prev,
  .pd-lightbox__nav--prev { inset-inline-start: 2px; }
  .pd-gallery__nav--next,
  .pd-lightbox__nav--next { inset-inline-end: 2px; }
  .pd-lightbox__toolbar { inset-inline-start: var(--space-xs); transform: none; }
  .pd-lightbox__toolbar output { display: none; }
}
@media (hover: none) {
  .pd-gallery__nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
}

.product-detail__ref {
  margin-block-start: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* Stone tables */
.product-stones {
  margin-block-start: var(--space-md);
}
.product-stones__group {
  margin-block-end: var(--space-sm);
}
.product-stones__title {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-block-end: var(--space-2xs);
}
.product-stones__table-wrap {
  overflow-x: auto;
}
.product-stones__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.product-stones__table th,
.product-stones__table td {
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--color-border);
  text-align: start;
}
.product-stones__table th {
  background: var(--color-bg-raised);
}

/* Info column */
.product-detail__title {
   font-family: var(--font-body);
  font-size: var(--fs-xl);
  margin-block: var(--space-xs) var(--space-2xs);
}
.product-detail__code {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.product-detail__summary {
  color: var(--color-text-muted);
  line-height: var(--lh-normal);
  margin-block: var(--space-sm);
}

.product-variants {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-block-start: var(--space-md);
}
.product-variants__field label {
  margin-block-end: var(--space-2xs);
}

.variant-select-with-guide {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.variant-select-with-guide .form-field {
  flex: 1 1 auto;
  min-width: 0;
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}
.variant-guide-link {
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: -1px;
  border: 1px solid var(--color-border);
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  color: var(--color-gold-text);
  background: var(--color-surface);
  font-family: Georgia, serif;
  font-size: var(--fs-base);
  font-weight: 700;
  font-style: italic;
  text-decoration: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}
.variant-guide-link span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 50%;
  line-height: 1;
}
.variant-guide-link:hover,
.variant-guide-link:focus-visible {
  border-color: var(--color-gold);
  background: var(--color-bg-raised);
  color: var(--color-gold);
}

.item-choices {
  display: flex;
  flex-flow: row wrap;
  align-items: flex-start;
  gap: var(--space-xs);
}
.item-choice-wrapper {
  flex: 0 1 auto;
  min-width: 95px;
}
.item-choice-wrapper.active {
  background: transparent;
}
.choice-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: calc(var(--space-xs) * .85) calc(var(--space-md) * .85);
  margin-block-end: 0;
  border: 1px dashed var(--color-gold);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-gold) 10%, var(--color-surface));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: calc(var(--fs-md) * .85);
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.choice-label:hover {
  border-style: solid;
  background: color-mix(in srgb, var(--color-gold) 18%, var(--color-surface));
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1);
}
.item-choice-wrapper.active .choice-label {
  border-style: solid;
  border-color: var(--color-gold);
  background: var(--color-gold);
  color: #fff;
  box-shadow: 0 5px 16px color-mix(in srgb, var(--color-gold) 30%, transparent);
}
.item-choice-wrapper.active .choice-label::before {
  content: "✓";
  margin-inline-end: var(--space-2xs);
  font-size: var(--fs-sm);
}
.choice-label .item-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.choice-label:has(.item-checkbox:focus-visible) {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}
.attr-size {
  display: none;
  padding-block-start: var(--space-2xs);
}
.attr-size.show {
  display: block;
}
.attr-size select {
  width: 100%;
}
.attr-size .variant-select-with-guide {
  max-width: 264px;
}

.product-variants__message {
  font-size: var(--fs-sm);
  color: var(--color-warning);
  min-height: 1.2em;
}

.price-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding: var(--space-sm);
  background: var(--color-bg-raised);
  border-radius: var(--radius-md);
}
.price-block[hidden] { display: none !important; }
.price-block--dependent {
  margin-block-start: var(--space-2xs);
}
.price-block__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.price-block__price {
  font-family: var(--font-body);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--color-gold-text);
}
.price-block [data-price-normal] {
  display: inline;
}
.price-block.has-discount [data-price-normal] {
  text-decoration: line-through;
  color: var(--color-text-muted);
  font-size: var(--fs-base);
  font-weight: 400;
}
.price-block [data-price-discounted] {
  display: none;
  color: var(--color-danger);
}
.price-block.has-discount [data-price-discounted] {
  display: inline;
}

.product-variants__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.product-variants__cta .btn {
  flex: 1 1 200px;
}

.product-detail__links {
  margin-block-start: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.product-detail__link-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}
.product-detail__link-label {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.product-detail__link-tag {
  font-size: var(--fs-xs);
  padding: var(--space-3xs) var(--space-2xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-round);
  color: var(--color-text);
}
.product-detail__link-tag:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-text);
}

/* Share dialog */
.share-links {
  display: flex;
  gap: var(--space-2xs);
  justify-content: center;
  padding-block: var(--space-sm);
}
.share-links__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.share-links__item:hover {
  border-color: var(--color-gold);
  color: var(--color-gold-text);
}

/* Customization modal */
dialog.modal--wide {
  max-width: min(560px, 92vw);
}
.customization-form__field {
  margin-block-end: var(--space-sm);
}
.customization-form__file-name {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* Tabs */
.detail-tabs {
  margin-block-start: var(--space-xl);
}
.detail-tabs__list {
  display: flex;
  gap: var(--space-md);
  border-block-end: 1px solid var(--color-border);
  list-style: none;
  padding: 0;
  overflow-x: auto;
}
.detail-tabs__tab {
  padding-block: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  border-block-end: 2px solid transparent;
  margin-block-end: -1px;
}
.detail-tabs__tab.active {
  color: var(--color-text);
  border-block-end-color: var(--color-gold);
}
.detail-tabs__panel {
  display: none;
  padding-block: var(--space-md);
}
.detail-tabs__panel.active {
  display: block;
}
.detail-tabs__panel :is(h1, h2, h3, h4) {
  font-size: var(--fs-md);
  margin-block: var(--space-sm) var(--space-2xs);
}

.service-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  justify-content: center;
  padding-block: var(--space-md);
  border-block: 1px solid var(--color-border);
}
.service-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.service-list__item img {
  width: 28px;
  height: 28px;
}

/* Comments */
.comment-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.comment {
  display: flex;
  gap: var(--space-sm);
}
.comment__avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
}
.comment__header {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-block-end: var(--space-3xs);
}
.comment__header strong {
  color: var(--color-text);
}
.comment__replies {
  list-style: none;
  padding: 0;
  margin-block-start: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.comment-form {
  margin-block-start: var(--space-lg);
  max-width: 640px;
}
.comment-form__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}
@media (min-width: 640px) {
  .comment-form__row { grid-template-columns: 1fr 1fr; }
}

/* Related / visited */
.related-products {
  margin-block: var(--space-xl);
}
.related-products .carousel__slide {
  flex-basis: 50%;
}
@media (min-width: 640px) {
  .related-products .carousel__slide { flex-basis: 33.33%; }
}
@media (min-width: 1024px) {
  .related-products .carousel__slide { flex-basis: 25%; }
}
