/*
 * Bổ sung nhỏ cho bản Laravel — KHÔNG sửa site.css (CSS gốc đã build từ Tailwind).
 * Chỉ thêm những phần HTML tĩnh chưa có: menu mobile, thông báo form, font Khmer.
 */

/* Font tiếng Khmer */
html[lang="km"] body {
    font-family: "Noto Sans Khmer", "Segoe UI", "Noto Sans", Arial, sans-serif;
}

/* Header dính trên cùng khi cuộn trang; có bóng đổ khi đã cuộn (class is-scrolled do site.js gắn). */
.site-header {
    position: sticky;
    top: 0;
    transition: box-shadow .2s ease;
}
.site-header.is-scrolled { box-shadow: 0 4px 16px rgba(21, 35, 26, .08); }
/* Nhảy tới #anchor không bị header che mất tiêu đề */
html { scroll-padding-top: 72px; }

/* Chữ menu header: in hoa, in đậm, nhỏ hơn chữ thường một chút (máy tính + điện thoại) */
.site-nav a,
.mobile-nav a {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Chọn ngôn ngữ: viên thuốc chia ô [EN | KM], cùng kiểu nút ngôn ngữ trong admin (partials/locale-switcher.blade.php) */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid #dce8df;
    border-radius: 999px;
    background: #f7faf8;
}
.lang-switch a {
    min-width: 38px;
    padding: 6px 11px;
    border-radius: 999px;
    color: #5f6f66;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.lang-switch a:hover { color: #126f37; }
.lang-switch a:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(18, 111, 55, .25); }
.lang-switch a.is-active { background: #126f37; color: #fff; }

/* Menu mobile (nút Menu trong header gốc) */
.mobile-nav {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e6ece8;
    background: #fff;
    padding: 8px 20px 16px;
    font-size: 15px;
    font-weight: 600;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
    padding: 12px 0;
    border-bottom: 1px solid #eef2ef;
}
.mobile-nav a:last-child { border-bottom: 0; }
.mobile-nav a.is-active,
.mobile-nav a:hover { color: #126f37; }
@media (min-width: 64rem) {
    .mobile-nav { display: none !important; }
}

/* Form liên hệ */
.form-error {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #b42318;
}
/* Trang chi tiết tin: bài viết + cột "Tin khác" (xuống dưới bài viết trên màn hình hẹp). */
.news-layout { display: grid; gap: 32px; }
@media (min-width: 1024px) { .news-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .news-others { position: sticky; top: 96px; } }
.news-others { border: 1px solid #dce5df; border-radius: 6px; background: #fff; padding: 24px; }
.news-others__title { margin: 0 0 16px; padding-bottom: 12px; border-bottom: 2px solid #126f37; font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #126f37; }
.news-others__item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid #edf2ee; color: #142019; }
.news-others__item:last-child { border-bottom: 0; padding-bottom: 0; }
.news-others__item:hover .news-others__name { color: #126f37; }
.news-others__thumb { flex: 0 0 88px; width: 88px; height: 64px; border-radius: 4px; object-fit: cover; }
.news-others__thumb--empty { display: flex; align-items: center; justify-content: center; background: #eef6f1; color: #126f37; }
.news-others__text { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.news-others__date { font-size: 12px; color: #68766d; }
.news-others__name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: 14px; font-weight: 600; line-height: 1.45; transition: color .2s ease; }
.news-others__empty { margin: 0; font-size: 14px; color: #68766d; }

/* Khung tin nổi bật (partials/capital-milestone.blade.php): ảnh đại diện của tin phủ kín cột phải; điện thoại: ảnh nằm dưới chữ. */
.capital-media { position: relative; display: block; min-height: 240px; aspect-ratio: 1200 / 630; overflow: hidden; }
.capital-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 1024px) { .capital-media { aspect-ratio: auto; min-height: 320px; } }

/* Khung tin nổi bật không có cột số liệu (đang ẩn): phần chữ chiếm cả chiều ngang. */
.capital-panel.is-single { grid-template-columns: 1fr; }

/* Tin nổi bật ở trang chủ (is-light): nằm giữa dải xanh "Thị trường xuất khẩu" và chân trang xám → nền trắng, thẻ sáng
   viền xanh, chữ xanh đậm. Tránh 2 khối xanh đậm chồng nhau và tách rõ khỏi chân trang. Trang Quan hệ cổ đông giữ thẻ xanh gốc. */
.capital-milestone.is-light { background: #fff; }
.capital-milestone.is-light .capital-panel {
    border: 1px solid #dce5df; border-left: 4px solid #126f37; border-radius: 6px;
    background: #f4f9f5; color: #142019; box-shadow: 0 12px 30px rgba(20, 75, 42, .08);
}
.capital-milestone.is-light .capital-copy > p:first-child { color: #14723b; }
.capital-milestone.is-light .capital-copy h2 { color: #0b5c2d; }
.capital-milestone.is-light .capital-copy > p:last-of-type { color: #4f6157; }
.capital-milestone.is-light .capital-copy a { border-bottom-color: #126f37; color: #126f37; }
.capital-milestone.is-light .capital-copy a:hover { color: #0b5c2d; }

/* Nút gửi form Liên hệ: trạng thái đang gửi (site.js thêm .is-sending). */
.contact-submit { display: inline-flex; align-items: center; gap: 10px; transition: background-color .2s ease, opacity .2s ease; }
.contact-submit__spinner {
    display: none; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 35%); border-top-color: #fff;
    border-radius: 999px; animation: contact-spin .7s linear infinite;
}
.contact-submit.is-sending { cursor: progress; opacity: .85; }
.contact-submit.is-sending .contact-submit__spinner { display: inline-block; }
@keyframes contact-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .contact-submit__spinner { animation-duration: 2s; } }
/* Form đang gửi: mờ nhẹ các ô, không cho sửa giữa chừng. */
[data-contact-form].is-sending input, [data-contact-form].is-sending textarea { opacity: .7; pointer-events: none; }

/* Captcha form Liên hệ: ô nhập + ảnh mã + nút đổi mã trên 1 hàng (xuống dòng trên điện thoại hẹp). */
.captcha-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.captcha-row .captcha-input { flex: 1 1 180px; margin-top: 0; text-transform: uppercase; letter-spacing: .12em; }
.captcha-row .captcha-input::placeholder { text-transform: none; letter-spacing: normal; }
.captcha-image { display: block; width: 170px; height: 56px; border: 1px solid #dce5df; border-radius: 4px; }
.captcha-refresh {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    border: 1px solid #dce5df; border-radius: 4px; background: #fff; color: #14723b; cursor: pointer;
}
.captcha-refresh:hover, .captcha-refresh:focus-visible { border-color: #14723b; background: #f1f8f3; }

/* Icon mạng xã hội ở footer (partials/footer.blade.php) */
.footer-social { display: flex; gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.footer-social a {
    display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border: 1px solid #cfe3d3; border-radius: 999px; background: #fff; color: #147b38;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.footer-social a:hover, .footer-social a:focus-visible { border-color: #147b38; background: #147b38; color: #fff; }

/* Dấu * đỏ sau nhãn trường bắt buộc (form Liên hệ) */
.form-required {
    margin-left: 2px;
    color: #b42318;
}
.form-alert {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 2px;
    font-size: 14px;
}
.form-alert-success {
    background: #eef6f1;
    border: 1px solid #cfe0d4;
    color: #0e5c2e;
}
.form-alert-error { border: 1px solid #f4c7c3; background: #fef3f2; color: #b42318; }
/* Ô có lỗi: viền đỏ (label chứa .form-error do @error in ra). */
label:has(.form-error) :is(input, textarea), div:has(> .form-error) .captcha-input { border-color: #d92d20; }
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Nội dung bài tin tức (HTML từ CMS) */
.news-body { line-height: 1.8; color: #344b3c; }
.news-body > * + * { margin-top: 1em; }
.news-body h2 { font-size: 1.5rem; font-weight: 700; color: #063e26; }
.news-body h3 { font-size: 1.25rem; font-weight: 700; color: #063e26; }
.news-body ul { list-style: disc; padding-left: 1.5em; }
.news-body ol { list-style: decimal; padding-left: 1.5em; }
.news-body a { color: #126f37; text-decoration: underline; }

/* ---------- Hiệu ứng chuyển động nhẹ khi cuộn tới nội dung ----------
 * Chỉ bật khi <html> có class js-reveal (JS có chạy + không bật "giảm chuyển động"), nên không JS vẫn thấy đủ nội dung.
 * Chỉ animate opacity/transform/filter → không xê dịch bố cục. Mỗi khối chạy 1 lần (site.js thêm .is-revealed).
 * Easing "quint-out": tăng tốc êm rồi giảm tốc rất dài → cảm giác trượt tự nhiên, dừng êm.
 */
:root {
    --motion-ease: cubic-bezier(.22, 1, .36, 1);
    --motion-duration: 1.3s;
}
.js-reveal [data-reveal] {
    opacity: 0;
    filter: blur(4px);
    transition:
        opacity calc(var(--motion-duration) * .8) ease-out,
        transform var(--motion-duration) var(--motion-ease),
        filter calc(var(--motion-duration) * .7) ease-out;
    transition-delay: var(--reveal-delay, 0ms);
}
.js-reveal [data-reveal="up"] { transform: translate3d(0, 12px, 0); }
.js-reveal [data-reveal="left"] { transform: translate3d(-14px, 0, 0); }
.js-reveal [data-reveal="right"] { transform: translate3d(14px, 0, 0); }
.js-reveal [data-reveal="zoom"] { transform: scale(.99); }
.js-reveal [data-reveal].is-revealed { opacity: 1; filter: none; transform: none; }
/* Khối lớn (ảnh, bản đồ, iframe PDF / Google Maps): không làm mờ để giữ mượt trên máy yếu. */
.js-reveal .overview-photo[data-reveal], .js-reveal .world-map[data-reveal], .js-reveal [data-reveal][data-reveal-solid] { filter: none; }

/* Ảnh trong khung hiện dần: ảnh thu nhỏ rất chậm từ 1.06 về 1 (khung có overflow hidden). */
.js-reveal [data-reveal="zoom"] img { transform: scale(1.06); transition: transform 1.8s var(--motion-ease); }
.js-reveal [data-reveal="zoom"].is-revealed img { transform: none; }

/* Ảnh bìa trang chủ: chạy ngay khi tải trang (không chờ cuộn). */
@keyframes hero-zoom { from { transform: scale(1.05); } to { transform: none; } }
@keyframes hero-copy { from { opacity: 0; filter: blur(4px); transform: translate3d(-16px, 0, 0); } to { opacity: 1; filter: none; transform: none; } }
.js-reveal .hero-motion-image { animation: hero-zoom 3s var(--motion-ease) both; }
.js-reveal .hero-motion-copy { animation: hero-copy 1.5s var(--motion-ease) .25s both; }

/* Số liệu đếm tăng: chữ số cùng độ rộng để khối không rung khi đếm. */
[data-count-up] { font-variant-numeric: tabular-nums; }

/* Bản đồ thị trường: các điểm hiện lần lượt (nảy rất nhẹ), đường nối chạy chậm liên tục sau khi hiện. */
@keyframes marker-pop { 0% { opacity: 0; transform: scale(.5); } 60% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes route-flow { to { stroke-dashoffset: -24; } }
/* Điểm trên bản đồ (partials/market-map.blade.php): <li> rộng 0 đặt đúng toạ độ %, chấm tròn + nhãn canh quanh điểm đó. */
.map-pin { position: absolute; width: 0; height: 0; }
.map-pin .map-marker { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; }
.map-pin__dot {
    position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; box-sizing: border-box;
    border: 4px solid #0b7137; border-radius: 50%; background: radial-gradient(circle, #0b7137 2.5px, #fff 3px);
}
.map-pin--origin .map-pin__dot { left: -9px; top: -9px; width: 18px; height: 18px; background: radial-gradient(circle, #0b7137 3px, #f4d978 3.5px); }
.map-pin__label {
    position: absolute; white-space: nowrap; color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
    text-shadow: 0 1px 3px rgba(2, 47, 21, .45);
}
.map-pin--top .map-pin__label { bottom: 11px; left: 0; transform: translateX(-50%); }
.map-pin--bottom .map-pin__label { top: 12px; left: 0; transform: translateX(-50%); }
.map-pin--left .map-pin__label { right: 12px; top: 0; transform: translateY(-50%); }
.map-pin--right .map-pin__label { left: 12px; top: 0; transform: translateY(-50%); }
.map-pin--origin.map-pin--top .map-pin__label { bottom: 14px; }
.map-pin--origin.map-pin--bottom .map-pin__label { top: 15px; }
@media (max-width: 639px) { .map-pin__label { font-size: 10px; } }
.js-reveal .map-marker { opacity: 0; transform-box: fill-box; transform-origin: center; }
.js-reveal .map-pin .map-marker { transform-origin: 0 0; }
.js-reveal .is-revealed .map-marker { animation: marker-pop .9s var(--motion-ease) var(--reveal-delay, 0ms) both; }
.js-reveal .map-routes { opacity: 0; transition: opacity 1.2s ease-out .6s; }
.js-reveal .is-revealed .map-routes { opacity: .9; }
.js-reveal .is-revealed .map-routes path { animation: route-flow 3s linear infinite; }

@media (prefers-reduced-motion: reduce) {
    .js-reveal [data-reveal], .js-reveal .map-marker, .js-reveal .map-routes { opacity: 1 !important; filter: none !important; transform: none !important; animation: none !important; }
}

/* ---------- Nút về đầu trang (layouts/app.blade.php) ----------
 * Hình tròn xanh thương hiệu, icon mũi tên lên; vòng viền xanh đậm chạy theo tiến độ cuộn. Ẩn cho tới khi cuộn xuống (site.js).
 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 999px;
    background: #126f37;
    color: #fff;
    box-shadow: 0 10px 26px rgba(9, 60, 30, .28);
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 14px, 0) scale(.9);
    transition:
        opacity .45s ease-out,
        transform .6s cubic-bezier(.22, 1, .36, 1),
        visibility 0s linear .6s,
        background-color .2s ease,
        box-shadow .2s ease;
}
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition:
        opacity .45s ease-out,
        transform .6s cubic-bezier(.22, 1, .36, 1),
        visibility 0s,
        background-color .2s ease,
        box-shadow .2s ease;
}
.back-to-top:hover { background: #0e5c2e; box-shadow: 0 14px 32px rgba(9, 60, 30, .34); }
.back-to-top:hover .lucide-arrow-up { transform: translateY(-3px); }
.back-to-top:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(231, 209, 116, .7), 0 10px 26px rgba(9, 60, 30, .28); }
.back-to-top .lucide-arrow-up { position: relative; transition: transform .35s cubic-bezier(.22, 1, .36, 1); }
.back-to-top-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}
.back-to-top-ring circle {
    fill: none;
    stroke: #063d1c;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset .15s linear;
}
@media (max-width: 640px) {
    .back-to-top { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
    .back-to-top, .back-to-top.is-visible, .back-to-top .lucide-arrow-up { transition: opacity .2s linear, visibility 0s; transform: none; }
}

/* ---------- Vùng bấm tối thiểu ~40px trên điện thoại (Google: ≥ 44px khuyến nghị) — không đổi giao diện nhìn thấy ---------- */
.lang-switch a { padding-block: 9px; }
/* Chỉ màn hình < 1024px (nút này có lg:hidden — không được đè display trên desktop). */
@media (max-width: 1023.98px) {
    [data-menu-toggle] {
        display: inline-grid;
        width: 44px;
        height: 44px;
        margin-right: -10px;
        place-items: center;
        border-radius: 10px;
    }
}
[data-menu-toggle]:focus-visible { outline: 2px solid #126f37; outline-offset: 2px; }
.hero a[href="#gioi-thieu"] { padding-block: 10px; margin-block: 2px -10px; }
.investor-doc-grid h3 a { display: inline-block; padding-block: 6px; }
.mobile-nav a { display: flex; min-height: 44px; align-items: center; }

/* ---------- Tin tức: giới hạn độ dài dòng để dễ đọc ---------- */
.news-body { max-width: 880px; }

/* ---------- Trang 404 ---------- */
.error-section { display: flex; min-height: calc(100vh - 72px - 270px); align-items: center; }
.error-page { max-width: 640px; }
.error-code { margin: 0; color: #e7d174; font-size: clamp(64px, 12vw, 120px); font-weight: 800; line-height: 1; letter-spacing: -.04em; -webkit-text-stroke: 2px #126f37; }
.error-page h1 { margin-top: 18px; color: #126f37; font-size: clamp(28px, 4vw, 40px); font-weight: 800; text-transform: uppercase; }
.error-text { margin-top: 14px; color: #59675f; font-size: 17px; line-height: 1.7; }
.error-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.error-actions a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 20px; border: 1px solid #cfdcd3; border-radius: 999px; color: #126f37; font-weight: 700; text-decoration: none; transition: background-color .15s ease, border-color .15s ease; }
.error-actions a:hover { border-color: #126f37; background: #f1f7f3; }
.error-actions a.error-primary { border-color: #126f37; background: #126f37; color: #fff; }
.error-actions a.error-primary:hover { background: #0e5c2e; }

/* ---------- Ảnh bìa trang chủ + Quan hệ cổ đông: khung đúng kích thước ảnh khuyến nghị trong admin ----------
 * (SitePageSections::COVER_FRAMES). Từ 768px (máy tính + máy tính bảng) khung theo ảnh máy tính (--cover-ratio), dưới 768px theo
 * ảnh điện thoại (--cover-ratio-mobile; chưa tải ảnh điện thoại thì hiện phần giữa của ảnh máy tính) → ảnh đúng kích thước hiện trọn.
 * Chữ cao hơn khung (vd. Quan hệ cổ đông trên máy tính bảng dọc, hoặc admin nhập chữ dài) thì khung tự cao thêm để không che chữ
 * (min-height auto của aspect-ratio; cần overflow clip vì overflow hidden làm mất cơ chế này), còn ảnh vẫn giữ đúng tỉ lệ, nằm giữa
 * khung — phần dư là màu nền, ảnh không bao giờ bị cắt. Thắng min-height 560/590px !important của site.css.
 */
section.cover-frame { min-height: auto !important; overflow: clip; aspect-ratio: var(--cover-ratio-mobile); }
section.cover-frame .hero-motion-image { height: auto; margin-block: auto; aspect-ratio: var(--cover-ratio-mobile); }
@media (min-width: 768px) {
    section.cover-frame, section.cover-frame .hero-motion-image { aspect-ratio: var(--cover-ratio); }
}
.investor-hero.cover-frame { display: flex; align-items: center; background-color: #05481f; }
/* Chữ canh giữa theo chiều dọc → đệm trên/dưới chỉ là khoảng cách tối thiểu; 3.5rem của site.css làm chữ không vừa khung 1920×400 ở 1024px. */
.investor-hero.cover-frame > div:last-child { width: 100%; padding-block: 1.5rem !important; }

/* site.css gốc dùng hero-agriculture.jpg (2,6 MB) cho ô đầu tiên khối Lĩnh vực (trang chủ) và đầu trang tin tức → dùng cùng ảnh bản WebP (224 KB). */
.sub-hero,
.investor-hero,
#linh-vuc article:first-child:before { background-image: url(../hero-agriculture.webp); }
.detail-hero { background-image: linear-gradient(105deg, #04411cf5, #147f3eb8), url(../hero-agriculture.webp); }
.detail-image { background-image: linear-gradient(#05471f1f, #05471fb8), url(../hero-agriculture.webp); }
