/**
 * TK Single Post
 * Phase 1: Collapsible Elementor Table of Contents
 */

/* =========================
   TABLE OF CONTENTS
   ========================= */

.single-post .elementor-widget-table-of-contents {
    margin-bottom: 32px;
}

/* Header của TOC */
.single-post .elementor-widget-table-of-contents .elementor-toc__header {
    cursor: pointer;
    user-select: none;
}

/* Phần danh sách TOC - mặc định đóng */
.single-post .elementor-widget-table-of-contents .elementor-toc__body {
    display: none;
}

/* Khi mở */
.single-post .elementor-widget-table-of-contents.tk-toc-is-open
.elementor-toc__body {
    display: block;
}

/* Mũi tên */
.single-post .elementor-widget-table-of-contents .elementor-toc__toggle-button {
    transition: transform 0.2s ease;
}

/* Xoay mũi tên khi mở */
.single-post .elementor-widget-table-of-contents.tk-toc-is-open
.elementor-toc__toggle-button {
    transform: rotate(180deg);
}

    font-size: 23px;
    line-height: 1.4;
}

.single-post .entry-content p {
    margin-bottom: 22px;
}

/* Ảnh trong bài */
.single-post .entry-content img {
    max-width: 100%;
    height: auto;
}

/* Bảng trong bài */
.single-post .entry-content table {
    width: 100%;
    max-width: 100%;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .single-post .site-content > .ast-container {
        width: calc(100% - 48px);
        column-gap: 40px;
    }

}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 921px) {

    .single-post .site-content > .ast-container {
        width: calc(100% - 40px);
        display: block;
    }

    .single-post .content-area {
        width: 100%;
    }

    .single-post .entry-content {
        max-width: 100%;
        font-size: 16px;
        line-height: 1.75;
    }

    .single-post .entry-title {
        max-width: 100%;
        font-size: 34px;
    }

}

/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 575px) {

    .single-post .site-content > .ast-container {
        width: calc(100% - 28px);
    }

    .single-post .entry-title {
        font-size: 30px;
    }

    .single-post .entry-content h2 {
        font-size: 25px;
    }

    .single-post .entry-content h3 {
        font-size: 20px;
    }

}

/* =========================================================
   TK SINGLE POST
   Phase 3 — Article Header & Reading Typography
   ========================================================= */

/* ---------------------------------------------------------
   1. TOC → H1
   --------------------------------------------------------- */

.single-post .elementor-widget-table-of-contents {
    margin-bottom: 28px !important;
}

/* ---------------------------------------------------------
   2. Tiêu đề bài viết
   --------------------------------------------------------- */

.single-post .entry-title {
    max-width: 900px;
    margin-top: 0 !important;
    margin-bottom: 22px !important;

    color: #7f1f20;
    font-size: clamp(38px, 3vw, 44px);
    line-height: 1.18;
    letter-spacing: -0.025em;
    font-weight: 750;
}

/* ---------------------------------------------------------
   3. Nội dung bài viết
   --------------------------------------------------------- */

.single-post .entry-content {
    color: #303c38;
    font-size: 17px;
    line-height: 1.82;
}

/* Đoạn văn */
.single-post .entry-content p {
    margin-top: 0;
    margin-bottom: 22px;
}

/* Khoảng cách giữa các đoạn đầu bài */
.single-post .entry-content > p:first-of-type {
    margin-bottom: 24px;
}

/* Link trong bài */
.single-post .entry-content a {
    color: #0877d1;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Link khi hover */
.single-post .entry-content a:hover {
    color: #7f1f20;
}

/* ---------------------------------------------------------
   4. Heading trong bài
   --------------------------------------------------------- */

.single-post .entry-content h2 {
    margin-top: 52px;
    margin-bottom: 20px;

    color: #7f1f20;
    font-size: 29px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.single-post .entry-content h3 {
    margin-top: 36px;
    margin-bottom: 16px;

    color: #153d34;
    font-size: 22px;
    line-height: 1.4;
}

/* ---------------------------------------------------------
   5. Hình ảnh trong bài
   --------------------------------------------------------- */

.single-post .entry-content figure {
    margin-top: 30px;
    margin-bottom: 32px;
}

.single-post .entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ---------------------------------------------------------
   6. Danh sách
   --------------------------------------------------------- */

.single-post .entry-content ul,
.single-post .entry-content ol {
    margin-top: 0;
    margin-bottom: 24px;
    padding-left: 26px;
}

.single-post .entry-content li {
    margin-bottom: 8px;
}

/* ---------------------------------------------------------
   7. Bảng
   --------------------------------------------------------- */

.single-post .entry-content table {
    width: 100%;
    margin: 28px 0 34px;
}

/* ---------------------------------------------------------
   8. Tablet
   --------------------------------------------------------- */

@media (max-width: 921px) {

    .single-post .elementor-widget-table-of-contents {
        margin-bottom: 24px !important;
    }

    .single-post .entry-title {
        font-size: 34px;
        line-height: 1.2;
        margin-bottom: 20px !important;
    }

    .single-post .entry-content {
        font-size: 16px;
        line-height: 1.78;
    }

    .single-post .entry-content h2 {
        font-size: 27px;
        margin-top: 44px;
    }

    .single-post .entry-content h3 {
        font-size: 21px;
    }
}

/* ---------------------------------------------------------
   9. Mobile
   --------------------------------------------------------- */

@media (max-width: 575px) {

    .single-post .elementor-widget-table-of-contents {
        margin-bottom: 22px !important;
    }

    .single-post .entry-title {
        font-size: 30px;
        line-height: 1.22;
    }

    .single-post .entry-content {
        font-size: 16px;
        line-height: 1.75;
    }

    .single-post .entry-content h2 {
        font-size: 25px;
        line-height: 1.3;
    }

    .single-post .entry-content h3 {
        font-size: 20px;
    }
}

/* =========================================================
   TK SINGLE POST
   Phase 3.1 — Tighten TOC → Article Title
   ========================================================= */

/* TOC */
.single-post .elementor-widget-table-of-contents {
    margin-top: 0 !important;
    margin-bottom: 18px !important;
    padding-bottom: 0 !important;
}

/* Các wrapper Elementor quanh TOC */
.single-post .elementor-widget-table-of-contents > .elementor-widget-container {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Khu vực tiêu đề bài */
.single-post .entry-header {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Nếu H1 nằm trực tiếp sau vùng TOC */
.single-post .entry-title {
    margin-top: 0 !important;
}

/* Loại bỏ khoảng cách do Astra/Elementor tạo ở đầu content */
.single-post .entry-content {
    margin-top: 0 !important;
}

/* Nếu Elementor đặt gap giữa các widget */
.single-post .elementor-widget-table-of-contents + .elementor-widget-post-title,
.single-post .elementor-widget-table-of-contents + .elementor-widget-theme-post-title {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* =========================================================
   TK SINGLE POST
   Phase 3.2 — Remove excessive gap above post title
   ========================================================= */

/* TOC */
.single-post .elementor-widget-table-of-contents {
    margin-bottom: 20px !important;
}

/* Các vùng chứa tiêu đề của Astra */
.single-post .entry-header,
.single-post .entry-header.ast-no-thumbnail {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Post title */
.single-post .entry-header .entry-title {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Astra content wrapper */
.single-post .site-main > article {
    margin-top: 0 !important;
}

.single-post .site-main > article > .entry-header {
    margin-top: 0 !important;
}

/* Một số phiên bản Astra đặt khoảng cách ở article */
.single-post article.ast-article-single {
    padding-top: 0 !important;
}

/* Nếu TOC và title cùng nằm trong vùng Elementor */
.single-post .elementor-widget-table-of-contents + .elementor-widget {
    margin-top: 0 !important;
}

/* Không để container tạo khoảng cách phía trên */
.single-post .elementor-location-single {
    padding-top: 0 !important;
}

/* Desktop */
@media (min-width: 922px) {
    .single-post .entry-header {
        margin-bottom: 0 !important;
    }
}