/* ═══════════════════════════════════════════════════════════════
   Hero Chainang — Homepage hero section styles
   Static file (no PHP) — browser-cacheable
   ═══════════════════════════════════════════════════════════════ */

.hero-chainang {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 520px;
    min-height: 420px;
    overflow: hidden;
    background: #000;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    margin-bottom: 50px;
}

.hero-chainang * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Desktop: bg-wrap กลืนกับ hero */
.hero-chainang-bg-wrap {
    position: absolute;
    inset: 0; 
    overflow: hidden;
}

/* Wrapper หลักสำหรับโปสเตอร์ + ribbon (ribbon ใช้ img เป็น relative) */
.hero-chainang-poster-main-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.hero-chainang-poster-main-wrap a {
   color: #d1d1d1;
}

.hero-chainang-poster-main-wrap a:hover {
    color: #fff;
    transition: none;
 }

/* Hover overlay — icon ดูข้อมูล (แสดงเฉพาะ mobile/poster แนวตั้ง) */
.hero-chainang-poster-info-hover {
    display: none;
}

/* Ribbon มุมซ้ายบน — ขี่ img poster_v, แสดงเมื่อ hero แนวตั้ง (mobile) */
.hero-chainang-ribbon {
    position: absolute;
    top: 10px;
    left: -5px;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgb(41 132 232);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 5;
    border-radius: 0 0 8px 0;
    font-family: 'Noto Sans Thai', sans-serif;
}

.hero-chainang-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

/* Wrapper สำหรับ poster แนวตั้ง (poster_v_url) + ribbon */
.hero-chainang-poster-v-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.hero-chainang-bg-v {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(60px) brightness(0.5);
}

.hero-chainang-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.hero-chainang-video.playing {
    opacity: 1;
}

/* ─── Overlay บน ───────────────────────────────────────────── */
.hero-chainang-overlay-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom,
                rgb(3 11 20 / 78%) 0%,
                rgb(3 11 20 / 29%) 20%,
                rgba(3, 11, 20, 0) 70%);
    z-index: 3;
    pointer-events: none;
}

/* ─── Overlay ล่าง ─────────────────────────────────────────── */
.hero-chainang-overlay-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55%;
    background: linear-gradient(to top, 
                #030b14 0%,
                rgb(3 11 20 / 67%) 20%,
                rgb(3 11 20 / 0%) 50%,
                rgb(3 11 20 / 0%) 100%);
    z-index: 3;
    pointer-events: none;
}

/* ─── Overlay ข้าง — จางเมื่อวิดีโอเล่น ─────────────────── */
.hero-chainang-overlay-side {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right,
                rgb(3 11 20 / 90%) 0%,
                rgb(3 11 20 / 50%) 40%,
                rgba(3, 11, 20, 0) 75%);
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.hero-chainang.video-playing .hero-chainang-overlay-side {
    opacity: 0.35;
    background: linear-gradient(to right,
                rgb(3 11 20 / 20%) 0%,
                rgb(3 11 20 / 10%) 40%,
                rgba(3, 11, 20, 0) 75%);
}

/* ─── Content ──────────────────────────────────────────────── */
.hero-chainang-content {
    position: relative;
    z-index: 4;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 6%;
}

.hero-chainang-info {
    max-width: 560px;
    color: #fff;
    transform-origin: left center;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ย่อ info เมื่อวิดีโอเล่น */
.hero-chainang.video-playing .hero-chainang-info {
    transform: scale(0.85) translateY(100px);
    opacity: 0.9;
}

.hero-chainang.video-playing .hero-chainang-info .hero-chainang-title-wrap img{
    max-width: 300px;
    max-height: 100px;
    transition: all 1.5s ease;
}

@media (max-width: 1199px) {
    .hero-chainang.video-playing .hero-chainang-info {
        transform: scale(0.85) translateY(100px);
    }
    .hero-chainang.video-playing .hero-chainang-info .hero-chainang-title-wrap img{
        max-width: 350px;
        max-height: 130px;
        transition: all 1.5s ease;
    }
}

/* ซ่อน genre + description เมื่อวิดีโอเล่น */
.hero-chainang.video-playing .hero-chainang-genres,
.hero-chainang.video-playing .hero-chainang-description {
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-chainang-genres,
.hero-chainang-description {
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 1.2s cubic-bezier(0.4, 0, 0.2, 1),
                margin 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90px;
}

/* ─── Badges ───────────────────────────────────────────────── */
.hero-chainang-badges {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hero-chainang-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-chainang-badge.type {
    background: rgb(41 132 232 / 40%);
    border: 1px solid #5aaeff;
    color: #fff;
}

/* ─── Title ────────────────────────────────────────────────── */
.hero-chainang-title {
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 64px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 18px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
}

/* Logo แทน title — 600×210px max, responsive */
.hero-chainang-title-wrap {
    margin-bottom: 18px;
}
.hero-chainang-title-logo {
    display: block;
    max-width: 600px;
    max-height: 210px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

/* Genre ใต้โปสเตอร์แนวตั้ง (mobile only) */
.hero-chainang-genres-mobile {
    display: none;
}

/* ─── Genre tags ───────────────────────────────────────────── */
.hero-chainang-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.hero-chainang-genre-tag,
.hero-chainang-rate-badge {
    font-size: clamp(1.1rem, 2vw, 1.2rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.4px;
    padding: 1px 3px;
    border-radius: 0px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
}

/* Badge rating แบบย่อ — อยู่หน้าสุด ก่อน genre */
.hero-chainang-rate-badge {
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.5);
    text-stroke: 0.5px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 2px 8px;
    letter-spacing: 0.5px;
}

/* ─── Description ──────────────────────────────────────────── */
.hero-chainang-description {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 5px;
    color: rgba(255,255,255,0.9);
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Action buttons ───────────────────────────────────────── */
.hero-chainang-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.hero-chainang-btn {
    padding: 12px 22px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
}

.hero-chainang-btn.play {
    background: #2984e8;
    color: #fff;
}

.hero-chainang-btn.play:hover {
    background: #1a6fd4;
    transform: scale(1.05);
}

.hero-chainang-btn.info {
    background: rgb(110 109 109 / 25%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
}

.hero-chainang-btn.info:hover {
    background: rgba(109,109,110,0.9);
}

/* ─── Video controls (แสดงเมื่อวิดีโอเล่นแล้วเท่านั้น) ───────── */
.hero-chainang-video-controls {
    position: absolute;
    bottom: 170px;
    right: 6%;
    z-index: 5;
    display: flex;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.hero-chainang.video-playing .hero-chainang-video-controls {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hero-chainang-video-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 26px;
}

.hero-chainang-video-btn:hover {
    background: rgba(0,0,0,0.8);
    border-color: #fff;
}

#heroChainangMute {
    font-size: 42px;
}

#heroChainangReplay .ion-refresh {
    display: inline-block;
    transition: transform 0.3s ease;
}

#heroChainangReplay:hover .ion-refresh {
    transform: rotate(-180deg);
}

/* ═══ Responsive ═══════════════════════════════════════════════ */

/* ─── Desktop (>991px): fixed height ──────────────────────── */
@media (min-width: 992px) {
    .hero-chainang {
        aspect-ratio: unset;
        height: 675px;
        max-height: 675px;
        min-height: unset;
    }
}

/* ─── Large desktop (≥1400px) ────────────────────────────── */
@media (min-width: 1400px) {
    .hero-chainang        { height: 750px; max-height: 750px; }
    .hero-chainang-title  { font-size: 62px; }
    .hero-chainang-info   { max-width: 550px; }
}

/* ─── Medium desktop / small laptop (992px – 1199px) ──────── */
@media (max-width: 1199px) {
    .hero-chainang-title               { font-size: 52px; }
    .hero-chainang-title-logo          { max-width: 500px; max-height: 175px; }
    .hero-chainang-description         { font-size: 16px; }
    .hero-chainang-info                { max-width: 550px; }
    .hero-chainang-content             { padding: 0 6%; }
    .hero-chainang-video-controls      { bottom: 170px; }
    .hero-chainang-video-btn           { width: 52px; height: 52px; }
    #heroChainangMute                  { font-size: 36px; }
}

/* ─── Tablet landscape (768px – 991px) ──────────────────── */
@media (max-width: 991px) {
    .hero-chainang                     { margin-bottom: 0px; }
    .hero-chainang-title               { font-size: 40px; }
    .hero-chainang-title-logo          { max-width: 400px; max-height: 140px; }
    .hero-chainang-description         { display: none; }
    .hero-chainang-genres              { display: none; }
    .hero-chainang-info                { max-width: 420px; }
    .hero-chainang-content             { padding: 0 12%; }
    .hero-chainang-btn                 { padding: 10px 20px; font-size: 14px; }
    .hero-chainang-video-controls      { bottom: 120px; gap: 8px; }
    .hero-chainang-video-btn           { width: 46px; height: 46px; }
    #heroChainangMute                  { font-size: 32px; }
    .movie-items, .latestnews          { margin-top: 0px !important; }
}

/* ─── Mobile (≤767px): poster แนวตั้ง, ไม่มีวิดีโอ ──────── */
@media (max-width: 767px) {

    .hero-chainang {
        position: static !important;
        height: auto !important;
        min-height: unset !important;
        max-height: none !important;
        aspect-ratio: unset !important;
        margin-top: 0;
        margin-bottom: 50px; 
        overflow: visible !important;
        display: flex !important;
        flex-direction: column;
        background: #000;
    }

    /* .hero-chainang-bg-wrap {
        position: relative !important;
        inset: unset !important;
        width: 100%;
        height: auto;
        aspect-ratio: unset;
        overflow: hidden;
        flex-shrink: 0;
        /* ปรับตามจอแบบ gradual: min 70px, max 90px, scale ด้วย % *
        padding-top: clamp(70px, 12%, 90px);
        box-sizing: border-box; 
    } */

    .hero-chainang-bg-wrap {
        position: relative !important;
        inset: unset !important;
        width: 100%;
        height: auto;
        aspect-ratio: unset;
        overflow: hidden;
        flex-shrink: 0;
        /* padding-top: clamp(70px, 12%, 90px); */
        box-sizing: border-box;
        padding: clamp(28%, 12%, 90px) 10% 18% 10%;
    }

    .hero-chainang-poster-main-wrap {
        position: relative !important;
        inset: unset !important;
        width: 100%;
    }

    /* overlay พื้นเทา — คลิกเพื่อ reset/hide */
    .hero-chainang-poster-info-overlay {
        display: none;
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        z-index: 3;
        cursor: pointer;
    }
    .hero-chainang-poster-main-wrap:hover .hero-chainang-poster-info-overlay,
    .hero-chainang-poster-main-wrap.is-expanded .hero-chainang-poster-info-overlay {
        display: block;
    }
    .hero-chainang-poster-main-wrap.overlay-dismissed .hero-chainang-poster-info-overlay {
        display: none !important;
    }
    .hero-chainang-poster-main-wrap.overlay-dismissed .hero-chainang-bg {
        pointer-events: auto;
        cursor: pointer;
    }
    /* reset หลังคลิ๊กพื้นที่ด้านนอก — ปุ่มกลับเป็นโปร่งใส */
    .hero-chainang-poster-main-wrap.overlay-dismissed .hero-chainang-poster-info-hover,
    .hero-chainang-poster-main-wrap.overlay-dismissed:hover .hero-chainang-poster-info-hover {
        bottom: 10px;
        right: 10px;
        transform: none;
        padding: 4px 5px 1px 8px;
        background: transparent !important;
    }
    .hero-chainang-poster-main-wrap.overlay-dismissed .hero-chainang-poster-info-text,
    .hero-chainang-poster-main-wrap.overlay-dismissed:hover .hero-chainang-poster-info-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    /* ปุ่ม: โปร่งใสตอน standby, ทึบตอน hover/expand */
    .hero-chainang-poster-info-hover {
        display: flex;
        position: absolute;
        bottom: 10px;
        right: 10px;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 4px 5px 1px 8px;
        background: transparent;
        border-radius: 50px;
        color: #fff;
        text-decoration: none;
        z-index: 4;
        overflow: hidden;
        transition: all 0.25s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .hero-chainang-poster-info-hover i {
        font-size: 2.8rem;
        flex-shrink: 0;
    }
    .hero-chainang-poster-info-text {
        white-space: nowrap;
        opacity: 0;
        width: 0;
        overflow: hidden;
        font-size: 0.9rem;
        font-weight: 500;
        font-size: 1.6rem;
        transition: opacity 0.25s ease, width 0s 0.2s;
    }
    .hero-chainang-poster-main-wrap:hover .hero-chainang-poster-info-hover,
    .hero-chainang-poster-main-wrap.is-expanded .hero-chainang-poster-info-hover {
        bottom: 50%;
        right: 50%;
        background: rgba(0, 0, 0, 0.6);
        transform: translate(50%, 50%);
        padding: 12px 20px;
    }
    .hero-chainang-poster-main-wrap:hover .hero-chainang-poster-info-text,
    .hero-chainang-poster-main-wrap.is-expanded .hero-chainang-poster-info-text {
        opacity: 1;
        width: auto;
        transition: opacity 0.3s ease 0.1s;
    }

    .hero-chainang-ribbon {
        display: flex;
        font-size: 1.5rem;
        min-width: 24px;
        height: 24px;
        padding: 15px 10px;
        border-radius: 0 2pc 10px 0;
    }

    .hero-chainang-bg {
        position: relative !important;
        top: unset; left: unset;
        width: 100%;
        height: auto;
        aspect-ratio: 7 / 10;
        display: block;
        object-fit: unset;
        object-position: unset;
        z-index: 1;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        pointer-events: none;
        border-radius: 10px;
    }

    .hero-chainang-genres-mobile {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 10px;
        justify-content: center;
        z-index: 21;
        position: absolute;
        bottom: 5%;
        left: 0;
        width: 100%;
        text-align: center;
    }

    .hero-chainang-overlay-top,
    .hero-chainang-overlay-bottom {
        position: absolute;
    }

    .hero-chainang-overlay-bottom {
        height: 5% !important;
    }

    .hero-chainang-video,
    .hero-chainang-video-controls { display: none !important; }

    .hero-chainang-overlay-side    { display: none; }

    .hero-chainang-badges,
    .hero-chainang-title-wrap,
    .hero-chainang-title,
    .hero-chainang-description,
    .hero-chainang-genres          { display: none !important; }

    .hero-chainang-content {
        position: relative !important;
        bottom: unset !important; left: unset !important; right: unset !important;
        padding: 12px 16px;
        align-items: stretch;
        justify-content: flex-start;
        background: #030b14;
        flex-shrink: 0;
    }

    .hero-chainang-info {
        max-width: 100%;
        width: 100%;
    }

    .hero-chainang-actions {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        gap: 10px;
        margin-top: -28px;
    }

    .movie-items.full-width,
    .trailers.full-width,
    .latestnew.full-width,
    .full-width {
        padding-top: 0px !important;
    }

    .hero-chainang-btn.info {
        display: none !important;
    }

    .hero-chainang-btn.play {
        flex: 1;
        justify-content: center;
        padding: 10px 14px;
        font-size: 14px;
        order: 2;
    }
}
