/* Bài viết: sidebar máy tính (TOC + bài mới nhất). Markup: libs/article-sidebar.php.
   Chỉ hiện từ 1200px; nhỏ hơn thì ẩn, bài giữ bố cục một cột như cũ. */

.hih-article-aside {
    display: none;
}

/* Neo tiêu đề không bị header dính che khi bấm mục lục */
body.single-post .wpresidence-post-content h2[id] {
    scroll-margin-top: calc(var(--hih-as-top, 164px) + 6px);
}

@media (min-width: 1200px) {
    /* Khung nội dung của template Article (container d32111b, 900px) nới ra để có chỗ cho sidebar */
    body.single-post .elementor-element.elementor-element-d32111b {
        --content-width: 1180px;
    }

    .hih-article-layout {
        display: grid;
        grid-template-columns: minmax(0, 760px) 300px;
        column-gap: 64px;
        justify-content: center;
        align-items: start;
    }
    .hih-article-main {
        min-width: 0;
    }
    body.single-post .hih-article-main .wpresidence-post-content {
        margin-left: 0;
        margin-right: 0;
    }

    .hih-article-aside {
        display: flex;
        flex-direction: column;
        gap: 24px;
        height: 100%;
    }
    /* Vùng dính chiếm phần còn trống phía trên, nên mục lục dừng lại trước khối "bài mới nhất" */
    .hih-article-aside__sticky {
        flex: 1 1 auto;
    }
    .hih-article-aside__sticky > .hih-as__box {
        position: sticky;
        top: var(--hih-as-top, 164px);
        max-height: calc(100vh - var(--hih-as-top, 164px) - 20px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #e2d7c6 transparent;
    }
}

/* Giao diện theo tông site: vàng đồng (#C4A77D / #a8854f), nâu ấm (#3e2f26 / #5E534D), tiêu đề Merriweather,
   thẻ nền kem bo góc mềm (giống thanh mục lục trang dự án, libs/section-nav.php). */
.hih-article-aside {
    --as-accent: #C4A77D;
    --as-accent-ink: #a8854f;
    --as-ink: #2B211D;
    --as-text: #5E534D;
    --as-muted: #8a7f78;
    --as-line: #ece5db;
    --as-bg: #ffffff;
    --as-hover: #f7f1e8;
}

.hih-as__box {
    background: var(--as-bg);
    border: 1px solid var(--as-line);
    border-radius: 14px;
    padding: 22px 20px 16px;
}
.hih-as__title {
    position: relative;
    margin: 0 0 14px;
    padding-bottom: 12px;
    font-family: Merriweather, Georgia, serif;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    color: #3e2f26;
}
.hih-as__title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: var(--as-accent);
}

/* Mục lục: số thứ tự vàng, mục đang đọc nền kem đậm + vạch vàng */
.hih-as__toc {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: hih-toc;
}
.hih-as__toc li {
    margin: 0;
    counter-increment: hih-toc;
}
.hih-as__toc a {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 8px 10px 8px 12px;
    margin: 0 -10px 2px -12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--as-text);
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.hih-as__toc a::before {
    content: counter(hih-toc, decimal-leading-zero);
    flex: 0 0 auto;
    min-width: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    color: var(--as-accent);
}
.hih-as__toc a:hover {
    background: var(--as-hover);
    color: var(--as-ink);
}
.hih-as__toc a.is-active {
    background: var(--as-hover);
    color: var(--as-ink);
    font-weight: 500;
}
.hih-as__toc a.is-active::before {
    color: var(--as-accent-ink);
}
.hih-as__toc a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--as-accent);
}

/* Bài mới nhất */
.hih-as__posts {
    list-style: none;
    margin: 0;
    padding: 0;
}
.hih-as__post + .hih-as__post {
    border-top: 1px solid var(--as-line);
}
.hih-as__post a {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    text-decoration: none;
}
.hih-as__thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--as-hover);
    transition: opacity .15s;
}
.hih-as__post-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.hih-as__post-title {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    color: var(--as-ink);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}
.hih-as__post a:hover .hih-as__post-title {
    color: var(--as-accent-ink);
}
.hih-as__post a:hover .hih-as__thumb {
    opacity: .85;
}
.hih-as__post-date {
    font-size: 12px;
    color: var(--as-muted);
}
