/* Fullscreen Image Viewer - Overlay activated when expandable-image is clicked */

/* Prevent body scroll when viewer is open */
body.fiv-open {
  overflow: hidden;
}

/* Cursor affordance on registered images */
[expandable-image] {
  cursor: zoom-in;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */

.fiv-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  user-select: none;
}

.fiv-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Header bar ──────────────────────────────────────────────────────────── */

.fiv-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  flex-shrink: 0;
}

.fiv-counter {
  color: white;
  margin-right: auto;
  padding-left: 4px;
}

.fiv-close {
  line-height: 1;
  transition: opacity 0.2s ease, background 0.2s ease;
}

/* ── Main image area ─────────────────────────────────────────────────────── */

.fiv-main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.fiv-main-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.fiv-main-track {
  display: flex;
  height: 100%;
  width: var(--fiv-track-width, 100vw);
  transform: translateX(var(--fiv-offset, 0%));
  transition: transform 0.4s ease-in-out;
}

.fiv-main-track.fiv-no-transition {
  transition: none;
}

.fiv-main-slide {
  flex-shrink: 0;
  width: 100vw;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 64px;
  box-sizing: border-box;
}

.fiv-main-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* ── Navigation arrows ───────────────────────────────────────────────────── */

.fiv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  transition: opacity 0.2s ease, background 0.2s ease;
  line-height: 1;
}

.fiv-arrow.left {
  left: 10px;
}

.fiv-arrow.right {
  right: 10px;
}

/* Single image: hide arrows */
.fiv-overlay.single-image .fiv-arrow {
  display: none;
}

/* ── Thumbnail strip ─────────────────────────────────────────────────────── */

.fiv-thumbs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 14px;
  flex-shrink: 0;
  background: var(--dark-back);
  backdrop-filter: var(--background-blur);
}

/* Single image: hide thumbs */
.fiv-overlay.single-image .fiv-thumbs-container {
  display: none;
}

.fiv-thumbs-arrow {
  transition: opacity 0.2s ease, background 0.2s ease;
}

.fiv-thumbs-wrapper {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  scroll-behavior: smooth;
  overflow-y: hidden;
  scrollbar-width: none;
}

.fiv-thumbs-wrapper::-webkit-scrollbar {
  display: none;
}

.fiv-thumbs {
  display: inline-flex;
  gap: 6px;
  padding: 2px 4px;
}

.fiv-thumb {
  width: 90px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.6;
  border: 2px solid transparent;
  transition: opacity 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  border-radius: var(--small-border-radius);
  flex-shrink: 0;
}

.fiv-thumb:hover {
  opacity: 0.85;
  animation: pulse 0.4s ease-in-out;
}

.fiv-thumb.active {
  opacity: 1;
  border-color: var(--lr-blue);
}

/* ── Comparison slide (fullscreen) ───────────────────────────────────────── */

.fiv-comparison-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  box-sizing: border-box;
}

/* Override comparison-slider defaults inside the viewer */
.fiv-comparison-wrap .comparison-slider {
  width: 100%;
  /* Constrain by available height so it never overflows the overlay */
  max-width: min(100%, calc((100vh - 200px) * 16 / 9));
  margin-bottom: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* ── Split-preview comparison thumbnail ─────────────────────────────────── */

.fiv-thumb-comparison {
  position: relative;
  width: 90px;
  height: 60px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.6;
  border: 2px solid transparent;
  transition: opacity 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  border-radius: var(--small-border-radius);
}

.fiv-thumb-comparison:hover {
  opacity: 0.85;
  animation: pulse 0.4s ease-in-out;
}

.fiv-thumb-comparison.active {
  opacity: 1;
  border-color: var(--lr-blue);
}

.fiv-thumb-cmp-before,
.fiv-thumb-cmp-after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.fiv-thumb-cmp-before { clip-path: inset(0 50% 0 0); }
.fiv-thumb-cmp-after  { clip-path: inset(0 0 0 50%); }

/* Centre-line divider on the split thumbnail */
.fiv-thumb-comparison::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.7);
  transform: translateX(-50%);
  pointer-events: none;
}
