/* Wide screens put copy beside the image; smaller screens give the image
   its own space above the copy. Scoped to location pages by meta.php. */
.hero,
.hero-amphur {
    --location-copy-width: min(52%, 660px);
    --location-surface: #f5f3ed;
    position: relative !important;
    isolation: isolate;
    display: block !important;
    box-sizing: border-box;
    min-height: 560px;
    padding: 64px max(28px, calc((100% - 1280px) / 2)) !important;
    overflow: hidden;
    background: var(--location-surface) !important;
    color: #263d32 !important;
    text-align: left !important;
}

.hero::before,
.hero-amphur::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0 0 0 auto;
    width: 48%;
    pointer-events: none;
    background-image:
        linear-gradient(90deg, var(--location-surface), transparent 24%),
        url('../images/hero-bg.webp');
    background-position: center, 82% center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* Normalize direct, container and nested-container hero layouts. */
:is(.hero, .hero-amphur) :is(.container, .hero-inner-amphur) {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

:is(.hero, .hero-amphur) :is(h1, h2, p, ul, ol) {
    box-sizing: border-box;
    width: var(--location-copy-width) !important;
    max-width: var(--location-copy-width) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    overflow-wrap: break-word;
    word-break: normal;
}

:is(.hero, .hero-amphur) h1 {
    margin-top: 0 !important;
    margin-bottom: 22px !important;
    padding: 0 !important;
    color: #243e30 !important;
    font-size: clamp(30px, 3.2vw, 46px) !important;
    font-weight: 700;
    line-height: 1.4 !important;
    letter-spacing: normal;
    text-wrap: balance;
}

:is(.hero, .hero-amphur) h2 {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
    color: #36523f !important;
    font-size: clamp(20px, 1.7vw, 25px) !important;
    font-weight: 600;
    line-height: 1.6 !important;
    text-wrap: balance;
}

:is(.hero, .hero-amphur) p {
    margin-top: 0 !important;
    margin-bottom: 18px !important;
    padding: 0 !important;
    color: #435348 !important;
    font-size: 17px !important;
    line-height: 1.95 !important;
    text-wrap: pretty;
}

:is(.hero, .hero-amphur) :is(ul, ol) {
    color: #435348;
    font-size: 17px;
    line-height: 1.95;
}

:is(.hero, .hero-amphur) p.answer-box {
    padding: 16px 18px !important;
    border: 1px solid #d6e0d4;
    border-radius: 12px;
    background: #edf2e9;
}

:is(.hero, .hero-amphur) a[href*='line.me'] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: fit-content;
    max-width: var(--location-copy-width) !important;
    min-height: 48px;
    margin: 8px 0 12px !important;
    padding: 13px 22px !important;
    border: 1px solid #08783d;
    border-radius: 12px !important;
    background: #087f3e !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 600;
    line-height: 1.65 !important;
    text-align: center;
    text-decoration: none !important;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 5px 16px rgb(22 72 43 / 10%);
}

:is(.hero, .hero-amphur) a[href*='line.me']:hover {
    background: #076a35 !important;
}

:is(.hero, .hero-amphur) a:focus-visible {
    outline: 3px solid #b38836;
    outline-offset: 4px;
}

@media (max-width: 991px) {
    .hero,
    .hero-amphur {
        --location-copy-width: 100%;
        --location-image-height: clamp(210px, 54vw, 400px);
        min-height: 0;
        padding: calc(var(--location-image-height) + 24px) 28px 32px !important;
    }

    .hero::before,
    .hero-amphur::before {
        inset: 0 0 auto;
        width: 100%;
        height: var(--location-image-height);
        background-image:
            linear-gradient(180deg, transparent 66%, var(--location-surface) 100%),
            url('../images/hero-bg.webp');
        background-position: center, right center;
    }

    :is(.hero, .hero-amphur) h1 {
        font-size: clamp(29px, 4.2vw, 38px) !important;
        margin-bottom: 18px !important;
    }

    :is(.hero, .hero-amphur) h2 {
        font-size: clamp(20px, 2.7vw, 24px) !important;
    }
}

@media (max-width: 575px) {
    .hero,
    .hero-amphur {
        padding-left: 22px !important;
        padding-right: 22px !important;
    }

    :is(.hero, .hero-amphur) h1 {
        font-size: clamp(27px, 7.2vw, 32px) !important;
    }

    :is(.hero, .hero-amphur) p {
        font-size: 16px !important;
        line-height: 1.9 !important;
    }

    :is(.hero, .hero-amphur) a[href*='line.me'] {
        padding: 13px 18px !important;
    }
}
