/* ===========================================================
   SCROLL VIEW (js/scroll-view.js) — the optional full-screen "reels" browse mode.
   Everything is namespaced "cmsv-", so it cannot touch the grid view or any other page style.
   The feed is always dark (like a video feed), whichever site theme is on.
   =========================================================== */

/* ---------- Grid | Scroll switch (next to the "All items" heading) ---------- */
.cmsv-toggle{
  display: inline-flex; flex: none; gap: 2px; padding: 3px;
  border-radius: 999px;
  background: var(--surface-2, #212126);
  border: 1px solid var(--border, #2b2b31);
  align-self: center;
}
.cmsv-tbtn{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-dim, #a3a3ab);
  font: 600 12px/1 var(--font-body, Inter, system-ui, sans-serif);
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.cmsv-tbtn i{ font-size: 12px; }
.cmsv-tbtn:hover:not(.is-on){ color: var(--text, #f5f5f2); }
.cmsv-tbtn.is-on{ background: var(--gradient, linear-gradient(90deg,#7dd3fc,#6366f1)); color: var(--on-accent, #0b0b0d); }
.cmsv-tbtn:focus-visible{ outline: 2px solid var(--c3, #0ea5e9); outline-offset: 2px; }
.cmsv-toggle[hidden]{ display: none; }
/* attention-grabbing glowing border around the switch (a ::after ring, so it never clashes with the pinned shadow) */
.cmsv-toggle{ position: relative; }
.cmsv-toggle::after{
  content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  border: 1.5px solid rgba(125,211,252,.85);
  box-shadow: 0 0 8px 1px rgba(125,211,252,.55), 0 0 16px 2px rgba(99,102,241,.45);
  animation: cmsv-glow 2.2s ease-in-out infinite;
}
@keyframes cmsv-glow{
  0%, 100%{ opacity: .55; box-shadow: 0 0 5px 0 rgba(125,211,252,.4), 0 0 10px 1px rgba(99,102,241,.3); }
  50%{ opacity: 1; box-shadow: 0 0 10px 2px rgba(125,211,252,.8), 0 0 22px 4px rgba(99,102,241,.6); }
}
@media (prefers-reduced-motion: reduce){ .cmsv-toggle::after{ animation: none; opacity: .9; } }
.chip-row > .cmsv-toggle{ margin-left: auto; }
.cmsv-row{ display: flex; justify-content: flex-end; margin: 0 0 12px; }
@media (max-width: 380px){ .cmsv-tbtn span{ display: none; } .cmsv-tbtn{ padding: 8px 12px; } }
.chip-row > .cmsv-toggle-spacer{ margin-left: auto; }
.cmsv-toggle-spacer{ display: inline-block; flex: none; }
/* phone only: the switch stays pinned just under the "online / visits" pill while the grid scrolls (see scroll-view.js) */
@media (max-width: 600px){
  .cmsv-toggle.cmsv-pinned{
    position: fixed; right: 6px; z-index: 900; margin: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
}

/* ---------- the overlay ---------- */
html.cmsv-open, html.cmsv-open body{ overflow: hidden; }
.cmsv{
  position: fixed; inset: 0; z-index: 1800;          /* above the top bar (1000); below toasts (2000) and the chat (4000) */
  display: flex; justify-content: center;
  background: #000; color: #fff;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.cmsv[hidden]{ display: none; }
.cmsv *{ box-sizing: border-box; }
.cmsv button, .cmsv a{ font-family: inherit; color: inherit; }
.cmsv a{ text-decoration: none; }

.cmsv-stage{ position: relative; width: 100%; height: 100%; background: #0b0b0d; overflow: hidden; }
/* big screens: the feed sits in a centred phone-shaped card (like TikTok on desktop); phones and landscape phones use the whole screen */
@media (min-width: 700px) and (min-height: 560px){
  .cmsv{ background: radial-gradient(1200px 700px at 50% 0%, #1b1d2b 0%, #07070a 70%); align-items: center; }
  .cmsv-stage{
    width: min(470px, 100%);
    height: calc(100% - 28px);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08);
  }
}

/* ---------- top: close + categories ---------- */
.cmsv-top{
  position: absolute; z-index: 6; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px 26px 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.62), rgba(0,0,0,0));
  pointer-events: none;                               /* swipes pass through the gaps */
}
.cmsv-close{
  pointer-events: auto; flex: none;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.cmsv-close:hover{ background: rgba(255,255,255,.26); }
.cmsv-chips{
  pointer-events: auto; display: flex; gap: 6px; overflow-x: auto; min-width: 0;
  scrollbar-width: none; -ms-overflow-style: none; padding: 2px 0;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  padding-right: 22px;
}
.cmsv-chips::-webkit-scrollbar{ display: none; }
.cmsv-chip{
  flex: none; border: 0; cursor: pointer; white-space: nowrap;
  padding: 9px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1;
  background: rgba(255,255,255,.16); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .15s ease, color .15s ease;
}
.cmsv-chip.on{ background: #fff; color: #0b0b0d; }
.cmsv-toplabel{
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; line-height: 1;
  background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.cmsv-close:focus-visible, .cmsv-chip:focus-visible, .cmsv-act:focus-visible, .cmsv-btn:focus-visible,
.cmsv-more:focus-visible, .cmsv-follow:focus-visible, .cmsv-arrow:focus-visible, .cmsv-navbtn:focus-visible{ outline: 2px solid #7dd3fc; outline-offset: 2px; }

/* ---------- the vertical feed ---------- */
.cmsv-feed{
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none; -ms-overflow-style: none; outline: none;
  touch-action: pan-y;
}
.cmsv-feed::-webkit-scrollbar{ display: none; }
.cmsv-slide{
  position: relative; width: 100%; height: 100%; flex: none;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: #0b0b0d;
}

/* ---------- photos (horizontal swipe) ---------- */
.cmsv-media, .cmsv-pager{ position: absolute; inset: 0; }
.cmsv-pager{
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -ms-overflow-style: none;
  touch-action: pan-x pan-y;
}
.cmsv-pager::-webkit-scrollbar{ display: none; }
.cmsv-pane{
  position: relative; flex: 0 0 100%; height: 100%;
  scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #131316;
}
/* a soft, blurred copy of the photo fills any empty space around it */
.cmsv-pane::before{
  content: ""; position: absolute; inset: -30px;
  background: var(--src) center / cover no-repeat;
  filter: blur(28px) brightness(.55) saturate(1.2);
}
.cmsv-pane img{
  position: relative; display: block; width: 100%; height: 100%;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
  background: none !important; animation: none !important;   /* beats the site's image-shimmer helper */
}
.cmsv-pane img.is-tall{ object-fit: cover; }
.cmsv-pane--icon{ display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1b2440, #0e1020); }
.cmsv-pane--icon::before{ display: none; }
.cmsv-ico{ font-size: 96px; color: rgba(255,255,255,.55); }

.cmsv-shade{
  position: absolute; left: 0; right: 0; bottom: 0; height: 62%; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.62) 38%, rgba(0,0,0,0) 100%);
}

/* photo progress (only when an item has more than one photo) */
.cmsv-segs{
  position: absolute; z-index: 5; left: 12px; right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  display: flex; gap: 4px; pointer-events: none;
}
.cmsv-seg{ flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); transition: background .2s ease; }
.cmsv-seg.on{ background: #fff; }

/* photo arrows: mouse users only (phones swipe) */
.cmsv-arrow{
  display: none; position: absolute; z-index: 5; top: 42%;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  align-items: center; justify-content: center; font-size: 14px;
  background: rgba(0,0,0,.45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.cmsv-arrow.prev{ left: 10px; } .cmsv-arrow.next{ right: 10px; }
.cmsv-arrow:hover{ background: rgba(0,0,0,.7); }
@media (hover: hover) and (pointer: fine){
  .cmsv-arrow{ display: flex; }
  .cmsv-slide:hover .cmsv-arrow{ opacity: 1; }
  .cmsv-slide.at-start .cmsv-arrow.prev, .cmsv-slide.at-end .cmsv-arrow.next{ opacity: 0 !important; pointer-events: none; }
}

/* double-tap heart */
.cmsv-burst{
  position: absolute; z-index: 5; left: 50%; top: 42%; margin: -48px 0 0 -48px;
  width: 96px; height: 96px; display: flex; align-items: center; justify-content: center;
  font-size: 84px; color: #fff; opacity: 0; pointer-events: none;
  filter: drop-shadow(0 6px 22px rgba(244,63,94,.55));
}
.cmsv-burst i{ color: #fb7185; }
.cmsv-burst.go{ animation: cmsv-burst .85s cubic-bezier(.2,.8,.2,1); }
@keyframes cmsv-burst{
  0%{ opacity: 0; transform: scale(.4); } 18%{ opacity: 1; transform: scale(1.12); }
  40%{ transform: scale(.96); } 100%{ opacity: 0; transform: scale(1.25) translateY(-14px); }
}

/* ---------- action rail (right) ---------- */
.cmsv-rail{
  position: absolute; z-index: 5; right: 8px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.cmsv-act{
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 52px; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 11px; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.cmsv-act i{
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .15s ease, background .15s ease;
}
.cmsv-act:hover i{ background: rgba(255,255,255,.28); }
.cmsv-act:active i{ transform: scale(.9); }
.cmsv-act.on i{ color: #fb7185; background: rgba(255,255,255,.22); }

/* ---------- item details (bottom-left) ---------- */
.cmsv-info{
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0;
  padding: 0 74px calc(env(safe-area-inset-bottom, 0px) + 22px) 14px;
  max-height: 76%; overflow: hidden;
  transition: background .2s ease;
}
.cmsv-shoprow{ display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-width: 0; }
.cmsv-shop{ display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; font-weight: 700; }
.cmsv-shopav{
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35);
}
.cmsv-shopname{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.cmsv-ver{ flex: none; font-size: 12px; color: #7dd3fc; }
.cmsv-uni{ flex: none; font-weight: 500; color: rgba(255,255,255,.72); font-size: 12px; }
.cmsv-follow{
  flex: none; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.7); background: transparent; color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1;
}
.cmsv-follow.on{ background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); }

.cmsv-title{
  margin: 0 0 4px; font: 700 18px/1.25 var(--font-display, Sora, system-ui, sans-serif); letter-spacing: -.01em; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 8px rgba(0,0,0,.55);
}
.cmsv-price{ margin: 0 0 8px; font: 800 21px/1.1 var(--font-display, Sora, system-ui, sans-serif); color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.55); }
.cmsv-price small{ font-size: 12px; font-weight: 600; color: rgba(255,255,255,.8); }
.cmsv-meta{ display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 8px; font-size: 12px; }
.cmsv .cm-rating-row{ display: inline-flex; align-items: center; }
.cmsv .cm-stars{ color: #fbbf24 !important; }
.cmsv .cm-rating-row > span:not(.cm-stars){ color: rgba(255,255,255,.8) !important; }
.cmsv-pill{
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,.18); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4;
}
.cmsv-pill.warn{ background: rgba(251,113,133,.28); color: #ffd1d9; }
.cmsv-loc{ color: rgba(255,255,255,.82); font-size: 12px; }
.cmsv-desc{
  margin: 0; font-size: 13.5px; line-height: 1.45; color: rgba(255,255,255,.9); text-shadow: 0 1px 6px rgba(0,0,0,.55);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-line; overflow-wrap: anywhere;
}
.cmsv-more{
  margin: 4px 0 0; padding: 4px 0; border: 0; background: none; cursor: pointer;
  color: #fff; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.cmsv-extra{ display: none; }

/* "See more" opened */
.cmsv-slide.is-open .cmsv-info{
  top: auto; max-height: 72%; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: rgba(12,12,17,.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.5);
  scrollbar-width: thin;
}
.cmsv-slide.is-open .cmsv-desc{ display: block; -webkit-line-clamp: unset; overflow: visible; }
.cmsv-slide.is-open .cmsv-extra{ display: block; margin-top: 12px; }
.cmsv-slide.is-open .cmsv-rail, .cmsv-slide.is-open .cmsv-shade, .cmsv-slide.is-open .cmsv-burst{ display: none; }
.cmsv-rows{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0 0 12px; }
.cmsv-rows dt{ font-size: 11px; color: rgba(255,255,255,.6); }
.cmsv-rows dd{ margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.cmsv-stock{ margin: 0 0 10px; font-size: 13px; color: rgba(255,255,255,.75); }
.cmsv-stock.out{ color: #fda4af; }
.cmsv-note{ margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,.62); }
.cmsv-note i{ margin-right: 4px; }
.cmsv-ctas{ display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.cmsv-btn{
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 13px 16px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 700; line-height: 1.2; text-align: center;
}
.cmsv-btn.primary{ background: var(--gradient, linear-gradient(90deg,#7dd3fc,#6366f1)); background-size: 200% 100%; color: #0b0b0d; }
.cmsv-btn.ghost{ background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.cmsv-btn.ghost:hover{ background: rgba(255,255,255,.1); }

/* ---------- last card / empty ---------- */
.cmsv-end{ display: flex; align-items: center; justify-content: center; background: linear-gradient(170deg, #11162b, #0b0b0d 70%); }
.cmsv-endbox{ width: 100%; max-width: 340px; padding: 24px; text-align: center; }
.cmsv-endico{
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 26px; color: #0b0b0d;
  background: var(--gradient, linear-gradient(90deg,#7dd3fc,#6366f1));
}
.cmsv-endbox h3{ margin: 0 0 8px; font: 700 20px/1.25 var(--font-display, Sora, system-ui, sans-serif); color: #fff; }
.cmsv-endbox p{ margin: 0; font-size: 14px; line-height: 1.5; color: rgba(255,255,255,.72); }

/* ---------- desktop up / down buttons ---------- */
.cmsv-nav{ display: none; }
@media (min-width: 700px) and (min-height: 560px) and (hover: hover) and (pointer: fine){
  .cmsv-nav{
    display: flex; flex-direction: column; gap: 12px; position: absolute; top: 50%; transform: translateY(-50%);
    right: max(16px, calc(50% - 235px - 72px));
  }
  .cmsv-navbtn{
    width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.12); color: #fff; transition: background .15s ease;
  }
  .cmsv-navbtn:hover{ background: rgba(255,255,255,.24); }
}

/* ---------- first-visit hint ---------- */
.cmsv-stage::after{
  content: "Swipe up for the next item"; position: absolute; z-index: 7; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 150px);
  padding: 9px 16px 9px 34px; border-radius: 999px; white-space: nowrap;
  background: rgba(0,0,0,.62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 600; color: #fff; pointer-events: none;
  opacity: 0; visibility: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 15l6-6 6 6' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; background-size: 16px 16px;
}
.cmsv.hint:not(.scrolled) .cmsv-stage::after{ visibility: visible; animation: cmsv-hint 2.4s ease .6s 2 both; }
@keyframes cmsv-hint{ 0%{ opacity: 0; transform: translate(-50%, 10px); } 25%,75%{ opacity: 1; transform: translate(-50%, 0); } 100%{ opacity: 0; transform: translate(-50%, -8px); } }

@media (prefers-reduced-motion: reduce){
  .cmsv *, .cmsv *::before, .cmsv *::after{ animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
