/* สไลด์วิดีโอในแบนเนอร์ (หน้าแรก / สหกิจ / ศูนย์ภาษา) — ทำงานคู่กับ assets/js/banner-slider.js */

/* วิดีโอวางทับภาพปกพอดีกรอบ ซ่อนไว้จนเริ่มเล่นจริง (ไม่กระพริบดำ) */
.carousel-item .banner-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .5s ease;
    pointer-events: none; /* คลิกทะลุไปที่ลิงก์แบนเนอร์ */
    z-index: 1;
}
.carousel-item.video-shown .banner-video { opacity: 1; }

/* สไลด์วิดีโอไม่ซูมภาพปก (Ken Burns) */
.carousel-item.has-video img {
    animation: none !important;
    transform: none !important;
}

/* ปุ่มเล่น/หยุด (ต้องมีตามหลักการเข้าถึง: สิ่งที่เคลื่อนไหวเองต้องหยุดได้) */
.banner-video-btn {
    position: absolute;
    right: 18px;
    bottom: calc(var(--wave-h, 0px) + 16px);
    z-index: 12;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(0, 20, 50, .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
    transition: background .2s ease, transform .2s ease;
}
.banner-video-btn:hover { background: rgba(0, 20, 50, .8); transform: scale(1.06); }
.banner-video-btn:focus-visible { outline: 3px solid var(--npu-gold, #ffd700); outline-offset: 2px; }
.banner-video-btn .bv-pause { display: none; }
.carousel-item.video-playing .banner-video-btn .bv-play { display: none; }
.carousel-item.video-playing .banner-video-btn .bv-pause { display: inline; }

/* ภาพปก + ปุ่มเล่น (มือถือ / ลดการเคลื่อนไหว / เล่นอัตโนมัติไม่ได้): ปุ่มใหญ่ขึ้นและเด่นขึ้น */
.carousel-item.video-manual .banner-video-btn {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
    background: rgba(0, 51, 102, .75);
    border-color: var(--npu-gold, #ffd700);
}
.carousel-item.video-manual .banner-video-btn::after {
    content: 'วิดีโอ';
    position: absolute;
    right: calc(100% + 8px);
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 20, 50, .75);
    color: #fff;
    font-size: .8rem;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .banner-video-btn { right: 10px; bottom: calc(var(--wave-h, 0px) + 10px); width: 38px; height: 38px; font-size: .85rem; }
    .carousel-item.video-manual .banner-video-btn { width: 42px; height: 42px; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-item .banner-video { transition: none; }
}
