/*
 * Pages: component cấp trang cho trang dự án, bài viết, danh mục, trang thường.
 * Chỉ dùng token --ml-*; mobile-first; không đụng thẻ toàn cục (an toàn cạnh Flatsome).
 */

/* ---------- Dùng chung ---------- */
.ml-page { font-family: var(--ml-font); color: var(--ml-text); font-size: var(--ml-fs-base); line-height: var(--ml-lh); }
.ml-page *, .ml-page *::before, .ml-page *::after { box-sizing: border-box; }
.ml-page img { max-width: 100%; height: auto; }

.ml-crumbs { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0; font-size: var(--ml-fs-sm); color: var(--ml-muted); list-style: none; margin: 0; }
.ml-crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--ml-line); }
.ml-crumbs a { color: var(--ml-muted); text-decoration: none; }
.ml-crumbs a:hover { color: var(--ml-primary-strong); }

.ml-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; font-size: var(--ml-fs-sm); font-weight: 600; backdrop-filter: blur(4px); }
.ml-chip--solid { background: var(--ml-primary); }
.ml-chip--soft { background: var(--ml-surface-alt); color: var(--ml-heading); backdrop-filter: none; }

.ml-btn--lg { padding: 14px 28px; font-size: var(--ml-fs-lg); }
.ml-btn--light { background: #fff; color: var(--ml-primary-strong); }
.ml-btn--light:hover { background: var(--ml-surface-alt); color: var(--ml-primary-strong); }
.ml-btn--block { display: block; width: 100%; text-align: center; }

/* Ảnh giữ chỗ khi chưa có ảnh (bản mẫu) */
.ml-ph { background: linear-gradient(135deg, #1f2937 0%, #374151 45%, #be1e2d 140%); }

/* ---------- Hero dự án ---------- */
.ml-phero { position: relative; color: #fff; background-size: cover; background-position: center; }
.ml-phero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,24,39,.35) 0%, rgba(17,24,39,.78) 100%); }
.ml-phero__inner { position: relative; padding-block: 56px 40px; display: flex; flex-direction: column; gap: 14px; min-height: 420px; justify-content: flex-end; }
.ml-phero .ml-crumbs, .ml-phero .ml-crumbs a { color: rgba(255,255,255,.8); }
.ml-phero__title { margin: 0; color: #fff; font-size: clamp(30px, 5vw, 52px); line-height: 1.1; letter-spacing: -.01em; }
.ml-phero__tagline { margin: 0; max-width: 640px; font-size: var(--ml-fs-lg); color: rgba(255,255,255,.92); }
.ml-phero__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ml-phero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.ml-phero .ml-btn--ghost { color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.8); }
.ml-phero .ml-btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- Thanh thông tin nhanh ---------- */
.ml-facts { position: relative; margin-top: -28px; z-index: 2; }
.ml-facts__grid { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--ml-surface); border-radius: var(--ml-radius-lg); box-shadow: var(--ml-shadow); overflow: hidden; }
.ml-facts__item { padding: 16px 18px; border-right: 1px solid var(--ml-line); border-bottom: 1px solid var(--ml-line); }
.ml-facts__label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ml-muted); }
.ml-facts__value { display: block; margin-top: 2px; font-weight: 700; color: var(--ml-heading); font-size: 17px; line-height: 1.3; }
.ml-facts__value--price { color: var(--ml-primary-strong); }
@media (min-width: 900px) { .ml-facts__grid { grid-template-columns: repeat(5, 1fr); } .ml-facts__item { border-bottom: 0; } .ml-facts__item:last-child { border-right: 0; } }

/* ---------- Điều hướng mục (neo) ---------- */
.ml-subnav { position: sticky; top: 0; z-index: 20; background: var(--ml-surface); border-bottom: 1px solid var(--ml-line); margin-top: 28px; }
.ml-subnav__list { display: flex; gap: 4px; overflow-x: auto; padding: 0; margin: 0; list-style: none; scrollbar-width: none; }
.ml-subnav__list::-webkit-scrollbar { display: none; }
.ml-subnav a { display: block; padding: 14px 14px; white-space: nowrap; font-weight: 600; font-size: 15px; color: var(--ml-text); text-decoration: none; border-bottom: 3px solid transparent; }
.ml-subnav a:hover, .ml-subnav a.is-active { color: var(--ml-primary-strong); border-bottom-color: var(--ml-primary); }

/* ---------- Khung 2 cột: nội dung + form dính ---------- */
.ml-split { display: grid; gap: 32px; padding-block: 8px 40px; }
@media (min-width: 992px) { .ml-split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .ml-split__aside { position: sticky; top: 72px; } }

/* ---------- Mục nội dung ---------- */
.ml-section { padding-block: 36px 8px; scroll-margin-top: 64px; }
.ml-section + .ml-section { border-top: 1px solid var(--ml-line); margin-top: 28px; }
.ml-section__head { margin-bottom: 18px; }
.ml-section__title { margin: 4px 0 0; font-size: clamp(24px, 3.2vw, 32px); line-height: 1.2; color: var(--ml-heading); }
.ml-section__lead { margin: 8px 0 0; max-width: 680px; color: var(--ml-muted); }

/* Lưới điểm nổi bật / tiện ích */
.ml-features { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ml-features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .ml-features--3 { grid-template-columns: repeat(3, 1fr); } }
.ml-feature { display: flex; gap: 14px; padding: 18px; border: 1px solid var(--ml-line); border-radius: var(--ml-radius-lg); background: var(--ml-surface); }
.ml-feature__icon { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #fff3ec; color: var(--ml-primary); font-size: 22px; }
.ml-feature__title { margin: 0 0 4px; font-size: 17px; color: var(--ml-heading); line-height: 1.3; }
.ml-feature__text { margin: 0; font-size: 15px; }

/* Thư viện ảnh */
.ml-gallery { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.ml-gallery > * { border-radius: var(--ml-radius); overflow: hidden; aspect-ratio: 4 / 3; }
.ml-gallery > *:first-child { grid-column: span 2; aspect-ratio: 16 / 9; }
@media (min-width: 768px) { .ml-gallery { grid-template-columns: repeat(3, 1fr); } .ml-gallery > *:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; } }

/* Bảng giá / thanh toán */
.ml-table-wrap { overflow-x: auto; border: 1px solid var(--ml-line); border-radius: var(--ml-radius-lg); }
.ml-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.ml-table th { text-align: left; background: var(--ml-surface-alt); color: var(--ml-heading); font-weight: 700; }
.ml-table th, .ml-table td { padding: 12px 16px; border-bottom: 1px solid var(--ml-line); }
.ml-table tr:last-child td { border-bottom: 0; }
.ml-table .ml-price { color: var(--ml-primary-strong); font-weight: 700; white-space: nowrap; }
.ml-note { margin: 10px 0 0; font-size: 13px; color: var(--ml-muted); }

/* Tiến độ (timeline) */
.ml-timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--ml-line); display: grid; gap: 22px; }
.ml-timeline__item { position: relative; }
.ml-timeline__item::before { content: ""; position: absolute; left: -29px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--ml-line); box-shadow: 0 0 0 4px var(--ml-surface); }
.ml-timeline__item.is-done::before { background: var(--ml-primary); }
.ml-timeline__date { font-size: 13px; font-weight: 700; color: var(--ml-primary-strong); text-transform: uppercase; letter-spacing: .04em; }
.ml-timeline__title { margin: 2px 0 2px; font-size: 17px; color: var(--ml-heading); }
.ml-timeline__text { margin: 0; font-size: 15px; }

/* Câu hỏi thường gặp (details, không cần JS) */
.ml-faq { display: grid; gap: 10px; }
.ml-faq details { border: 1px solid var(--ml-line); border-radius: var(--ml-radius-lg); background: var(--ml-surface); }
.ml-faq summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; font-weight: 700; color: var(--ml-heading); position: relative; }
.ml-faq summary::-webkit-details-marker { display: none; }
.ml-faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--ml-primary); }
.ml-faq details[open] summary::after { content: "−"; }
.ml-faq details[open] { border-color: var(--ml-primary); }
.ml-faq__answer { padding: 0 18px 16px; }
.ml-faq__answer p { margin: 0; }

/* ---------- Form lead ---------- */
.ml-lead { background: var(--ml-surface); border-radius: var(--ml-radius-lg); box-shadow: var(--ml-shadow); border-top: 4px solid var(--ml-primary); padding: 22px; }
.ml-lead__title { margin: 0 0 4px; font-size: 20px; line-height: 1.25; color: var(--ml-heading); }
.ml-lead__sub { margin: 0 0 14px; font-size: 14px; color: var(--ml-muted); }
.ml-field { display: block; margin-bottom: 12px; }
.ml-field__input { width: 100%; padding: 12px 14px; border: 1px solid var(--ml-line); border-radius: var(--ml-radius); font: inherit; color: var(--ml-heading); background: #fff; }
.ml-field__input:focus { outline: 2px solid var(--ml-primary); outline-offset: 1px; border-color: transparent; }
.ml-lead__trust { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ml-muted); }
.ml-lead__trust li::before { content: "✓ "; color: var(--ml-primary); font-weight: 700; }
.ml-lead--band { display: grid; gap: 18px; align-items: center; background: linear-gradient(120deg, var(--ml-dark), #2b3445); color: #fff; border-top: 0; }
.ml-lead--band .ml-lead__title { color: #fff; font-size: 24px; }
.ml-lead--band .ml-lead__sub { color: rgba(255,255,255,.75); }

/* ---------- Chuyên viên phụ trách (đổi theo ngày/tuần) ---------- */
.ml-agent { background: var(--ml-surface); border: 1px solid var(--ml-line); border-radius: var(--ml-radius-lg); padding: 18px; margin-bottom: 16px; }
.ml-agent__label { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ml-muted); }
.ml-agent__dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.ml-agent__row { display: flex; align-items: center; gap: 14px; }
.ml-agent__photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: 0 0 64px; font-size: 26px; }
.ml-agent__name { margin: 0; font-size: 18px; font-weight: 700; color: var(--ml-heading); line-height: 1.2; }
.ml-agent__role { margin: 2px 0 0; font-size: 14px; color: var(--ml-muted); }
.ml-agent__bio { margin: 12px 0 0; font-size: 14px; }
.ml-agent__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.ml-agent__actions .ml-btn { text-align: center; padding: 11px 8px; font-size: 15px; }
.ml-agent--compact { padding: 14px; }

/* Thanh CTA dính chân trang (mobile) */
.ml-stickybar { position: fixed; inset: auto 0 0 0; z-index: 40; display: flex; gap: 8px; padding: 10px var(--ml-gutter); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--ml-line); }
.ml-stickybar .ml-btn { flex: 1; text-align: center; padding: 12px 8px; }
@media (min-width: 992px) { .ml-stickybar { display: none; } }
.ml-has-stickybar { padding-bottom: 70px; }
@media (min-width: 992px) { .ml-has-stickybar { padding-bottom: 0; } }

/* ---------- Bài viết ---------- */
.ml-article__head { padding: 8px 0 20px; }
.ml-article__title { margin: 8px 0 12px; font-size: clamp(28px, 4.4vw, 42px); line-height: 1.18; letter-spacing: -.01em; color: var(--ml-heading); }
.ml-article__dek { margin: 0 0 16px; font-size: var(--ml-fs-lg); color: var(--ml-muted); }
.ml-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--ml-fs-sm); color: var(--ml-muted); }
.ml-meta__author { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ml-heading); }
.ml-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ml-primary); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.ml-article__cover { margin: 0 0 28px; border-radius: var(--ml-radius-lg); overflow: hidden; aspect-ratio: 16 / 9; }

.ml-toc { border: 1px solid var(--ml-line); border-left: 4px solid var(--ml-primary); border-radius: var(--ml-radius); background: var(--ml-surface-alt); padding: 14px 18px; margin: 0 0 28px; }
.ml-toc__title { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ml-heading); }
.ml-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ml-toc a { color: var(--ml-text); text-decoration: none; }
.ml-toc a:hover { color: var(--ml-primary-strong); text-decoration: underline; }

/* Thân bài: dòng ngắn, dễ đọc */
.ml-prose--article { font-size: 18px; line-height: 1.75; color: #374151; }
.ml-prose--article h2 { margin: 2em 0 .5em; font-size: clamp(24px, 3vw, 30px); scroll-margin-top: 72px; }
.ml-prose--article h3 { margin: 1.6em 0 .4em; font-size: 22px; }
.ml-prose--article p, .ml-prose--article ul, .ml-prose--article ol { margin: 0 0 1.1em; }
.ml-prose--article img { border-radius: var(--ml-radius); }
.ml-prose--article blockquote { margin: 1.4em 0; padding: 14px 20px; border-left: 4px solid var(--ml-primary); background: var(--ml-surface-alt); border-radius: 0 var(--ml-radius) var(--ml-radius) 0; color: var(--ml-heading); font-style: italic; }
.ml-prose--article table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 0 0 1.2em; }
.ml-prose--article th, .ml-prose--article td { padding: 10px 12px; border: 1px solid var(--ml-line); text-align: left; }
.ml-prose--article th { background: var(--ml-surface-alt); color: var(--ml-heading); }

.ml-cta-inline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 2em 0; padding: 20px 22px; border-radius: var(--ml-radius-lg); background: #fff3ec; border: 1px solid #fbd9c5; }
.ml-cta-inline__text { margin: 0; flex: 1 1 260px; color: var(--ml-heading); font-weight: 600; }
.ml-cta-inline__text small { display: block; margin-top: 2px; font-weight: 400; color: var(--ml-muted); }

.ml-author { display: flex; gap: 16px; padding: 20px; margin: 32px 0; border: 1px solid var(--ml-line); border-radius: var(--ml-radius-lg); }
.ml-author .ml-avatar { width: 56px; height: 56px; font-size: 22px; flex: 0 0 56px; }
.ml-author__name { margin: 0; font-weight: 700; color: var(--ml-heading); }
.ml-author__bio { margin: 4px 0 0; font-size: 15px; }

.ml-related__title { font-size: 24px; margin: 8px 0 16px; color: var(--ml-heading); }

/* ---------- Danh mục / lưu trữ ---------- */
.ml-archive-hero { background: linear-gradient(120deg, var(--ml-dark), #2b3445); color: #fff; padding: 40px 0 36px; }
.ml-archive-hero .ml-crumbs, .ml-archive-hero .ml-crumbs a { color: rgba(255,255,255,.75); }
.ml-archive-hero__title { margin: 6px 0 8px; font-size: clamp(28px, 4vw, 40px); color: #fff; }
.ml-archive-hero__desc { margin: 0; max-width: 680px; color: rgba(255,255,255,.85); }
.ml-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.ml-filters a { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--ml-line); text-decoration: none; color: var(--ml-text); font-weight: 600; font-size: 14px; background: #fff; }
.ml-filters a.is-active, .ml-filters a:hover { background: var(--ml-primary); border-color: var(--ml-primary); color: #fff; }
.ml-pagination { display: flex; justify-content: center; gap: 6px; margin: 36px 0; }
.ml-pagination a, .ml-pagination span { min-width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--ml-line); border-radius: var(--ml-radius); text-decoration: none; color: var(--ml-text); font-weight: 600; }
.ml-pagination .is-current { background: var(--ml-primary); border-color: var(--ml-primary); color: #fff; }
.ml-card__meta { font-size: 13px; color: var(--ml-muted); }
.ml-card__media .ml-ph { aspect-ratio: 16 / 9; }

/* Trang thường */
.ml-pagehead { padding: 10px 0 24px; }
.ml-pagehead__title { margin: 6px 0 0; font-size: clamp(28px, 4vw, 40px); color: var(--ml-heading); }

@media (prefers-reduced-motion: no-preference) { .ml-btn, .ml-feature, .ml-card { transition: transform .15s ease, box-shadow .15s ease; } .ml-card:hover { transform: translateY(-2px); } }

/* Form lead (CF7) + trạng thái cảm ơn */
.ml-lead .wpcf7 form { margin: 0; }
.ml-lead .wpcf7 p { margin: 0 0 12px; }
.ml-lead .wpcf7 input[type="text"], .ml-lead .wpcf7 input[type="tel"], .ml-lead .wpcf7 input[type="email"], .ml-lead .wpcf7 textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--ml-line); border-radius: var(--ml-radius); font: inherit; color: var(--ml-heading); background: #fff; box-sizing: border-box; }
.ml-lead .wpcf7 input:focus, .ml-lead .wpcf7 textarea:focus { outline: 2px solid var(--ml-primary); outline-offset: 1px; border-color: transparent; }
.ml-lead .wpcf7 input[type="submit"] { width: 100%; padding: 13px 18px; border: 0; border-radius: var(--ml-radius); background: var(--ml-primary); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.ml-lead .wpcf7 input[type="submit"]:hover { filter: brightness(.95); }
.ml-lead .wpcf7-not-valid-tip { color: var(--ml-danger, #be1e2d); font-size: 13px; margin-top: 4px; }
.ml-lead .wpcf7-response-output { margin: 12px 0 0 !important; border-radius: var(--ml-radius); font-size: 14px; }
.ml-lead__thanks { padding: 16px; border-radius: var(--ml-radius); background: #eef8f0; color: #1d6b34; font-weight: 600; }
.ml-lead__thanks[hidden], .ml-lead .wpcf7[hidden] { display: none; }

/* Khối chèn cuối trang dự án */
.ml-project-extras { padding-block: 32px; display: grid; gap: 32px; }
.ml-project-extras .ml-agent { max-width: 520px; }
@media (max-width: 767px) { .ml-project-extras { padding-bottom: 88px; } } /* chừa chỗ cho thanh CTA dính đáy */

/* Khối cuối bài viết */
.ml-post-extras { margin-top: 32px; display: grid; gap: 24px; }
.ml-post-extras .ml-agent { max-width: 520px; }
@media (max-width: 767px) { .ml-post-extras { padding-bottom: 72px; } }
