.mgh-product-detail {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
}

.mgh-product-main-image {
  height: clamp(280px, 42vw, 480px) !important;
  border-radius: 12px !important;
  background: linear-gradient(145deg, #edf2ee, #f6efe9);
  border: 1px solid var(--line);
  overflow: hidden;
}

.mgh-product-main-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(145deg, #edf2ee, #f6efe9);
}

.mgh-product-thumbnails {
  display: flex;
  gap: 10px;
  grid-column: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.mgh-product-thumbnail {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.mgh-product-thumbnail[aria-pressed="true"] {
  border-color: var(--teal);
}

.mgh-product-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mgh-product-thumbnail:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.mgh-gallery-manager {
  max-width: 920px;
}

.mgh-gallery-product-select {
  display: grid;
  grid-template-columns: minmax(100px, 180px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.mgh-gallery-product-select label,
.mgh-gallery-upload-form label {
  font-weight: 700;
}

.mgh-gallery-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.mgh-gallery-image-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mgh-gallery-image-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

.mgh-gallery-image-item .btn {
  width: 100%;
}

.mgh-gallery-upload-form {
  display: grid;
  justify-items: start;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .mgh-product-detail {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px !important;
  }

  .mgh-product-main-image {
    height: clamp(260px, 62vw, 420px) !important;
    width: 100%;
  }

  .mgh-product-thumbnails {
    grid-column: 1;
    grid-row: 2;
    gap: 8px;
    padding-bottom: 4px;
  }

  .mgh-product-thumbnail {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
  }

  .mgh-gallery-product-select {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .mgh-gallery-upload-form .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mgh-product-thumbnail {
    scroll-behavior: auto;
  }
}