/* ==========================================================================
   Superfast Theme v2.1 - Mobile-First, SEO & AdSense Optimized
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color, #f8fafc);
    color: var(--text-color, #1e293b);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; border-radius: 6px; }
a { color: var(--primary-color, #2563eb); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--secondary-color, #1d4ed8); }

/* Container */
.container { width: 100%; padding: 0 16px; margin: 0 auto; }
@media (min-width: 768px) { .container { max-width: 750px; } }
@media (min-width: 1024px) { .container { max-width: 1140px; } }

/* Header & Logo */
.site-header {
    background: var(--card-bg, #ffffff);
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 0;
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.logo { display: inline-flex; align-items: center; font-size: 1.4rem; font-weight: 800; color: var(--text-color, #1e293b); }
.logo img { max-height: 42px; width: auto; border-radius: 0; }
.site-title { font-size: 1.4rem; font-weight: 800; color: var(--text-color, #1e293b); }
.main-nav ul { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.main-nav a { color: var(--text-color, #1e293b); font-weight: 600; font-size: 0.95rem; padding: 4px 0; }
.main-nav a:hover, .main-nav li.active > a { color: var(--primary-color, #2563eb); }

/* Dropdown Menu Support */
.main-nav li { position: relative; }
.main-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-radius: 6px;
    min-width: 180px;
    padding: 8px 0;
    z-index: 100;
    flex-direction: column;
    gap: 0;
}
.main-nav li:hover > ul { display: flex; }
.main-nav ul ul li { width: 100%; }
.main-nav ul ul a { padding: 6px 16px; display: block; font-weight: 500; font-size: 0.9rem; color: var(--text-color, #1e293b); }
.main-nav ul ul a:hover { background: #f8fafc; color: var(--primary-color, #2563eb); }

/* Main Layout & Desktop-Only Sidebar */
.layout-wrapper { display: block; }
.desktop-sidebar { display: none; } /* Strictly hidden on mobile & tablet (<992px) */

@media (min-width: 992px) {
    .layout-wrapper.has-sidebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 28px;
        align-items: start;
    }
    .desktop-sidebar {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
}
.sticky-widget { position: sticky; top: 80px; }
.widget-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color, #2563eb);
    display: inline-block;
}
.widget-body { font-size: 0.925rem; color: #475569; }
.tag-cloud { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    display: inline-block;
    background: #f1f5f9;
    color: var(--text-color, #1e293b);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}
.tag-cloud a:hover { background: var(--primary-color, #2563eb); color: #fff; }
.tag-cloud span { font-size: 0.75rem; opacity: 0.75; }

/* AdSense Containers (CLS-Safe) */
.ad-container, .ad-widget {
    margin: 18px 0;
    text-align: center;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 8px;
}

/* Homepage & Archive Post Grid */
.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 32px;
}
@media (min-width: 640px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}

.post-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.05); }
.post-image-link img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0;
}
.post-content { padding: 16px; display: flex; flex-direction: column; flex-grow: 1; gap: 8px; }
.post-tag-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color, #2563eb);
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
}
.post-card-title { font-size: 1.15rem; line-height: 1.35; }
.post-card-title a { color: var(--text-color, #1e293b); }
.post-card-title a:hover { color: var(--primary-color, #2563eb); }
.post-excerpt { font-size: 0.9rem; color: #475569; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Post Footer Row & Read More Button */
.post-footer-row {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
}
.post-footer-row time { font-size: 0.8rem; color: #64748b; }
.read-more-btn {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.read-more-btn:hover {
    background: var(--primary-color, #2563eb);
    color: #fff;
}

/* Single Post */
.single-post {
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 16px;
    margin-bottom: 28px;
}
@media (min-width: 768px) { .single-post { padding: 32px; } }

.breadcrumb { font-size: 0.85rem; color: #64748b; margin-bottom: 12px; }
.breadcrumb .sep { margin: 0 6px; }
.post-header { margin-bottom: 20px; }
.post-header h1 { font-size: 1.65rem; line-height: 1.3; margin-bottom: 10px; color: var(--text-color, #1e293b); }
@media (min-width: 768px) { .post-header h1 { font-size: 2.1rem; } }
.single-meta { font-size: 0.875rem; color: #64748b; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-image { margin-bottom: 24px; }
.post-image img { width: 100%; max-height: 460px; object-fit: cover; }
.post-image figcaption { font-size: 0.8rem; color: #64748b; text-align: center; margin-top: 6px; }

/* Post Typography */
.post-body { font-size: 1.05rem; line-height: 1.75; overflow-wrap: break-word; }
.post-body h2, .post-body h3, .post-body h4 { margin: 26px 0 12px; line-height: 1.3; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote { margin-bottom: 16px; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body blockquote { border-left: 4px solid var(--primary-color, #2563eb); background: #f8fafc; padding: 12px 16px; font-style: italic; }
.post-body table { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 0.95rem; }
.post-body th, .post-body td { border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left; }
.post-body th { background: #f1f5f9; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #f1f5f9; }
.post-tags a { background: #f1f5f9; color: #475569; padding: 4px 10px; border-radius: 4px; font-size: 0.85rem; }
.post-tags a:hover { background: var(--primary-color, #2563eb); color: #fff; }

/* Author Box */
.author-box {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    margin-top: 28px;
}
.author-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    overflow: hidden;
    flex-shrink: 0;
    padding: 4px;
}
.author-name { font-size: 1.05rem; margin-bottom: 4px; }
.author-name a { color: var(--text-color, #1e293b); }
.author-bio { font-size: 0.875rem; color: #475569; margin: 0; }

/* Compact Related Posts Grid (Small Cards) */
.related-posts-section {
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 28px;
}
.section-heading {
    font-size: 1.15rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color, #2563eb);
    display: inline-block;
}
.related-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 640px) {
    .related-grid-compact { grid-template-columns: repeat(3, 1fr); }
}
.related-card-small {
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 8px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background 0.15s ease;
}
.related-card-small:hover { background: #f1f5f9; }
.related-thumb img {
    width: 100%;
    height: 85px;
    object-fit: cover;
    border-radius: 4px;
}
.related-card-info h4 {
    font-size: 0.85rem;
    line-height: 1.35;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-card-info h4 a { color: var(--text-color, #1e293b); }
.related-card-info h4 a:hover { color: var(--primary-color, #2563eb); }
.related-card-info time { font-size: 0.72rem; color: #64748b; display: block; margin-top: 2px; }

/* Archive Headers */
.archive-header {
    background: var(--card-bg, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
.author-archive-header { display: flex; align-items: center; gap: 16px; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; margin: 28px 0; }
.btn {
    display: inline-block;
    padding: 8px 18px;
    background-color: var(--primary-color, #2563eb);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}
.btn:hover { background-color: var(--secondary-color, #1d4ed8); color: #fff; }

/* Footer & Footer Logo */
.site-footer {
    background: var(--card-bg, #ffffff);
    border-top: 1px solid #e2e8f0;
    padding: 36px 0 24px;
    margin-top: 40px;
    font-size: 0.875rem;
    color: #64748b;
}
.footer-top {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
}
@media (min-width: 768px) {
    .footer-top { flex-direction: row; justify-content: space-between; align-items: center; }
}
.footer-logo { display: inline-block; font-size: 1.25rem; font-weight: 800; color: var(--text-color, #1e293b); margin-bottom: 6px; }
.footer-logo img { max-height: 36px; width: auto; border-radius: 0; }
.footer-desc { max-width: 420px; font-size: 0.85rem; color: #64748b; }
.footer-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; }
.footer-nav a { color: #475569; font-weight: 500; }
.footer-nav a:hover { color: var(--primary-color, #2563eb); }
.footer-bottom { padding-top: 20px; text-align: center; font-size: 0.825rem; }
