/**
 * Easy Cloud Zoom 2.0 — vanilla CSS (prefix: jx-ecz)
 * Browser-chrome look inspired by Pop Any Article modern theme
 */
:root {
  --jx-ecz-accent: #1819ed;
  --jx-ecz-control: rgba(15, 18, 28, 0.72);
  --jx-ecz-radius: 16px;
  --jx-ecz-bg: #ffffff;
  --jx-ecz-text: #101828;
  --jx-ecz-muted: #667085;
  --jx-ecz-border: rgba(24, 25, 237, 0.1);
  --jx-ecz-chrome: #f4f6fb;
  --jx-ecz-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 18px 48px rgba(16, 24, 40, 0.12),
    0 6px 18px color-mix(in srgb, var(--jx-ecz-accent) 10%, transparent);
}

.jx-ecz {
  --jx-ecz-gap: 14px;
  --jx-ecz-thumb-size: 80px;
  --jx-ecz-nav-size: 1.85rem;
  --jx-ecz-thumbs-pad: 4px;
  width: 100%;
  max-width: 100%;
  margin: 1.25rem 0;
  color: var(--jx-ecz-text);
  box-sizing: border-box;
}

.jx-ecz *,
.jx-ecz *::before,
.jx-ecz *::after {
  box-sizing: border-box;
}

/* —— Browser chrome shell —— */
.jx-ecz--browser {
  background: var(--jx-ecz-bg);
  border: 1px solid var(--jx-ecz-border);
  border-radius: var(--jx-ecz-radius);
  box-shadow: var(--jx-ecz-shadow);
  overflow: hidden;
}

.jx-ecz__chrome {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(180deg, #fbfcfe 0%, var(--jx-ecz-chrome) 100%);
  border-bottom: 1px solid var(--jx-ecz-border);
}

.jx-ecz__traffic {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.jx-ecz__dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.jx-ecz__dot--close { background: #ff5f57; }
.jx-ecz__dot--min { background: #febc2e; }
.jx-ecz__dot--max { background: #28c840; }

.jx-ecz__chrome-label {
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--jx-ecz-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 3.2rem;
}

.jx-ecz__body {
  display: flex;
  gap: var(--jx-ecz-gap);
  padding: 1rem;
  align-items: stretch;
}

.jx-ecz--thumbs-left .jx-ecz__body { flex-direction: row-reverse; }
.jx-ecz--thumbs-right .jx-ecz__body { flex-direction: row; }
.jx-ecz--thumbs-top .jx-ecz__body { flex-direction: column-reverse; }
.jx-ecz--thumbs-bottom .jx-ecz__body { flex-direction: column; }

.jx-ecz__stage {
  flex: 1 1 auto;
  min-width: 0;
}

.jx-ecz__viewport {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0d12;
  cursor: crosshair;
  touch-action: none;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.jx-ecz__viewport:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--jx-ecz-accent) 35%, transparent);
}

.jx-ecz__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 640px);
  object-fit: contain;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.2s ease;
}

.jx-ecz__img.is-loading {
  opacity: 0.4;
}

.jx-ecz__lens {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.25);
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 2;
}

.jx-ecz--mode-inner .jx-ecz__lens {
  inset: 0;
  width: auto !important;
  height: auto !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.jx-ecz__hint {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(15, 18, 28, 0.72);
  color: #fff;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 3;
}

.jx-ecz__viewport:not(.is-zooming) .jx-ecz__hint {
  opacity: 0.85;
}

.jx-ecz__caption {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--jx-ecz-text);
}

.jx-ecz__thumbs {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.jx-ecz--thumbs-right .jx-ecz__thumbs,
.jx-ecz--thumbs-left .jx-ecz__thumbs {
  flex-direction: column;
  /* Room for active ring so it doesn't look like a scrollbar gutter */
  width: calc(var(--jx-ecz-thumb-size) + (var(--jx-ecz-thumbs-pad) * 2));
  padding-inline: var(--jx-ecz-thumbs-pad);
  max-height: min(72vh, 640px);
}

.jx-ecz--thumbs-top .jx-ecz__thumbs,
.jx-ecz--thumbs-bottom .jx-ecz__thumbs {
  flex-direction: row;
  width: 100%;
  height: var(--jx-ecz-thumb-size);
}

.jx-ecz__track {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: auto;
  scroll-behavior: smooth;
  /* Nav buttons scroll the track — hide native scrollbar chrome */
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0;
}

.jx-ecz__track::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.jx-ecz--thumbs-right .jx-ecz__track,
.jx-ecz--thumbs-left .jx-ecz__track {
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.jx-ecz--thumbs-top .jx-ecz__track,
.jx-ecz--thumbs-bottom .jx-ecz__track {
  flex-direction: row;
  height: var(--jx-ecz-thumb-size);
}

.jx-ecz__thumb {
  flex: 0 0 auto;
  width: var(--jx-ecz-thumb-size);
  height: var(--jx-ecz-thumb-size);
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #eef1f6;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jx-ecz__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  image-rendering: auto;
}

.jx-ecz__thumb:hover,
.jx-ecz__thumb:focus-visible {
  border-color: color-mix(in srgb, var(--jx-ecz-accent) 45%, transparent);
  outline: none;
}

.jx-ecz__thumb.is-active {
  border-color: var(--jx-ecz-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--jx-ecz-accent) 18%, transparent);
}

.jx-ecz__nav {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--jx-ecz-nav-size);
  height: var(--jx-ecz-nav-size);
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--jx-ecz-border) 80%, #98a2b3);
  border-radius: 10px;
  background: #fff;
  color: #344054;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.jx-ecz__nav svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

/* Match nav width/height to the thumbnail strip axis */
.jx-ecz__thumbs--vertical .jx-ecz__nav {
  width: var(--jx-ecz-thumb-size);
  height: var(--jx-ecz-nav-size);
}

.jx-ecz__thumbs--horizontal .jx-ecz__nav {
  width: var(--jx-ecz-nav-size);
  height: var(--jx-ecz-thumb-size);
}

.jx-ecz__nav:hover,
.jx-ecz__nav:focus-visible {
  border-color: var(--jx-ecz-accent);
  color: var(--jx-ecz-accent);
  outline: none;
}

.jx-ecz__nav.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Themes */
.jx-ecz--theme-minimal {
  --jx-ecz-radius: 8px;
  --jx-ecz-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --jx-ecz-chrome: #f8fafc;
}

.jx-ecz--theme-dark {
  --jx-ecz-bg: #12141a;
  --jx-ecz-text: #f3f5f9;
  --jx-ecz-muted: #98a2b3;
  --jx-ecz-border: rgba(255, 255, 255, 0.08);
  --jx-ecz-chrome: #1a1d24;
  --jx-ecz-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.jx-ecz--theme-dark .jx-ecz__thumb {
  background: #0b0d12;
}

.jx-ecz--theme-dark .jx-ecz__nav {
  background: #1a1d24;
  color: #f3f5f9;
}

.jx-ecz--soft .jx-ecz__img {
  filter: contrast(0.96) saturate(0.98);
}

@media (max-width: 720px) {
  .jx-ecz__body {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .jx-ecz--thumbs-right .jx-ecz__body,
  .jx-ecz--thumbs-left .jx-ecz__body {
    flex-direction: column;
  }

  .jx-ecz {
    --jx-ecz-thumb-size: 68px;
  }

  .jx-ecz--thumbs-right .jx-ecz__thumbs,
  .jx-ecz--thumbs-left .jx-ecz__thumbs {
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: var(--jx-ecz-thumb-size);
    max-height: none;
  }

  .jx-ecz--thumbs-right .jx-ecz__track,
  .jx-ecz--thumbs-left .jx-ecz__track {
    flex-direction: row;
    width: auto;
    height: var(--jx-ecz-thumb-size);
  }

  /* Vertical galleries stack on phones — flip chevrons to left/right */
  .jx-ecz__thumbs--vertical .jx-ecz__nav {
    width: var(--jx-ecz-nav-size);
    height: var(--jx-ecz-thumb-size);
  }

  .jx-ecz__thumbs--vertical .jx-ecz__nav--prev svg,
  .jx-ecz__thumbs--vertical .jx-ecz__nav--next svg {
    transform: rotate(-90deg);
  }

  .jx-ecz__img {
    max-height: min(52vh, 420px);
  }

  .jx-ecz__hint {
    display: none;
  }

  .jx-ecz__caption {
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .jx-ecz__body {
    padding: 0.55rem;
  }

  .jx-ecz__img {
    max-height: min(48vh, 360px);
  }
}

/* Short landscape phones / small laptop heights */
@media (max-height: 480px) {
  .jx-ecz__img {
    max-height: min(62vh, 260px);
  }

  .jx-ecz--thumbs-right .jx-ecz__thumbs,
  .jx-ecz--thumbs-left .jx-ecz__thumbs {
    max-height: min(62vh, 260px);
  }
}
