/* 文章／案例底部圖庫：一排縮圖 + 點擊放大 */
.article-gallery {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #eadfce;
  max-width: 100%;
}

.article-gallery-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 900;
  color: #06244a;
}

.gallery-thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.gallery-thumb {
  display: block;
  flex: 0 0 auto;
  width: 120px;
  min-width: 120px;
  padding: 0;
  margin: 0;
  border: 1px solid #eadfce;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.gallery-thumb:focus-visible {
  outline: 2px solid #e76542;
  outline-offset: 2px;
}

.gallery-thumb img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.article-gallery-videos {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-gallery-videos .article-gallery-title {
  margin-top: 0;
}

.article-gallery-video-item {
  max-width: 100%;
}

.article-gallery-video-item .gallery-inline-player .peace-media-16x9-inner {
  border-radius: 14px;
}

/* Lightbox */
.peace-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.peace-lightbox[hidden] {
  display: none !important;
}

.peace-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 36, 74, 0.88);
  cursor: zoom-out;
}

.peace-lightbox-dialog {
  position: relative;
  z-index: 2;
  width: min(92vw, 1000px);
  max-width: 100%;
  max-height: min(92vh, 100dvh);
  margin: 16px;
  box-sizing: border-box;
}

.peace-lightbox-figure {
  margin: 0;
  text-align: center;
}

.peace-lightbox-img {
  max-width: 100%;
  max-height: min(78vh, calc(100dvh - 140px));
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.peace-lightbox-caption {
  margin-top: 10px;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  padding: 0 8px;
}

.peace-lightbox-close,
.peace-lightbox-prev,
.peace-lightbox-next {
  position: absolute;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #06244a;
  font-size: 26px;
  line-height: 1;
  width: 44px;
  height: 44px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
}

.peace-lightbox-close {
  top: 0;
  right: 0;
}

.peace-lightbox-prev {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.peace-lightbox-next {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 760px) {
  .gallery-thumb {
    width: 100px;
    min-width: 100px;
  }

  .gallery-thumb img {
    height: 72px;
  }

  .peace-lightbox-dialog {
    width: 100%;
    margin: 8px;
    padding-bottom: 56px;
  }

  .peace-lightbox-close {
    top: 4px;
    right: 4px;
    width: 40px;
    height: 40px;
  }

  .peace-lightbox-prev,
  .peace-lightbox-next {
    top: auto;
    bottom: 0;
    transform: none;
    width: 48px;
    height: 48px;
  }

  .peace-lightbox-prev {
    left: 8px;
  }

  .peace-lightbox-next {
    right: 8px;
  }

  .peace-lightbox-img {
    max-height: calc(100dvh - 160px);
  }
}
