html.merch-gallery-open {
  overflow: hidden;
}
.merch-gallery {
  width: 100%;
}
.merch-gallery__preview {
  position: relative;
  aspect-ratio: 1;
  touch-action: pan-y pinch-zoom;
}
.merch-gallery__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #eee5f4;
  cursor: zoom-in;
}
.merch-gallery__open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.merch-gallery__arrow,
.merch-lightbox__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #b9a0cc66;
  border-radius: 50%;
  background: #fffaf8ed;
  color: #583fa1;
  font: 24px/1 var(--font-body);
  cursor: pointer;
}
.merch-gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition:
    opacity 0.18s ease,
    background 0.18s ease;
}
.merch-gallery__arrow svg {
  display: block;
}
.merch-gallery__arrow--prev svg {
  transform: rotate(180deg);
}
@media (hover: hover) and (pointer: fine) {
  .merch-gallery__arrow {
    opacity: 0;
    pointer-events: none;
  }
  :is(.merch-gallery__preview, .merch-lightbox__stage):is(:hover, :has(:focus-visible))
    .merch-gallery__arrow {
    opacity: 1;
    pointer-events: auto;
  }
}
.merch-gallery__arrow--prev {
  left: 12px;
}
.merch-gallery__arrow--next {
  right: 12px;
}
.merch-gallery__arrow:hover,
.merch-lightbox__close:hover {
  background: #e6d7f3;
}
.merch-gallery__count {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 20px;
  background: #241733cc;
  color: #fffaf8;
  font: 14px/1.4 var(--font-body);
  pointer-events: none;
}
.merch-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  border: 0;
  background: #19121ff5;
  color: #fffaf8;
  overflow: hidden;
}
.merch-lightbox[open] {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px 24px;
}
.merch-lightbox::backdrop {
  background: #19121f;
}
.merch-lightbox__head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.book-detail .merch-lightbox__head p {
  margin: 0;
  color: #fffaf8;
  font: 16px/1.5 var(--font-body);
}
.merch-lightbox__close {
  flex-shrink: 0;
  font-size: 32px;
}
.merch-lightbox__thumbs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
  overscroll-behavior: contain;
}
.merch-lightbox__thumbs button {
  flex-shrink: 0;
  width: 100%;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.merch-lightbox__thumbs button[aria-current='true'] {
  border-color: #c3a2d5;
}
.merch-lightbox__thumbs img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
}
.merch-lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  padding: 0 64px 48px;
  touch-action: pan-y pinch-zoom;
}
.merch-lightbox__stage > img {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: contain;
}
.merch-lightbox button:focus-visible {
  outline: 2px solid #eed7ee;
  outline-offset: 2px;
}
@media (max-width: 600px) {
  .merch-lightbox {
    padding-inline: 10px;
  }
  .merch-lightbox[open] {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px 8px;
  }
  .merch-lightbox__thumbs {
    gap: 8px;
    padding-inline: 0;
  }
  .book-detail .merch-lightbox__head p {
    font-size: 14px;
  }
  .merch-lightbox__stage {
    padding: 0 0 58px;
  }
  .merch-lightbox__stage .merch-gallery__arrow {
    top: auto;
    bottom: 4px;
    transform: none;
  }
  .merch-lightbox__stage .merch-gallery__count {
    bottom: 14px;
  }
  .merch-gallery__arrow--prev {
    left: 6px;
  }
  .merch-gallery__arrow--next {
    right: 6px;
  }
}
