/* Scope: product photo trigger and its native modal. */
.card-gallery__main-carousel.tf-gallery-zoom {
  cursor: zoom-in;
}

.card-gallery__main-carousel.tf-gallery-zoom::after,
.card-gallery--list-item.tf-gallery-zoom-main::after {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 30px;
  background: rgba(21, 30, 27, .8);
  color: #fff;
  font: 500 12px/1.2 Arial, sans-serif;
  pointer-events: none;
  content: "Увеличить ↗";
}

.card-gallery--list-item.tf-gallery-zoom-main {
  position: relative;
  cursor: zoom-in;
}

.card-gallery__main-carousel.tf-gallery-zoom:focus-visible {
  outline: 2px solid #e64a16;
  outline-offset: 3px;
}

.tf-product-lightbox {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #151e1b;
  color: #fff;
  font: 400 16px/1.4 Arial, sans-serif;
  color-scheme: dark;
}

.tf-product-lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.tf-product-lightbox::backdrop {
  background: #151e1b;
}

.tf-product-lightbox__header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: max(12px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 12px max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.tf-product-lightbox__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #fff;
  font: 500 16px/1.4 Arial, sans-serif;
}

.tf-product-lightbox__counter {
  flex: none;
  color: #c4cbc7;
  font: 400 14px/1.4 Arial, sans-serif;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tf-product-lightbox button {
  display: grid;
  place-items: center;
  flex: none;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 50%;
  background: rgba(21, 30, 27, .88);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.tf-product-lightbox button:hover {
  border-color: #e64a16;
  background: #bf390c;
}

.tf-product-lightbox button:focus-visible {
  outline: 2px solid #f37750;
  outline-offset: 4px;
}

.tf-product-lightbox button[hidden],
.tf-product-lightbox__hint[hidden] {
  display: none;
}

.tf-product-lightbox button svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tf-product-lightbox__stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}

.tf-product-lightbox__photo {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 12px 88px;
  object-fit: contain;
  user-select: none;
}

.tf-product-lightbox__photo--outgoing {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tf-product-lightbox__stage.is-loading .tf-product-lightbox__photo {
  opacity: .25;
}

.tf-product-lightbox__status {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: calc(100% - 120px);
  margin: 0;
  transform: translate(-50%, -50%);
  color: #fff;
  font: 400 14px/1.5 Arial, sans-serif;
  text-align: center;
  pointer-events: none;
}

.tf-product-lightbox__prev,
.tf-product-lightbox__next {
  position: absolute;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
}

.tf-product-lightbox__prev {
  left: max(24px, env(safe-area-inset-left));
}

.tf-product-lightbox__next {
  right: max(24px, env(safe-area-inset-right));
}

.tf-product-lightbox__hint {
  margin: 0;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  color: #aeb9b3;
  font: 400 12px/1.4 Arial, sans-serif;
  text-align: center;
}

.tf-product-lightbox__hint-mobile {
  display: none;
}

@media (max-width: 960px) {
  .tf-product-lightbox .tf-product-lightbox__prev,
  .tf-product-lightbox .tf-product-lightbox__next,
  .tf-product-lightbox__hint-desktop {
    display: none;
  }

  .tf-product-lightbox__hint-mobile {
    display: inline;
  }

  .tf-product-lightbox__photo {
    padding-right: 0;
    padding-left: 0;
  }
}

@media (max-width: 600px) {
  .tf-product-lightbox__header {
    gap: 12px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .tf-product-lightbox__title {
    font-size: 13px;
  }

  .tf-product-lightbox__counter {
    font-size: 12px;
  }

  .tf-product-lightbox button {
    width: 44px;
    height: 44px;
    padding: 11px;
  }

  .tf-product-lightbox__photo {
    padding: 8px 0;
  }

}

@media (prefers-reduced-motion: reduce) {
  .tf-product-lightbox button {
    transition: none;
  }
}
