.product {
  cursor: pointer;
}

.product:focus {
  outline: 2px solid #c4577e;
  outline-offset: 3px;
  transform: translateY(-4px);
  box-shadow: 0 18px 45px rgba(74, 40, 57, .13);
}

.product-hint {
  display: block;
  margin: -5px 0 11px;
  color: #8b7d85;
  font-size: 11px;
  font-weight: 700;
}

.product-dialog {
  position: relative;
  width: min(1000px, 92vw);
  max-height: 90vh;
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fffaf5;
  color: #2d2430;
  box-shadow: 0 30px 90px rgba(45, 36, 48, .35);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.product-dialog::backdrop {
  background: rgba(32, 24, 30, .68);
  backdrop-filter: blur(5px);
}

.dialog-close {
  position: sticky;
  display: block;
  float: none;
  top: 16px;
  margin: 16px 16px -42px auto;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #2d2430;
  color: #fff;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.dialog-layout {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 45px;
  padding: 28px 42px 42px;
}

.dialog-gallery,
.dialog-info {
  min-width: 0;
}

.dialog-main-image {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 20px;
  background: #f2e9e4;
  cursor: zoom-in;
}

.dialog-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform .18s ease-out;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.dialog-main-image.is-zoomed img {
  transform: scale(2.25);
  transition: transform .08s linear;
}

.zoom-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(45, 36, 48, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.dialog-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 3px;
  overflow-x: auto;
}

.dialog-thumbs[hidden] {
  display: none;
}

.dialog-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f2e9e4;
  cursor: pointer;
}

.dialog-thumb.active {
  border-color: #c4577e;
}

.dialog-thumb img {
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.dialog-info {
  align-self: center;
}

.dialog-info h2 {
  margin: 0;
  font: 700 clamp(23px, 2vw, 30px) / 1.2 "Playfair Display", serif;
}

.dialog-price {
  margin: 18px 0;
  font-size: 21px;
  font-weight: 800;
}

.dialog-status {
  display: inline-block;
  margin: -8px 0 18px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #f9e3e8;
  color: #a1294f;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dialog-status[hidden] {
  display: none;
}

.sold-out-note {
  max-width: 430px;
  margin: -8px 0 16px;
  padding: 10px 12px;
  border-left: 3px solid #d68aa4;
  border-radius: 0 9px 9px 0;
  background: #fff5f7;
  color: #74515e;
  font-size: 13px;
  line-height: 1.5;
}

.sold-out-note[hidden] {
  display: none;
}

.dialog-description {
  color: #6d626b;
  font-size: 16px;
  white-space: pre-line;
}

.dialog-info .btn {
  margin: 12px 0 16px;
}

.product-social-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: -6px 0 18px;
  padding: 10px 16px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(120deg, #833ab4, #e1306c 52%, #f77737);
  color: #fff;
  box-shadow: 0 7px 20px rgba(225, 48, 108, .25);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: instagram-pulse 2.4s ease-in-out infinite;
}

.product-social-link::before {
  content: "◎";
  font-size: 20px;
  line-height: 1;
}

.product-social-link.is-facebook {
  background: linear-gradient(120deg, #0866ff, #1877f2 55%, #4695f7);
  box-shadow: 0 7px 20px rgba(24, 119, 242, .28);
  animation-name: facebook-pulse;
}

.product-social-link.is-facebook::before {
  content: "f";
  width: 20px;
  font-family: Arial, sans-serif;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.product-social-link::after {
  content: "";
  position: absolute;
  inset: -50% auto -50% -35%;
  width: 28%;
  background: rgba(255, 255, 255, .3);
  transform: rotate(18deg);
  animation: instagram-shine 3.2s ease-in-out infinite;
}

.product-social-link:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 11px 28px rgba(225, 48, 108, .38);
  text-decoration: none;
}

.product-social-link[hidden] {
  display: none;
}

@keyframes instagram-pulse {
  0%, 100% { box-shadow: 0 7px 20px rgba(225, 48, 108, .22); }
  50% { box-shadow: 0 8px 27px rgba(225, 48, 108, .42); }
}

@keyframes facebook-pulse {
  0%, 100% { box-shadow: 0 7px 20px rgba(24, 119, 242, .24); }
  50% { box-shadow: 0 8px 27px rgba(24, 119, 242, .44); }
}

@keyframes instagram-shine {
  0%, 58% { left: -35%; }
  82%, 100% { left: 125%; }
}

@media (prefers-reduced-motion: reduce) {
  .product-social-link,
  .product-social-link::after {
    animation: none;
  }
}

.dialog-info small {
  display: block;
  color: #7c7078;
}

@media (max-width: 900px) {
  .dialog-layout {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 20px 28px 35px;
  }
}

@media (max-width: 640px) {
  .product-dialog {
    width: min(96vw, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 8px));
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 20px;
  }

  .dialog-layout {
    padding: 12px 18px 28px;
    width: 100%;
    overflow: hidden;
  }

  .dialog-close {
    top: max(9px, env(safe-area-inset-top));
    margin: max(9px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-right)) -44px auto;
    width: 44px;
    height: 44px;
  }

  .dialog-info h2 {
    font-size: 21px;
  }

  .dialog-price {
    margin: 13px 0;
    font-size: 19px;
  }

  .dialog-description {
    font-size: 14.5px;
    line-height: 1.55;
  }

  .zoom-hint {
    padding: 7px 10px;
    font-size: 11px;
  }

  .dialog-info .btn,
  .product-social-link {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .dialog-thumbs {
    display: flex;
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .dialog-thumb {
    flex: 0 0 64px;
    width: 64px;
    min-width: 0;
    height: 64px;
    aspect-ratio: 1;
  }
}
