﻿/* ==== Full-bleed ชนซ้าย-ขวาจริง ==== */
.hero-bleed-contain {
    position: relative;
    width: 100vw;
    left: 50%;
    margin-left: -50vw;
    right: 50%;
    margin-right: -50vw;
    overflow: hidden;
    /* ⭐ ค่าเริ่มต้น (สำหรับเบราว์เซอร์ที่ไม่รองรับ dvh) */
    height: 45vh;
}

@supports (width: 100dvw) {
    .hero-bleed-contain {
        width: 100dvw;
        margin-left: -50dvw;
        margin-right: -50dvw;
        /* ⭐ ค่า 85dvh: ใช้เฉพาะเมื่อเบราว์เซอร์รองรับ dVw/dVh */
        height: 85dvh; /* สูงมาก (85% ของ Dynamic Viewport Height) */
    }
}

/* รูป: ไม่ครอปด้านข้าง + ตัดทิ้งเฉพาะ "ขอบล่าง" ที่รูป (ด้วย mask) */
/* รูป: ไม่ครอปด้านข้าง + ตัดทิ้งเฉพาะ "ขอบล่าง" ที่รูป (ด้วย mask) */
.hero-bleed-contain > img {
    display: block;
    width: 100%;
    /* ❌ height: auto; (ต้องลบออก) */
    /* ⭐ แก้ไข: ตั้งค่าให้รูปภาพครอบคลุมพื้นที่ Container */
    height: 100%;
    object-fit: cover; /* ⭐ สำคัญ: เพื่อให้รูปภาพรักษาสัดส่วนและเต็มความสูง 45vh */
    object-position: center; /* สามารถเปลี่ยนเป็น top, bottom, 50% 50% ได้ */

    position: absolute; /* ⭐ สำคัญ: เพื่อให้ height: 100% ทำงาน */
    top: 0;
    left: 0;
    z-index: 1;
    /* ... โค้ด mask-image ที่เหลือยังคงเดิม หรือลบออกหากไม่ต้องการตัดขอบล่าง ... */
}

/* (แนะนำ) กันสกอลล์แนวนอนจากเทคนิค full-bleed เฉพาะบริเวณคอมโพเนนต์นี้ */
.hero-bleed-contain-wrapper {
    overflow-x: hidden;
}

/* ==== แถบคลื่นเล็ก ๆ ปิดทับบน/ล่าง (เท่านั้น) ==== */
.hero-bleed-contain.waves {
    --blue-1: #1e3a8a;
    --blue-2: #2563eb;
    --blue-3: #60a5fa;
    --wave-grad: linear-gradient(90deg, var(--blue-1), var(--blue-2) 40%, var(--blue-3));
    --wave-h: 50px; /* สูงแถบคลื่น */
    --wave-overlap: 12px; /* ซ้อนเข้าภาพเล็กน้อย */
    
  
}

.hero-bleed-contain.waves::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: var(--wave-h);
   
    background: var(--wave-grad);
    z-index: 2;
    pointer-events: none;
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'><path fill='white' d='M0,0 H1440 V40 C1280,60 1120,20 960,40 C800,60 640,20 480,40 C320,60 160,20 0,40 Z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'><path fill='white' d='M0,0 H1440 V40 C1280,60 1120,20 960,40 C800,60 640,20 480,40 C320,60 160,20 0,40 Z'/></svg>");
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.hero-bleed-contain.waves::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: var(--wave-h);
    bottom: calc(0px - var(--wave-overlap));
    background: var(--wave-grad);
    z-index: 2;
    pointer-events: none;
    transform: scaleY(-1);
    transform-origin: center;
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'><path fill='white' d='M0,0 H1440 V40 C1280,60 1120,20 960,40 C800,60 640,20 480,40 C320,60 160,20 0,40 Z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80' preserveAspectRatio='none'><path fill='white' d='M0,0 H1440 V40 C1280,60 1120,20 960,40 C800,60 640,20 480,40 C320,60 160,20 0,40 Z'/></svg>");
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* ยกคลื่นล่างให้สูงขึ้น */
.hero-bleed-contain.waves {
    --wave-overlap: 44px; /* จาก 12px → 44px (ทับรูปมากขึ้น) */
    --wave-raise: 0px;   /* ระยะยก */
}
.hero-bleed-contain.waves::after {
    bottom: 0;
    transform: translateY(calc(-1 * var(--wave-raise))) scaleY(-1);
}

/* === กลุ่มข้อความบนฮีโร่ (วางไว้บน) === */
.hero-copy {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    align-content: start;
    justify-items: center;
    gap: .75rem;
  
    padding: 24px var(--pad-x);
    text-align: center;
}
.hero-copy--top {
    padding-top: clamp(32px,10vh,120px);
}

/* จอใหญ่: ชิดซ้ายและเว้นขอบ */
@media (min-width:992px) {
    .hero-copy {
        --pad-x: 6vw; /* desktop */
        justify-items: start;
        text-align: left;
        padding: 32px var(--pad-x);
    }
    .hero-copy--top {
        padding-top: clamp(48px,14vh,180px);
    }
    .hero-badge {
        /* ⭐ แก้ไข: margin-top อาจจะเยอะเกินไปเมื่อ Hero Section เล็กลง */
        margin-top: 60px; /* ลดลงเล็กน้อย */
        max-width: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* === การ์ดพื้นหลังน้ำเงินบางๆ === */
.hero-card {
    display: inline-block;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(37,99,235,.08);
    border: 1px solid rgba(37,99,235,.18);
    box-shadow: 0 8px 22px rgba(37,99,235,.10), 0 2px 6px rgba(0,0,0,.10);
    backdrop-filter: saturate(120%) blur(2px);
    margin-top: 8px;
}

.hero-copy--top {
    /* เดิมอยู่กลางไปหน่อย → ลด padding-top ลง */
    padding-top: clamp(6px, 3.2vh, 28px);
}

/* ===================================================================================================================================================== */
/* ======================= TYPOGRAPHY UPGRADE (สำหรับข้อความบนภาพ) ======================= */

/* === หัวข้อหลัก (Headline) === */
.hero-h1 {
    font-size: clamp(20px, 5vw, 48px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

/* === ข้อความรองหรือ Subtitle === */
.hero-sub {
    font-size: clamp(14px, 3.5vw, 20px);
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0px;
    color: #f1f5f9;
    margin: 8px 0 0 0;
    padding: 0;
}

/* === ป้ายข้อความ (Badge) === */
.hero-badge {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.15), rgba(37, 99, 235, 0.12), rgba(96, 165, 250, 0.08));
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.2);
    width: 100%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

/* ข้อความนำหน้า (Badge Lead) */
.badge-lead {
    font-size: clamp(12px, 2.5vw, 14px);
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

/* ข้อความหลัก (Badge Body) */
.badge-body {
    font-size: clamp(13px, 3vw, 16px);
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff;
    display: block;
}

/* === สำหรับจอเล็ก (Mobile) === */
@media (max-width: 576px) {
    .hero-h1 {
        font-size: clamp(18px, 4.5vw, 28px);
    }

    .hero-sub {
        font-size: clamp(13px, 3vw, 16px);
    }

    .badge-lead {
        font-size: clamp(11px, 2.2vw, 13px);
    }

    .badge-body {
        font-size: clamp(11px, 2.3vw, 13px);
    }

    .hero-badge {
        margin-top: 12px;
    }
}

/* === สำหรับจอกลาง (Tablet) === */
@media (min-width: 577px) and (max-width: 991px) {
    .hero-h1 {
        font-size: clamp(24px, 5.5vw, 36px);
    }

    .hero-sub {
        font-size: clamp(15px, 3.8vw, 18px);
    }

    .badge-lead {
        font-size: clamp(12px, 2.6vw, 14px);
    }

    .badge-body {
        font-size: clamp(13px, 3.2vw, 16px);
    }
}

/* === สำหรับจอใหญ่ (Desktop) === */
@media (min-width: 992px) {
    .hero-h1 {
        font-size: clamp(32px, 6vw, 52px);
    }

    .hero-sub {
        font-size: clamp(16px, 4vw, 22px);
    }

    .hero-badge {
        margin-top: 200px;
        max-width: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .badge-lead {
        font-size: clamp(18px, 3.5vw, 22px);
    }

    .badge-body {
        font-size: clamp(14px, 3.5vw, 18px);
    }
}

/* === การปรับอื่นๆ สำหรับอ่านง่าย === */
.hero-card {
    word-spacing: 0.05em;
}

    .hero-card h2 {
        margin-bottom: 8px;
    }

@media (min-width: 992px) {
    .hero-card {
        padding: 16px 20px;
    }
}

/* ===  Responsive spacing adjustment === */
/* === Fix hero-badge บนจอเล็ก: ดันลงไปด้านล่างของภาพ === */
@media (max-width: 576px) {

    /* ให้ hero สูงพอให้มีที่วาง text + badge */
    .hero-bleed-contain {
        height: 80vh; /* สูงประมาณ 80% ของหน้าจอ */
        min-height: 420px; /* กันไม่ให้เตี้ยเกินไป */
        position: relative;
        overflow: hidden;
    }

        .hero-bleed-contain > img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%; /* รูปเต็ม container */
            object-fit: cover;
        }

    /* เอา text มาทำเป็น flex column เพื่อดัน badge ลงล่างได้ */
    .hero-copy {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
        padding: 24px 16px 24px;
        gap: 10px;
        z-index: 5;
    }

    .hero-copy--top {
        padding-top: clamp(20px, 8vh, 40px);
    }

    .hero-card {
        max-width: 90%;
        flex-shrink: 0;
    }

    /* ⭐ ตรงนี้สำคัญ: ดัน badge ลงไปด้านล่าง hero */
    .hero-badge {
        width: 100%;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
        margin-top: auto; /* ดันลงไปสุด column */
        margin-bottom: 16px; /* เว้นจากขอบล่างนิดนึง */
    }

    .hero-h1 {
        font-size: clamp(18px, 5vw, 24px);
    }

    .hero-sub {
        font-size: clamp(13px, 3.8vw, 16px);
    }

    .badge-lead {
        font-size: clamp(11px, 3vw, 13px);
    }

    .badge-body {
        font-size: clamp(11px, 3.3vw, 14px);
    }
}

/* === สำหรับจอกลาง (Tablet / iPad) === */
@media (min-width: 577px) and (max-width: 991.98px) {

    /* ให้ hero สูงพอมีที่วาง badge ด้านล่าง */
    .hero-bleed-contain {
        height: 80vh;
        min-height: 520px;
        position: relative;
        overflow: hidden;
    }

        .hero-bleed-contain > img {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

    /* ใช้ flex column เพื่อดัน badge ลงล่าง */
    .hero-copy {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
        padding: 32px 7vw 24px;
        gap: 12px;
        z-index: 5;
    }

    .hero-copy--top {
        padding-top: clamp(40px, 12vh, 80px);
    }

    .hero-card {
        max-width: 70%;
        flex-shrink: 0;
        padding: 16px 20px;
    }

    /* ⭐ ตรงนี้คือการดัน hero-badge ลงด้านล่างของ hero */
    .hero-badge {
        width: 70%;
        max-width: 520px;
        margin-left: 0;
        margin-right: 0;
        margin-top: auto; /* ดันลงล่างสุดของ flex column */
        margin-bottom: 24px; /* เว้นจากขอบล่างนิดนึง */
    }

    /* ปรับขนาดตัวอักษรกลาง ๆ ไม่ใหญ่เกิน */
    .hero-h1 {
        font-size: clamp(24px, 3.2vw, 32px);
        line-height: 1.25;
    }

    .hero-sub {
        font-size: clamp(14px, 2.1vw, 18px);
        line-height: 1.5;
    }

    .badge-lead {
        font-size: clamp(12px, 1.6vw, 14px);
    }

    .badge-body {
        font-size: clamp(13px, 2vw, 16px);
        line-height: 1.4;
    }
}
