/* NopsImageViewer - Self-hosted Lightbox with Bottom Proportional Zoom Toolbar */

.post-content[view-image] img:not([no-view]) {
  cursor: zoom-in;
}

.nops-iv-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.nops-iv-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0));
}

.nops-iv-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.nops-iv-counter {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-variant-numeric: tabular-nums;
}

.nops-iv-caption {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.78);
}

.nops-iv-icon-btn {
  pointer-events: auto;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.72);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nops-iv-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.36);
}

.nops-iv-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 56px 64px 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nops-iv-loading {
  position: absolute;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.75);
}

.nops-iv-img {
  display: block;
  flex-shrink: 0;
  max-width: none !important;
  max-height: none !important;
  border-radius: 2px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transform-origin: center center;
  will-change: transform;
  transition: opacity 0.15s ease;
  cursor: default;
}

.nops-iv-img--smooth {
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s ease;
}

.nops-iv-img--draggable {
  cursor: grab;
}

.nops-iv-img--dragging {
  cursor: grabbing;
}

.nops-iv-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.72);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nops-iv-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.36);
}

.nops-iv-nav--prev {
  left: 16px;
}

.nops-iv-nav--next {
  right: 16px;
}

.nops-iv-nav[hidden],
.nops-iv-counter[hidden],
.nops-iv-caption[hidden],
.nops-iv-loading[hidden] {
  display: none !important;
}

.nops-iv-toolbar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  color: #f8fafc;
}

.nops-iv-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nops-iv-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.nops-iv-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(248, 250, 252, 0.9);
  font-size: 13px;
  line-height: 1;
  height: 32px;
  min-width: 32px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.nops-iv-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.nops-iv-btn:focus-visible,
.nops-iv-icon-btn:focus-visible,
.nops-iv-nav:focus-visible,
.nops-iv-slider:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.nops-iv-btn.is-active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}

.nops-iv-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nops-iv-step {
  font-size: 16px;
  font-weight: 600;
  padding: 0;
  width: 32px;
  flex-shrink: 0;
}

.nops-iv-slider-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 176px;
  height: 32px;
  margin: 0 2px;
  flex-shrink: 0;
}

.nops-iv-slider-tick {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 10px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  z-index: 1;
}

.nops-iv-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  touch-action: pan-x;
  --nops-iv-slider-progress: 50%;
}

.nops-iv-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #3b82f6 0%,
    #3b82f6 var(--nops-iv-slider-progress, 50%),
    rgba(255, 255, 255, 0.24) var(--nops-iv-slider-progress, 50%),
    rgba(255, 255, 255, 0.24) 100%
  );
}

.nops-iv-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.nops-iv-slider:hover::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.24), 0 1px 4px rgba(0, 0, 0, 0.45);
}

.nops-iv-slider:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.14);
}

.nops-iv-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #3b82f6 0%,
    #3b82f6 var(--nops-iv-slider-progress, 50%),
    rgba(255, 255, 255, 0.24) var(--nops-iv-slider-progress, 50%),
    rgba(255, 255, 255, 0.24) 100%
  );
}

.nops-iv-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.nops-iv-slider:hover::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.24), 0 1px 4px rgba(0, 0, 0, 0.45);
}

.nops-iv-slider:active::-moz-range-thumb {
  cursor: grabbing;
  transform: scale(1.14);
}

.nops-iv-scale-label {
  min-width: 48px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Mobile responsive layout (<= 640px, including 375px viewports) */
@media (max-width: 640px) {
  .nops-iv-stage {
    padding: 52px 12px 96px;
  }

  .nops-iv-nav {
    width: 36px;
    height: 36px;
    font-size: 22px;
    top: 46%;
  }

  .nops-iv-nav--prev {
    left: 8px;
  }

  .nops-iv-nav--next {
    right: 8px;
  }

  .nops-iv-toolbar {
    bottom: 12px;
    border-radius: 16px;
    padding: 6px 10px;
    gap: 6px;
    width: calc(100vw - 20px);
    max-width: 420px;
    flex-wrap: nowrap;
  }

  .nops-iv-divider {
    height: 16px;
  }

  .nops-iv-slider-group {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
  }

  .nops-iv-slider-wrap {
    flex: 1 1 88px;
    width: auto;
    min-width: 72px;
    height: 36px;
    margin: 0;
  }

  .nops-iv-slider {
    height: 36px;
  }

  .nops-iv-slider::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    margin-top: -7px;
  }

  .nops-iv-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }

  .nops-iv-quick-group {
    flex-shrink: 0;
    gap: 4px;
  }

  .nops-iv-btn {
    height: 30px;
    min-width: 28px;
    padding: 0 7px;
    font-size: 12px;
  }

  .nops-iv-step {
    width: 28px;
    height: 30px;
    font-size: 15px;
  }

  .nops-iv-scale-label {
    min-width: 38px;
    font-size: 12px;
  }
}
