.g500-image {
  background: #fff;
}
.g500-image > img {
  object-fit: contain;
}
.g500-image > .g500-image-incoming {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.g500-thumbs button {
  height: auto;
  min-height: 104px;
  background: #fff;
}
.g500-thumbs img {
  display: block;
  height: 78px;
  object-fit: contain;
}
.g500-thumbs span {
  display: block;
  padding: 5px;
  font-size: 11px;
}
.g500-status {
  min-height: 1.5em;
  margin-top: 6px;
}
.g500-colors {
  min-width: 0;
}
.g500-color-heading {
  clear: both;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.g500-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 12px 8px;
  clear: both;
  padding: 6px;
  scroll-padding: 8px;
}
.g500-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background 160ms ease, border-color 160ms ease;
  cursor: pointer;
  min-width: 0;
}
.g500-swatch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.g500-swatch-circle {
  display: block;
  width: 34px;
  height: 34px;
  border: 3px solid var(--paper);
  outline: 1px solid #aaa;
  border-radius: 50%;
  background: var(--swatch);
  overflow: hidden;
}
.g500-swatch-circle img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.g500-swatch input:checked + .g500-swatch-circle {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.g500-swatch input:focus-visible + .g500-swatch-circle {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.g500-swatch-name {
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}
.g500-color-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: 600 11px Body, sans-serif;
  cursor: pointer;
  min-height: 44px;
}
.g500-search {
  clear: both;
  margin-bottom: 8px;
}
.g500-search label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
}
.g500-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 66px 12px 14px;
  background: var(--paper);
  font: inherit;
  font-size: 16px;
}
.g500-color-toolbar, .g500-color-bottom {
  clear: both;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.g500-color-bottom { margin: 12px 0 0; font-size: 11px; color: var(--muted); justify-content: flex-start; }
.g500-color-bottom button { order: -1; }
.g500-colors.is-expanded .g500-swatches {
  height: clamp(250px, 44vh, 440px);
  align-content: start;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #9ba7ac transparent;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff60;
}
.g500-swatch:hover { background: #fff; border-color: var(--line); }
.g500-swatch.is-selected { background: var(--sky); border-color: var(--blue); }
.g500-swatch.is-selected .g500-swatch-name { font-weight: 700; }
.g500-swatch.is-pending { border-style: dashed; border-color: var(--blue); }
.g500-selected-color { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.g500-selected-color::before {
  content: ''; width: 16px; height: 16px; flex: 0 0 16px;
  background: var(--selected-swatch); border: 1px solid #899090; border-radius: 50%;
}
.g500-search-control { position: relative; }
.g500-search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  min-height: 36px; border: 0; border-radius: 6px; padding: 8px;
  background: #fff; color: var(--ink); font-size: 11px; cursor: pointer;
}
.g500-search input::-webkit-search-cancel-button { display: none; }
.g500-search-results { min-height: 18px; margin: 8px 0; font-size: 11px; color: var(--muted); }
.g500-selection-status { min-height: 18px; margin: 5px 0 0; color: var(--blue); font-size: 11px; }
.g500-colors [data-g500-no-results] { grid-column: 1 / -1; padding: 18px 8px; color: var(--muted); }
.g500-color-toggle:hover, .g500-search-clear:hover { background: var(--sky); }
.g500-color-toggle:focus-visible, .g500-search-clear:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
@media (min-width: 1100px) and (min-height: 560px) {
  .product-detail--g500 > .product-gallery { display: flex; flex-direction: column; align-self: stretch; }
  .product-detail--g500 > .purchase-panel { position: static; }
  .g500-gallery-rail { flex: 1; }
  .g500-gallery-preview { position: sticky; top: 107px; }
  .g500-gallery-preview .g500-image { height: min(680px, calc(100dvh - 290px)); aspect-ratio: auto; }
  .g500-gallery-preview .g500-thumbs { margin: 10px 0; }
  .g500-gallery-preview .g500-thumbs button { min-height: 72px; }
  .g500-gallery-preview .g500-thumbs img { height: 48px; }
  .g500-gallery-preview > p { font-size: 10px; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) { .g500-swatch { transition: none; } }
.g500-composition {
  margin-top: 14px;
}
.g500-colors [hidden] {
  display: none !important;
}
@media (max-width: 760px) {
  .g500-swatches {
    grid-template-columns: repeat(auto-fill, minmax(59px, 1fr));
  }
  .g500-thumbs button {
    min-height: 84px;
  }
  .g500-thumbs img {
    height: 58px;
  }
}
