/* =====================================================================================================
   MYAN — Nội dung soạn thảo .myan-rich (product.md mục 6; product-plan Bước 9j)
   MỘT bộ style theo THẺ cho thân ngăn thông tin sản phẩm (UX Block + ô soạn thảo product edit) VÀ preview UX Builder của
   5 UX Block ngăn (pdp-fit / personalise / timeline / payment / faq).
   Nạp: inc/pdp.php — phụ thuộc của myan-pdp.css (is_product) + iframe UX Builder của 5 block (myan_pdp_is_rich_preview).
   Quy tắc theo thẻ áp cho MỌI thẻ trừ thẻ có class myan-* (element MYAN, vd ul.myan-pdp-swatches) — `:not([class*='myan-'])`,
   KHÔNG `:not([class])`: class do theme / JS / trình soạn thảo khối gắn (has-block, wp-block-heading, wp-block-list…) vẫn
   nhận style (Bước 9k); link còn loại `.button` (nút Flatsome). Class .myan-rich__* do PHP gắn (myan_rich_finish /
   myan_rich_faq_html): __note (p chỉ 1 em) · __cta (p chỉ 1 a) · __scroll (khung cuộn bảng số liệu) · __faq (h4 → details).
   Preview (.myan-rich-uxb post-content, không có PHP hậu xử lý): ghi chú / link / h4 nhận diện gần đúng bằng :has.
   Reset + nhịp dùng :where → độ ưu tiên thấp (0,1,1), quy tắc riêng ghi đè được. Chỉ dùng biến --myan-*.
   ===================================================================================================== */

html :is(.myan-rich, .myan-rich-uxb post-content) {
    font-size: 15px;
    line-height: 1.6;
    color: var(--myan-text);
}
/* Preview UX Builder: khung giống thân ngăn (nền surface, nội dung rộng 456px = 520 − 2 × 32px) */
html .myan-rich-uxb post-content {
    display: block;
    max-width: 456px;
    margin: 0 auto;
    padding: 20px 32px 24px;
    background: var(--myan-surface);
}
/* Reset lề — chống theme ghi đè (Bước 9j sửa): Flatsome đặt lề dưới / trái cho p, ul/ol, li, h*, blockquote, table…
   → lề phải / dưới / trái viết KHÔNG :where (0,1,3 > selector thẻ của theme). Lề trên = 0 ở mức :where (thấp) để
   quy tắc nhịp dọc bên dưới (cũng :where nhưng đứng sau) ghi đè được. */
html :is(.myan-rich, .myan-rich-uxb post-content) :is(p, ul, ol, li, dl, dt, dd, blockquote, table, figure, details, h2, h3, h4, h5, .myan-rich__scroll) {
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :where(p, ul, ol, li, dl, dt, dd, blockquote, table, figure, details, h2, h3, h4, h5, .myan-rich__scroll) {
    margin-top: 0;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :where(p:empty, .section-bg) {
    display: none; /* p rỗng của wpautop (Bước 9g) */
}

/* Nhịp dọc: khối có anh em hiển thị đứng trước → 22px; ngay sau h3 / h4 → 6px; khối đầu 0 (không gap, không margin âm).
   Áp trong thân và mọi khung bọc nội dung (div không class, blockquote, câu trả lời FAQ; preview: wrapper UX Builder). */
html :is(.myan-rich, .myan-rich-uxb post-content) > :where(:not(style, script, template, p:empty, .section-bg) ~ *),
html
    :is(.myan-rich, .myan-rich-uxb post-content)
    :where(div:not([class*='myan-']), blockquote, .myan-rich__a)
    > :where(:not(style, script, template, p:empty) ~ *),
html
    .myan-rich-uxb post-content
    :where(.row, .col, .col-inner, .text, .section-content, .uxb-wrapper, div[id^='text-'])
    > :where(:not(style, script, template, p:empty, .section-bg) ~ *) {
    margin-top: 22px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :where(h2, h3, h4) + *,
html :is(.myan-rich, .myan-rich-uxb post-content) :where(h2, h3, h4) + p:empty + * {
    margin-top: 6px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :where(ul, ol) > li + li {
    margin-top: 4px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) li > :where(ul, ol) {
    margin-top: 4px;
}

/* Tiêu đề nhóm */
html :is(.myan-rich, .myan-rich-uxb post-content) :is(h2, h3):not([class*='myan-']) {
    font-family: var(--myan-sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--myan-ink);
}

/* Chữ trong đoạn */
html :is(.myan-rich, .myan-rich-uxb post-content) strong {
    font-weight: 600;
    color: var(--myan-ink);
}
html :is(.myan-rich, .myan-rich-uxb post-content) em {
    font-style: italic;
}
html :is(.myan-rich, .myan-rich-uxb post-content) a:not([class*='myan-'], .button) {
    color: var(--myan-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) img {
    max-width: 100%;
    height: auto;
}

/* Gạch đầu dòng */
html :is(.myan-rich, .myan-rich-uxb post-content) ul:not([class*='myan-']) {
    padding-left: 18px;
    list-style: disc;
}
html :is(.myan-rich, .myan-rich-uxb post-content) li > ul:not([class*='myan-']) {
    list-style: circle;
}

/* ol = dòng thời gian (không số): chấm + đường dọc; <strong> đầu mỗi bước = tiêu đề */
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) {
    padding: 0;
    list-style: none;
}
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) > li {
    position: relative;
    margin: 0 0 0 6px;
    padding: 0 0 18px 30px;
    border-left: 1px solid var(--myan-line);
    font-size: 14px;
    line-height: 1.55;
}
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) > li + li {
    margin-top: 0;
}
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) > li:last-child {
    padding-bottom: 0;
}
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) > li::before {
    content: '';
    position: absolute;
    top: 4px;
    left: -6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--myan-brand);
}
html :is(.myan-rich, .myan-rich-uxb post-content) ol:not([class*='myan-']) > li > strong:first-child {
    display: block;
    font-size: 15px;
    line-height: 1.45;
}

/* Ghi chú — mọi blockquote trừ của element MYAN (blockquote có class lạ, vd `wp-block-quote` khi dán từ trình soạn
   thảo khối, trước đây rơi về kiểu Flatsome: vạch trái + nghiêng + 1.2em). Ghi đè đủ thuộc tính theme đặt. */
html :is(.myan-rich, .myan-rich-uxb post-content) blockquote:not([class*='myan-']) {
    position: static;
    padding: 12px 14px;
    border: 0;
    box-shadow: none;
    border-radius: var(--myan-radius);
    background: var(--myan-bg);
    font-size: 14px;
    font-style: normal;
    line-height: 1.55;
    color: var(--myan-text);
}
html :is(.myan-rich, .myan-rich-uxb post-content) blockquote:not([class*='myan-']) :is(p, cite, footer) {
    font-size: inherit;
    font-style: normal;
    line-height: inherit;
}
html :is(.myan-rich, .myan-rich-uxb post-content) blockquote:not([class*='myan-']) > * + * {
    margin-top: 8px;
}

/* p chỉ chứa 1 <em> = ghi chú nhỏ; sát bảng ngay trước → 10px */
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__note,
html .myan-rich-uxb post-content p:has(> em:only-child) {
    font-size: 13px;
    color: var(--myan-muted);
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__note em,
html .myan-rich-uxb post-content p:has(> em:only-child) > em {
    font-style: normal;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :is(table, .myan-rich__scroll) + .myan-rich__note {
    margin-top: 10px;
}

/* p chỉ chứa 1 <a> = link cuối khối, " →" tự thêm (PHP bỏ "→" người nhập gõ sẵn) */
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__cta a,
html .myan-rich-uxb post-content p:has(> a:only-child) > a {
    font-size: 14px;
    font-weight: 600;
    color: var(--myan-link);
    text-decoration: underline;
    text-underline-offset: 4px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__cta a::after,
html .myan-rich-uxb post-content p:has(> a:only-child) > a::after {
    content: ' →';
}

/* ---------- Bảng ----------
   Bảng KHÔNG thead (và hàng đầu không toàn th) = dòng nhãn–giá trị (dl của thiết kế).
   Bảng CÓ thead / hàng đầu toàn th = bảng số liệu (bảng cỡ), PHP bọc .myan-rich__scroll (cuộn ngang).
   Nhận diện bằng :has → giống nhau trên trang và trong preview UX Builder. Bỏ viền / nền / padding mặc định. */
html :is(.myan-rich, .myan-rich-uxb post-content) table {
    width: 100%;
    border: 0;
    border-collapse: collapse;
    background: none;
}
html :is(.myan-rich, .myan-rich-uxb post-content) :is(th, td) {
    border: 0;
    background: none;
    text-transform: none;
    letter-spacing: normal;
    vertical-align: top;
}
/* Dòng nhãn–giá trị */
html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))),
html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) > tbody {
    display: block;
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) tr {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--myan-subtle);
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) :is(td, th) {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
    color: var(--myan-text);
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) :is(td, th):first-child {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--myan-ink);
}
/* Bảng số liệu (bảng cỡ) */
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__scroll {
    overflow-x: auto;
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:is(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) :is(th, td) {
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    color: var(--myan-text);
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:is(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) th {
    padding: 8px 6px;
    border-bottom: 1px solid var(--myan-ink);
    font-weight: 600;
    color: var(--myan-ink);
}
html :is(.myan-rich, .myan-rich-uxb post-content) table:is(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) td {
    padding: 7px 6px;
    border-bottom: 1px solid var(--myan-subtle);
}
html :is(.myan-rich, .myan-rich-uxb post-content) :is(td, th) a {
    text-underline-offset: 2px;
}

/* dl (dữ liệu cũ: <div><dt>…</dt><dd>…</dd></div>) — hiển thị như dòng nhãn–giá trị */
html :is(.myan-rich, .myan-rich-uxb post-content) dl > div {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--myan-subtle);
}
html :is(.myan-rich, .myan-rich-uxb post-content) dt {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--myan-ink);
    text-transform: none;
    letter-spacing: normal;
}
html :is(.myan-rich, .myan-rich-uxb post-content) dd {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--myan-text);
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- FAQ: h4 + nội dung tới h4 kế → details (PHP: myan_pdp_faq_split + myan_rich_faq_html) ---------- */
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__faq {
    border-bottom: 1px solid var(--myan-line);
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--myan-ink);
    list-style: none;
    cursor: pointer;
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__q::-webkit-details-marker {
    display: none;
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__q::after {
    content: '+';
    flex: 0 0 auto;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    color: var(--myan-muted);
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__faq[open] > .myan-rich__q::after {
    content: '\2212'; /* − */
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__q:focus-visible {
    outline: 2px solid var(--myan-focus);
    outline-offset: 2px;
}
html :is(.myan-rich, .myan-rich-uxb post-content) .myan-rich__a {
    padding: 0 0 14px;
}
/* Preview UX Builder: h4 chưa tách (không có PHP) → trông như dòng câu hỏi */
html .myan-rich-uxb post-content h4:not([class*='myan-']) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    margin-top: 0;
    padding: 12px 0 6px;
    border-top: 1px solid var(--myan-line);
    font-family: var(--myan-sans);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    color: var(--myan-ink);
}
html .myan-rich-uxb post-content h4:not([class*='myan-'])::after {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: var(--myan-muted);
}
/* h4 còn sót ngoài FAQ (vd nội dung không có câu trả lời) — tiêu đề phụ chữ thường */
html :is(.myan-rich, .myan-rich-uxb post-content) h4:not([class*='myan-']) {
    font-family: var(--myan-sans);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    color: var(--myan-ink);
}

/* Preview UX Builder: wrapper Flatsome thành khối thường (bỏ lưới / padding) để nhịp đi xuyên qua */
html .myan-rich-uxb post-content :is(.row, .col, .col-inner, .text, .section-content, .uxb-wrapper, div[id^='text-']) {
    display: block;
    width: auto;
    max-width: none;
    min-height: 0;
    flex: none;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
    padding: 0;
}

@media (max-width: 849px) {
    html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) tr,
    html :is(.myan-rich, .myan-rich-uxb post-content) dl > div {
        flex-direction: column;
        gap: 2px;
    }
    html :is(.myan-rich, .myan-rich-uxb post-content) table:not(:has(> thead), :has(> tbody:first-of-type > tr:first-child > th):not(:has(> tbody:first-of-type > tr:first-child > td))) :is(td, th):first-child,
    html :is(.myan-rich, .myan-rich-uxb post-content) dt {
        flex-basis: auto;
    }
}
