.product-modal {
  --bs-modal-margin: clamp(0.5rem, 2.5dvh, 1.75rem);
  --product-ink: var(--roxo-profundo);
  --product-control: color-mix(in srgb, var(--product-ink) 87%, transparent);
  overflow: hidden;
  overscroll-behavior: contain;
}

.product-modal .modal-dialog {
  max-width: min(70rem, calc(100% - 2 * var(--bs-modal-margin)));
  min-height: calc(100dvh - 2 * var(--bs-modal-margin));
  margin-inline: auto;
}

.product-modal .modal-content {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  height: min(39rem, calc(100dvh - 2 * var(--bs-modal-margin)));
  overflow: hidden;
  border: 0;
  border-radius: 1.125rem;
  box-shadow: 0 24px 80px color-mix(in srgb, var(--product-ink) 40%, transparent);
}

.product-modal .product-gallery {
  min-height: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--lilas-claro) 22%, #fff) 30%, var(--lilas-claro) 100%);
}

.product-gallery .carousel-inner,
.product-gallery .carousel-item {
  height: 100%;
}

.product-modal .product-gallery .carousel-inner img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none !important;
  object-fit: contain;
}

.product-modal .product-close,
.product-modal .product-gallery :is(.carousel-control-prev, .carousel-control-next) {
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #ffffff88;
  border-radius: 50%;
  background-color: var(--product-control);
  opacity: 1;
}

.product-modal .product-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
}

.product-modal .product-close:hover,
.product-modal .product-gallery :is(.carousel-control-prev, .carousel-control-next):hover {
  background-color: var(--roxo-escuro);
  color: #fff;
}

.product-gallery :is(.carousel-control-prev-icon, .carousel-control-next-icon) {
  width: 1.15rem;
  height: 1.15rem;
}

.product-gallery-count {
  position: absolute;
  inset: auto auto 0.65rem 50%;
  transform: translateX(-50%);
  padding: 0.2rem 0.65rem;
  border-radius: 2rem;
  background: var(--product-control);
  color: #fff;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.product-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: clamp(0.875rem, 3dvh, 2rem);
  padding: clamp(1.25rem, 5dvh, 2.75rem) clamp(1.125rem, 3.4vw, 2.75rem);
  background: linear-gradient(145deg, var(--azul), var(--product-ink) 85%);
  color: #fff;
  overflow-wrap: anywhere;
}

.product-info {
  align-self: center;
  display: grid;
  gap: 0.875rem;
}

.product-info :is(p, h2, h3, dl, dd) {
  margin: 0;
}

.product-category {
  color: var(--lilas-claro);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-title {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.65rem, 3.1vw, 2.65rem);
  font-weight: 500;
  line-height: 1.13;
}

.product-copy {
  color: color-mix(in srgb, var(--lilas-claro) 64%, #fff);
  font-size: 0.94rem;
  line-height: 1.5;
  white-space: pre-line;
}

.product-highlights h3,
.product-specs dt {
  color: var(--lilas-claro);
  font-size: 0.72rem;
  font-weight: 600;
}

.product-highlights h3 {
  margin-bottom: 0.2rem;
}

.product-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid #ffffff40;
  font-size: 0.875rem;
  line-height: 1.35;
}

.product-specs > :only-child {
  grid-column: 1 / -1;
}

.product-actions {
  display: grid;
  grid-template-columns: minmax(max-content, 1.35fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.product-actions .btn {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  padding: 0.4rem clamp(0.45rem, 1.4vw, 0.9rem);
  border-radius: 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.product-actions .product-quote {
  background: color-mix(in srgb, var(--lilas-claro) 72%, #fff);
  color: var(--product-ink);
}

.product-actions .product-quote:hover {
  background: var(--lilas-claro);
  color: var(--product-ink);
}

.product-actions .product-whatsapp {
  border-color: #ffffff80;
  color: #fff;
}

.product-actions .product-whatsapp:hover {
  background: #ffffff20;
  color: #fff;
}

.product-modal button:focus-visible,
.product-modal a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Bloqueia a página junto com a abertura do fundo do Bootstrap. */
html:has(body.modal-open) {
  overflow-y: hidden;
  overflow-anchor: none;
}

@supports (scrollbar-gutter: stable) {
  html:has(body.modal-open) {
    scrollbar-gutter: stable;
    background-color: color-mix(in srgb, var(--fundo-catalogo), #000 50%);
  }

  /* A largura da barra já está reservada no viewport. */
  body.modal-open {
    padding-right: 0 !important;
  }
}

body.modal-open :is(#lgpd-cookie-banner, .whatsapp-float) {
  visibility: hidden;
}

@media (max-width: 767px) {
  .product-modal .modal-dialog {
    max-width: min(29rem, calc(100% - 2 * var(--bs-modal-margin)));
  }

  .product-modal .modal-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    height: min(36rem, calc(100dvh - 2 * var(--bs-modal-margin)));
    border-radius: 0.875rem;
  }

  .product-panel {
    gap: 0.75rem;
    padding: 0.95rem clamp(0.75rem, 4.5vw, 1.4rem);
  }

  .product-info {
    gap: 0.45rem;
  }

  .product-title {
    font-size: clamp(1.45rem, 5.7vw, 1.95rem);
  }

  .product-copy {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  .product-specs {
    padding-top: 0.45rem;
  }
}

@media (max-height: 440px) {
  .product-modal .modal-content {
    border-radius: 0.75rem;
  }

  .product-panel {
    gap: 0.5rem;
    padding-block: 0.65rem;
  }

  .product-info {
    gap: 0.4rem;
  }

  .product-title {
    font-size: 1.4rem;
  }

  .product-copy {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .product-specs {
    padding-top: 0.4rem;
  }
}
