/* --- Blog Archive Styles (Sidebar Left) --- */

.blog-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 36px;
    margin-top: 32px;
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-widget {
    background: rgba(var(--heading-color-rgb), 0.02);
    border: 1px solid rgba(var(--heading-color-rgb), 0.05);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
}

.widget-title {
    font-size: var(--content-size);
    font-weight: 800;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(var(--heading-color-rgb), 0.1);
    color: var(--heading-color);
}

.widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-list li {
    margin-bottom: 12px;
}

.widget-list li a {
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--secondary-size);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.8;
}

.widget-list li a:hover,
.widget-list li a.active {
    color: var(--primary-color);
    opacity: 1;
    font-weight: 700;
    padding-left: 5px;
}

.widget-list li a .count {
    font-size: var(--small-size);
    background: rgba(var(--heading-color-rgb), 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Tag Cloud Widget */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud a {
    font-size: var(--small-size) !important;
    background: rgba(var(--heading-color-rgb), 0.05);
    border: 1px solid rgba(var(--heading-color-rgb), 0.1);
    padding: 6px 15px;
    border-radius: 50px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag-cloud a:hover,
.tag-cloud a.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--cta-text-color);
    transform: translateY(-2px);
}

/* Search Bar (Top) */
.blog-search-wrap {
    margin-bottom: 24px;
}

.blog-search-form {
    display: flex;
    gap: 0;
    background: rgba(var(--heading-color-rgb), 0.02);
    border: 1px solid rgba(var(--heading-color-rgb), 0.1);
    border-radius: 50px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.blog-search-form:focus-within {
    border-color: var(--primary-color);
    background: rgba(var(--heading-color-rgb), 0.05);
}

.blog-search-form input {
    flex-grow: 1;
    background: transparent;
    border: none;
    padding: 15px 25px;
    color: var(--heading-color);
    font-size: var(--secondary-size);
    outline: none;
}

.blog-search-form button {
    background: var(--primary-color);
    color: var(--cta-text-color);
    border: none;
    padding: 0 30px;
    cursor: pointer;
    font-weight: 700;
    transition: opacity 0.3s;
}

.blog-search-form button:hover {
    opacity: 0.9;
}

/* Blog List — single column for editorial cards */
.blog-posts-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

/* Blog Editorial Card Wrapper */
.blog-card-horizontal .editorial-card {
    border: 1px solid rgba(var(--heading-color-rgb), 0.05);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.blog-card-horizontal .editorial-card:hover {
    border-color: var(--primary-color);
}

/* Pagination */
.blog-pagination {
    margin-top: 32px;
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.blog-pagination .page-numbers {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--heading-color-rgb), 0.05);
    border-radius: 50%;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s;
}

.blog-pagination .page-numbers.current,
.blog-pagination .page-numbers:hover {
    background: var(--primary-color);
    color: var(--cta-text-color);
}

/* Mobile Responsive */
@media (max-width: 1200px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        order: 2;
        position: static;
    }

    .blog-posts-list {
        grid-template-columns: 1fr;
    }

    .blog-card-horizontal .editorial-card {
        border-radius: 16px;
    }
}

/* Search Refinements */
.archive-title span {
    color: var(--primary-color);
    position: relative;
    display: inline-block;
}

.archive-title span::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 8px;
    background: var(--primary-color);
    opacity: 0.15;
    z-index: -1;
}

.search-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    padding: 6px 15px;
    border-radius: 50px;
    font-size: var(--small-size);
    font-weight: 700;
    margin-top: 15px;
    border: 1px solid rgba(var(--primary-color-rgb), 0.2);
}

/* Breadcrumbs: base styles in services.css; blog-specific override for .sep */
.siap-breadcrumbs .sep {
    opacity: 0.4;
}

@media (max-width: 768px) {
    .blog-card-horizontal .editorial-card {
        border-radius: 14px;
    }

    .blog-search-form {
        flex-direction: column;
        border-radius: 20px;
    }

    .blog-search-form button {
        padding: 15px;
        width: 100%;
    }
}

/* ============================================= */
/* --- Single Blog Post Styles --- */
/* ============================================= */

/* Hero styles now handled by shared .single-hero component in style.css */

/* 2. Single Blog Layout (Content + Sidebar) */
.single-blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    padding: 48px 0 60px;
}

/* Shared Rich Text Content (Blog + Page) */
.blog-rich-text,
.page-rich-text {
    font-size: var(--content-size);
    line-height: 1.85;
    color: var(--text-color);
}

.blog-rich-text h2,
.page-rich-text h2 {
    font-size: var(--content-h2-size);
    font-weight: 800;
    margin: 40px 0 16px;
    letter-spacing: -0.5px;
    color: var(--heading-color);
}

.blog-rich-text h3,
.page-rich-text h3 {
    font-size: var(--h4-size);
    font-weight: 800;
    margin: 32px 0 14px;
    color: var(--heading-color);
}

.blog-rich-text h4,
.page-rich-text h4 {
    font-size: var(--h5-size);
    font-weight: 700;
    margin: 24px 0 12px;
    color: var(--heading-color);
}

.blog-rich-text p,
.page-rich-text p {
    margin-bottom: 25px;
    opacity: 0.85;
}

/* Blog-specific: justify text */
.blog-rich-text p {
    text-align: justify;
}

.blog-rich-text ul,
.blog-rich-text ol,
.page-rich-text ul,
.page-rich-text ol {
    margin-bottom: 30px;
    padding-left: 25px;
}

.blog-rich-text li,
.page-rich-text li {
    margin-bottom: 10px;
    opacity: 0.85;
}

.blog-rich-text img,
.page-rich-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md, 16px);
    margin: 30px 0;
}

.blog-rich-text blockquote,
.page-rich-text blockquote {
    margin: 40px 0;
    padding: 30px 35px;
    border-left: 4px solid var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
    border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
    font-size: var(--h5-size);
    font-style: italic;
    line-height: 1.7;
    color: var(--heading-color);
}

.blog-rich-text blockquote p,
.page-rich-text blockquote p {
    margin-bottom: 0;
    opacity: 1;
}

.blog-rich-text a,
.page-rich-text a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.3s ease;
}

.blog-rich-text a:hover,
.page-rich-text a:hover {
    opacity: 0.8;
}

/* Blog-specific: code & table styles */
.blog-rich-text pre {
    background: rgba(var(--overlay-bg-rgb), 0.3);
    border: 1px solid rgba(var(--heading-color-rgb), 0.1);
    border-radius: var(--radius-sm, 8px);
    padding: 25px;
    overflow-x: auto;
    margin: 30px 0;
    font-size: var(--button-size);
    line-height: 1.6;
}

.blog-rich-text code {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.blog-rich-text pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.blog-rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: var(--secondary-size);
}

.blog-rich-text th,
.blog-rich-text td {
    padding: 12px 16px;
    border: 1px solid rgba(var(--heading-color-rgb), 0.1);
    text-align: left;
}

.blog-rich-text th {
    background: rgba(var(--heading-color-rgb), 0.05);
    font-weight: 700;
    color: var(--heading-color);
}

/* Post Tags */
.blog-post-tags {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 30px 0;
    margin-top: 20px;
    border-top: 1px solid rgba(var(--heading-color-rgb), 0.08);
}

.tags-label {
    font-size: var(--button-size);
    font-weight: 700;
    color: var(--heading-color);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-tag {
    font-size: var(--small-size);
    background: rgba(var(--heading-color-rgb), 0.05);
    border: 1px solid rgba(var(--heading-color-rgb), 0.1);
    padding: 6px 15px;
    border-radius: 50px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.post-tag:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--cta-text-color);
    transform: translateY(-2px);
}

/* Author Box */
.author-box {
    display: flex;
    gap: 20px;
    padding: 24px;
    margin: 32px 0;
    background: rgba(var(--heading-color-rgb), 0.02);
    border: 1px solid rgba(var(--heading-color-rgb), 0.08);
    border-radius: var(--radius-md, 16px);
}

.author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    flex: 1;
}

.author-label {
    font-size: var(--small-size);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

.author-name {
    font-size: var(--h5-size);
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--heading-color);
}

.author-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.author-name a:hover {
    color: var(--primary-color);
}

.author-bio {
    font-size: var(--secondary-size);
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.7;
    margin: 0;
}

/* Post Navigation */
.post-nav {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(var(--heading-color-rgb), 0.08);
}

.post-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.post-nav-item {
    padding: 25px;
    background: rgba(var(--heading-color-rgb), 0.02);
    border: 1px solid rgba(var(--heading-color-rgb), 0.08);
    border-radius: var(--radius-sm, 8px);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-nav-item:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
    transform: translateY(-3px);
}

.post-nav-empty {
    border: none;
    background: none;
}

.nav-direction {
    font-size: var(--small-size);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-direction .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.post-nav-next .nav-direction {
    justify-content: flex-end;
}

.nav-title {
    font-size: var(--secondary-size);
    font-weight: 600;
    color: var(--heading-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-nav-next {
    text-align: right;
}

/* 3. Related Posts Section */
.related-posts-section {
    padding: 48px 0 60px;
    border-top: 1px solid rgba(var(--heading-color-rgb), 0.05);
}

.related-posts-title {
    font-size: var(--content-h2-size);
    font-weight: 900;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: -1px;
    color: var(--heading-color);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.related-post-card {
    background: rgba(var(--heading-color-rgb), 0.02);
    border: 1px solid rgba(var(--heading-color-rgb), 0.05);
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.related-post-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.related-post-img {
    aspect-ratio: 16/10;
    overflow: hidden;
}

.related-post-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.related-post-card:hover .related-post-img img {
    transform: scale(1.05);
}

.related-post-info {
    padding: 25px;
}

.related-post-cat {
    font-size: var(--xs-size);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-color);
    display: block;
    margin-bottom: 10px;
}

.related-post-info h3 {
    font-size: var(--content-size);
    font-weight: 700;
    color: var(--heading-color);
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-post-date {
    font-size: var(--small-size);
    color: var(--text-color);
    opacity: 0.5;
}

/* ============================================= */
/* --- Default Page Styles --- */
/* ============================================= */

.page-content-wrap {
    padding: 48px 0 60px;
    max-width: 900px;
    margin: 0 auto;
}

.page-featured-img {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg, 24px);
    overflow: hidden;
    margin-bottom: 32px;
    border: 1px solid rgba(var(--heading-color-rgb), 0.05);
}

.page-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================= */
/* --- Single Blog Responsive --- */
/* ============================================= */

@media (max-width: 1200px) {
    .single-blog-layout {
        grid-template-columns: 1fr;
    }

    .single-blog-layout .blog-sidebar {
        order: 2;
        position: static;
    }
}

@media (max-width: 991px) {
    .related-posts-grid {
        grid-template-columns: 1fr 1fr;
    }

    .author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .post-nav-grid {
        grid-template-columns: 1fr;
    }

    .post-nav-next {
        text-align: left;
    }

    .post-nav-next .nav-direction {
        justify-content: flex-start;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }

    .page-content-wrap {
        padding: 32px 0 48px;
    }

    .page-featured-img {
        border-radius: var(--radius-md, 16px);
    }
}