/**
 * 工具详情截图轮播（独立于 Vite 构建，服务器无 npm 时也能即时生效）
 * 列表态：固定视口（限高 + 宽度不越过左右箭头），图 object-contain 居中
 */

.mytb-screenshots {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.mytb-screenshots-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  align-items: stretch;
  width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mytb-screenshots-track::-webkit-scrollbar {
  display: none;
}

.mytb-screenshot-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  min-width: 0;
}

/* 固定显示区：高度封顶，左右留出箭头空间；框本身不可见，圆角打在图片上 */
.mytb-screenshot-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* 左右略收，给箭头留位；高度抬一档，横向图会跟着变宽 */
  width: calc(100% - 48px);
  max-width: 100%;
  height: 280px;
  margin: 0 auto;
  position: relative;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
  padding: 0;
  text-decoration: none;
}

@media (min-width: 640px) {
  .mytb-screenshot-frame {
    width: calc(100% - 48px);
    height: 340px;
  }
}

.mytb-screenshot-frame:hover {
  box-shadow: none;
}

.mytb-screenshot-frame__media {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.mytb-screenshot-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 12px;
}

.mytb-screenshots-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ededed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #222;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mytb-screenshots-nav[hidden] {
  display: none;
}

.mytb-screenshots-nav:hover {
  background: #fff;
}

.mytb-screenshots-nav--prev {
  left: 8px;
}

.mytb-screenshots-nav--next {
  right: 8px;
}

@media (min-width: 640px) {
  .mytb-screenshots-nav {
    width: 40px;
    height: 40px;
  }

  .mytb-screenshots-nav--prev {
    left: 12px;
  }

  .mytb-screenshots-nav--next {
    right: 12px;
  }
}

.mytb-screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 16px;
}

@media (min-width: 640px) {
  .mytb-screenshot-lightbox {
    padding: 32px;
  }
}

.mytb-screenshot-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.mytb-screenshot-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mytb-screenshot-lightbox.is-long .mytb-screenshot-lightbox-stage {
  align-items: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mytb-screenshot-lightbox.is-long .mytb-screenshot-lightbox-img {
  max-height: none;
  width: min(420px, 92vw);
  height: auto;
  margin: 48px auto 32px;
}

.mytb-screenshot-lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  max-height: 36vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 24px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(17, 17, 17, 0.55) 42%, rgba(17, 17, 17, 0.82) 100%);
  color: #ffffff;
  font-size: 14px; /* text-caption */
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.mytb-screenshot-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: #71717a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mytb-screenshot-lightbox-close:hover {
  background: #f9fafb;
}

.mytb-screenshot-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  color: #222;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mytb-screenshot-lightbox-nav:hover {
  background: #fff;
}

.mytb-screenshot-lightbox-nav--prev {
  left: 12px;
}

.mytb-screenshot-lightbox-nav--next {
  right: 12px;
}

/* 轮播底部分页点（对齐工具模块 React CarouselIndicator） */
.mytb-screenshots-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding: 0 8px;
}

.mytb-screenshots-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: #cccccc;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mytb-screenshots-dot.is-active {
  background: #222222;
  transform: scale(1.15);
}

.mytb-screenshots-dot:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mytb-screenshots-dot {
    transition: none;
  }
}

/* ---------- B 站视频（轮播第一位：点封面播放） ---------- */
/* 与产品截图同高，宽度按 16:9 收成卡片，避免整行拉满黑底 */
.mytb-screenshot-frame.mytb-bilibili-frame {
  width: auto;
  height: 280px;
  max-width: calc(100% - 48px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  cursor: pointer;
}

@media (min-width: 640px) {
  .mytb-screenshot-frame.mytb-bilibili-frame {
    height: 340px;
    max-width: calc(100% - 48px);
  }
}

.mytb-bilibili-frame.is-playing {
  cursor: default;
  background: #000;
}

.mytb-bilibili-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 0;
}

.mytb-bilibili-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #1a1a1a 0%, #2c2c2c 100%);
}

.mytb-bilibili-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

.mytb-bilibili-frame:hover .mytb-bilibili-play,
.mytb-bilibili-frame:focus-visible .mytb-bilibili-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(0, 0, 0, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .mytb-bilibili-play {
    transition: none;
  }
}

.mytb-bilibili-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.mytb-bilibili-external {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ededed;
  color: #222;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.mytb-bilibili-external:hover,
.mytb-bilibili-external:focus-visible {
  background: #fff;
  color: #222;
}

/* ---------- 本地短视频（铺满截图框，无黑边；始终静音循环） ---------- */
.mytb-screenshot-frame.mytb-local-video-frame {
  width: calc(100% - 48px);
  height: 280px;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
  cursor: default;
}

@media (min-width: 640px) {
  .mytb-screenshot-frame.mytb-local-video-frame {
    height: 340px;
  }
}

.mytb-local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.mytb-local-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

.mytb-local-video-play:hover,
.mytb-local-video-play:focus-visible {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(0, 0, 0, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .mytb-local-video-play {
    transition: none;
  }
}

@media (min-width: 640px) {
  .mytb-screenshot-lightbox-nav--prev {
    left: 24px;
  }

  .mytb-screenshot-lightbox-nav--next {
    right: 24px;
  }
}
