/* OPhotobox 1.0.0 | Copyright (c) 2026 欧阳博客 | MIT License */
:root {
  --opb-duration: 300ms;
  --opb-backdrop: rgba(8, 10, 16, .94);
  --opb-panel: rgba(34, 37, 45, .78);
  --opb-text: #f7f7f8;
  --opb-muted: rgba(255, 255, 255, .72);
  --opb-hover: rgba(255, 255, 255, .16);
  --opb-caption: linear-gradient(transparent, rgba(0, 0, 0, .76));
  --opb-ease: cubic-bezier(.22, .61, .36, 1);
}

[data-opb-theme="light"] {
  --opb-backdrop: rgba(245, 246, 249, .96);
  --opb-panel: rgba(255, 255, 255, .84);
  --opb-text: #20232a;
  --opb-muted: rgba(32, 35, 42, .7);
  --opb-hover: rgba(0, 0, 0, .08);
  --opb-caption: linear-gradient(transparent, rgba(255, 255, 255, .92));
}

@media (prefers-color-scheme: light) {
  :root:not([data-opb-theme="dark"]) {
    --opb-backdrop: rgba(245, 246, 249, .96);
    --opb-panel: rgba(255, 255, 255, .84);
    --opb-text: #20232a;
    --opb-muted: rgba(32, 35, 42, .7);
    --opb-hover: rgba(0, 0, 0, .08);
    --opb-caption: linear-gradient(transparent, rgba(255, 255, 255, .92));
  }
}

.opb-overlay,
.opb-overlay * { box-sizing: border-box; }

.opb-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  color: var(--opb-text);
  background: var(--opb-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--opb-duration) var(--opb-ease), visibility 0s linear var(--opb-duration);
  -webkit-tap-highlight-color: transparent;
}

.opb-overlay.opb-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.opb-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 64px 72px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.opb-slide {
  position: absolute;
  inset: 64px 72px;
  display: grid;
  place-items: center;
  color: var(--opb-text);
  opacity: 0;
  transform: scale(.975);
  transition: opacity var(--opb-duration) var(--opb-ease), transform var(--opb-duration) var(--opb-ease);
}

.opb-slide.opb-slide-active { opacity: 1; transform: scale(1); }
.opb-slide img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: 0 !important;
  object-fit: contain;
  transform: translate(-50%, -50%);
  transform-origin: center;
  cursor: grab;
  transition: transform .18s var(--opb-ease);
  will-change: transform;
}
.opb-slide img.opb-dragging { cursor: grabbing; transition: none; }
.opb-error { font: 15px/1.5 system-ui, sans-serif; }

.opb-loader {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(127, 127, 127, .3);
  border-top-color: var(--opb-text);
  border-radius: 50%;
  animation: opb-spin .7s linear infinite;
}
.opb-loader[hidden] { display: none; }
@keyframes opb-spin { to { transform: rotate(360deg); } }

.opb-toolbar {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 4;
  display: flex;
  gap: 3px;
  padding: 5px 7px;
  border: 1px solid rgba(127, 127, 127, .18);
  border-radius: 12px;
  background: var(--opb-panel);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.opb-button,
.opb-close,
.opb-nav,
.opb-share-item {
  border: 0;
  color: var(--opb-text);
  background: transparent;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.opb-button,
.opb-close,
.opb-nav {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}
.opb-button:hover,
.opb-close:hover,
.opb-nav:hover { background: var(--opb-hover); transform: scale(1.08); }
.opb-button:focus-visible,
.opb-close:focus-visible,
.opb-nav:focus-visible,
.opb-share-item:focus-visible { outline: 2px solid #4f8cff; outline-offset: 2px; }
.opb-button:disabled { cursor: default; opacity: .32; transform: none; }
.opb-nav:disabled { cursor: default; opacity: .3; transform: translateY(-50%); }
.opb-button-active { background: var(--opb-hover); }
.opb-button svg,
.opb-close svg,
.opb-nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.opb-button svg .opb-fill { fill: currentColor; stroke: none; }
.opb-reset { width: auto; min-width: 46px; padding: 0 6px; font-size: 12px; font-weight: 650; }

.opb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  border-radius: 50%;
  background: var(--opb-panel);
  backdrop-filter: blur(12px);
}
.opb-close:hover { background: #d94343; }

.opb-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--opb-panel);
  backdrop-filter: blur(12px);
}
.opb-nav:hover { transform: translateY(-50%) scale(1.08); }
.opb-nav-prev { left: 16px; transform: translateY(-50%); }
.opb-nav-next { right: 16px; transform: translateY(-50%); }

.opb-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  z-index: 4;
  color: var(--opb-muted);
  font: 500 13px/1 system-ui, sans-serif;
  letter-spacing: .06em;
  transform: translateX(-50%);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.opb-has-caption .opb-counter { bottom: 52px; }

.opb-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  padding: 48px 24px 16px;
  color: var(--opb-text);
  background: var(--opb-caption);
  font: 400 15px/1.5 system-ui, sans-serif;
  text-align: center;
  pointer-events: none;
}
.opb-caption[hidden] { display: none; }

.opb-share-menu {
  position: absolute;
  top: 62px;
  right: 18px;
  z-index: 7;
  display: grid;
  min-width: 148px;
  padding: 6px;
  border: 1px solid rgba(127, 127, 127, .18);
  border-radius: 11px;
  background: var(--opb-panel);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  backdrop-filter: blur(16px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.opb-share-menu.opb-share-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
.opb-share-item { padding: 9px 11px; border-radius: 7px; font-size: 13px; text-align: left; }
.opb-share-item:hover { background: var(--opb-hover); }

.opb-overlay [hidden] { display: none !important; }

@media (max-width: 768px) {
  .opb-stage { padding: 54px 42px; }
  .opb-slide { inset: 54px 42px; }
  .opb-toolbar { top: 9px; gap: 1px; padding: 4px; }
  .opb-button { width: 32px; height: 32px; }
  .opb-reset { width: auto; min-width: 42px; }
  .opb-close { top: 8px; right: 8px; width: 34px; height: 34px; }
  .opb-nav { width: 36px; height: 36px; }
  .opb-nav-prev { left: 5px; }
  .opb-nav-next { right: 5px; }
  .opb-caption { padding: 38px 14px 12px; font-size: 13px; }
}

@media (max-width: 480px) {
  .opb-stage { padding: 48px 6px; }
  .opb-slide { inset: 48px 6px; }
  .opb-button { width: 29px; height: 30px; }
  .opb-button svg { width: 17px; height: 17px; }
  .opb-reset { width: auto; min-width: 38px; font-size: 11px; }
  .opb-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .opb-overlay,
  .opb-slide,
  .opb-slide img,
  .opb-share-menu { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
