/* Единая CSS-галерея страниц товаров и услуг. */
.entity-gallery {
position: relative;
width: 100%;
max-width: 495px;
height: auto;
aspect-ratio: auto;
min-width: 0;
overflow: visible;
align-self: start;
background: transparent;
border-radius: 0;
isolation: isolate;
}

.entity-gallery__radio {
position: fixed;
top: 0;
right: auto;
bottom: auto;
left: 0;
inline-size: 1px;
block-size: 1px;
opacity: 0;
pointer-events: none;
}

.entity-gallery__stage {
position: relative;
width: 100%;
height: auto;
aspect-ratio: 495 / 660;
overflow: hidden;
background: #313336;
border-radius: 20px;
}

.entity-gallery__slide {
position: absolute;
inset: 0;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
margin: 0;
clip-path: inset(0 100% 0 0);
transition: clip-path .55s ease;
will-change: clip-path;
}

.entity-gallery__image,
.entity-gallery__slide .product-image {
position: static;
display: block;
width: 100%;
height: 100%;
max-width: none;
object-fit: cover;
border-radius: 0;
}

/*
* Направленная маска, повторяющая прежнюю товарную галерею:
* следующий слайд заранее скрыт слева, предыдущий — справа.
* При выборе clip-path раскрывается без перемещения изображения.
*/
.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6) {
z-index: 2;
clip-path: inset(0 0 0 0);
}

/* Состояние 1: следующее изображение готово раскрыться справа налево. */
.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2) {
clip-path: inset(0 0 0 100%);
}

.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4),
.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5),
.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6) {
clip-path: inset(0 100% 0 0);
}

/* Состояния 2–5: предыдущий слайд справа, следующий слева. */
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5) {
clip-path: inset(0 100% 0 0);
}

.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6) {
clip-path: inset(0 0 0 100%);
}

/* Остальные неактивные слайды остаются скрыты с правой стороны. */
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4),
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5),
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(5),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(6),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(1),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(2),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(3),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__stage .entity-gallery__slide:nth-child(4) {
clip-path: inset(0 100% 0 0);
}

.entity-gallery__nav {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
}

.entity-gallery__hit,
.entity-gallery__dead {
height: 100%;
}

.entity-gallery__hit {
  width: 33.333%;
  cursor: pointer;
  transition: background-color .2s ease;
}

.entity-gallery__hit:hover {
background: rgb(255 255 255 / 9%);
}

.entity-gallery__dead {
width: 33.334%;
pointer-events: none;
}

.entity-gallery__thumbs {
position: relative;
left: auto;
bottom: auto;
z-index: 5;
display: flex;
width: 100%;
max-width: 100%;
gap: 1px;
margin-top: 4px;
overflow-x: auto;
overflow-y: hidden;
justify-content: center;
transform: none;
scrollbar-width: none;
overscroll-behavior-inline: contain;
}

.entity-gallery__thumbs::-webkit-scrollbar {
display: none;
}

.entity-gallery__thumb {
box-sizing: border-box;
position: relative;
flex: 0 0 82px;
width: 82px;
height: 110px;
padding: 0;
cursor: pointer;
transition: .2s ease;
border-radius: 7px;
overflow: hidden;
}

.entity-gallery__thumb img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
border: 0;
border-radius: 0;
}

.entity-gallery__thumb::after {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
}

.entity-gallery__thumb:hover {
opacity: 1;
}

.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(1),
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(2),
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(3),
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(4),
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(5),
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(6) {
opacity: 1;
background: transparent;
}

.entity-gallery__radio:nth-of-type(1):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(1)::after,
.entity-gallery__radio:nth-of-type(2):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(2)::after,
.entity-gallery__radio:nth-of-type(3):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(3)::after,
.entity-gallery__radio:nth-of-type(4):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(4)::after,
.entity-gallery__radio:nth-of-type(5):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(5)::after,
.entity-gallery__radio:nth-of-type(6):checked ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(6)::after {
border-color: #fff;
}

.entity-gallery__radio:nth-of-type(1):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(1),
.entity-gallery__radio:nth-of-type(2):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(2),
.entity-gallery__radio:nth-of-type(3):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(3),
.entity-gallery__radio:nth-of-type(4):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(4),
.entity-gallery__radio:nth-of-type(5):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(5),
.entity-gallery__radio:nth-of-type(6):focus-visible ~ .entity-gallery__thumbs .entity-gallery__thumb:nth-child(6) {
outline: 3px solid #26becf;
outline-offset: -3px;
}

.entity-gallery--empty {
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 495 / 660;
overflow: hidden;
background: #313336;
border-radius: 20px;
}

@media (max-width: 540px) {
.entity-gallery {
max-width: 100%;
border-radius: 0;
}

.entity-gallery__stage,
.entity-gallery--empty {
border-radius: 14px;
}

.entity-gallery__thumbs {
width: 100%;
justify-content: flex-start;
}
}

@media (prefers-reduced-motion: reduce) {
.entity-gallery__slide,
.entity-gallery__thumb {
transition: none;
}
}
