/* =============================================
   BLOG — Premium Editorial Design
   ============================================= */

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-muted: #f4f4f5;
    --text: #18181b;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --border: #e4e4e7;
    --border-light: #f4f4f5;
    --success: #16a34a;
    --error: #dc2626;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 0.15s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --container: 1120px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { 
    scroll-behavior: smooth; 
    -webkit-text-size-adjust: 100%; 
    overflow-x: hidden;
}
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    padding-top: 120px; /* Space for fixed header (desktop: header + nav-bar) */
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* =============================================
   HEADER
   ============================================= */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
}
.header-top {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
    width: 100%;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    text-decoration: none;
}
.logo-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.logo:hover .logo-icon { transform: scale(1.08); }
.logo-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo:hover .logo-text { opacity: 0.85; }

/* Header right: search + admin */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Nav search */
.nav-search {
    display: flex;
    align-items: center;
    background: var(--bg-muted);
    border: 1px solid transparent;
    border-radius: 100px;
    transition: all var(--transition);
    overflow: hidden;
}
.nav-search:focus-within {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.nav-search input {
    width: 160px;
    padding: 0.5rem 0 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.875rem;
    font-family: var(--font-sans);
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search input:focus { outline: none; }
.nav-search button {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.nav-search button:hover { color: var(--accent); }

/* Admin links */
.nav-admin { display: flex; align-items: center; gap: 0.25rem; }
.nav-admin a {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.nav-admin a:hover { color: var(--accent); background: var(--accent-light); }

/* Nav categories bar */
.nav-bar {
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
    /* Ensure nav bar stays with header on mobile */
    position: relative;
    z-index: 49;
}
.nav-bar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.125rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-bar-inner::-webkit-scrollbar { display: none; }
.nav-bar-inner a {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.nav-bar-inner a:hover { color: var(--text); border-bottom-color: var(--border); }
.nav-bar-inner a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* Hamburger */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text);
}
.menu-toggle svg { width: 20px; height: 20px; }

/* =============================================
   LAYOUT
   ============================================= */
.page-wrap {
    max-width: var(--container);
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    gap: 2.5rem;
    padding: 2rem 0.5rem;
    flex: 1;
}
.page-main { flex: 1; min-width: 0; overflow-wrap: break-word; word-wrap: break-word; }
.page-sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    align-self: flex-start;
}

/* =============================================
   SIDEBAR WIDGETS
   ============================================= */
.widget {
    margin-bottom: 1.5rem;
}
.widget-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.widget ul { list-style: none; }
.widget li { margin-bottom: 0.125rem; }
.widget a {
    display: block;
    padding: 0.5rem 0.625rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1.4;
}
.widget a:hover { color: var(--accent); background: var(--accent-light); }
.recent-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.widget-empty { color: var(--text-muted); font-size: 0.875rem; padding: 0.5rem 0.625rem; }

/* Trending / Popular Posts */
.widget-trending .widget-title {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.popular-list li { margin-bottom: 0; }
.popular-list a {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem;
}
.popular-rank {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 50%;
    line-height: 1;
}
.popular-title {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}
.popular-list a:hover .popular-title { color: var(--accent); }
.popular-views {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Newsletter */
.newsletter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.newsletter-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
.newsletter-card input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
}
.newsletter-card input:focus { outline: none; border-color: var(--accent); }

/* Ad slot */
.ad-slot {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* In-content ads */
.in-content-ad {
    margin: 2rem 0;
    padding: 0.5rem 0;
    text-align: center;
    clear: both;
    min-height: 100px;
}

/* =============================================
   BLOG LIST — CARD GRID
   ============================================= */
.page-title {
    font-size: clamp(1.5rem, 3.5vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Post list - Grid layout */
.post-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.post-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}

.post-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

/* Card image - top of each grid card */
.post-card-image {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-muted);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item:hover .post-card-image img {
    transform: scale(1.03);
}

/* Card body - below image (or top if no image) */
.post-item .post-body {
    padding: 1.25rem 1.5rem;
}

.post-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.post-action { padding: 0 1.5rem 1.25rem; align-self: flex-start; }

.post-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.375rem;
}
.post-title {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.375rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-title a { transition: color var(--transition); }
.post-title a:hover { color: var(--accent); }
.post-excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.post-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

/* Pagination */
.pagination {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-links li a,
.pagination-links li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.pagination-links li a {
    color: var(--text-secondary);
    background: transparent;
}

.pagination-links li a:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.pagination-current {
    color: white;
    background: var(--accent);
}

.pagination-disabled {
    color: var(--text-muted);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: clamp(3rem, 8vw, 5rem) 2rem;
    color: var(--text-muted);
}
.empty-state p { font-size: 1rem; margin-bottom: 1rem; }

/* =============================================
   ARTICLE — READING VIEW
   ============================================= */
.article-wrap {
    max-width: 680px;
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-bottom: 2rem;
}
.article-back {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    transition: color var(--transition);
}
.article-back:hover { color: var(--accent); }
.article-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: var(--text);
}
.article-lead {
    font-size: clamp(1.0625rem, 2vw, 1.1875rem);
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.article-meta .category {
    color: var(--accent);
    font-weight: 600;
}
.article-meta .separator { color: var(--border); }

/* Blog content typography */
.blog-content {
    font-size: clamp(1rem, 1.5vw, 1.0625rem);
    line-height: 1.8;
    color: var(--text-secondary);
}
.blog-content h2 {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 2.5em 0 0.75em;
    color: var(--text);
}
.blog-content h3 {
    font-size: clamp(1.0625rem, 2.5vw, 1.1875rem);
    font-weight: 600;
    margin: 2em 0 0.5em;
    color: var(--text);
}
.blog-content p { margin-bottom: 1.375em; }
.blog-content ul, .blog-content ol { margin: 1.25em 0 1.25em 1.25em; }
.blog-content li { margin-bottom: 0.5em; }
.blog-content strong { color: var(--text); font-weight: 600; }
.blog-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.blog-content a:hover { color: var(--accent-hover); }
.blog-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.75rem 0 0.75rem 1.25rem;
    margin: 1.75em 0;
    color: var(--text-muted);
    font-size: 1.0625rem;
}
.blog-content code {
    font-size: 0.875em;
    background: var(--bg-muted);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}
.blog-content pre {
    background: var(--text);
    color: #e4e4e7;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.875rem;
    line-height: 1.6;
}
.blog-content pre code { background: none; padding: 0; }
.blog-content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
    max-width: 100%;
    height: auto;
}
.blog-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
}
/* Table of Contents */
.toc {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}
.toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}
.toc-toggle:hover { color: var(--accent); background: var(--bg-card); }
.toc-collapsed .toc-list { display: none; }
.toc-collapsed .toc-title { margin-bottom: 0; }
.toc-collapsed .toc-toggle svg { transform: rotate(-90deg); }
.toc-list {
    list-style: none;
    counter-reset: toc-counter;
    padding: 0;
    margin: 0;
}
.toc-list li {
    counter-increment: toc-counter;
    margin-bottom: 0.25rem;
}
.toc-list li::before {
    content: counter(toc-counter) ".";
    color: var(--accent);
    font-weight: 600;
    font-size: 0.75rem;
    margin-right: 0.5rem;
    min-width: 1.5rem;
    display: inline-block;
}
.toc-list a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
    line-height: 1.6;
}
.toc-list a:hover { color: var(--accent); }
.toc-h3 { padding-left: 1.25rem; }
.toc-h3 a { font-size: 0.8125rem; color: var(--text-muted); }

/* Sources & References */
.article-sources {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.sources-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.sources-list {
    list-style: none;
    counter-reset: source-counter;
    padding: 0;
}
.sources-list li {
    counter-increment: source-counter;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    padding-left: 2rem;
}
.sources-list li:last-child { border-bottom: none; }
.sources-list li::before {
    content: counter(source-counter);
    position: absolute;
    left: 0;
    top: 0.75rem;
    width: 22px;
    height: 22px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sources-list a {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    word-break: break-word;
}
.sources-list a:hover { text-decoration: underline; }
.source-org {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.source-summary {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}

.article-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.article-footer a { color: var(--accent); font-weight: 500; }

/* =============================================
   SOCIAL SHARE BAR
   ============================================= */
.share-bar {
    margin-top: 2rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.share-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.share-buttons {
    display: flex;
    gap: 0.5rem;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.share-twitter:hover { background: #000; color: #fff; border-color: #000; }
.share-facebook:hover { background: #1877F2; color: #fff; border-color: #1877F2; }
.share-linkedin:hover { background: #0A66C2; color: #fff; border-color: #0A66C2; }
.share-whatsapp:hover { background: #25D366; color: #fff; border-color: #25D366; }
.share-copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.share-copy.copied { background: #16a34a; color: #fff; border-color: #16a34a; }

.article-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border); }
.btn-full { width: 100%; }

/* =============================================
   FLASH MESSAGES
   ============================================= */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.flash.error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.flash.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    margin-top: auto;
}
.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}
.footer-copy {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a {
    font-size: 0.8125rem;
    color: var(--text-muted);
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

/* =============================================
   MOBILE SIDEBAR (below content on tablets)
   ============================================= */
.mobile-sidebar {
    display: none;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
.mobile-sidebar .widget { margin-bottom: 1.5rem; }

/* =============================================
   MOBILE NAV OVERLAY
   ============================================= */
.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.25s ease;
    /* Ensure mobile nav appears above fixed header */
    top: 0;
}
.mobile-nav.open { display: block; opacity: 1; }
.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100%;
    height: 100vh; /* Use viewport height for better mobile support */
    background: var(--bg-card);
    padding: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 151;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: -8px 0 30px rgba(0,0,0,0.1);
}
.mobile-nav.open .mobile-nav-panel { transform: translateX(0); }
.mobile-nav-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}
.mobile-nav-close:hover { background: var(--border); color: var(--text); }
.mobile-nav-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.mobile-nav-search input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
}
.mobile-nav-search input:focus { outline: none; border-color: var(--accent); }
.mobile-nav-search button {
    padding: 0.5rem 0.625rem;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
}
.mobile-nav-search button:hover { background: var(--accent-hover); }
.mobile-nav-panel .mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.mobile-nav-panel .mobile-nav-link:hover { color: var(--accent); background: var(--accent-light); }
.mobile-nav-panel .mobile-nav-link.active { color: var(--accent); font-weight: 600; }
.mobile-nav-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.5rem 0;
}

/* =============================================
   RELATED POSTS
   ============================================= */
.related-posts {
    max-width: var(--container);
    margin: 3rem auto 0;
    padding: 0 1rem;
}
.related-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.related-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}
.related-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.related-category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.related-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.related-excerpt {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    flex: 1;
}
.related-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Reading time helper */
.article-reading-time {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* =============================================
   RESPONSIVE - Frontend Mobile
   ============================================= */
@media (max-width: 1024px) {
    .page-sidebar { display: none; }
    .mobile-sidebar { display: block; }
    .page-wrap { 
        gap: 0; 
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .header-top { 
        padding: 0.875rem 1.25rem; 
        max-width: 100%;
    }
    .nav-bar-inner { padding: 0 1rem; }
    
    /* Grid: 2 columns on tablet */
    .post-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet and Mobile */
@media (max-width: 768px) {
    .site-header {
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    
    /* Shorter header on mobile (nav-bar hidden) */
    body {
        padding-top: 60px;
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    
    .nav-bar { display: none; }
    .nav-search { display: none; }
    .nav-admin { display: none; }
    .menu-toggle { display: flex; }
    
    .header-top { 
        padding: 0.875rem 1rem; 
        min-height: 60px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .logo-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .page-wrap { 
        padding: 1.5rem 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Grid: 1 column on mobile */
    .post-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .post-item {
        padding: 1.25rem;
    }
    
    .article-wrap {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .article-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .article-lead {
        font-size: 1rem;
    }
    
    .blog-content {
        font-size: 1rem;
    }
    
    .blog-content h2 {
        font-size: 1.375rem;
        margin-top: 2em;
    }
    
    .blog-content h3 {
        font-size: 1.125rem;
    }
    
    .footer-inner { 
        flex-direction: column; 
        text-align: center; 
        padding: 1.25rem 1rem;
    }
    
    .footer-links { 
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .related-grid { 
        grid-template-columns: 1fr; 
    }
    
    /* Mobile nav: keep display:none until .open; do NOT force display:block here */
    
    /* Improve mobile sidebar spacing */
    .mobile-sidebar {
        padding: 1.5rem 0;
    }
    
    /* Make widgets more compact on mobile */
    .widget {
        margin-bottom: 1.25rem;
    }
    
    /* Improve button sizing on mobile */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Improve form inputs on mobile */
    .newsletter-card input,
    .mobile-nav-search input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    body {
        padding-top: 56px; /* Slightly smaller header */
    }
    
    .site-header {
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .header-top { 
        padding: 0.75rem 1rem;
        min-height: 56px;
    }
    
    .logo-text {
        font-size: 0.9375rem;
    }
    
    .menu-toggle {
        width: 36px;
        height: 36px;
    }
    
    .menu-toggle svg {
        width: 18px;
        height: 18px;
    }
    
    .page-wrap { 
        padding: 1rem 0.75rem;
    }
    
    .post-item { 
        padding: 1rem; 
    }
    
    .post-title {
        font-size: 1rem;
    }
    
    .post-excerpt {
        font-size: 0.8125rem;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .article-lead {
        font-size: 0.9375rem;
    }
    
    .page-title {
        font-size: 1.375rem;
    }
    
    .page-subtitle {
        font-size: 0.875rem;
    }
    
    .mobile-nav-panel {
        width: min(300px, 90vw);
        padding: 1.25rem;
    }
    
    .mobile-nav-link {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .footer-inner {
        padding: 1rem 0.75rem;
    }
    
    .footer-copy,
    .footer-links a {
        font-size: 0.75rem;
    }
    
    /* Tables handled in base .blog-content table */
    
    /* Improve code blocks on mobile */
    .blog-content pre {
        padding: 1rem;
        font-size: 0.8125rem;
        overflow-x: auto;
    }
    
    /* Improve share buttons */
    .share-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .share-buttons {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .header-top {
        padding: 0.625rem 0.75rem;
    }
    
    .logo-text {
        font-size: 0.875rem;
    }
    
    .page-wrap {
        padding: 0.875rem 0.5rem;
    }
    
    .mobile-nav-panel {
        width: 100vw;
        padding: 1rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding-top: 56px;
    }
    
    .site-header {
        position: fixed;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    .nav-bar-inner a {
        padding: 0.875rem 1rem;
    }
    
    .mobile-nav-link {
        min-height: 44px;
    }
    
    /* Improve tap feedback */
    .post-item:active,
    .widget a:active,
    .btn:active {
        opacity: 0.7;
    }
}
