/* =========================================================
   SNAZZY VP STORIES — Frontend
   ========================================================= */

@property --svps-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.svps-stories-wrapper {
  width: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.svps-stories-intro {
  font-family: 'Aleria', sans-serif;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  margin: 0 0 10px;
  color: inherit;
}

.svps-stories-track {
  display: flex;
  gap: 12px;
  padding: 6px 4px 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.svps-stories-track::-webkit-scrollbar { display: none; }

/* ------- Bulles ------- */
.svps-bubble,
.svps-bubble:hover,
.svps-bubble:focus,
.svps-bubble:active,
.svps-bubble:focus-visible {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
  box-shadow: none !important;
  outline: none !important;
  text-shadow: none !important;
  text-decoration: none !important;
}

.svps-bubble {
  flex: 0 0 auto !important;
  scroll-snap-align: start;
  cursor: pointer;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 6px;
  font-family: 'Sora', sans-serif;
  position: relative;
  isolation: isolate;
  line-height: 1;
}

.svps-bubble__ring {
  position: relative;
  display: block;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 50%;
  box-sizing: border-box;
  padding: 2.5px;
  background:
    conic-gradient(
      from var(--svps-angle, 0deg),
      #f09433 0%,
      #e6683c 20%,
      #dc2743 40%,
      #cc2366 60%,
      #bc1888 80%,
      #f09433 100%
    );
  animation: svps-spin 4s linear infinite;
  transition: transform .25s ease;
}

.svps-bubble:hover .svps-bubble__ring,
.svps-bubble:focus-visible .svps-bubble__ring {
  transform: scale(1.06);
}
.svps-bubble:focus-visible .svps-bubble__ring {
  box-shadow: 0 0 0 3px rgba(220, 39, 67, .35) !important;
}

/* Etat "vu" : ring atténué */
.svps-bubble.is-seen .svps-bubble__ring {
  background: #d1d1d6;
  animation: none;
}

@keyframes svps-spin {
  to { --svps-angle: 360deg; }
}

.svps-bubble__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 2px #fff;
}

.svps-bubble__img,
.svps-bubble__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  margin: 0;
  padding: 0;
  max-width: none;
}

.svps-bubble__placeholder {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #E4CAFF, #993EF9);
}

/* Source vidéo cachée pour capture de frame */
.svps-bubble__frame-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: 0;
  top: 0;
}

.svps-bubble__label {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  line-height: 1.2;
  max-width: 70px;
  color: inherit;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  font-weight: 500;
  letter-spacing: .1px;
}

/* =========================================================
   Viewer fullscreen
   ========================================================= */
.svps-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  font-family: 'Sora', sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.svps-viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.svps-viewer__stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 100vh;
  background: #111;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 720px) {
  .svps-viewer__stage {
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
  }
}

.svps-viewer__progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  z-index: 3;
  pointer-events: none;
}
.svps-viewer__progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,.32);
  border-radius: 2px;
  overflow: hidden;
}
.svps-viewer__progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: #fff;
  transform-origin: left center;
}
.svps-viewer__progress-bar.is-done > span { width: 100%; }

.svps-viewer__header {
  position: absolute;
  top: 22px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  z-index: 3;
  pointer-events: none;
}
.svps-viewer__title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.svps-viewer__close {
  background: rgba(0,0,0,.35);
  border: 0;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.svps-viewer__close:hover { background: rgba(0,0,0,.55); }

.svps-viewer__media-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
.svps-viewer__media-wrap img,
.svps-viewer__media-wrap video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
}
.svps-viewer__media-wrap video {
  background: #000;
}

/* Zones de tap gauche / droite (invisibles) */
.svps-viewer__tap {
  position: absolute;
  top: 0; bottom: 0;
  width: 30%;
  z-index: 2;
  cursor: pointer;
  user-select: none;
}
.svps-viewer__tap--prev { left: 0; }
.svps-viewer__tap--next { right: 0; }

/* CTA */
.svps-viewer__cta {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,.95);
  color: #111;
  padding: 10px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  z-index: 3;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  transition: transform .2s ease;
}
.svps-viewer__cta:hover { transform: translateX(-50%) translateY(-2px); }

/* Etat chargement */
.svps-viewer__loader {
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: svps-loader 1s linear infinite;
  z-index: 1;
  opacity: 0;
  transition: opacity .15s ease;
}
.svps-viewer.is-loading .svps-viewer__loader { opacity: 1; }
@keyframes svps-loader { to { transform: rotate(360deg); } }

/* Empêche le scroll body quand viewer ouvert */
body.svps-no-scroll {
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .svps-bubble__ring { animation: none; }
}
