/* Dorris Spotlight — all classes prefixed dorris-spotlight- to avoid theme conflicts */

/* ── Variables (set by JS on .dorris-spotlight) ── */
.dorris-spotlight {
  --dorris-spotlight-slide: 320px;
  --dorris-spotlight-accent: #c5612b;
  --dorris-spotlight-radius: 18px;
  --dorris-spotlight-gap: 24px;
  position: relative;
  padding: 24px 0;
  box-sizing: border-box;
  width: 100%;
}
.dorris-spotlight *,
.dorris-spotlight *::before,
.dorris-spotlight *::after {
  box-sizing: border-box;
}

.dorris-spotlight__heading {
  font-size: 1.5rem;
  text-align: center;
  margin: 0 0 20px;
}
.dorris-spotlight__heading--bold {
  font-weight: 700;
}

/* ── Track wrapper (holds scroller + arrows) ── */
.dorris-spotlight__track-wrap {
  position: relative;
  width: 100%;
}

/* ── Desktop carousel ── */
@media (min-width: 768px) {
  .dorris-spotlight__carousel {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--dorris-spotlight-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    /* Active slide sits roughly centred with peeking neighbours on both sides.
       Side padding equals half the track width minus half a slide so the
       first/last real slides can centre. The looped layout (clones on either
       side) means the user always sees content on both sides. */
    padding: 32px calc(50% - (var(--dorris-spotlight-slide) / 2));
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .dorris-spotlight__carousel::-webkit-scrollbar {
    display: none;
  }

  .dorris-spotlight--desktop .dorris-spotlight__slide {
    flex: 0 0 var(--dorris-spotlight-slide);
    width: var(--dorris-spotlight-slide);
    transform: scale(0.82);
    opacity: 0.55;
    transition:
      transform 240ms ease,
      opacity 240ms ease;
    cursor: pointer;
  }
  .dorris-spotlight--desktop .dorris-spotlight__slide--active {
    transform: scale(1);
    opacity: 1;
  }

  .dorris-spotlight__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #222;
  }
  .dorris-spotlight__nav svg {
    width: 20px;
    height: 20px;
  }
  .dorris-spotlight__nav--prev {
    left: 12px;
  }
  .dorris-spotlight__nav--next {
    right: 12px;
  }
  .dorris-spotlight__nav:disabled {
    opacity: 0.35;
    cursor: default;
  }
}

/* ── Mobile horizontal swipe carousel ── */
@media (max-width: 767px) {
  .dorris-spotlight__scroll {
    /* Defensive: themes occasionally clobber `display` on generic divs, so
       force a row flex layout here. */
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    padding: 0 16px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
  }
  .dorris-spotlight__scroll::-webkit-scrollbar {
    display: none;
  }

  .dorris-spotlight--mobile .dorris-spotlight__slide {
    /* One slide nearly fills the viewport so swipe feels like one-at-a-time,
       with a small peek of the next. */
    flex: 0 0 84% !important;
    width: 84%;
    max-width: 360px;
    min-width: 0;
    scroll-snap-align: center;
    cursor: pointer;
  }

  /* Arrows hidden on mobile — swipe is primary interaction */
  .dorris-spotlight__nav {
    display: none !important;
  }
}

/* ── Slide media ── */
.dorris-spotlight__media {
  position: relative;
  border-radius: var(--dorris-spotlight-radius);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background: #111;
  width: 100%;
}
.dorris-spotlight__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dorris-spotlight__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 300ms;
}
.dorris-spotlight__preview--playing {
  opacity: 1;
}

/* Bottom-left play / mute controls (Tolstoy-style) */
.dorris-spotlight__controls {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
  z-index: 3;
}
.dorris-spotlight__ctrl {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease;
}
.dorris-spotlight__ctrl:hover {
  background: rgba(0, 0, 0, 0.75);
}
.dorris-spotlight__ctrl svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ── Product card under media ── */
.dorris-spotlight__card {
  display: flex;
  gap: 10px;
  padding: 10px;
  margin-top: 8px;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.dorris-spotlight__card-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.dorris-spotlight__card-text {
  min-width: 0;
  flex: 1 1 auto;
}
.dorris-spotlight__card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dorris-spotlight__card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--dorris-spotlight-accent);
  margin-top: 2px;
}

/* ── Modal player ── */
.dorris-spotlight-player {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dorris-spotlight-player__modal {
  display: flex;
  max-height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  position: relative;
}
.dorris-spotlight-player__stage {
  position: relative;
  aspect-ratio: 9/16;
  max-height: 80vh;
  background: #000;
}
.dorris-spotlight-player__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.dorris-spotlight-player__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.dorris-spotlight-player__prev,
.dorris-spotlight-player__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.dorris-spotlight-player__prev {
  left: 8px;
}
.dorris-spotlight-player__next {
  right: 8px;
}
.dorris-spotlight-player__panel {
  width: 280px;
  background: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.dorris-spotlight-player__cta-add {
  background: var(--dorris-spotlight-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.dorris-spotlight-player__cta-add:disabled {
  opacity: 0.6;
}

/* mobile: panel becomes bottom sheet */
@media (max-width: 767px) {
  .dorris-spotlight-player__modal {
    flex-direction: column;
    width: 100%;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .dorris-spotlight-player__stage {
    max-height: 55vh;
  }
  .dorris-spotlight-player__panel {
    width: 100%;
    max-height: 40vh;
    border-radius: 0;
  }
}
