.blog-detail-page {
    background: #fff;
}

.blog-detail-page .menu a.is-active {
    background: #ebf4ec;
    color: #123016;
}

.post-section {
    padding: 24px 0 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2f6b3a;
    font-weight: 700;
    margin-bottom: 12px;
}

.post-article {
    background: #fff;
    border: 1px solid #dce7dc;
    border-radius: 12px;
    padding: 18px;
}

.post-header {
    margin-bottom: 4px;
}

.post-date {
    margin: 0 0 10px;
    font-size: 14px;
    color: #748477;
}

.post-article h1 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 1.35;
    color: #1f2f22;
}

.post-excerpt {
    margin: 0 0 18px;
    font-size: 18px;
    line-height: 1.65;
    color: #3d5244;
    font-weight: 500;
}

.post-cover {
    margin: 0 0 16px;
    border-radius: 12px;
    overflow: hidden;
}

.post-cover img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
}

.post-body {
    font-size: 17px;
    line-height: 1.8;
    color: #2f4135;
}

.post-body p {
    margin: 0 0 12px;
}

.post-body h2,
.post-body h3 {
    margin: 1.25em 0 0.5em;
    line-height: 1.35;
    color: #1f2f22;
}

.post-body h2 {
    font-size: 1.35rem;
}

.post-body h3 {
    font-size: 1.15rem;
}

.post-body ul,
.post-body ol {
    margin: 0 0 12px;
    padding-left: 1.35em;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-placeholder {
    margin: 0;
    color: #748477;
    font-style: italic;
}

.post-gallery {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #e8eee9;
}

.post-gallery-title {
    margin: 0 0 14px;
    font-size: 1.2rem;
    color: #1f2f22;
}

.post-gallery-grid {
    display: grid;
    gap: 12px;
}

.post-gallery-grid--count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-gallery-grid--count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-gallery-grid--count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-gallery-item {
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e3ebe4;
    background: #fafcf9;
}

.post-gallery-item img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.related-section {
    padding: 0 0 30px;
}

.related-section h2 {
    margin: 0 0 12px;
    font-size: 24px;
    color: #1f2f22;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.related-item {
    background: #fff;
    border: 1px solid #dce7dc;
    border-radius: 12px;
    overflow: hidden;
}

.related-item a {
    display: block;
    height: 100%;
}

.related-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.related-item h3 {
    margin: 0;
    padding: 12px;
    font-size: 17px;
    line-height: 1.5;
    color: #1f2f22;
}

.related-item p {
    margin: 0;
    padding: 0 12px 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #4a5d4d;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-empty {
    grid-column: 1 / -1;
    background: #fff;
    border: 1px solid #dce7dc;
    border-radius: 12px;
    padding: 14px;
}

.related-empty p {
    margin: 0;
    color: #3d4f40;
}

@media (max-width: 1024px) {
    .post-article h1 {
        font-size: 28px;
    }

    .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .post-body {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .post-article {
        padding: 14px;
    }

    .post-article h1 {
        font-size: 24px;
    }

    .post-excerpt {
        font-size: 16px;
    }

    .post-gallery-grid--count-3,
    .post-gallery-grid--count-4 {
        grid-template-columns: 1fr;
    }

    .post-gallery-item img {
        height: 220px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .post-body {
        font-size: 15px;
    }
}

/* --- Trang chi tiết blog: layout 2 cột (mẫu) --- */
.blog-detail-content {
    background: #fff;
    padding: 36px 0 56px;
}

.blog-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 28%);
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
}

.blog-detail-title {
    margin: 0 0 10px;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
}

.blog-detail-meta {
    margin: 0 0 28px;
    font-size: 15px;
    line-height: 1.5;
    color: #6b7280;
}

.blog-detail-meta time {
    font-weight: 500;
}

.blog-toc {
    margin-bottom: 28px;
}

.blog-toc-label {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.blog-toc-box {
    border: 1px solid #e5e5e5;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 16px 18px;
}

.blog-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-toc-list li + li {
    margin-top: 10px;
}

.blog-toc-list a {
    color: #1f2f22;
    font-size: 15px;
    line-height: 1.5;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-toc-list a:hover {
    color: #2f6b3a;
}

.blog-toc-icon {
    display: inline-block;
    margin-right: 6px;
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.blog-detail-lead {
    margin: 0 0 28px;
    font-size: 17px;
    line-height: 1.75;
    color: #333;
}

.blog-detail-subtitle {
    margin: 0 auto 28px;
    max-width: min(calc(100% - 20px), 760px);
    text-align: center;
    font-size: 18px;
    line-height: 1.65;
    font-weight: 700;
    color: #221f36;
}

.blog-detail-subtitle p {
    margin: 0 0 12px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.blog-detail-subtitle p:last-child {
    margin-bottom: 0;
}

.blog-detail-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 28px;
    max-width: min(calc(100% - 20px), 760px);
    text-align: center;
}

.blog-detail-feature img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: cover;
    max-height: 420px;
}

.blog-detail-caption {
    margin: 12px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
    font-style: italic;
    text-align: center;
}

.blog-detail-body {
    font-size: 17px;
    line-height: 1.8;
    color: #2a2a2a;
}

.blog-detail-body p {
    margin: 0 0 16px;
}

/* Ảnh trong nội dung: cùng kích thước / căn giữa / crop như .blog-detail-feature */
.blog-detail-body img,
.blog-detail-body--richtext img {
    display: block !important;
    width: 100%;
    max-width: min(calc(100% - 20px), 760px);
    height: auto;
    margin: 0 auto 28px !important;
    float: none !important;
    object-fit: cover;
    max-height: 420px;
}

/* Nội dung từ WYSIWYG (Summernote, v.v.) */
.blog-detail-body--richtext h2,
.blog-detail-body--richtext h3,
.blog-detail-body--richtext h4,
.blog-detail-body--richtext h5,
.blog-detail-body--richtext h6 {
    margin: 1.25em 0 0.5em;
    line-height: 1.35;
    font-weight: 700;
    color: #1a1a1a;
}
.blog-detail-body--richtext h2 { font-size: 1.35rem; }
.blog-detail-body--richtext h3 { font-size: 1.2rem; }
.blog-detail-body--richtext h4 { font-size: 1.1rem; }
.blog-detail-body--richtext h5,
.blog-detail-body--richtext h6 { font-size: 1.05rem; }
.blog-detail-body--richtext h2:first-child,
.blog-detail-body--richtext h3:first-child,
.blog-detail-body--richtext h4:first-child {
    margin-top: 0;
}
.blog-detail-body--richtext ul,
.blog-detail-body--richtext ol {
    margin: 0 0 16px;
    padding-left: 1.5em;
}
.blog-detail-body--richtext li {
    margin-bottom: 8px;
}
.blog-detail-body--richtext blockquote {
    margin: 16px 0;
    padding: 12px 18px;
    border-left: 4px solid #2f6b3a;
    background: #f6faf6;
    color: #374151;
    font-style: italic;
}
.blog-detail-body--richtext hr {
    margin: 24px 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}
.blog-detail-body--richtext table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 15px;
}
.blog-detail-body--richtext th,
.blog-detail-body--richtext td {
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
}
.blog-detail-body--richtext th {
    background: #f3f4f6;
    font-weight: 600;
}

.blog-detail-body--richtext figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 28px;
    max-width: min(calc(100% - 20px), 760px);
    text-align: center;
}

.blog-detail-body--richtext figure img {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    max-height: 420px;
    object-fit: cover;
}

/* Đoạn chỉ có ảnh (Summernote thường bọc <p>) — cùng khối như .blog-detail-feature */
.blog-detail-body--richtext p:has(> img:only-child) {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 28px;
    max-width: min(calc(100% - 20px), 760px);
    text-align: center;
}

.blog-detail-body--richtext p:has(> img:only-child) img {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto !important;
    object-fit: cover;
    max-height: 420px;
    float: none !important;
}
.blog-detail-body--richtext pre,
.blog-detail-body--richtext code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
}
.blog-detail-body--richtext pre {
    margin: 16px 0;
    padding: 14px 16px;
    background: #f4f4f5;
    border-radius: 8px;
    overflow-x: auto;
}
.blog-detail-body--richtext a {
    color: #2f6b3a;
    font-weight: 600;
    text-decoration: underline;
}

.blog-detail-heading {
    margin: 28px 0 12px;
    font-size: 1.2rem;
    line-height: 1.35;
    font-weight: 700;
    color: #1a1a1a;
}

.blog-detail-heading:first-child {
    margin-top: 0;
}

.blog-detail-section {
    margin-bottom: 8px;
}

.blog-detail-subheading {
    margin: 24px 0 14px;
    font-size: 1.1rem;
    line-height: 1.35;
    font-weight: 700;
    color: #1a1a1a;
}

.blog-detail-inline-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 22px auto 0;
    max-width: min(calc(100% - 20px), 760px);
    text-align: center;
}

.blog-detail-inline-figure img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: cover;
    max-height: 380px;
}

.blog-sidebar-card {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 22px;
    background: #fff;
}

.blog-sidebar-title {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
}

.blog-sidebar-empty {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
}

.blog-sidebar-posts {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-sidebar-posts li + li {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #efefef;
}

.blog-sidebar-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
}

.blog-sidebar-row:hover .blog-sidebar-text {
    color: #2f6b3a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-sidebar-thumb {
    flex: 0 0 128px;
    width: 128px;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
}

.blog-sidebar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-sidebar-text {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    color: #1f2f22;
}

@media (max-width: 960px) {
    .blog-detail-grid {
        grid-template-columns: 1fr;
    }

    .blog-detail-aside {
        order: 2;
        max-width: 100%;
    }

    .blog-detail-article {
        order: 1;
    }
}
