/*
 * The fullscreen viewer — HistoryLightbox's styles.
 *
 * These lived in bn_generate-image.css, which exactly one page loads. The
 * component is shared (Generate Image, Character Album History, and now a
 * collection's media grid), so the stylesheet has to be too: the markup
 * rendering unstyled on a page that imports the component is not a bug you
 * find by reading the component.
 *
 * Every selector here is prefixed `hst-`, so loading this alongside any
 * page stylesheet is safe.
 */

/* ========== LIGHTBOX ========== */
.hst-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.95);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.hst-lightbox.open {
  display: flex;
}

.hst-lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--neutral-700);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s;
}

.hst-lb-close:hover {
  background: var(--neutral-600);
}

.hst-lb-close svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.hst-lb-counter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: var(--neutral-400);
  z-index: 2;
}

.hst-lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--neutral-700);
  border: 1px solid var(--neutral-600);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, opacity 0.2s;
}

.hst-lb-arrow:hover {
  background: var(--neutral-600);
}

.hst-lb-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

.hst-lb-arrow svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  fill: none;
}

.hst-lb-prev {
  left: 16px;
}

.hst-lb-next {
  right: 16px;
}

.hst-lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 70px 80px 100px;
  cursor: pointer;
}

.hst-lb-stage img,
.hst-lb-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.2s;
  cursor: default;
}

/* A video needs its own cursor: `default` would say the controls are not
   clickable, which they are. */
.hst-lb-stage video { cursor: auto; }

.hst-lb-thumbs {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
  padding: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  max-width: 90%;
  overflow-x: auto;
}

.hst-lb-thumbs::-webkit-scrollbar {
  height: 4px;
}

.hst-lb-thumbs::-webkit-scrollbar-thumb {
  background: var(--neutral-600);
  border-radius: 2px;
}

.hst-lb-thumb {
  width: 48px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.hst-lb-thumb.active {
  border-color: var(--purple-400);
  opacity: 1;
}

.hst-lb-thumb:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.hst-lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .hst-lb-stage {
    padding: 60px 16px 100px;
  }
  
  .hst-lb-arrow {
    width: 36px;
    height: 36px;
  }
  
  .hst-lb-prev {
    left: 8px;
  }
  
  .hst-lb-next {
    right: 8px;
  }
}
