/* см. docs/design/07-asset-notes.md */
.lp-gallery {
  width: 320px;
  max-width: 100%;
}

.lp-gallery__stage {
  position: relative;
  display: flex;
  aspect-ratio: 1 / 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--c-border-soft);
  border-radius: var(--radius-sm);
}

.lp-gallery__stage::-webkit-scrollbar {
  display: none;
}

.lp-gallery__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
}

.lp-gallery__slide-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  position: relative;
}

.lp-gallery__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lp-gallery__slide-btn--video {
  cursor: pointer;
}

.lp-gallery__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lp-gallery__play::after {
  content: '';
  width: 0;
  height: 0;
  margin-left: 4px;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
}

.lp-gallery__video-frame {
  position: absolute;
  inset: 0;
}

.lp-gallery__video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.lp-gallery__thumbs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

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

.lp-gallery__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--c-border-soft);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  scroll-snap-align: center;
  transition: border-color var(--transition);
}

.lp-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lp-gallery__thumb.is-active {
  border-color: var(--c-brand);
}

.lp-gallery__thumb:hover,
.lp-gallery__thumb:focus-visible {
  border-color: var(--c-brand-600);
}

.lp-gallery__thumb:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

.lp-gallery__thumb-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.lp-gallery__thumb-play::after {
  content: '';
  width: 0;
  height: 0;
  margin-left: 1px;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
}

.lp-gallery__placeholder {
  aspect-ratio: 1 / 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--c-border-soft);
  border-radius: var(--radius-sm);
  color: var(--c-muted);
  font-size: var(--fs-body);
  text-align: center;
  padding: var(--space-4);
}

.lp-gallery__placeholder svg {
  width: 40px;
  height: 40px;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .lp-gallery__stage,
  .lp-gallery__thumbs {
    scroll-behavior: auto;
  }
}

.lp-gallery-modal {
  padding: 0;
  border: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  background: #000;
  overflow: hidden;
}

.lp-gallery-modal[open] {
  display: flex;
  flex-direction: column;
  animation: lp-gallery-modal-in var(--transition);
}

.lp-gallery-modal::backdrop {
  background: #000;
}

@keyframes lp-gallery-modal-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lp-gallery-modal[open] {
    animation: none;
  }
}

.lp-gallery-modal__stage {
  flex: 1 1 auto;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.lp-gallery-modal__stage::-webkit-scrollbar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .lp-gallery-modal__stage {
    scroll-behavior: auto;
  }
}

.lp-gallery-modal__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--space-6) var(--space-4);
  box-sizing: border-box;
}

.lp-gallery-modal__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lp-gallery-modal__playbtn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.lp-gallery-modal__close,
.lp-gallery-modal__arr {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition);
}

.lp-gallery-modal__close:hover,
.lp-gallery-modal__close:focus-visible,
.lp-gallery-modal__arr:hover,
.lp-gallery-modal__arr:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.lp-gallery-modal__close:focus-visible,
.lp-gallery-modal__arr:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lp-gallery-modal__close {
  top: var(--space-3);
  right: var(--space-3);
  font-size: 26px;
  line-height: 1;
}

.lp-gallery-modal__arr {
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
}

.lp-gallery-modal__arr--prev {
  left: var(--space-3);
}

.lp-gallery-modal__arr--next {
  right: var(--space-3);
}

.lp-gallery-modal__arr:disabled {
  opacity: 0.3;
  cursor: default;
}

.lp-gallery-modal__counter {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 2;
}

@media (max-width: 599px) {
  .lp-gallery-modal__slide {
    padding: var(--space-4) var(--space-2);
  }
}
