/* =============================================================
   WP Stories – stories.css
   Zero dependencies. GPU-accelerated. Mobile-first.
============================================================= */

/* ---------- Story row (bubble scroller) ---------- */
.wps-row {
  display: flex;
  gap: 14px;
  padding: 12px 4px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;          /* Firefox */
  scroll-snap-type: x mandatory;
}
.wps-row::-webkit-scrollbar { display: none; }

/* ---------- Individual bubble ---------- */
.wps-bubble {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 3px;
}

.wps-bubble-ring {
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #f9a825 0%, #f06292 50%, #7c4dff 100%);
  transition: transform 0.15s ease;
}
.wps-bubble.wps-seen .wps-bubble-ring {
  background: #ccc;
}
.wps-bubble:hover .wps-bubble-ring,
.wps-bubble:focus-visible .wps-bubble-ring {
  transform: scale(1.07);
}
.wps-bubble-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid #fff;
  background: #eee;
}

.wps-bubble-label {
  font-size: 11px;
  line-height: 1.3;
  color: inherit;
  max-width: 72px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- Lightbox backdrop ---------- */
.wps-lb {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  touch-action: none;           /* prevent page scroll while swiping */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.wps-lb.wps-lb-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Slide container ---------- */
.wps-lb-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  background: #111;
}

/* ---------- Slide image ---------- */
.wps-slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.28s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.wps-slide-img.wps-active {
  opacity: 1;
}

/* ---------- Caption ---------- */
.wps-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 20px 28px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.wps-caption.wps-active {
  opacity: 1;
  transform: translateY(0);
}
.wps-caption a {
  color: #fff;
  text-decoration: underline;
  pointer-events: auto;
}

/* ---------- Progress bars ---------- */
.wps-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
  z-index: 10;
  pointer-events: none;
}
.wps-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.35);
  overflow: hidden;
}
.wps-bar-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
  will-change: width;
  /* width is driven by JS requestAnimationFrame – no CSS transition here */
}
.wps-bar.wps-bar-done .wps-bar-fill {
  width: 100%;
}

/* ---------- Header (avatar + title + close) ---------- */
.wps-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 26px 14px 10px;
  z-index: 11;
  pointer-events: none;
}
.wps-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.8);
  flex-shrink: 0;
}
.wps-header-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wps-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.wps-close:hover { background: rgba(0,0,0,.6); }

/* ---------- Tap zones (prev / next) ---------- */
.wps-tap-prev,
.wps-tap-next {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  z-index: 9;
  cursor: pointer;
}
.wps-tap-prev { left: 0; }
.wps-tap-next { right: 0; }

/* ---------- Swipe hint on desktop ---------- */
@media (hover: hover) {
  .wps-tap-prev::after,
  .wps-tap-next::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    opacity: 0;
    transition: opacity 0.2s;
  }
  .wps-tap-prev::after { right: 10px; }
  .wps-tap-next::after { left: 10px; }
  .wps-tap-prev:hover::after,
  .wps-tap-next:hover::after { opacity: 1; }
}

/* ---------- Pause overlay (long-press) ---------- */
.wps-lb-stage.wps-paused .wps-bar-fill {
  /* JS sets animation-play-state via RAF pause, nothing extra needed */
}

/* ---------- Swipe transition ---------- */
.wps-lb-stage.wps-swipe-left {
  animation: wpsSlideLeft 0.28s ease forwards;
}
.wps-lb-stage.wps-swipe-right {
  animation: wpsSlideRight 0.28s ease forwards;
}

@keyframes wpsSlideLeft {
  from { transform: translateX(0); opacity:1; }
  to   { transform: translateX(-6%); opacity:0; }
}
@keyframes wpsSlideRight {
  from { transform: translateX(0); opacity:1; }
  to   { transform: translateX(6%); opacity:0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wps-slide-img,
  .wps-caption,
  .wps-lb,
  .wps-lb-stage { transition: none !important; animation: none !important; }
}
