/* =============================================================
   CTL Photo Slider — Frontend Styles
   All rules are scoped under .ctl-slider-root to prevent
   any leakage into WordPress theme styles.
   ============================================================= */

/* ── Reset & custom properties ── */
.ctl-slider-root *,
.ctl-slider-root *::before,
.ctl-slider-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.ctl-slider-root {
  --ctl-transition:    0.45s cubic-bezier(0.4, 0, 0.2, 1);
  --ctl-arrow-size:    44px;
  --ctl-dot-size:      10px;
  --ctl-dot-gap:       8px;
  --ctl-thumb-w:       82px;
  --ctl-thumb-h:       58px;
  --ctl-thumb-gap:     8px;
  --ctl-radius:        6px;
  --ctl-bottom-bg:     #1a1a1a;  /* overridden inline by block attributes */

  font-family: system-ui, -apple-system, sans-serif;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #111;
  border-radius: var(--ctl-radius);
  user-select: none;
  position: relative;
}

/* ── Stage ── */
.ctl-slider-root .ctl-stage {
  position: relative;
  width: 100%;
  /* Use custom height when set, otherwise fall back to 16:9 aspect ratio */
  height: var(--ctl-stage-height, auto);
  aspect-ratio: var(--ctl-stage-height, 16 / 9);
  overflow: hidden;
  background: var(--ctl-stage-bg, #000);
}
/* When a fixed height is set, disable the aspect-ratio so height wins */
.ctl-slider-root[style*="--ctl-stage-height"] .ctl-stage {
  aspect-ratio: unset;
}

/* ── Track (infinite-loop: clones prepended/appended) ── */
.ctl-slider-root .ctl-track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform var(--ctl-transition);
  will-change: transform;
}

/* ── Slides ── */
.ctl-slider-root .ctl-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
}

.ctl-slider-root .ctl-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* default — overridden by data-fit below */
  object-position: var(--ctl-focal, 50% 50%); /* per-slide focal point */
  display: block;
  pointer-events: none;
}

/* ── Image fit modes (set via data-fit on the root) ── */

/* Crop to fill: image fills the frame, edges cropped as needed */
.ctl-slider-root[data-fit="cover"] .ctl-slide img {
  object-fit: cover;
  background: none;
}

/* Fit inside: whole image visible, letterbox area is always transparent
   so the stage background color shows through behind the image */
.ctl-slider-root[data-fit="contain"] .ctl-slide {
  background: transparent;
}
.ctl-slider-root[data-fit="contain"] .ctl-slide img {
  object-fit: contain;
}

/* Stretch to fill: image is stretched to fill frame exactly, no cropping */
.ctl-slider-root[data-fit="fill"] .ctl-slide img {
  object-fit: fill;
}

/* ── Caption ── */
.ctl-slider-root .ctl-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 60px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: clamp(12px, 2vw, 15px);
  text-align: center;
  pointer-events: none;
  min-height: 54px;
}

/* ══════════════════════════════════════════
   ARROW STYLES
   Three variants: circle | square | minimal
   ══════════════════════════════════════════ */
.ctl-slider-root .ctl-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--ctl-arrow-size);
  height: var(--ctl-arrow-size);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  color: #fff;
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
  border: none;
  padding: 0;
  background: transparent;
}

.ctl-slider-root .ctl-arrow svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.ctl-slider-root .ctl-arrow--prev { left: 12px; }
.ctl-slider-root .ctl-arrow--next { right: 12px; }

/* — circle — */
.ctl-slider-root[data-arrow="circle"] .ctl-arrow {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
}
.ctl-slider-root[data-arrow="circle"] .ctl-arrow:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: translateY(-50%) scale(1.08);
}

/* — square — */
.ctl-slider-root[data-arrow="square"] .ctl-arrow {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 4px;
}
.ctl-slider-root[data-arrow="square"] .ctl-arrow:hover {
  background: rgba(0, 0, 0, 0.80);
  transform: translateY(-50%) scale(1.06);
}

/* — minimal — */
.ctl-slider-root[data-arrow="minimal"] .ctl-arrow {
  background: transparent;
  border: none;
  opacity: 0.7;
  --ctl-arrow-size: 36px;
}
.ctl-slider-root[data-arrow="minimal"] .ctl-arrow svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}
.ctl-slider-root[data-arrow="minimal"] .ctl-arrow:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.12);
}

/* ── Dot navigation ── */
.ctl-slider-root .ctl-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--ctl-dot-gap);
  padding: 10px 0;
  background: var(--ctl-bottom-bg);
}

.ctl-slider-root .ctl-dot {
  width: var(--ctl-dot-size);
  height: var(--ctl-dot-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.30);
  border: none;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.ctl-slider-root .ctl-dot:hover {
  background: rgba(255, 255, 255, 0.60);
  transform: scale(1.2);
}
.ctl-slider-root .ctl-dot.is-active {
  background: #ffffff;
  transform: scale(1.3);
}

/* ── Thumbnail strip ── */
.ctl-slider-root .ctl-thumbs-wrapper {
  background: var(--ctl-bottom-bg);
  padding: 0 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.ctl-slider-root .ctl-thumbs-wrapper::-webkit-scrollbar { height: 4px; }
.ctl-slider-root .ctl-thumbs-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.ctl-slider-root .ctl-thumbs {
  display: flex;
  gap: var(--ctl-thumb-gap);
  padding: 0 10px;
  min-width: max-content;
}

.ctl-slider-root .ctl-thumb {
  flex-shrink: 0;
  width: var(--ctl-thumb-w);
  height: var(--ctl-thumb-h);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, opacity 0.2s, transform 0.2s;
  opacity: 0.55;
}
.ctl-slider-root .ctl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.ctl-slider-root .ctl-thumb:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}
.ctl-slider-root .ctl-thumb.is-active {
  border-color: #ffffff;
  opacity: 1;
  transform: translateY(-2px);
}

/* ── Lightbox — pointer cursor when enabled ── */
.ctl-slider-root[data-lightbox="true"] .ctl-slide {
  cursor: zoom-in;
}

/* ── Lightbox overlay ── */
.ctl-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ctlLbFadeIn 0.2s ease;
  outline: none;
}
@keyframes ctlLbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Main image */
.ctl-lightbox-img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
  transition: opacity 0.15s ease;
  display: block;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.16s ease, transform 0.16s ease;
  display: block;
}

/* Close button */
.ctl-lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctl-lightbox-close:hover { opacity: 1; background: rgba(0,0,0,0.7); }

/* Prev / Next arrows */
.ctl-lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s, transform 0.15s;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ctl-lightbox-arrow:hover {
  opacity: 1;
  background: rgba(0,0,0,0.75);
  transform: translateY(-50%) scale(1.06);
}
.ctl-lightbox-arrow--prev { left: 16px; }
.ctl-lightbox-arrow--next { right: 16px; }

/* Caption */
.ctl-lightbox-caption {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  max-width: 80vw;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Counter (e.g. "2 / 7") */
.ctl-lightbox-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-family: system-ui, sans-serif;
  pointer-events: none;
  letter-spacing: 0.05em;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .ctl-slider-root {
    --ctl-arrow-size: 36px;
    --ctl-thumb-w:    64px;
    --ctl-thumb-h:    46px;
    --ctl-dot-size:   8px;
  }
  .ctl-slider-root .ctl-arrow--prev { left: 6px; }
  .ctl-slider-root .ctl-arrow--next { right: 6px; }
  .ctl-slider-root .ctl-caption { padding: 22px 46px 10px; }
}
