/* =============================================================
   Leon Dio — Blog Archive & Single Post
   ============================================================= */

/* ── Archive Hero ─────────────────────────────────────────────── */
.blog-archive-hero {
    background: var(--secondary);
    padding: 36px 0;
    text-align: center;
}
.blog-archive-title {
    font-family: var(--font-heading);
    font-size: clamp(32px, 5vw, 52px);
    color: #fff;
    margin: 0 0 16px;
}
.blog-archive-desc {
    color: rgba(255, 255, 255, 0.65);
    font-size: 16px;
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto;
}
.blog-archive-breadcrumb {
    color: rgba(255,255,255,0.45);
    font-size: 13px;
    margin-bottom: 16px;
}
.blog-archive-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

/* ── Filter Bar (same pattern as archive-product) ─────────────── */
#blog-archive-page .archive-filter-bar {
    background: #fff;
    border-top: 1px solid #ebebeb;
    border-bottom: 1px solid #ebebeb;
    z-index: 90;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
#blog-archive-page .archive-filter-bar.is-sticky {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}
#blog-archive-page .archive-filter-bar-spacer { display: none; }
#blog-archive-page .archive-filter-bar-spacer.active { display: block; }

#blog-archive-page .filter-form {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 12px 0;
}
#blog-archive-page .filter-group {
    flex: 1;
    min-width: 120px;
    max-width: 260px;
}
#blog-archive-page .filter-select {
    appearance: none;
    -webkit-appearance: none;
    background: #f8f8f8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 9px 26px 9px 10px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
}
#blog-archive-page .filter-select:hover,
#blog-archive-page .filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(197,160,89,0.12);
}

/* ── Post Grid ────────────────────────────────────────────────── */
.blog-archive-posts { padding: 48px 0 72px; }

.blog-post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px 28px;
}

/* ── Post Card ────────────────────────────────────────────────── */
.blog-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
    transform: translateY(-4px);
}
.blog-card-thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 40 / 21;
    background: #f0ede8;
}
.blog-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-thumb img {
    transform: scale(1.04);
}
.blog-card-no-thumb {
    aspect-ratio: 40 / 21;
    background: linear-gradient(135deg, #1a1a1a 0%, #2e2e2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.blog-card-no-thumb i {
    font-size: 36px;
    color: var(--primary);
    opacity: 0.4;
}
.blog-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.blog-card-cat {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 2px;
    text-decoration: none;
    transition: background 0.2s;
}
.blog-card-cat:hover { background: var(--secondary); }
.blog-card-date {
    color: var(--text-muted);
    font-size: 12px;
}
.blog-card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 10px;
}
.blog-card-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
}
.blog-card-title a:hover { color: var(--primary); }
.blog-card-excerpt {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    margin: 0 0 18px;
    flex: 1;
}
.blog-card-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s;
    margin-top: auto;
}
.blog-card-link:hover { gap: 10px; }

/* ── Pagination ───────────────────────────────────────────────── */
.blog-pagination {
    margin-top: 60px;
    display: flex;
    justify-content: center;
}
.blog-pagination .page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
}
.blog-pagination .page-numbers li a,
.blog-pagination .page-numbers li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-radius: 2px;
}
.blog-pagination .page-numbers li a:hover,
.blog-pagination .page-numbers li span.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   SINGLE POST
   ═══════════════════════════════════════════════════════════════ */

/* ── Page wrapper ─────────────────────────────────────────────── */
#blog-single-page {
    padding-bottom: 0;
}
body.admin-bar #blog-single-page { padding-top: 124px; }

#blog-single-page > .container {
    padding-top: 32px;
    padding-bottom: 64px;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */
.sp-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.sp-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.sp-breadcrumb a:hover { text-decoration: underline; }
.sp-breadcrumb span { color: var(--text-muted); }

/* ── Featured Image (boxed, full container width) ─────────────── */
.sp-featured-image {
    width: 100%;
    aspect-ratio: 40 / 21;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 40px;
    background: #f0ede8;
}
.sp-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── Two-column layout ────────────────────────────────────────── */
.sp-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 52px;
    align-items: start;
}

/* ── Left: Main content ───────────────────────────────────────── */
.sp-main { min-width: 0; }

.sp-cats { margin-bottom: 12px; }
.sp-cat-tag {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 10px;
    border-radius: 2px;
    text-decoration: none;
    margin-right: 6px;
    transition: background 0.2s;
}
.sp-cat-tag:hover { background: var(--secondary); }

.sp-title {
    font-family: var(--font-heading);
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
    margin: 0 0 16px;
}

.sp-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}
.sp-meta i { color: var(--primary); margin-right: 5px; }
.sp-meta a { color: var(--text-muted); text-decoration: none; }
.sp-meta a:hover { color: var(--primary); }

/* ── Article content ──────────────────────────────────────────── */
.sp-content { line-height: 1.85; }
.sp-content h2,
.sp-content h3,
.sp-content h4 {
    font-family: var(--font-heading);
    color: var(--text-dark);
    margin: 2em 0 0.7em;
    line-height: 1.35;
}
.sp-content h2 { font-size: clamp(20px, 2.5vw, 26px); }
.sp-content h3 { font-size: clamp(17px, 2vw, 21px); }
.sp-content h4 { font-size: 17px; }
.sp-content p { color: #333; margin: 0 0 1.4em; }
.sp-content ul,
.sp-content ol { padding-left: 24px; margin: 0 0 1.4em; color: #333; }
.sp-content li { margin-bottom: 6px; }
.sp-content blockquote {
    border-left: 3px solid var(--primary);
    margin: 2em 0;
    padding: 14px 20px;
    background: #faf8f4;
    font-style: italic;
    color: #555;
}
.sp-content img { max-width: 100%; height: auto; border-radius: 3px; margin: 8px 0 16px; }
.sp-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* Reset article link styles inside product cards (shortcode [ld_products] in content) */
.sp-content .product-card a {
    color: inherit;
    text-decoration: none;
}
/* Keep btn-dark white text even inside sp-content */
.sp-content .product-card a.btn-dark,
.sp-content .product-card a.btn-dark:hover { color: #fff; }
.sp-content .product-info h3 {
    font-size: 15px;
    margin: 0 0 10px;
    line-height: 1.45;
    font-family: inherit;
}
.sp-content .product-info h3 a {
    color: var(--text-dark);
    text-decoration: none;
}
.sp-content .product-info h3 a:hover { color: var(--primary); }
.sp-content .product-img a { text-decoration: none; }
.sp-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 14px; }
.sp-content table th,
.sp-content table td { border: 1px solid #e0e0e0; padding: 10px 14px; text-align: left; }
.sp-content table th { background: var(--secondary); color: #fff; font-weight: 600; }
.sp-content table tr:nth-child(even) { background: #fafafa; }

/* ── Post Tags ────────────────────────────────────────────────── */
.sp-tags {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.sp-tags-label { font-size: 13px; color: var(--text-muted); }
.sp-tag {
    background: #f3f3f3;
    color: var(--text-dark);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.sp-tag:hover { background: var(--primary); color: #fff; }

/* ── Right: Sidebar ───────────────────────────────────────────── */
.sp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-self: start;
}

/* ── TOC ──────────────────────────────────────────────────────── */
.sp-toc {
    background: #faf8f4;
    border: 1px solid #ece8df;
    border-radius: 6px;
    padding: 20px;
}
.sp-toc-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0dbd0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-toc-title i { color: var(--primary); }
.sp-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 320px;
    overflow-y: auto;
}
.sp-toc-list::-webkit-scrollbar { width: 3px; }
.sp-toc-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }
.sp-toc-list li a {
    display: block;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    padding: 5px 0 5px 12px;
    border-left: 2px solid transparent;
    transition: all 0.18s;
}
.sp-toc-list li a:hover,
.sp-toc-list li a.toc-active {
    color: var(--primary);
    border-left-color: var(--primary);
    padding-left: 16px;
}
.sp-toc-list .toc-h3 a { padding-left: 24px; font-size: 12px; color: #777; }
.sp-toc-list .toc-h3 a:hover,
.sp-toc-list .toc-h3 a.toc-active { color: var(--primary); border-left-color: var(--primary); padding-left: 28px; }

/* ── Ad Banner ────────────────────────────────────────────────── */
.sp-ad-banner { border-radius: 6px; overflow: hidden; }
.sp-ad-inner {
    display: block;
    background: linear-gradient(145deg, var(--secondary) 0%, #2e2820 100%);
    padding: 24px 20px;
    text-decoration: none;
    text-align: center;
    border: 1px solid rgba(197,160,89,0.25);
    border-radius: 6px;
    transition: border-color 0.2s;
}
.sp-ad-inner:hover { border-color: var(--primary); }
.sp-ad-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    margin-bottom: 10px;
}
.sp-ad-headline {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 8px;
    line-height: 1.3;
}
.sp-ad-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
    margin: 0 0 16px;
}
.sp-ad-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 2px;
    transition: background 0.2s;
}
.sp-ad-inner:hover .sp-ad-btn { background: #b8903f; }

/* ── Sidebar Related ──────────────────────────────────────────── */
.sp-related-sidebar { }
.sp-related-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-related-title i { color: var(--primary); }
.sp-related-list { display: flex; flex-direction: column; gap: 14px; }
.sp-related-item {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 10px;
    text-decoration: none;
}
.sp-related-item:hover .sp-related-item-title { color: var(--primary); }
.sp-related-thumb {
    aspect-ratio: 40 / 21;
    overflow: hidden;
    border-radius: 3px;
    background: #f0ede8;
}
.sp-related-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.sp-related-item:hover .sp-related-thumb img { transform: scale(1.06); }
.sp-related-item-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.45;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sp-related-item-date { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Related Bottom Grid ──────────────────────────────────────── */
.sp-related-section {
    background: var(--bg-light);
    padding: 56px 0;
}
.post-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 36px;
}

/* ── Reading Progress ─────────────────────────────────────────── */
#reading-progress {
    position: fixed;
    top: 92px;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary);
    z-index: 99;
    transition: width 0.1s linear;
}
body.admin-bar #reading-progress { top: 124px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sp-layout { grid-template-columns: 1fr 260px; gap: 36px; }
    .blog-post-grid { grid-template-columns: repeat(2, 1fr); }
    .post-related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .blog-archive-hero { padding: 24px 0; }

    #blog-archive-page .filter-form { gap: 6px; padding: 10px 0; }
    #blog-archive-page .filter-select { font-size: 12px; padding: 8px 22px 8px 8px; }
    #blog-archive-page .filter-group { max-width: unset; }
    .blog-post-grid { grid-template-columns: 1fr; gap: 24px; }

    /* Single: sidebar lên trên content, full width */
    .sp-layout { grid-template-columns: 1fr; gap: 0; }
    .sp-sidebar {
        position: static;
        order: -1;
        margin-bottom: 28px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }
    .sp-toc { flex: 1; min-width: 260px; }
    .sp-ad-banner { display: none; }
    .sp-related-sidebar { display: none; }
    .sp-toc-list { max-height: 200px; }
    .sp-featured-image { border-radius: 3px; margin-bottom: 24px; }
    .post-related-grid { grid-template-columns: 1fr; gap: 20px; }
    #blog-single-page > .container { padding-top: 20px; padding-bottom: 40px; }
}
