/* แกลเลอรีแบบ Masonry ด้วย CSS Columns — กำหนด selector เฉพาะ .video-gallery */
.video-gallery,
.video-gallery *,
.video-gallery *::before,
.video-gallery *::after {
  box-sizing: border-box;
}

.video-gallery {
  --gap: 8px;
  display: block;
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  column-count: 3;
  column-width: 200px;
  column-gap: var(--gap);
  color: #171717;
  font: 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.video-gallery .video {
  display: inline-block;
  width: 100%;
  margin: 0 0 12px;
  break-inside: avoid;
  vertical-align: top;
}

.video-gallery .image-frame {
	  position: relative;
  display: block;
  width: 100%;
  background: #f1eee8;
  border: 1px solid rgba(25, 32, 40, 0.07);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 5px 16px rgba(24, 32, 42, 0.10), 0 1px 3px rgba(24, 32, 42, 0.06);
  transition: box-shadow 0.25s ease;
}

.video-gallery .video img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.video-gallery .video-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 3px 6px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.78);
  color: #fff;
  font: 600 12px/1.2 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.video-gallery .source {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 0 1px;
  font-size: 13px;
  color: #292929;
}

.video-gallery .brand-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #ff7a18, #d62976 55%, #4f5bd5);
}

.video-gallery .video:nth-child(4) .brand-icon,
.video-gallery .video:nth-child(5) .brand-icon {
  background: #111;
}

.video-gallery .caption {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  .video-gallery .image-frame:hover {
    box-shadow: 0 9px 24px rgba(24, 32, 42, 0.15), 0 2px 5px rgba(24, 32, 42, 0.08);
  }

  .video-gallery .image-frame:hover img {
    transform: scale(1.015);
  }
}

/* จำนวนคอลัมน์สูงสุดตามความกว้างหน้าจอ */
@media (min-width: 1200px) {
  .video-gallery { column-count: 4; }
}

@media (min-width: 1400px) {
  .video-gallery { column-count: 5; }
}

@media (min-width: 1800px) {
  .video-gallery { column-count: 6; }
}

@media (max-width: 720px) {
  .video-gallery { column-count: 2; }
}

@media (max-width: 480px) {
  .video-gallery {
    column-count: 1;
    column-width: auto;
    column-gap: 0;
  }

  .video-gallery .caption { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .video-gallery .image-frame,
  .video-gallery .video img {
    transition: none !important;
  }
}
