/* ============================================================
   Julyem - Giao diện CHI TIẾT BÀI VIẾT (single post)
   Style lại markup mặc định của Flatsome theo nhận diện Julyem.
   Mọi selector đều bọc trong .blog-single để không ảnh hưởng
   trang lưu trữ / trang khác.
   ============================================================ */

.blog-single {
    --jl-primary: #003462;
    --jl-heading: #0B3F66;
    --jl-gold: #CFA56A;
    --jl-gold-soft: #E4C79A;
    --jl-text: #333333;
    --jl-muted: #7A8A99;
    --jl-line: rgba(11, 63, 102, .1);
    --jl-paper: #fcfaf6;
}

/* ---------- Thanh tiến trình đọc ---------- */
.jl-read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--jl-gold), var(--jl-gold-soft));
    z-index: 9999;
    transition: width .1s linear;
    box-shadow: 0 0 8px rgba(207, 165, 106, .6);
}

/* ---------- Khung chung ---------- */
.blog-single.page-wrapper {
    padding-top: 28px;
}

.blog-single .row-divided > .col + .col {
    border-color: var(--jl-line);
}

/* ============================================================
   HEADER BÀI VIẾT
   ============================================================ */
.blog-single .entry-header {
    margin-bottom: 34px;
}

.blog-single .entry-header-text {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    padding: 8px 16px 0;
}

/* Chuyên mục */
.blog-single .entry-category {
    margin-bottom: 16px;
    letter-spacing: 2.5px;
    font-weight: 700;
}

.blog-single .entry-category a {
    color: var(--jl-gold);
    text-decoration: none;
    transition: color .2s ease;
}

.blog-single .entry-category a:hover {
    color: var(--jl-primary);
}

/* Tiêu đề */
.blog-single h1.entry-title {
    color: var(--jl-heading);
    font-weight: 700;
    line-height: 1.25;
    font-size: clamp(24px, 4.4vw, 30px);
    margin: 0 auto 18px;
    max-width: 760px;
}

/* Đường kẻ vàng dưới tiêu đề */
.blog-single .entry-divider.is-divider {
    background: linear-gradient(90deg, transparent, var(--jl-gold), transparent);
    height: 2px;
    width: 90px;
    margin: 18px auto 20px;
}

/* Meta header (ngày đăng / tác giả) */
.blog-single .entry-header-text .entry-meta {
    color: var(--jl-muted);
    letter-spacing: 1.2px;
    font-weight: 600;
}

.blog-single .entry-header-text .entry-meta a {
    color: var(--jl-muted);
    text-decoration: none;
    transition: color .2s ease;
}

.blog-single .entry-header-text .entry-meta a:hover {
    color: var(--jl-gold);
}

/* ---------- Ảnh đại diện ---------- */
.blog-single .entry-image {
    max-width: 1000px;
    margin: 30px auto 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 22px 50px -20px rgba(0, 52, 98, .45);
}

.blog-single .entry-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 20px;
}

/* Badge ngày trên ảnh */
.blog-single .entry-image .badge.post-date .badge-inner {
    background: var(--jl-primary);
    color: #fff;
    border: 1px solid var(--jl-gold);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}

.blog-single .entry-image .badge.post-date .post-date-day {
    color: var(--jl-gold-soft);
}

/* ============================================================
   HERO HEADER - tiêu đề đè lên ảnh đại diện
   Chỉ kích hoạt khi bài viết CÓ ảnh đại diện (:has).
   Bài không ảnh giữ nguyên header thường ở trên.
   ============================================================ */
.blog-single .entry-header:has(.entry-image) {
    position: relative;
    margin-bottom: 44px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 22px 50px -20px rgba(0, 52, 98, .5);
}

/* Ảnh phủ kín khung hero */
.blog-single .entry-header:has(.entry-image) .entry-image {
    margin: 0;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.blog-single .entry-header:has(.entry-image) .entry-image a {
    display: block;
    height: 100%;
}

.blog-single .entry-header:has(.entry-image) .entry-image img {
    width: 100%;
    height: clamp(360px, 56vh, 560px);
    object-fit: cover;
    border-radius: 0;
}

/* Lớp overlay tối để chữ nổi bật */
.blog-single .entry-header:has(.entry-image) .entry-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(0, 40, 71, .92) 0%,
        rgba(0, 52, 98, .55) 45%,
        rgba(0, 52, 98, .18) 78%,
        rgba(0, 52, 98, .28) 100%
    );
}

/* Khối chữ đè lên đáy ảnh */
.blog-single .entry-header:has(.entry-image) .entry-header-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 32px 42px;
}

.blog-single .entry-header:has(.entry-image) .entry-category a {
    color: var(--jl-gold-soft);
    text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}

.blog-single .entry-header:has(.entry-image) .entry-category a:hover {
    color: #fff;
}

.blog-single .entry-header:has(.entry-image) h1.entry-title {
    color: #fff;
    text-shadow: 0 2px 22px rgba(0, 0, 0, .45);
}

.blog-single .entry-header:has(.entry-image) .entry-divider.is-divider {
    background: linear-gradient(90deg, transparent, var(--jl-gold-soft), transparent);
}

.blog-single .entry-header:has(.entry-image) .entry-header-text .entry-meta,
.blog-single .entry-header:has(.entry-image) .entry-header-text .entry-meta a {
    color: rgba(255, 255, 255, .9);
    text-shadow: 0 1px 8px rgba(0, 0, 0, .4);
}

.blog-single .entry-header:has(.entry-image) .entry-header-text .entry-meta a:hover {
    color: var(--jl-gold-soft);
}

/* Badge ngày nổi trên overlay */
.blog-single .entry-header:has(.entry-image) .entry-image .badge.post-date {
    z-index: 3;
}

@media (max-width: 849px) {
    .blog-single .entry-header:has(.entry-image) {
        border-radius: 14px;
        margin-bottom: 30px;
    }
    .blog-single .entry-header:has(.entry-image) .entry-image img {
        height: clamp(300px, 62vh, 440px);
    }
    .blog-single .entry-header:has(.entry-image) .entry-header-text {
        padding: 0 20px 28px;
    }
}

/* ============================================================
   MỤC LỤC (TOC) - tự sinh từ H2/H3
   ============================================================ */
.blog-single .jl-toc {
    margin: 0 0 36px;
    background: var(--jl-paper);
    border: 1px solid var(--jl-line);
    border-left: 4px solid var(--jl-gold);
    border-radius: 14px;
    overflow: hidden;
}

.blog-single .jl-toc-head {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 16px 20px;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--jl-heading);
    -webkit-appearance: none;
    appearance: none;
}

.blog-single .jl-toc-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.blog-single .jl-toc-title svg {
    color: var(--jl-gold);
}

.blog-single .jl-toc-chevron {
    color: var(--jl-muted);
    transition: transform .25s ease;
    flex: 0 0 auto;
}

.blog-single .jl-toc.is-collapsed .jl-toc-chevron {
    transform: rotate(-90deg);
}

.blog-single .jl-toc-list {
    list-style: none;
    margin: 0;
    padding: 4px 20px 18px;
    max-height: 1200px;
    overflow: hidden;
    transition: max-height .3s ease, padding .3s ease, opacity .25s ease;
}

.blog-single .jl-toc.is-collapsed .jl-toc-list {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.blog-single .jl-toc-item {
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.blog-single .jl-toc-item::marker {
    content: "";
}

.blog-single .jl-toc-item a {
    display: block;
    padding: 6px 0 6px 14px;
    border-left: 2px solid transparent;
    color: var(--jl-text);
    font-size: 15.5px;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}

.blog-single .jl-toc-h3 a {
    padding-left: 30px;
    font-size: 14.5px;
    color: var(--jl-muted);
}

.blog-single .jl-toc-item a:hover {
    color: var(--jl-gold);
}

.blog-single .jl-toc-item a.is-active {
    color: var(--jl-primary);
    font-weight: 700;
    border-left-color: var(--jl-gold);
}

/* ============================================================
   NỘI DUNG BÀI VIẾT
   ============================================================ */
.blog-single .entry-content.single-page {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    color: var(--jl-text);
    font-size: 17.5px;
    line-height: 1.85;
}

.blog-single .entry-content.single-page > p {
    margin: 0 0 1.4em;
}

/* Đoạn mở đầu nổi bật (chữ to hơn một chút) */
.blog-single .entry-content.single-page > p:first-of-type {
    font-size: 1.08em;
    color: #2a2a2a;
}

/* Tiêu đề trong bài */
.blog-single .entry-content.single-page h2,
.blog-single .entry-content.single-page h3,
.blog-single .entry-content.single-page h4 {
    color: var(--jl-heading);
    font-weight: 700;
    line-height: 1.3;
    scroll-margin-top: 90px;
}

.blog-single .entry-content.single-page h2 {
    font-size: clamp(22px, 3vw, 30px);
    margin: 1.8em 0 .7em;
    padding-left: 16px;
    border-left: 4px solid var(--jl-gold);
}

.blog-single .entry-content.single-page h3 {
    font-size: clamp(19px, 2.4vw, 24px);
    margin: 1.6em 0 .6em;
}

.blog-single .entry-content.single-page h4 {
    font-size: clamp(17px, 2vw, 20px);
    margin: 1.4em 0 .5em;
}

/* Link trong bài */
.blog-single .entry-content.single-page a {
    color: var(--jl-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color .2s ease;
}

.blog-single .entry-content.single-page a:hover {
    color: var(--jl-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Danh sách với marker vàng (loại trừ mục lục TOC) */
.blog-single .entry-content.single-page ul:not(.jl-toc-list),
.blog-single .entry-content.single-page ol:not(.jl-toc-list) {
    margin: 0 0 1.4em;
    padding-left: 1.4em;
}

.blog-single .entry-content.single-page li:not(.jl-toc-item) {
    margin-bottom: .55em;
    padding-left: .3em;
}

.blog-single .entry-content.single-page ul li:not(.jl-toc-item)::marker {
    color: var(--jl-gold);
    content: "◆ ";
    font-size: .8em;
}

.blog-single .entry-content.single-page ol li:not(.jl-toc-item)::marker {
    color: var(--jl-gold);
    font-weight: 700;
}

/* Trích dẫn */
.blog-single .entry-content.single-page blockquote {
    position: relative;
    margin: 1.8em 0;
    padding: 22px 26px 22px 56px;
    background: var(--jl-paper);
    border-left: 4px solid var(--jl-gold);
    border-radius: 0 14px 14px 0;
    color: var(--jl-heading);
    font-style: italic;
    font-size: 1.05em;
    line-height: 1.7;
}

.blog-single .entry-content.single-page blockquote::before {
    content: "\201C";
    position: absolute;
    left: 16px;
    top: 6px;
    font-size: 52px;
    line-height: 1;
    color: var(--jl-gold);
    opacity: .55;
    font-family: Georgia, serif;
}

.blog-single .entry-content.single-page blockquote p:last-child {
    margin-bottom: 0;
}

/* Ảnh trong bài */
.blog-single .entry-content.single-page img {
    border-radius: 14px;
    box-shadow: 0 14px 34px -16px rgba(0, 52, 98, .4);
}

.blog-single .entry-content.single-page figure,
.blog-single .entry-content.single-page .wp-caption {
    margin: 1.8em auto;
    max-width: 100%;
}

.blog-single .entry-content.single-page figcaption,
.blog-single .entry-content.single-page .wp-caption-text {
    margin-top: 10px;
    text-align: center;
    color: var(--jl-muted);
    font-size: 14px;
    font-style: italic;
}

/* Đường kẻ ngang */
.blog-single .entry-content.single-page hr {
    border: 0;
    height: 1px;
    margin: 2.2em auto;
    width: 120px;
    background: linear-gradient(90deg, transparent, var(--jl-gold), transparent);
}

/* Bảng */
.blog-single .entry-content.single-page table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.6em 0;
    font-size: 16px;
}

.blog-single .entry-content.single-page table th {
    background: var(--jl-primary);
    color: #fff;
    font-weight: 700;
    text-align: left;
}

.blog-single .entry-content.single-page table th,
.blog-single .entry-content.single-page table td {
    border: 1px solid var(--jl-line);
    padding: 10px 14px;
}

.blog-single .entry-content.single-page table tr:nth-child(even) td {
    background: var(--jl-paper);
}

/* ---------- Khu vực chia sẻ ---------- */
.blog-single .blog-share {
    max-width: 820px;
    margin: 40px auto 0;
}

.blog-single .blog-share .is-divider {
    background: var(--jl-line);
}

/* ============================================================
   FOOTER: meta + tác giả + điều hướng
   ============================================================ */
.blog-single .entry-meta:not(.uppercase) {
    max-width: 820px;
    margin: 26px auto 0;
    color: var(--jl-muted);
    font-size: 14.5px;
}

.blog-single .entry-meta a {
    color: var(--jl-gold);
    text-decoration: none;
}

.blog-single .entry-meta a:hover {
    text-decoration: underline;
}

/* Hộp tác giả */
.blog-single .entry-author.author-box {
    max-width: 820px;
    margin: 36px auto 0;
    padding: 26px 28px;
    background: var(--jl-paper);
    border: 1px solid var(--jl-line);
    border-radius: 18px;
}

.blog-single .entry-author .blog-author-image img {
    border-radius: 50%;
    border: 2px solid var(--jl-gold);
}

.blog-single .entry-author .author-name {
    color: var(--jl-heading);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.blog-single .entry-author .author-desc {
    color: var(--jl-muted);
    margin-bottom: 0;
}

/* Điều hướng bài trước / sau */
.blog-single .nav-pagination,
.blog-single .post-navigation {
    max-width: 820px;
    margin: 38px auto 0;
}

.blog-single .nav-pagination a {
    border: 1px solid var(--jl-line);
    border-radius: 12px;
    padding: 10px 18px;
    color: var(--jl-heading);
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.blog-single .nav-pagination a:hover {
    background: var(--jl-primary);
    border-color: var(--jl-primary);
    color: #fff;
}

/* ---------- Sidebar ---------- */
.blog-single .post-sidebar .widget-title {
    color: var(--jl-heading);
}

.blog-single .post-sidebar a {
    color: var(--jl-text);
    transition: color .2s ease;
}

.blog-single .post-sidebar a:hover {
    color: var(--jl-gold);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 849px) {
    .blog-single.page-wrapper {
        padding-top: 14px;
    }
    .blog-single .entry-image {
        border-radius: 14px;
    }
    .blog-single .entry-image img {
        border-radius: 14px;
    }
    .blog-single .entry-content.single-page {
        font-size: 16.5px;
        line-height: 1.8;
    }
    .blog-single .entry-author.author-box {
        padding: 20px;
    }
}

/* ============================================================
   BÀI VIẾT LIÊN QUAN
   ============================================================ */
.blog-single .jl-related {
    margin: 56px auto 8px;
    padding-top: 40px;
    border-top: 1px solid var(--jl-line);
}

.blog-single .jl-related-inner {
    max-width: 1180px;
    margin: 0 auto;
}

/* Tiêu đề khối */
.blog-single .jl-rel-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 0 0 36px;
    color: var(--jl-heading);
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: center;
}

.blog-single .jl-rel-orn {
    flex: 0 0 auto;
    width: clamp(36px, 8vw, 100px);
    height: 12px;
    position: relative;
}

.blog-single .jl-rel-orn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.blog-single .jl-rel-orn-left::before {
    background: linear-gradient(90deg, transparent, var(--jl-gold));
}

.blog-single .jl-rel-orn-right::before {
    background: linear-gradient(90deg, var(--jl-gold), transparent);
}

.blog-single .jl-rel-orn::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 7px;
    height: 7px;
    background: var(--jl-gold);
    transform: translateY(-50%) rotate(45deg);
}

.blog-single .jl-rel-orn-left::after { right: 0; }
.blog-single .jl-rel-orn-right::after { left: 0; }

/* Lưới thẻ */
.blog-single .jl-rel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

/* Thẻ */
.blog-single .jl-rel-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--jl-line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 26px -18px rgba(0, 52, 98, .4);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.blog-single .jl-rel-card:hover {
    transform: translateY(-6px);
    border-color: rgba(207, 165, 106, .55);
    box-shadow: 0 18px 38px -16px rgba(0, 52, 98, .5);
}

.blog-single .jl-rel-thumb {
    display: block;
    aspect-ratio: 16 / 11;
    overflow: hidden;
    background: var(--jl-paper);
}

.blog-single .jl-rel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.blog-single .jl-rel-card:hover .jl-rel-thumb img {
    transform: scale(1.06);
}

.blog-single .jl-rel-thumb-ph {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0e4a78, var(--jl-gold));
}

.blog-single .jl-rel-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 16px 20px 20px;
}

.blog-single .jl-rel-date {
    color: var(--jl-muted);
    font-size: 13px;
    letter-spacing: .4px;
    margin-bottom: 8px;
}

.blog-single .jl-rel-card-title {
    margin: 0 0 16px;
    font-size: 17px;
    line-height: 1.45;
    font-weight: 700;
    flex: 1 1 auto;
}

.blog-single .jl-rel-card-title a {
    color: var(--jl-heading);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s ease;
}

.blog-single .jl-rel-card-title a:hover {
    color: var(--jl-gold);
}

.blog-single .jl-rel-more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    align-self: flex-start;
    color: var(--jl-gold);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s ease, gap .2s ease;
}

.blog-single .jl-rel-more svg {
    transition: transform .2s ease;
}

.blog-single .jl-rel-more:hover {
    color: var(--jl-primary);
    gap: 11px;
}

.blog-single .jl-rel-more:hover svg {
    transform: translateX(2px);
}

@media (max-width: 849px) {
    .blog-single .jl-rel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 549px) {
    .blog-single .jl-rel-grid {
        grid-template-columns: 1fr;
    }
}
