/* ============================================================
   KBLIX Blog Stylesheet
   Inherits CSS variables from style.css
   ============================================================ */

/* ── Blog Header ────────────────────────────────────────────── */
.blog-header {
    background: var(--gradient-brand);
    padding: 150px 0 80px;
    margin-top: -75px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.blog-header::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(0,204,255,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,204,255,.05) 1px, transparent 1px);
    background-size: 56px 56px;
    pointer-events: none;
}
.blog-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--neutral);
    margin-bottom: 1rem;
    position: relative;
}
.blog-subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,.7);
    position: relative;
}

/* ── Blog Layout ────────────────────────────────────────────── */
.blog-main {
    margin-top: 3rem;
    padding-bottom: 4rem;
}

/* ── Post Card ──────────────────────────────────────────────── */
.blog-post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: var(--transition);
}
.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), .2);
}

.post-image {
    height: 260px;
    overflow: hidden;
}
.post-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
    display: block;
}
.blog-post-card:hover .post-image img { transform: scale(1.05); }

.post-content { padding: 1.6rem; }

/* Category pill */
.post-category { margin-bottom: .6rem; }
.post-category a {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), .2);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    display: inline-block;
    transition: var(--transition);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.post-category a:hover {
    background: var(--primary);
    color: var(--neutral);
    border-color: var(--primary);
}

/* Post title */
.post-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .75rem;
    line-height: 1.3;
}
.post-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color .25s;
}
.post-title a:hover { color: var(--primary); }

/* Meta row */
.post-meta {
    font-size: .83rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: center;
}
.post-meta i { margin-right: 4px; color: var(--primary); }

/* Excerpt */
.post-excerpt {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 1.2rem;
    font-size: .95rem;
}

/* Read more link */
.read-more {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .9rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: var(--transition);
}
.read-more:hover {
    color: var(--accent);
    gap: 10px;
}

/* Like button */
.like-button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: .8rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}
.like-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.like-button.liked {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.like-button i { margin-right: 3px; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination-wrapper { margin-top: 2.5rem; }
.pagination { gap: 6px; }
.page-link {
    color: var(--primary-dark);
    border-radius: var(--border-radius) !important;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    transition: var(--transition);
}
.page-link:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--neutral);
}
.page-item.active .page-link {
    background: var(--gradient-brand);
    border-color: transparent;
    color: var(--neutral);
    box-shadow: var(--shadow-blue);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar { position: sticky; top: 90px; }

.sidebar-widget {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-widget h4 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid transparent;
    border-image: var(--gradient-brand) 1;
    display: block;
    color: var(--text-dark);
}

/* Search form in sidebar */
.sidebar-widget .form-control {
    border-color: var(--border-color);
    font-size: .9rem;
}
.sidebar-widget .btn-search {
    background: var(--gradient-brand);
    border: none;
    color: var(--neutral);
    padding: 8px 16px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.sidebar-widget .input-group .btn {
    background: var(--gradient-brand);
    border: none;
    color: var(--neutral);
}
.sidebar-widget .input-group .btn:hover { opacity: .9; }

/* Recent posts list */
.recent-posts, .category-list {
    list-style: none;
    padding: 0; margin: 0;
}
.recent-posts li, .category-list li { margin-bottom: .6rem; }
.recent-posts li a, .category-list li a {
    color: var(--text-medium);
    text-decoration: none;
    font-size: .9rem;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(var(--border-color), .5);
}
.recent-posts li:last-child a,
.category-list li:last-child a { border-bottom: none; }
.recent-posts li a:hover, .category-list li a:hover {
    color: var(--primary);
    padding-left: 4px;
}
.category-list li a span {
    color: var(--text-muted);
    font-size: .78rem;
    background: var(--surface-alt);
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud .tag {
    background: var(--surface-alt);
    color: var(--text-medium);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: .78rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.tag-cloud .tag:hover {
    background: var(--primary);
    color: var(--neutral);
    border-color: var(--primary);
    box-shadow: var(--shadow-blue);
}

/* Featured post in sidebar */
.featured-post {
    display: flex; gap: 12px; align-items: flex-start;
    margin-bottom: .9rem; padding-bottom: .9rem;
    border-bottom: 1px solid var(--border-color);
}
.featured-post:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.featured-post img {
    width: 64px; height: 64px;
    object-fit: cover; border-radius: var(--border-radius);
    flex-shrink: 0;
}
.featured-post h5 { font-size: .87rem; margin: 0 0 4px; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; }
.featured-post h5 a { color: var(--text-dark); text-decoration: none; transition: color .25s; }
.featured-post h5 a:hover { color: var(--primary); }
.featured-post small { font-size: .72rem; color: var(--text-muted); }

/* Newsletter sidebar widget */
.newsletter-widget {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0,204,255,.08) 100%);
    border-color: rgba(var(--primary-rgb), .15);
}
.newsletter-widget h4 { border-image: none; border-bottom-color: rgba(var(--primary-rgb), .2); }

/* ── Single Post ────────────────────────────────────────────── */
.post-article { padding: 2.5rem 0 5rem; }
.single-post-main-article {
    background: var(--neutral);
    padding: 20px;
    border-radius: 20px;
}

.post-header { margin-bottom: 2rem; }
.post-header .post-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.post-featured-image { margin-bottom: 2.5rem; border-radius: var(--radius-lg); overflow: hidden; }
.post-featured-image img { width: 100%; display: block; border-radius: var(--radius-lg); }

/* Post TOC */
.toc-list { list-style: none; padding-left: 0; counter-reset: toc-counter; }
.toc-list li:not(.toc-sub)  { counter-increment: toc-counter; }
.toc-list li:not(.toc-sub) > a::before {
    content: counter(toc-counter) ". ";
    font-weight: 600;
    color: var(--primary);
}
.toc-list li.toc-sub > a::before { content: none; } /* no number for H3 sub-items */
.toc-list li.toc-sub { padding-left: 1.2rem; }

.toc-toggle-btn {
    background: none;
    border: none;
    padding: 0 4px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted, #6b7a8d);
    font-size: 0.8rem;
    margin-left: auto;          /* pushes it to the far right of the header flex row */
    transition: color 0.2s, transform 0.2s;
}
.toc-toggle-btn:hover  { color: var(--primary); }
.toc-toggle-btn:focus  { outline: 1px solid var(--primary); border-radius: 3px; }

/* Article body */
.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-medium);
}
.post-content h2, .post-content h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary-dark);
    margin-top: 2.5rem; margin-bottom: 1rem;
    font-weight: 700;
}
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }
.post-content p { margin-bottom: 1.5rem; }
.post-content img {
    max-width: 100%; height: auto;
    border-radius: var(--radius-lg); margin: 1.5rem 0; display: block;
}
.post-content a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
.post-content a:hover { color: var(--accent); }
.post-content ul, .post-content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.post-content li { margin-bottom: .4rem; }
.post-content code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .9em;
}
.post-content pre {
    background: var(--primary-dark);
    color: var(--primary-light);
    padding: 1.2rem 1.5rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: .88rem;
    border: 1px solid rgba(var(--accent-rgb), .15);
}
.post-content pre code { background: none; color: inherit; padding: 0; }
.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-style: italic;
    color: var(--primary-dark);
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.post-content th, .post-content td {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
}
.post-content th { background: var(--primary-light); font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; }
.post-content tr:nth-child(even) { background: var(--surface-alt); }

/* Post tags */
.post-tags {
    margin: 1.5rem 0 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border-color);
}
.post-tags .tag {
    display: inline-block;
    background: var(--surface-alt);
    color: var(--text-medium);
    border: 1px solid var(--border-color);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: .78rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    margin: 2px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.post-tags .tag:hover {
    background: var(--primary);
    color: var(--neutral);
    border-color: var(--primary);
}

/* Author box */
.author-box {
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin: 2rem 0;
}
.author-avatar {
    width: 72px; height: 72px;
    border-radius: 50%; object-fit: cover;
    border: 3px solid var(--primary-light);
}
.author-box h5 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    margin-bottom: 4px;
}
.author-box p { color: var(--text-light); font-size: .9rem; margin: 0; }

/* Social share */
.social-share {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}
.social-share strong { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--text-dark); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: .75rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-pill);
    font-size: .85rem; font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-decoration: none; transition: var(--transition);
    cursor: pointer; border: none;
}
.share-btn:hover { transform: translateY(-2px); opacity: .9; }
.share-facebook  { background: #1877f2; color: #fff; }
.share-twitter   { background: #000;    color: #fff; }
.share-linkedin  { background: #0077b5; color: #fff; }
.share-whatsapp  { background: #25d366; color: #fff; }
.share-copy      { background: var(--primary-dark); color: #fff; }
.share-btn:hover { color: #fff; }

/* Related posts */
.related-posts { margin: 3rem 0; }
.related-posts h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.3rem; font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--border-color);
}
.related-post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 100%;
}
.related-post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(var(--primary-rgb),.2); }
.related-post-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.related-post-card h5 {
    padding: .75rem;
    margin: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: .9rem; font-weight: 700;
}
.related-post-card h5 a { color: var(--text-dark); text-decoration: none; }
.related-post-card h5 a:hover { color: var(--primary); }
.related-post-card small { padding: 0 .75rem .75rem; display: block; color: var(--text-muted); font-size: .75rem; }

/* Comments section */
.comments-section { margin-top: 3rem; }
.comments-section h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700; margin-bottom: 1.5rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--border-color);
}
.comments-list { margin-bottom: 2rem; }
.comment {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
}
.comment-author {
    margin-bottom: .5rem; padding-bottom: .5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.comment-author strong { color: var(--primary-dark); font-family: 'Plus Jakarta Sans', sans-serif; }
.comment-author small { color: var(--text-muted); font-size: .78rem; }
.comment-content { color: var(--text-medium); line-height: 1.7; font-size: .93rem; }

/* Comment form */
.comment-form {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}
.comment-form h4 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700; margin-bottom: 1.2rem;
}

/* Breadcrumb (blog) */
.breadcrumb { font-size: .88rem; }
.breadcrumb-item a { color: var(--text-medium); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--border-color); }

/* Series banner */
.series-banner {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(0,204,255,.1) 100%);
    border: 1px solid rgba(var(--primary-rgb), .2);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: .92rem;
    color: var(--primary-dark);
}
.series-banner a { color: var(--primary); font-weight: 600; }
.series-banner a:hover { color: var(--accent); }

/* Series card (series.php) */
.series-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: 100%;
    transition: var(--transition);
}
.series-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb),.2); }
.series-card .card-img-top { height: 180px; object-fit: cover; }
.series-card .card-body { padding: 1.2rem; }
.series-card .card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem; font-weight: 700;
}
.series-card .card-title a { color: var(--text-dark); text-decoration: none; }
.series-card .card-title a:hover { color: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar { position: static; }
}

@media (max-width: 768px) {
    .blog-header { padding: 120px 0 56px; }
    .post-image { height: 210px; }
    .post-header .post-title { font-size: 1.6rem; }
    .share-btn { padding: 7px 12px; font-size: .8rem; }
    .author-box .d-flex { flex-direction: column; text-align: center; }
    .author-avatar { margin: 0 auto .75rem; }
    .related-post-card { margin-bottom: 1rem; }
}