/* Example themes marquee — auto-scroll, device switcher, hover pause, magnify lightbox */

.example-themes-marquee {
  --etm-accent: #818cf8;
  --etm-accent-mauve: #c4b5fd;
  --etm-frame-ratio: 4 / 3;
  --etm-speed: 24;
  --etm-zoom: 1;
  position: relative;
  margin: 0 0 1.25rem;
  user-select: none;
}

.example-themes-marquee--compact {
  margin: 0 0 1.25rem;
}

/* ── Device switcher ─────────────────────────────────────────────── */

.example-themes-marquee__device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}

.example-themes-marquee__device-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  appearance: none;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.14) 0%,
    rgba(139, 92, 246, 0.08) 100%
  );
  color: #c7d2fe;
  border-radius: 999px;
  min-height: 2rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.18s ease;
}

.example-themes-marquee__device-btn[hidden] {
  display: none !important;
}

.example-themes-marquee__device-btn:hover,
.example-themes-marquee__device-btn:focus-visible {
  background: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.28) 0%,
    rgba(196, 181, 253, 0.16) 100%
  );
  border-color: rgba(167, 139, 250, 0.65);
  color: #ede9fe;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.22);
  outline: none;
}

.example-themes-marquee__device-btn:active {
  transform: scale(0.97);
}

.example-themes-marquee__device-icon {
  flex-shrink: 0;
  opacity: 0.9;
}

/* ── Viewport & track ──────────────────────────────────────────── */

.example-themes-marquee__viewport {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--site-rail-border, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.02);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

.example-themes-marquee__scroller {
  display: flex;
  width: max-content;
  will-change: transform;
}

.example-themes-marquee__track {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.35rem 0.25rem;
}

.example-themes-marquee__track--dup {
  padding-left: 0;
}

/* ── Slides & device frames ────────────────────────────────────── */

.example-themes-marquee__slide {
  flex: 0 0 auto;
  margin: 0;
  width: min(840px, 85vw);
  aspect-ratio: var(--etm-frame-ratio);
  overflow: visible;
  position: relative;
  z-index: 0;
  transform: scale(var(--etm-zoom, 1));
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

.example-themes-marquee__frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: border-radius 0.3s ease, box-shadow 0.3s ease;
}

.example-themes-marquee__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}

/* Magnify overlay button */
.example-themes-marquee__zoom-btn {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 10, 18, 0.72);
  color: #e0e7ff;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px) scale(0.94);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.example-themes-marquee__slide:hover .example-themes-marquee__zoom-btn,
.example-themes-marquee__slide:focus-within .example-themes-marquee__zoom-btn,
.example-themes-marquee__zoom-btn:focus-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.example-themes-marquee__zoom-btn:hover,
.example-themes-marquee__zoom-btn:focus-visible {
  background: rgba(99, 102, 241, 0.55);
  border-color: rgba(196, 181, 253, 0.65);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
  outline: none;
}

/* Desktop device mode — native 4:3 captures */
.example-themes-marquee[data-device="desktop"] {
  --etm-frame-ratio: 4 / 3;
}

.example-themes-marquee[data-device="desktop"] .example-themes-marquee__slide {
  width: min(840px, 85vw);
}

.example-themes-marquee[data-device="desktop"] .example-themes-marquee__frame {
  border-radius: 8px;
}

/* Tablet device mode — portrait 4:5 captures */
.example-themes-marquee[data-device="tablet"] {
  --etm-frame-ratio: 4 / 5;
}

.example-themes-marquee[data-device="tablet"] .example-themes-marquee__slide {
  width: min(340px, 38vw);
}

.example-themes-marquee[data-device="tablet"] .example-themes-marquee__frame {
  border-radius: 14px;
  border-width: 2px;
  border-color: rgba(196, 181, 253, 0.18);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.05);
}

/* Mobile device mode — 4:5 numbered theme cards */
.example-themes-marquee[data-device="mobile"] {
  --etm-frame-ratio: 4 / 5;
}

.example-themes-marquee[data-device="mobile"] .example-themes-marquee__slide {
  width: min(260px, 42vw);
}

.example-themes-marquee[data-device="mobile"] .example-themes-marquee__frame {
  border-radius: 18px;
  border-width: 3px;
  border-color: rgba(129, 140, 248, 0.22);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(196, 181, 253, 0.12),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.example-themes-marquee[data-device="mobile"] .example-themes-marquee__frame::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  z-index: 2;
  pointer-events: none;
}

.example-themes-marquee__slide:hover {
  --etm-zoom: 1.04;
  z-index: 2;
}

.example-themes-marquee__slide:hover .example-themes-marquee__frame {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(129, 140, 248, 0.2);
}

/* ── Edge scrub zones ──────────────────────────────────────────── */

.example-themes-marquee__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20%;
  z-index: 2;
  cursor: ew-resize;
}

.example-themes-marquee__edge--left {
  left: 0;
}

.example-themes-marquee__edge--right {
  right: 0;
}

.example-themes-marquee__hint {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  opacity: 0.85;
}

.example-themes-marquee__static {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.35rem;
}

.example-themes-marquee--reduced .example-themes-marquee__scroller {
  display: none;
}

.example-themes-marquee--reduced .example-themes-marquee__static {
  display: flex;
}

.example-themes-marquee--reduced .example-themes-marquee__edge {
  display: none;
}

.example-themes-marquee--hover-paused .example-themes-marquee__slide {
  --etm-zoom: 1.02;
}

.example-themes-marquee--scrubbing .example-themes-marquee__slide {
  --etm-zoom: 1.03;
}

.example-themes-marquee--dragging .example-themes-marquee__viewport,
.example-themes-marquee--dragging .example-themes-marquee__slide {
  cursor: grabbing;
}

.example-themes-marquee--dragging .example-themes-marquee__scroller {
  transition: none !important;
}

.example-themes-marquee--zoom-open .example-themes-marquee__viewport {
  pointer-events: none;
}

/* ── Magnify lightbox ──────────────────────────────────────────── */

.example-themes-marquee__lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.example-themes-marquee__lightbox[hidden] {
  display: none !important;
}

.example-themes-marquee__lightbox.is-active {
  pointer-events: auto;
}

.example-themes-marquee__lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(4, 6, 14, 0);
  cursor: zoom-out;
  transition: background 0.38s ease;
}

.example-themes-marquee__lightbox.is-active .example-themes-marquee__lightbox-backdrop {
  background: rgba(4, 6, 14, 0.88);
}

.example-themes-marquee__lightbox-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.example-themes-marquee__lightbox-img {
  position: fixed;
  top: 0;
  left: 0;
  object-fit: contain;
  border-radius: 10px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  will-change: transform, width, height, top, left;
  pointer-events: none;
}

.example-themes-marquee__lightbox-close {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  min-height: 2.35rem;
  padding: 0.4rem 0.85rem;
  background: rgba(12, 14, 24, 0.82);
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.28s ease 0.12s,
    transform 0.28s ease 0.12s,
    background 0.2s ease,
    border-color 0.2s ease;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.example-themes-marquee__lightbox.is-active .example-themes-marquee__lightbox-close {
  opacity: 1;
  transform: translateY(0);
}

.example-themes-marquee__lightbox-close:hover,
.example-themes-marquee__lightbox-close:focus-visible {
  background: rgba(99, 102, 241, 0.45);
  border-color: rgba(196, 181, 253, 0.55);
  outline: none;
}

body.example-themes-marquee-zoom-open {
  overflow: hidden;
}

/* ── Home fold variant ─────────────────────────────────────────── */

main.silo-main #example-themes.example-themes-marquee:not(.example-themes-marquee--home-fold) {
  padding-top: calc(var(--nav-height, 5.75rem) + 0.35rem);
  scroll-margin-top: calc(var(--nav-height, 5.75rem) + 0.35rem);
}

.example-themes-marquee:not(.example-themes-marquee--home-fold) .example-themes-marquee__hint {
  margin-bottom: 0.25rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__viewport {
  border-radius: 10px;
}

.example-themes-marquee--home-fold .example-themes-marquee__device {
  margin-bottom: 0.4rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__device-btn {
  min-height: 1.75rem;
  padding: 0.22rem 0.65rem;
  font-size: 0.65rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__track {
  padding: 0.2rem 0.15rem;
  gap: 0.65rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__controls {
  margin-top: 0.4rem;
  gap: 0.35rem 0.5rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__btn,
.example-themes-marquee--home-fold .example-themes-marquee__speed-btn {
  min-height: 1.9rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
}

.example-themes-marquee--home-fold .example-themes-marquee__hint {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

/* Home fold — desktop device (4:3, larger frames) */
.example-themes-marquee--home-fold[data-device="desktop"] .example-themes-marquee__slide {
  width: min(100%, 680px);
  height: min(48vh, 420px);
  max-height: min(48vh, 420px);
  aspect-ratio: auto;
}

@media (min-width: 1280px) {
  .example-themes-marquee--home-fold[data-device="desktop"] .example-themes-marquee__slide {
    width: min(100%, 800px);
    height: min(52vh, 500px);
    max-height: min(52vh, 500px);
  }
}

@media (min-width: 1600px) {
  .example-themes-marquee--home-fold[data-device="desktop"] .example-themes-marquee__slide {
    width: min(100%, 920px);
    height: min(56vh, 580px);
    max-height: min(56vh, 580px);
  }
}

/* Home fold — tablet device (4:5, taller) */
.example-themes-marquee--home-fold[data-device="tablet"] .example-themes-marquee__slide {
  width: min(100%, 300px);
  height: min(58vh, 440px);
  max-height: min(58vh, 440px);
  aspect-ratio: auto;
}

/* Home fold — mobile device (4:5 numbered cards) */
.example-themes-marquee--home-fold[data-device="mobile"] .example-themes-marquee__slide {
  width: min(100%, 240px);
  height: min(62vh, 460px);
  max-height: min(62vh, 460px);
  aspect-ratio: auto;
}

@media (max-width: 900px) {
  .example-themes-marquee--home-fold[data-device="desktop"] .example-themes-marquee__slide {
    width: min(94vw, 680px);
    height: min(42vh, 320px);
    max-height: min(42vh, 320px);
  }

  .example-themes-marquee--home-fold[data-device="tablet"] .example-themes-marquee__slide {
    width: min(56vw, 320px);
    height: min(60vh, 460px);
    max-height: min(60vh, 460px);
  }

  .example-themes-marquee--home-fold[data-device="mobile"] .example-themes-marquee__slide {
    width: min(52vw, 240px);
    height: min(64vh, 480px);
    max-height: min(64vh, 480px);
  }
}

@media (max-width: 640px) {
  .example-themes-marquee__slide {
    width: min(92vw, 640px);
  }

  .example-themes-marquee[data-device="mobile"] .example-themes-marquee__slide {
    width: min(240px, 48vw);
  }

  .example-themes-marquee--home-fold[data-device="mobile"] .example-themes-marquee__slide {
    width: min(100%, 220px);
    height: min(66vh, 500px);
    max-height: min(66vh, 500px);
  }

  .example-themes-marquee__zoom-btn {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Controls ──────────────────────────────────────────────────── */

.example-themes-marquee__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.65rem;
  margin: 0.65rem 0 0;
}

.example-themes-marquee__btn,
.example-themes-marquee__speed-btn {
  appearance: none;
  border: 1px solid var(--site-rail-border, rgba(255, 255, 255, 0.14));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted, #cbd5e1);
  border-radius: 999px;
  min-height: 2.1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.example-themes-marquee__btn[data-marquee-control="prev"],
.example-themes-marquee__btn[data-marquee-control="next"] {
  min-width: 2.35rem;
  padding-inline: 0.55rem;
  font-size: 0.9rem;
  line-height: 1;
}

.example-themes-marquee__btn:hover,
.example-themes-marquee__speed-btn:hover,
.example-themes-marquee__btn:focus-visible,
.example-themes-marquee__speed-btn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #f8fafc;
  outline: none;
}

.example-themes-marquee__speed {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.15rem;
}

.example-themes-marquee__speed-btn {
  min-width: 2.35rem;
  padding-inline: 0.55rem;
}

.example-themes-marquee__speed-btn.is-active,
.example-themes-marquee__speed-btn[aria-pressed="true"] {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(129, 140, 248, 0.55);
  color: #e0e7ff;
}

.example-themes-marquee--stopped .example-themes-marquee__btn--toggle {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
}

.example-themes-marquee--reduced .example-themes-marquee__controls,
.example-themes-marquee--reduced .example-themes-marquee__device {
  display: none;
}

@media (max-width: 640px) {
  .example-themes-marquee__controls {
    gap: 0.4rem;
  }

  .example-themes-marquee__btn--toggle {
    order: 3;
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .example-themes-marquee__edge {
    display: none;
  }

  .example-themes-marquee__slide:hover {
    --etm-zoom: 1;
  }

  .example-themes-marquee__slide:hover .example-themes-marquee__frame {
    box-shadow:
      0 4px 24px rgba(0, 0, 0, 0.35),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }

  .example-themes-marquee__lightbox-img {
    transition: none !important;
  }
}
