.mosthome-product-gallery {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.mosthome-product-gallery__main {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  cursor: zoom-in;
}

.mosthome-product-gallery__main img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}

.mosthome-product-gallery__rail {
  display: flex;
  min-width: 0;
}

.mosthome-product-gallery__thumbs {
  display: flex;
  min-width: 0;
}

.mosthome-product-gallery__thumb {
  display: block;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  appearance: none;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--card);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.mosthome-product-gallery__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}

.mosthome-product-gallery__thumb.is-current,
.mosthome-product-gallery__thumb[aria-current="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.mosthome-product-gallery__thumb:focus-visible,
.mosthome-product-gallery__main:focus-visible,
.mosthome-product-gallery__rail-button:focus-visible,
.mosthome-product-gallery__dialog button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.mosthome-product-gallery__rail-button {
  border: 0;
  border-radius: 10px;
  background: var(--brand-slate-deep);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.mosthome-product-gallery__rail-button:disabled {
  cursor: default;
  opacity: .42;
}

.mosthome-product-gallery__dialog {
  width: min(94vw, 920px);
  max-width: none;
  max-height: 94vh;
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  background: var(--card);
}

.mosthome-product-gallery__dialog::backdrop {
  background: rgba(19, 25, 35, .82);
}

.mosthome-product-gallery__dialog img {
  display: block;
  width: 100%;
  max-height: calc(94vh - 76px);
  object-fit: contain;
}

.mosthome-product-gallery__dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.mosthome-product-gallery__dialog-actions button {
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--brand-slate-deep);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 22px;
}

@media (min-width: 900px) {
  .mosthome-product-gallery {
    display: block;
    position: relative;
    padding-left: clamp(76px, 12%, 110px);
  }

  .mosthome-product-gallery__rail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(clamp(76px, 12%, 110px) - 14px);
    flex-direction: column;
    gap: 9px;
    min-height: 0;
  }

  .mosthome-product-gallery__rail-button {
    flex: 0 0 34px;
  }

  .mosthome-product-gallery__thumbs {
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .mosthome-product-gallery__thumb {
    width: 100%;
  }

  .mosthome-product-gallery__main {
    min-height: 0;
  }
}

@media (max-width: 899px) {
  .mosthome-product-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  .mosthome-product-gallery__main {
    grid-row: 1;
  }

  .mosthome-product-gallery__rail {
    grid-row: 2;
  }

  .mosthome-product-gallery__rail-button {
    display: none;
  }

  .mosthome-product-gallery__thumbs {
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 2px 1px 7px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .mosthome-product-gallery__thumb {
    width: clamp(64px, 19vw, 92px);
    scroll-snap-align: start;
  }
}
