.ugc-gallery {
  display: block;
  overflow: hidden;
  color: rgb(var(--color-text));
  background: rgb(var(--color-background));
}

.ugc-gallery__inner {
  width: 100%;
  margin-inline: auto;
}

.ugc-gallery__header {
  margin-block-end: 38px;
  text-align: center;
}

.ugc-gallery__title {
  margin: 0;
  color: var(--ugc-title-color);
  font-size: var(--ugc-title-size);
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ugc-gallery__carousel {
  position: relative;
}

.ugc-gallery__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--ugc-card-width);
  gap: var(--ugc-card-gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding-block-end: 8px;
  user-select: none;
}

.ugc-gallery-card,
.ugc-gallery-card__button {
  min-width: 0;
  width: 100%;
}

.ugc-gallery-card__button {
  display: block;
  padding: 0;
  color: inherit;
  text-align: start;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.ugc-gallery-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: rgb(var(--color-image-background));
  border-radius: var(--ugc-image-radius);
}

.ugc-gallery-card__image,
.ugc-gallery-card__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ugc-gallery-card__media img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ugc-gallery-card__button:hover .ugc-gallery-card__image,
.ugc-gallery-card__button:focus-visible .ugc-gallery-card__image {
  transform: scale(1.03);
}

.ugc-gallery-card__play {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  z-index: 1;
  width: 60px;
  height: 60px;
  /* color: #fff; */
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ugc-gallery-card__play svg {
  width: 100%;
  height: 100%;
}

.ugc-gallery-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #fff;
  background: rgb(12 12 12 / 22%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.ugc-gallery-card__button:hover .ugc-gallery-card__overlay,
.ugc-gallery-card__button:focus-visible .ugc-gallery-card__overlay {
  opacity: 1;
}

.ugc-gallery-card__overlay-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 240px);
  padding: 24px 18px;
  text-align: center;
  background: rgb(0 0 0 / 22%);
}

.ugc-gallery-card__handle {
  display: block;
  margin-block-start: 12px;
  overflow: hidden;
  color: var(--ugc-handle-color);
  font-size: var(--ugc-handle-size);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ugc-gallery__nav,
.ugc-gallery-modal__nav,
.ugc-gallery-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.ugc-gallery__nav {
  position: absolute;
  inset-block-start: 50%;
  z-index: 2;
  width: 40px;
  height: 40px;
  color: #101010;
  background: rgb(240 235 227 / 95%);
  transform: translateY(-50%);
}

.ugc-gallery__nav--previous {
  inset-inline-start: 14px;
}

.ugc-gallery__nav--previous svg,
.ugc-gallery-modal__nav--previous svg {
  transform: rotate(180deg);
}

.ugc-gallery__nav--next {
  inset-inline-end: 14px;
}

.ugc-gallery__nav[disabled] {
  opacity: 0.4;
  cursor: default;
}

.ugc-gallery__progress {
  position: relative;
  width: min(95%, var(--ugc-progress-width));
  height: var(--ugc-progress-height);
  margin: 34px auto 0;
  overflow: hidden;
  background: var(--ugc-progress-track);
}

.ugc-gallery__progress-bar {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 0;
  height: 100%;
  background: var(--ugc-progress-bar);
  transition: width 0.18s ease, transform 0.18s ease;
  will-change: width, transform;
}

.ugc-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 32px;
}

.ugc-gallery-modal[hidden] {
  display: none;
}

.ugc-gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(20 20 20 / 56%);
}

.ugc-gallery-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(var(--ugc-modal-max-width), 100%);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  background: rgb(var(--color-background));
  box-shadow: 0 20px 60px rgb(0 0 0 / 24%);
}

.ugc-gallery-modal__close {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  z-index: 4;
  width: 40px;
  height: 40px;
  color: rgb(var(--color-text));
  background: rgb(var(--color-background));
}

.ugc-gallery-modal__close svg,
.ugc-gallery-modal__nav svg {
  width: 20px;
  height: 20px;
}

.ugc-gallery-modal__nav {
  position: absolute;
  inset-block-start: 50%;
  z-index: 3;
  width: 42px;
  height: 42px;
  color: #101010;
  background: rgb(255 255 255 / 92%);
  transform: translateY(-50%);
}

.ugc-gallery-modal__nav--previous {
  inset-inline-start: 12px;
}

.ugc-gallery-modal__nav--next {
  inset-inline-end: 12px;
}

.ugc-gallery-modal__slide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, var(--ugc-modal-content-width));
  height: min(var(--ugc-modal-height), calc(100vh - 64px));
}

.ugc-gallery-modal__slide[hidden] {
  display: none;
}

.ugc-gallery-modal__media {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #111;
}

.ugc-gallery-modal__image,
.ugc-gallery-modal__direct-video,
.ugc-gallery-modal__video-media,
.ugc-gallery-modal__video-media .theme-video-media {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.ugc-gallery-modal__video-media .theme-video-media {
  aspect-ratio: auto !important;
}

.ugc-gallery-modal__media video,
.ugc-gallery-modal__media iframe,
.ugc-gallery-modal__video-media .theme-video-media__poster,
.ugc-gallery-modal__video-media .theme-video-media__media {
  width: 100%;
  height: 100%;
}

.ugc-gallery-modal__media video {
  object-fit: contain;
}

.ugc-gallery-modal__content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 64px 40px 36px;
  overflow-y: auto;
}

.ugc-gallery-modal__author {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ugc-gallery-modal__author-icon {
  display: inline-flex;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}

.ugc-gallery-modal__author-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ugc-gallery-modal__author-divider {
  color: rgb(var(--color-text));
  font-size: 22px;
  line-height: 1;
}

.ugc-gallery-modal__author h3,
.ugc-gallery-modal__caption,
.ugc-gallery-modal__meta {
  margin: 0;
}

.ugc-gallery-modal__author h3 {
  font-weight: 600;
  line-height: 1.2;
}

.ugc-gallery-modal__caption {
  line-height: 1.55;
}

.ugc-gallery-modal__meta {
  color: rgb(var(--color-light-text));
}

.ugc-gallery-product {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  margin-block-start: 8px;
  padding-block-start: 24px;
  border-block-start: 1px solid rgb(var(--color-entry-line));
}

.ugc-gallery-product__image {
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  background: rgb(var(--color-image-background));
}

.ugc-gallery-product__image img,
.ugc-gallery-product__image svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ugc-gallery-product__content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.ugc-gallery-product__title,
.ugc-gallery-product__link {
  color: inherit;
}

.ugc-gallery-product__title {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ugc-gallery-product__button {
  width: 100%;
}

.ugc-gallery-product__link {
  font-size: 0.875em;
  text-underline-offset: 3px;
}

body.ugc-gallery-modal-open {
  overflow: hidden;
}

@media (max-width: 1199px) {
  .ugc-gallery__track {
    grid-auto-columns: var(--ugc-card-width-tablet);
  }
}

@media (max-width: 959px) {
  .ugc-gallery__header {
    margin-block-end: 24px;
  }

  .ugc-gallery__title {
    font-size: var(--ugc-title-size-mobile);
  }

  .ugc-gallery__track {
    grid-auto-columns: var(--ugc-card-width-mobile);
    gap: var(--ugc-card-gap-mobile);
  }

  .ugc-gallery-card__handle {
    font-size: var(--ugc-handle-size-mobile);
  }

  .ugc-gallery__nav {
    display: none;
  }

  .ugc-gallery__progress {
    margin-block-start: 22px;
  }

  .ugc-gallery-modal {
    align-items: end;
    padding: 0;
  }

  .ugc-gallery-modal__dialog {
    width: 100%;
    max-height: 92vh;
    overflow: auto;
  }

  .ugc-gallery-modal__slide {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .ugc-gallery-modal__media,
  .ugc-gallery-modal__image,
  .ugc-gallery-modal__direct-video,
  .ugc-gallery-modal__video-media,
  .ugc-gallery-modal__video-media .theme-video-media {
    min-height: 0;
    height: min(52vh, 540px);
  }

  .ugc-gallery-modal__content {
    gap: 12px;
    padding: 24px 20px 28px;
    overflow-y: visible;
  }

  .ugc-gallery-modal__nav {
    inset-block-start: 26vh;
  }

  .ugc-gallery-product {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    margin-block-start: 8px;
    padding-block-start: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ugc-gallery__track,
  .ugc-gallery-card__image,
  .ugc-gallery-card__overlay,
  .ugc-gallery__progress-bar {
    scroll-behavior: auto;
    transition: none;
  }
}
