/* ============================================================
   Dragenbit store effects
   1) Center-focus blur carousel
   2) Rotating product sphere
   Everything is scoped to .dbc / .dbs so nothing else on the
   site is affected.
   ============================================================ */

/* ---------- shared ---------- */
.dbc, .dbs { --db-brand: #667eea; --db-brand-2: #764ba2; --db-ink: #111827; --db-muted: #6b7280; box-sizing: border-box; }
.dbc *, .dbs *, .dbs *::before, .dbs *::after { box-sizing: border-box; }
.db-empty { margin: 0; padding: 26px 18px; text-align: center; color: var(--db-muted); font-size: 14px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 14px; }

/* ============================================================
   EFFECT 1 - center focus blur carousel
   ============================================================ */
.dbc { position: relative; width: 100%; padding: 0 6px; }

.dbc-viewport {
  position: relative;
  width: 100%;
  perspective: 1500px;
  perspective-origin: 50% 45%;
  overflow: hidden;
  touch-action: pan-y;
  outline: none;
  transition: height .25s ease;
}

.dbc-track { position: absolute; inset: 0; transform-style: preserve-3d; }

.dbc-card {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, .14), 0 2px 6px rgba(17, 24, 39, .06);
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  transition: transform .55s cubic-bezier(.22, .8, .24, 1), opacity .45s ease, filter .45s ease, box-shadow .45s ease;
  will-change: transform, filter, opacity;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: var(--db-ink);
  -webkit-tap-highlight-color: transparent;
}
.dbc-card.is-center {
  box-shadow: 0 34px 66px rgba(17, 24, 39, .30), 0 0 0 4px rgba(102, 126, 234, .22), 0 0 0 10px rgba(102, 126, 234, .07);
}
.dbc-card.is-center .dbc-cap { padding: 11px 13px 13px; }
.dbc-card.is-center .dbc-name { font-size: 15px; }
.dbc-card.is-center .dbc-price { font-size: 15px; }
.dbc-card:focus-visible { outline: 3px solid var(--db-brand); outline-offset: 3px; }

.dbc-img { display: block; width: 100%; flex: 1 1 auto; min-height: 0; object-fit: cover; background: linear-gradient(135deg, #eef2ff, #e5e7eb); pointer-events: none; }

.dbc-cap { flex: 0 0 auto; padding: 9px 11px 11px; background: #fff; text-align: left; }
.dbc-name {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--db-ink);
}
.dbc-price { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 800; color: var(--db-brand); }

/* arrows */
.dbc-arrow {
  position: absolute; top: 50%; z-index: 60;
  width: 42px; height: 42px; margin-top: -21px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 3px; border-radius: 50%;
  border: 1px solid rgba(102, 126, 234, .28);
  background: rgba(255, 255, 255, .96);
  color: var(--db-brand);
  font-size: 26px; line-height: 1; font-family: Arial, Helvetica, sans-serif;
  cursor: pointer; user-select: none;
  box-shadow: 0 8px 18px rgba(17, 24, 39, .14);
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
  -webkit-appearance: none; appearance: none;
}
.dbc-arrow:hover { background: #fff; transform: scale(1.07); }
.dbc-arrow:active { transform: scale(.95); }
.dbc-arrow:disabled { opacity: .35; cursor: default; transform: none; }
.dbc-prev { left: -4px; }
.dbc-next { right: -4px; }

/* ============================================================
   EFFECT 2 - rotating product sphere
   ============================================================ */
.dbs { position: relative; width: 100%; }

.dbs-scene {
  position: relative;
  width: 100%;
  height: 560px;
  perspective: 1500px;
  perspective-origin: 50% 50%;
  border-radius: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  /* no panel: the page wallpaper shows straight through */
  background: none;
  border: 0;
  box-shadow: none;
}
.dbs-scene.is-dragging { cursor: grabbing; }

/* optional dark stage */
.dbs[data-theme="dark"] .dbs-scene {
  background: none;
  border-color: transparent;
  box-shadow: none;
}

/* the 0s and 1s live behind the photos, inside the ball */
.dbs-matrix {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  /* below the photos (globe is z 2) */
  z-index: 2;
  opacity: 1;
  box-shadow: 0 0 44px rgba(0, 255, 130, .16), inset 0 0 30px rgba(0, 0, 0, .85);
}

.dbs-globe { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 2; transform-style: preserve-3d; will-change: transform; }

.dbs-card {
  position: absolute; left: 50%; top: 50%;
  margin: 0; padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, .92);
  background: #dbe2f5;
  box-shadow: 0 6px 16px rgba(17, 24, 39, .22);
  transform-origin: 50% 50%;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .25s ease, border-color .25s ease;
  will-change: opacity;
}
.dbs[data-theme="dark"] .dbs-card { border-color: rgba(255, 255, 255, .30); }
.dbs-card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.dbs-card:hover { border-color: var(--db-brand); box-shadow: 0 10px 22px rgba(102, 126, 234, .45); }
.dbs-card:focus-visible { outline: 3px solid var(--db-brand); outline-offset: 2px; }
.dbs-card.is-front { border-color: var(--db-brand); box-shadow: 0 0 0 3px rgba(102, 126, 234, .35), 0 12px 26px rgba(102, 126, 234, .4); }

.dbs-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 5; pointer-events: none;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .82); color: var(--db-muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 4px 12px rgba(17, 24, 39, .08);
  transition: opacity .4s ease;
  white-space: nowrap;
}
.dbs[data-theme="dark"] .dbs-hint { background: rgba(15, 23, 42, .72); color: #c7d2fe; }
.dbs-hint.is-hidden { opacity: 0; }

/* chain that holds the pulled-out product */
.dbs-tether {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none; z-index: 6;
  opacity: 0; transition: opacity .24s ease;
}
.dbs-tether.is-live { opacity: 1; }
.dbs-tether-group { animation: dbs-beam-breathe 3.4s ease-in-out infinite; }
@keyframes dbs-beam-breathe { 0%, 100% { opacity: .88; } 50% { opacity: 1; } }

/* light pulses running along the trail, towards the card */
.dbs-beam-flow { stroke-dasharray: 10 28; animation: dbs-beam-flow 1.15s linear infinite; }
@keyframes dbs-beam-flow { from { stroke-dashoffset: 38; } to { stroke-dashoffset: 0; } }

/* 0s and 1s riding the trail - same digits as the code in the ball */
.dbs-bit {
  fill: #b6ffd8;
  stroke: rgba(6, 45, 25, .6);
  stroke-width: .9;
  paint-order: stroke;
  font-family: "Courier New", monospace;
  font-weight: 700;
  animation: dbs-bit 1.7s ease-in-out infinite;
}
@keyframes dbs-bit {
  0%, 100% { opacity: .18; }
  40% { opacity: 1; }
  55% { opacity: .5; }
  70% { opacity: .95; }
}

.dbs-card.is-pulled {
  border-color: #00e676;
  box-shadow: 0 0 0 2px rgba(0, 230, 118, .55), 0 16px 34px rgba(0, 230, 118, .38);
}

/* the card that pops up when an image is tapped */
.dbs-focus {
  position: absolute; right: 14px; top: 50%;
  width: 268px; max-width: 62%;
  z-index: 20;
  transform: translate(14px, -50%) scale(.38);
  opacity: 0; pointer-events: none;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 26px 60px rgba(17, 24, 39, .30);
  transition: opacity .34s ease, transform .46s cubic-bezier(.22, .8, .24, 1);
}
.dbs-focus.is-open { opacity: 1; transform: translate(0, -50%) scale(1); pointer-events: auto; }
.dbs-focus-media { position: relative; background: #eef2f7; }
.dbs-focus-media img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.dbs-focus-close {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(17, 24, 39, .62); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0 0 2px;
  -webkit-appearance: none; appearance: none;
}
.dbs-focus-close:hover { background: rgba(17, 24, 39, .85); }
.dbs-focus-body { padding: 11px 13px 13px; text-align: left; }
.dbs-focus-name { margin: 0; font-size: 14px; font-weight: 800; line-height: 1.3; color: var(--db-ink); }
.dbs-focus-price { margin: 5px 0 0; font-size: 15px; font-weight: 800; color: var(--db-brand); }
.dbs-focus-meta { margin: 4px 0 0; font-size: 11.5px; font-weight: 600; color: var(--db-muted); }
.dbs-focus-open {
  display: none; width: 100%; margin-top: 10px; padding: 9px 10px;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--db-brand), var(--db-brand-2));
  color: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.dbs-focus-open.is-shown { display: block; }


/* glassy depth: the photos sink into the ball instead of sitting on a disc */
.dbs-orb-shade {
  position: absolute; z-index: 3; pointer-events: none;
  border-radius: 50%;
  box-shadow: inset 0 0 34px 10px rgba(14, 5, 2, .55), inset 0 0 90px 22px rgba(20, 8, 2, .35);
  background: radial-gradient(circle, rgba(6, 3, 1, 0) 74%, rgba(10, 4, 2, .30) 92%, rgba(8, 3, 1, .48) 100%);
}

/* optional ember-coloured code instead of green */
.dbs[data-code="ember"] .dbs-matrix {
  filter: hue-rotate(-116deg) saturate(1.55) brightness(1.1);
}

/* ============================================================
   phones
   ============================================================ */
@media (max-width: 640px) {
  .dbc-arrow { width: 36px; height: 36px; margin-top: -18px; font-size: 22px; }
  .dbc-prev { left: 0; }
  .dbc-next { right: 0; }
  .dbs-scene { height: 460px; border-radius: 18px; }
  .dbs-focus {
    right: 10px; left: 10px; width: auto; max-width: none;
    top: auto; bottom: 10px;
    display: flex; align-items: stretch;
    transform: translateY(12px) scale(.38);
  }
  .dbs-focus.is-open { transform: translateY(0) scale(1); }
  .dbs-focus-media { flex: 0 0 96px; }
  .dbs-focus-media img { aspect-ratio: 1 / 1; height: 100%; }
  .dbs-focus-body { flex: 1 1 auto; padding: 9px 11px; min-width: 0; }
  .dbs-focus-name { font-size: 12.5px; }
  .dbs-focus-price { font-size: 13.5px; margin-top: 3px; }
  .dbs-focus-open { margin-top: 7px; padding: 7px 8px; font-size: 11.5px; }
  .dbs-hint { font-size: 10.5px; bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .dbc-card, .dbs-focus, .dbc-viewport { transition-duration: .01ms !important; }
  .dbs-tether-group, .dbs-beam-flow, .dbs-bit { animation: none !important; }
}
