﻿/*
 * Kiểu hiển thị nội dung bài viết (soạn bằng CKEditor) ngoài website:
 * mô tả sản phẩm (HangHoa/Index), tin tức (TinTuc/View), mùi hương (MuiHuong/Index).
 * Dùng: thêm class "nd-prose" vào khung chứa nội dung.
 * Chỉ áp cho phần tử con TRỰC TIẾP của khung (hoặc qua 1 thẻ div không class) → không đụng landing
 * nhúng (.ld1-inline) và các khối có class riêng. Theme reset ul/ol về list-style none nên phải dựng lại.
 */
.nd-prose {
    --nd-text: #2b2b2b;
    --nd-heading: #111;
    --nd-muted: #6f6f6f;
    --nd-gold: #c9a74a;
    --nd-gold-dark: #8a6a1f;
    --nd-gold-soft: #fbf8f1;
    --nd-gold-line: #efe5cf;
    --nd-radius: 10px;

    color: var(--nd-text);
    font-size: 15.5px;
    line-height: 1.8;
    word-wrap: break-word;
}

/* ---------- Đoạn văn ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > p {
    margin: 0 0 14px;
}

/* Đoạn rỗng / chỉ có "." do CKEditor để lại */
:is(.nd-prose, .nd-prose > div:not([class])) > p:empty {
    display: none;
}

.nd-prose strong,
.nd-prose b {
    color: var(--nd-heading);
    font-weight: 600;
}

/* ---------- Tiêu đề ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > :is(h2, h3, h4) {
    color: var(--nd-heading);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(h2, h3, h4) strong {
    font-weight: inherit;
}

:is(.nd-prose, .nd-prose > div:not([class])) > h2 {
    position: relative;
    margin: 34px 0 14px;
    padding: 0 0 0 16px;
    font-size: 21px;
}

:is(.nd-prose, .nd-prose > div:not([class])) > h2::before {
    content: "";
    position: absolute;
    top: .2em;
    bottom: .2em;
    left: 0;
    width: 4px;
    border-radius: 2px;
    background: var(--nd-gold);
}

:is(.nd-prose, .nd-prose > div:not([class])) > h2:first-child {
    margin-top: 4px;
}

:is(.nd-prose, .nd-prose > div:not([class])) > h3 {
    margin: 26px 0 10px;
    font-size: 18px;
}

:is(.nd-prose, .nd-prose > div:not([class])) > h4 {
    margin: 20px 0 8px;
    font-size: 16px;
}

/* ---------- Danh sách gạch đầu dòng: thẻ nền nhạt, mỗi dòng ngăn cách ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > ul {
    margin: 4px 0 20px;
    padding: 6px 20px;
    list-style: none;
    border: 1px solid var(--nd-gold-line);
    border-radius: var(--nd-radius);
    background: var(--nd-gold-soft);
}

:is(.nd-prose, .nd-prose > div:not([class])) > ul > li {
    position: relative;
    margin: 0;
    padding: 9px 0 9px 22px;
    border-bottom: 1px dashed var(--nd-gold-line);
}

:is(.nd-prose, .nd-prose > div:not([class])) > ul > li:last-child {
    border-bottom: 0;
}

:is(.nd-prose, .nd-prose > div:not([class])) > ul > li::before {
    content: "";
    position: absolute;
    top: calc(9px + .9em - 4px);
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nd-gold);
    box-shadow: 0 0 0 3px rgba(201, 167, 74, .18);
}

/* ---------- Danh sách đánh số: số tròn viền vàng ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > ol {
    margin: 4px 0 20px;
    padding: 0;
    list-style: none;
    counter-reset: nd-ol;
}

:is(.nd-prose, .nd-prose > div:not([class])) > ol > li {
    position: relative;
    margin: 0 0 10px;
    padding: 2px 0 2px 40px;
    counter-increment: nd-ol;
}

:is(.nd-prose, .nd-prose > div:not([class])) > ol > li::before {
    content: counter(nd-ol);
    position: absolute;
    top: 2px;
    left: 0;
    width: 28px;
    height: 28px;
    border: 1px solid var(--nd-gold);
    border-radius: 50%;
    background: #fff;
    color: var(--nd-gold-dark);
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

/* Danh sách con bên trong: gọn, không nền */
:is(.nd-prose, .nd-prose > div:not([class])) > :is(ul, ol) li :is(ul, ol) {
    margin: 6px 0 0;
    padding: 0 0 0 18px;
    list-style: circle;
    border: 0;
    background: none;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(ul, ol) li li {
    margin: 4px 0;
    padding: 0;
    border: 0;
    counter-increment: none;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(ul, ol) li li::before {
    content: none;
}

/* ---------- Liên kết ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > :is(p, ul, ol, blockquote) a {
    color: var(--nd-gold-dark);
    text-decoration: underline;
    text-decoration-color: rgba(138, 106, 31, .35);
    text-underline-offset: 3px;
    transition: color .15s, text-decoration-color .15s;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(p, ul, ol, blockquote) a:hover {
    color: #000;
    text-decoration-color: currentColor;
}

/* ---------- Trích dẫn ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > blockquote {
    margin: 22px 0;
    padding: 14px 20px;
    border: 0;
    border-left: 4px solid var(--nd-gold);
    border-radius: 0 var(--nd-radius) var(--nd-radius) 0;
    background: var(--nd-gold-soft);
    color: #3a3a3a;
    font-size: 16px;
    font-style: italic;
}

:is(.nd-prose, .nd-prose > div:not([class])) > blockquote p:last-child {
    margin-bottom: 0;
}

/* ---------- Ảnh & chú thích ---------- */
.nd-prose img {
    max-width: 100%;
    height: auto;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(p, figure, .image-wrapper) img {
    border-radius: 8px;
}

:is(.nd-prose, .nd-prose > div:not([class])) > :is(figure, .image-wrapper) {
    margin: 22px 0;
    text-align: center;
}

.nd-prose figcaption,
.nd-prose .post-img-caption {
    margin: 8px auto 0;
    max-width: 640px;
    color: var(--nd-muted);
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    text-align: center;
}

/* ---------- Đường kẻ ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > hr {
    height: 1px;
    margin: 28px 0;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--nd-gold-line) 20%, var(--nd-gold) 50%, var(--nd-gold-line) 80%, transparent);
}

/* ---------- Bảng (mô tả sản phẩm đã có kiểu riêng trong cus-style.css, rule đó ưu tiên hơn) ---------- */
:is(.nd-prose, .nd-prose > div:not([class])) > table {
    width: 100%;
    margin: 18px 0 22px;
    border-collapse: collapse;
    font-size: 14.5px;
}

:is(.nd-prose, .nd-prose > div:not([class])) > table :is(th, td) {
    padding: 10px 12px;
    border: 1px solid var(--nd-gold-line);
    vertical-align: top;
}

:is(.nd-prose, .nd-prose > div:not([class])) > table th {
    background: var(--nd-gold-soft);
    color: var(--nd-heading);
    font-weight: 600;
    text-align: left;
}

/* ---------- Điện thoại ---------- */
@media (max-width: 767px) {
    .nd-prose {
        font-size: 15px;
        line-height: 1.75;
    }

    :is(.nd-prose, .nd-prose > div:not([class])) > h2 {
        margin-top: 28px;
        font-size: 19px;
    }

    :is(.nd-prose, .nd-prose > div:not([class])) > h3 {
        font-size: 17px;
    }

    :is(.nd-prose, .nd-prose > div:not([class])) > ul {
        padding: 4px 14px;
    }

    :is(.nd-prose, .nd-prose > div:not([class])) > table {
        display: block;
        overflow-x: auto;
    }
}
