/* แถบประชาสัมพันธ์การรับสมัคร (DEK70) — ใช้คู่กับ includes/home_banner.php
   หลักการเดียวกับป๊อปอัปหน้าแรก: ไม่กำหนดความกว้าง/สูงตายตัวให้ภาพ
   ปล่อย width/height เป็น auto แล้วคุมด้วย max-* อย่างเดียว ภาพจึงรักษาสัดส่วนเดิมเสมอ */

.dek-band {
    /* navbar เป็น position:fixed สคริปต์จะเขียนค่าความสูงจริงลง --dek-navtop ให้
       ตัวเลขด้านล่างคือค่าสำรองตอนสคริปต์ยังไม่ทำงาน คิดจาก logo 60px + padding 12px สองด้าน */
    --dek-navtop: 92px;
    --dek-shadow: 0 18px 48px rgba(190, 24, 93, 0.16), 0 4px 14px rgba(15, 23, 42, 0.08);

    position: relative;
    overflow: hidden;
    padding: calc(var(--dek-navtop) + 1.25rem) 0 1.75rem;
    background: linear-gradient(135deg, #fff4fa 0%, #f3f7ff 52%, #fdf6ff 100%);
    border-bottom: 1px solid rgba(236, 72, 153, 0.12);
}

/* จุดไข่ปลาจาง ๆ ล้อลายในโปสเตอร์ ช่วยไม่ให้พื้นหลังดูเป็นสีเรียบแบน */
.dek-band::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(236, 72, 153, 0.16) 1.2px, transparent 1.3px);
    background-size: 22px 22px;
    opacity: 0.5;
}

/* ก้อนสีเบลอสองก้อน ให้พื้นหลังมีความลึกแทนการไล่เฉดเรียบ ๆ */
.dek-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    opacity: 0.5;
}

.dek-blob-a {
    width: 32vw;
    height: 32vw;
    max-width: 460px;
    max-height: 460px;
    top: -8%;
    left: -6%;
    background: #fbcfe8;
}

.dek-blob-b {
    width: 30vw;
    height: 30vw;
    max-width: 420px;
    max-height: 420px;
    bottom: -14%;
    right: -5%;
    background: #bfdbfe;
}

.dek-band-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.dek-band-main {
    position: relative;
}

/* ออร่า: วงแสงเบลอหลังการ์ด ดึงสีจากโปสเตอร์เอง ทำให้การ์ดเหมือนถูกส่องจากด้านหลัง */
.dek-aura {
    position: absolute;
    inset: -5% -3% auto -3%;
    height: 86%;
    border-radius: 50%;
    filter: blur(52px);
    opacity: 0.55;
    pointer-events: none;
    background:
        radial-gradient(circle at 26% 46%, #f472b6 0%, transparent 62%),
        radial-gradient(circle at 72% 54%, #60a5fa 0%, transparent 60%),
        radial-gradient(circle at 50% 70%, #fcd34d 0%, transparent 58%);
}

.dek-band-link {
    display: block;
    position: relative;
    z-index: 1;
    margin: 0 auto;
    /* คุมสองทาง: กว้างไม่เกิน 1140px และสูงไม่เกินพื้นที่จอที่เหลือ
       ตัวคูณ 1.7769 = 1672/941 คืออัตราส่วนของภาพแนวนอน จอเตี้ยจึงย่อภาพให้เอง
       โดยที่ hero ยังโผล่ขอบล่างให้รู้ว่ามีเนื้อหาต่อ ส่วน max() กันภาพหดจนอ่านไม่ออก */
    max-width: min(1140px, max(600px, calc((100vh - 250px) * 1.7769)));
    max-width: min(1140px, max(600px, calc((100dvh - 250px) * 1.7769)));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--dek-shadow);
    background: #fff;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    --dek-x: 50%;
    --dek-y: 50%;
}

.dek-band-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1672 / 941;
    object-fit: contain;
    background: #fff;
}

.dek-band-cta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1.1rem;
    text-align: center;
}

.dek-band-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0 1.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ec4899 0%, #d6176d 100%);
    color: #fff;
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(214, 23, 109, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dek-band-note {
    margin: 0;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    color: #475569;
    font-size: 0.95rem;
}

.dek-band-sep { color: #cbd5e1; }

.dek-band-tel {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #be185d;
    font-weight: 700;
    text-decoration: none;
}

.dek-band-note i { color: #ec4899; }

/* ---------- ชิปแผนกวิชาสองข้างโปสเตอร์ (เฉพาะจอกว้าง) ----------
   ซ่อนเป็นค่าตั้งต้น แล้วค่อยเปิดใน media query ด้านล่าง จอแคบจะได้ไม่ต้องคิดอะไรเลย */
.dek-side { display: none; }

.dek-side-head {
    margin: 0 0 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Mali', 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #be185d;
}

.dek-side-head i { color: #f59e0b; font-size: 1.05rem; }

.dek-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dek-chip-item { display: flex; }

.dek-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    padding: 0.45rem 0.95rem 0.45rem 0.6rem;
    border-radius: 999px;
    border: 2px solid var(--dek-c, #f9a8d4);
    background: #fff;
    color: #3f3f46;
    font-family: 'Mali', 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    line-height: 1.35;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
    transform: rotate(var(--dek-rot, 0deg));
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

.dek-chip i {
    flex-shrink: 0;
    width: 1.55rem;
    height: 1.55rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--dek-c, #f9a8d4);
    color: #fff;
    font-size: 0.9rem;
}

/* หกสีวนไป ให้ดูสดใสแบบไม่สุ่มมั่ว และเอียงสลับซ้ายขวาเล็กน้อยให้ดูเป็นสติกเกอร์แปะ */
.dek-chip-item:nth-child(6n + 1) .dek-chip { --dek-c: #ec4899; --dek-rot: -1.6deg; }
.dek-chip-item:nth-child(6n + 2) .dek-chip { --dek-c: #f59e0b; --dek-rot: 1.4deg; }
.dek-chip-item:nth-child(6n + 3) .dek-chip { --dek-c: #38bdf8; --dek-rot: -1.1deg; }
.dek-chip-item:nth-child(6n + 4) .dek-chip { --dek-c: #a78bfa; --dek-rot: 1.7deg; }
.dek-chip-item:nth-child(6n + 5) .dek-chip { --dek-c: #34d399; --dek-rot: -1.3deg; }
.dek-chip-item:nth-child(6n + 6) .dek-chip { --dek-c: #fb7185; --dek-rot: 1.2deg; }

/* ลอยขึ้นลงเบา ๆ คนละจังหวะ ใส่ที่ <li> ไม่ใช่ที่ <a> จะได้ไม่ชนกับ transform ตอน hover */
@keyframes dek-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

.dek-chip-item {
    animation: dek-float 5.5s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.38s);
}

/* เมาส์เท่านั้น — บนจอสัมผัส :hover จะค้างหลังแตะ จึงกันไว้ด้วย hover:hover */
@media (hover: hover) {
    .dek-band-link:hover {
        transform: translateY(-4px);
        box-shadow: 0 26px 60px rgba(190, 24, 93, 0.22), 0 6px 18px rgba(15, 23, 42, 0.1);
    }
    .dek-band-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(214, 23, 109, 0.42);
    }
    .dek-band-tel:hover { text-decoration: underline; }
    .dek-chip:hover {
        transform: rotate(0deg) scale(1.06);
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
        background: #fffdf8;
    }
}

.dek-band-link:active { transform: scale(0.994); }
.dek-band-btn:active  { transform: scale(0.97); }
.dek-chip:active      { transform: rotate(0deg) scale(0.98); }

.dek-band-link:focus-visible,
.dek-band-btn:focus-visible,
.dek-band-tel:focus-visible,
.dek-chip:focus-visible {
    outline: 3px solid #0ea5e9;
    outline-offset: 3px;
}

/* ---------- จอกว้างตั้งแต่ 1440px: วางเป็นสามคอลัมน์ ชิป | โปสเตอร์ | ชิป ---------- */
@media (min-width: 1440px) {
    .dek-band.has-sides .dek-band-inner {
        max-width: 1800px;
        display: grid;
        grid-template-columns: minmax(205px, 1fr) minmax(0, 1140px) minmax(205px, 1fr);
        align-items: center;
        gap: 0 1.75rem;
    }
    .dek-band.has-sides .dek-side { display: block; }
    /* ชิปชิดเข้าหาโปสเตอร์ ขอบด้านในจึงเป็นเส้นตรงเหมือนกรอบรูป */
    .dek-side-l .dek-chips { align-items: flex-end; }
    .dek-side-l .dek-chip-item { justify-content: flex-end; }
    .dek-side-l .dek-side-head { justify-content: flex-end; }
    .dek-side-r .dek-chip-item { justify-content: flex-start; }
}

@media (min-width: 1700px) {
    .dek-chip { font-size: 0.95rem; padding: 0.55rem 1.1rem 0.55rem 0.7rem; }
    .dek-chip i { width: 1.75rem; height: 1.75rem; font-size: 1rem; }
    .dek-chips { gap: 0.75rem; }
}

/* ---------- มือถือ: สลับไปใช้ภาพพื้นขาว 5:4 ซึ่งจัตุรัสกว่า จึงคุ้มพื้นที่จอแนวตั้งมากกว่า ----------
   ต้องตรงกับ media ของ <source> ใน home_banner.php คือ 767px
   โปสเตอร์ตัวนี้พื้นเป็นโทนอุ่น (ขอบภาพเฉลี่ย #EEC9B4 มุมเป็นเหลือง #FCD004) และมีพื้นที่
   เกือบขาวถึง 27% ถ้าวางบนพาสเทลโทนเย็นเดิมขอบการ์ดจะกลืนหาย จึงเปลี่ยนเป็นพื้นหลังโทนอุ่น */
@media (max-width: 767px) {
    .dek-band {
        --dek-navtop: 68px;
        padding: calc(var(--dek-navtop) + 0.9rem) 0 1.35rem;
        background: linear-gradient(140deg, #ffe2b8 0%, #ffd0dd 48%, #ffe8bc 100%);
        border-bottom-color: rgba(217, 119, 6, 0.18);
    }
    .dek-band::before { opacity: 0.35; background-image: radial-gradient(rgba(217, 119, 6, 0.2) 1.2px, transparent 1.3px); }
    .dek-blob, .dek-aura { display: none; }
    .dek-band-inner { padding: 0 0.75rem; }
    .dek-band-link {
        max-width: 100%;
        border-radius: 16px;
    }
    .dek-band-img { aspect-ratio: 1402 / 1122; }
    .dek-band-cta { margin-top: 0.9rem; gap: 0.6rem 1rem; }
    .dek-band-btn { width: 100%; justify-content: center; font-size: 1rem; }
    .dek-band-note { font-size: 0.88rem; }
    .dek-band-tel { color: #9d174d; }
    .dek-band-note i { color: #d97706; }
}

@media (max-width: 420px) {
    .dek-band { --dek-navtop: 60px; }
    .dek-band-inner { padding: 0 0.625rem; }
    .dek-band-note { font-size: 0.82rem; }
}

/* มือถือแนวนอน / จอเตี้ย: ภาพ 5:4 จะสูงเกินจอ ให้กลับไปคุมด้วยความสูงแทน */
@media (max-width: 767px) and (max-height: 520px) {
    .dek-band-link {
        max-width: max(420px, calc((100vh - 190px) * 1.25));
        max-width: max(420px, calc((100dvh - 190px) * 1.25));
    }
}

/* ---------- สปอตไลต์ตามเมาส์ (เฉพาะในกรอบรูป) ----------
   --dek-x / --dek-y เป็นตำแหน่งเมาส์หน่วย % ที่สคริปต์เขียนลงมาทุกเฟรม
   ค่าเริ่มต้น 50% ทำให้ไฟอยู่กลางรูปตอนยังไม่มีเมาส์ จะได้ไม่กระพริบตอนโหลด */
.dek-band-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;   /* คลิกทะลุไปที่ลิงก์ได้ตามปกติ */
    opacity: 0;
    transition: opacity 0.4s ease;
    /* soft-light คือหัวใจ: มันเพิ่มความสว่างให้สิ่งที่อยู่ข้างใต้ แทนที่จะทาสีขาวทับ
       สีชมพู/เหลืองในโปสเตอร์จึงสดขึ้นแทนที่จะซีดลง */
    background: radial-gradient(
        circle var(--dek-r, 300px) at var(--dek-x) var(--dek-y),
        rgba(255, 255, 255, 0.62) 0%,
        rgba(255, 255, 255, 0.26) 36%,
        rgba(255, 255, 255, 0) 72%
    );
    mix-blend-mode: soft-light;
}

/* ไส้ในดวงเล็กกว่า ใช้ screen เพื่อให้ตรงกลางไฟมีประกายคมขึ้นอีกนิด */
.dek-band-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle 130px at var(--dek-x) var(--dek-y),
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0) 70%
    );
    mix-blend-mode: screen;
}

.dek-band-link.is-lit .dek-band-glow { opacity: 1; }

/* เงารอบกรอบอุ่นขึ้นเล็กน้อยตอนไฟติด ให้รู้สึกว่าทั้งใบถูกส่อง ไม่ใช่แค่จุดเดียว */
.dek-band-link.is-lit {
    box-shadow: 0 26px 64px rgba(190, 24, 93, 0.26), 0 6px 20px rgba(15, 23, 42, 0.1);
}

@media (min-width: 1400px) {
    .dek-band-link { --dek-r: 340px; }
}

/* เบราว์เซอร์ที่ไม่รองรับ mix-blend-mode จะได้ฝ้าขาวทับรูปแทนการส่องสว่าง จึงปิดไปเลย */
@supports not (mix-blend-mode: soft-light) {
    .dek-band-glow { display: none; }
}

/* จอสัมผัสไม่มีตำแหน่งเมาส์ และผู้ใช้ที่ขอลดการเคลื่อนไหวก็ไม่ควรเจอไฟวิ่งตาม */
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
    .dek-band-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dek-band-link,
    .dek-band-btn,
    .dek-chip {
        transition: none;
    }
    .dek-chip-item { animation: none; }
    .dek-band-link:hover,
    .dek-band-btn:hover,
    .dek-band-link:active,
    .dek-band-btn:active {
        transform: none;
    }
    .dek-chip:hover { transform: rotate(var(--dek-rot, 0deg)); }
}

@media print {
    .dek-band-cta, .dek-side, .dek-blob, .dek-aura { display: none; }
    .dek-band { padding: 0 0 1rem; background: none; }
    .dek-band::before { display: none; }
}
