/* ============ BLOG STYLES ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* CSS Variables (shared with main app) */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: #1f2937;
    background: #f9fafb;
}

/* ============ SITE NAV (shared with landing page) ============ */
.site-nav {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.site-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
}
.site-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 32px;
}
.site-nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
}
.site-nav-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}
.site-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-700);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
}
.site-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.site-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: var(--font-sans);
}
.site-nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}
.nav-caret {
    font-size: 10px;
    opacity: 0.6;
}
.btn-dark-toggle {
    font-size: 18px;
    padding: 6px 10px;
    margin-left: 4px;
    min-width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    color: var(--gray-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}
.dark-label { font-size: 12px; font-weight: 500; }
.site-nav-mobile-dark {
    display: none; position: absolute; right: 48px; top: 50%; transform: translateY(-50%);
    background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-700);
    padding: 6px 10px; border-radius: 6px; align-items: center; gap: 4px; white-space: nowrap;
}
.site-nav-mobile-dark .dark-label { font-size: 11px; font-weight: 500; }
.btn-dark-toggle:hover, .site-nav-mobile-dark:hover {
    background: var(--gray-100);
}
@media (max-width: 768px) {
    .site-nav-mobile-dark { display: inline-flex; }
    .btn-dark-toggle { display: none; }
}

/* Nav sublabels for grouped Resources dropdown */
.nav-menu-sublabel {
    display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--gray-400); padding: 10px 12px 4px;
}
.nav-menu-sublabel:first-child { padding-top: 4px; }

/* Dropdown menus */
.site-nav-dropdown {
    position: relative;
}
.site-nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    padding: 16px;
    min-width: 540px;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 8px;
    z-index: 1001;
}
.site-nav-menu-sm {
    min-width: 220px;
    display: none;
    grid-template-columns: 1fr;
}
.site-nav-dropdown:hover .site-nav-menu {
    display: grid;
}
.nav-menu-group {
    padding: 8px;
    border-radius: 8px;
}
.nav-menu-group:hover {
    background: var(--gray-50);
}
.nav-menu-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
    padding: 0 4px;
}
a.nav-menu-label {
    color: var(--gray-900);
    font-weight: 600;
    text-decoration: none;
}
a.nav-menu-label:hover {
    color: var(--primary);
}
.site-nav-menu a {
    display: block;
    padding: 4px 4px;
    font-size: 13px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.15s;
}
.site-nav-menu a:hover {
    color: var(--primary);
}
.site-nav-menu-sm a {
    padding: 8px 12px;
    font-size: 14px;
}
.site-nav-menu-sm a:hover {
    background: var(--gray-50);
}

/* Mega menu for Resources (4-column) */
.site-nav-menu-mega {
    min-width: 700px;
    right: 0;
    left: auto;
    transform: none;
    grid-template-columns: repeat(4, 1fr);
}
.nav-menu-col {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}
.nav-menu-col .nav-menu-sublabel {
    padding: 0 4px 4px;
}
.nav-menu-col a {
    padding: 4px;
    font-size: 13px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.15s;
}
.nav-menu-col a:hover {
    color: var(--primary);
}

/* Mobile nav */
@media (max-width: 768px) {
    .site-nav-toggle { display: block; }
    .site-nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 12px 16px;
        gap: 0;
        align-items: stretch;
    }
    .nav-open .site-nav-links { display: flex; }
    .site-nav-link { justify-content: space-between; padding: 12px 8px; }
    .site-nav-dropdown { position: static; }
    .site-nav-menu,
    .site-nav-menu-sm,
    .site-nav-menu-mega {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        min-width: auto;
        padding: 4px 0 4px 16px;
        display: none;
        grid-template-columns: 1fr;
    }
    .site-nav-dropdown:hover .site-nav-menu { display: none; }
    .site-nav-dropdown.menu-open .site-nav-menu { display: grid; }
    .btn-dark-toggle { align-self: flex-start; }
}

/* Dark mode nav */
body.dark-mode .site-nav {
    background: #0f1120;
    border-bottom-color: #1e2240;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body.dark-mode .site-nav-title { color: #e8eaf4; }
body.dark-mode .site-nav-link { color: #9ca3be; }
body.dark-mode .site-nav-link:hover { background: #1a1d35; color: #6d9efc; }
body.dark-mode .site-nav-menu,
body.dark-mode .site-nav-menu-sm,
body.dark-mode .site-nav-menu-mega {
    background: #13152a;
    border-color: #1e2240;
    box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}
body.dark-mode .nav-menu-col a { color: #8b8fa8; }
body.dark-mode .nav-menu-col a:hover { color: #6d9efc; }
body.dark-mode .nav-menu-label { color: #e8eaf4; }
body.dark-mode a.nav-menu-label { color: #e8eaf4; }
body.dark-mode a.nav-menu-label:hover { color: #6d9efc; }
body.dark-mode .nav-menu-group:hover { background: #1a1d35; }
body.dark-mode .site-nav-menu a { color: #8b8fa8; }
body.dark-mode .site-nav-menu a:hover { color: #6d9efc; }
body.dark-mode .site-nav-menu-sm a:hover { background: #1a1d35; }
@media (max-width: 768px) {
    body.dark-mode .site-nav-links {
        background: #0f1120;
        border-bottom-color: #1e2240;
    }
}

/* Legacy blog-nav (kept for backwards compat) */
.blog-nav {
    display: none;
}

/* ============ BLOG INDEX PAGE ============ */

/* Hero section */
.blog-hero {
    background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
    padding: 48px 24px 40px;
    text-align: center;
    margin-bottom: 32px;
}
.blog-hero h1 {
    font-size: 34px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}
.blog-hero .blog-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}
.blog-hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.blog-hero-stat {
    text-align: center;
    color: #fff;
}
.blog-hero-stat .stat-number {
    display: block;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.blog-hero-stat .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* Blog index container */
.blog-index {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 40px;
}
.blog-index h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}
.blog-index .blog-subtitle {
    color: #6b7280;
    margin-bottom: 32px;
}

/* Blog search bar */
.blog-search-bar {
    max-width: 600px; margin: 0 auto 24px; padding: 0 24px;
}
.blog-search-bar input {
    width: 100%; padding: 12px 16px; font-size: 15px; border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 8px; font-family: inherit; outline: none; transition: border-color 0.15s;
    box-sizing: border-box; background: #fff; color: #1a1a2e;
}
.blog-search-bar input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.blog-no-results { text-align: center; color: #6b7280; padding: 32px 0; font-size: 15px; }
body.dark-mode .blog-search-bar input { background: #1a1d2e; border-color: #2a2e44; color: #e8eaf0; }
body.dark-mode .blog-search-bar input:focus { border-color: #4f8af7; box-shadow: 0 0 0 3px rgba(79,138,247,0.15); }
body.dark-mode .blog-no-results { color: #9ca3be; }

/* Section headings with discipline color accent */
.blog-section-heading {
    font-size: 16px;
    font-weight: 700;
    color: #374151;
    margin: 36px 0 14px;
    padding: 10px 16px;
    border-bottom: none;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.blog-section-heading:first-of-type {
    margin-top: 0;
}
.blog-section-heading .section-icon {
    font-size: 20px;
    line-height: 1;
}
/* Discipline-specific section colors */
.blog-section-heading[data-disc="general"] { border-left: 4px solid #1a56db; }
.blog-section-heading[data-disc="ece"] { border-left: 4px solid #f59e0b; }
.blog-section-heading[data-disc="civil"] { border-left: 4px solid #10b981; }
.blog-section-heading[data-disc="mechanical"] { border-left: 4px solid #ef4444; }
.blog-section-heading[data-disc="chemical"] { border-left: 4px solid #8b5cf6; }
.blog-section-heading[data-disc="pe-trans"] { border-left: 4px solid #0ea5e9; }
.blog-section-heading[data-disc="pe-struct"] { border-left: 4px solid #f97316; }
.blog-section-heading[data-disc="pe-power"] { border-left: 4px solid #ec4899; }
.blog-section-heading[data-disc="environmental"] { border-left: 4px solid #06b6d4; }
.blog-section-heading[data-disc="pe-wre"] { border-left: 4px solid #0d9488; }

/* Blog cards with type tags */
.blog-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 14px;
    text-decoration: none;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
    position: relative;
}
.blog-card:hover {
    border-color: #1a56db;
    box-shadow: 0 6px 20px rgba(26,86,219,0.12);
    transform: translateY(-2px);
}
.blog-card h2 {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}
.blog-card p {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
}
.blog-card .card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
}
.blog-card .card-meta {
    font-size: 13px;
    color: #9ca3af;
}
.blog-card .card-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1;
}
.card-tag-guide { background: #dbeafe; color: #1e40af; }
.card-tag-study { background: #d1fae5; color: #065f46; }
.card-tag-practice { background: #fef3c7; color: #92400e; }
.card-tag-tool { background: #ede9fe; color: #5b21b6; }
.card-tag-calculator { background: #f3f4f6; color: #374151; }

/* ============ ARTICLE PAGES ============ */

.blog-article {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}
/* Widen article when sidebar is present */
.blog-article:has(.blog-layout) {
    max-width: 1000px;
    padding: 0;
}

/* Article hero banner */
.article-hero {
    padding: 40px 24px;
    text-align: center;
    margin-bottom: 0;
    border-radius: 0 0 24px 24px;
}
.article-hero[data-disc="ece"]       { background: linear-gradient(135deg, #f59e0b, #d97706); }
.article-hero[data-disc="civil"]     { background: linear-gradient(135deg, #10b981, #059669); }
.article-hero[data-disc="mechanical"]{ background: linear-gradient(135deg, #ef4444, #dc2626); }
.article-hero[data-disc="chemical"]  { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.article-hero[data-disc="pe-trans"]  { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.article-hero[data-disc="pe-struct"] { background: linear-gradient(135deg, #f97316, #ea580c); }
.article-hero[data-disc="pe-power"]  { background: linear-gradient(135deg, #ec4899, #db2777); }
.article-hero[data-disc="pe-wre"]    { background: linear-gradient(135deg, #0d9488, #0f766e); }
.article-hero[data-disc="general"]   { background: linear-gradient(135deg, #1a56db, #7c3aed); }
.article-hero .hero-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
}
.article-hero h1 {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.article-hero .article-meta {
    justify-content: center;
    color: rgba(255,255,255,0.85);
}
.article-hero .article-meta time,
.article-hero .article-meta .reading-time {
    color: rgba(255,255,255,0.85);
}

/* Legacy article header (fallback) */
.article-header {
    padding: 40px 0 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 32px;
}
.article-header h1 {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.25;
    color: #111827;
    margin-bottom: 12px;
}
.article-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #6b7280;
}

/* Key facts box */
.key-facts {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 24px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.key-facts h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1a56db;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.key-facts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.key-facts li {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
    font-size: 14px;
}
.key-facts li:last-child { border-bottom: none; }
.key-facts .fact-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* Tip / Warning callout boxes */
.callout {
    border-radius: 10px;
    padding: 16px 20px;
    margin: 20px 0;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.callout-icon {
    font-size: 20px;
    line-height: 1.4;
    flex-shrink: 0;
}
.callout-content {
    flex: 1;
}
.callout-content p {
    margin-bottom: 0;
}
.callout-content strong {
    display: block;
    margin-bottom: 4px;
}
.callout-tip {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.callout-tip .callout-icon { color: #059669; }
.callout-tip strong { color: #065f46; }
.callout-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.callout-warning .callout-icon { color: #d97706; }
.callout-warning strong { color: #92400e; }
.callout-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}
.callout-info .callout-icon { color: #1a56db; }
.callout-info strong { color: #1e40af; }

/* Topic weight bar chart (CSS-only) */
.topic-weight-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.topic-weight-bar .topic-name {
    width: 180px;
    flex-shrink: 0;
    text-align: right;
    color: #374151;
    font-weight: 500;
}
.topic-weight-bar .bar-track {
    flex: 1;
    height: 18px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.topic-weight-bar .bar-fill {
    height: 100%;
    background: #1a56db;
    border-radius: 4px;
    transition: width 0.3s;
}
.topic-weight-bar .bar-value {
    width: 60px;
    flex-shrink: 0;
    color: #6b7280;
    font-size: 12px;
}

/* Article body */
.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-top: 36px;
    margin-bottom: 12px;
}
.article-body h3 {
    font-size: 19px;
    font-weight: 600;
    color: #1f2937;
    margin-top: 28px;
    margin-bottom: 8px;
}
.article-body p {
    margin-bottom: 16px;
    color: #374151;
}
.article-body ul, .article-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.article-body li {
    margin-bottom: 6px;
    color: #374151;
}
.article-body strong {
    color: #111827;
}
.article-body blockquote {
    border-left: 4px solid #1a56db;
    padding: 12px 20px;
    margin: 20px 0;
    background: #eff6ff;
    border-radius: 0 8px 8px 0;
    color: #1e40af;
    font-style: italic;
}
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}
.article-body th, .article-body td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.article-body th {
    background: #f3f4f6;
    font-weight: 600;
    color: #111827;
}
.article-body tr:hover {
    background: #f9fafb;
}

/* Practice problems */
.practice-problem {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 24px 0;
    position: relative;
}
.practice-problem h3 {
    margin-top: 0;
    color: #1a56db;
}
.practice-problem .problem-number {
    position: absolute;
    top: -10px;
    left: 20px;
    background: #1a56db;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.problem-question {
    font-weight: 500;
    color: #111827;
}
.problem-options {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}
.problem-options li {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.problem-options li:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}
.problem-solution {
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}
.problem-solution summary {
    cursor: pointer;
    font-weight: 600;
    color: #1a56db;
    padding: 6px 0;
    transition: color 0.15s;
}
.problem-solution summary:hover {
    color: #1e40af;
}
.problem-solution p {
    margin-top: 8px;
}

/* Feature showcase grid */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}
.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.feature-card .feature-icon {
    font-size: 28px;
    margin-bottom: 10px;
    display: block;
}
.feature-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}
.feature-card p {
    font-size: 14px;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}
.feature-card.feature-wide {
    grid-column: 1 / -1;
}

/* Stat highlight row */
.stat-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin: 24px 0;
    padding: 20px;
    background: #f0f4ff;
    border-radius: 12px;
}
.stat-item {
    text-align: center;
    min-width: 100px;
}
.stat-item .stat-num {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #1a56db;
    letter-spacing: -0.02em;
}
.stat-item .stat-lbl {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Discipline pill list */
.disc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.disc-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}
.disc-pill[data-d="ece"] { background: #f59e0b; }
.disc-pill[data-d="civil"] { background: #10b981; }
.disc-pill[data-d="mechanical"] { background: #ef4444; }
.disc-pill[data-d="chemical"] { background: #8b5cf6; }
.disc-pill[data-d="environmental"] { background: #06b6d4; }
.disc-pill[data-d="pe-trans"] { background: #0ea5e9; }
.disc-pill[data-d="pe-struct"] { background: #f97316; }
.disc-pill[data-d="pe-power"] { background: #ec4899; }

/* Inline SVG diagram showcase */
.diagram-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
.diagram-showcase-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.diagram-showcase-item .diagram-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 8px;
}
.diagram-showcase-item svg {
    max-width: 100%;
    height: auto;
}

/* Comparison mini-table */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.compare-table th {
    background: #1a56db;
    color: #fff;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
}
.compare-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table .check { color: #10b981; font-weight: 700; }
.compare-table .cross { color: #ef4444; }
.compare-table .highlight-row { background: #eff6ff; }

/* Environmental discipline color for article hero */
.article-hero[data-disc="environmental"] { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* Question type badges */
.qtype-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.qtype-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}
.qtype-badge.active { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

@media (max-width: 640px) {
    .feature-grid { grid-template-columns: 1fr; }
    .diagram-showcase { grid-template-columns: 1fr; }
    .stat-row { gap: 16px; padding: 16px; }
    .stat-item .stat-num { font-size: 22px; }
    .disc-pills { justify-content: center; }
}

/* CTA */
.article-cta {
    text-align: center;
    background: linear-gradient(135deg, #eff6ff, #e8f0fe);
    border: 2px solid #1a56db;
    border-radius: 12px;
    padding: 32px 24px;
    margin: 40px 0;
}
.article-cta h2 {
    font-size: 22px;
    color: #111827;
    margin-bottom: 8px;
    margin-top: 0;
}
.article-cta p {
    color: #4b5563;
    margin-bottom: 16px;
}
.btn-cta {
    display: inline-block;
    background: #1a56db;
    color: #fff;
    padding: 12px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: background 0.15s, transform 0.15s;
}
.btn-cta:hover { background: #1e40af; transform: translateY(-1px); }

/* Footer */
.blog-footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    font-size: 13px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
}
.footer-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}
.footer-col h4 {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.footer-col a {
    display: block;
    color: #6b7280;
    text-decoration: none;
    padding: 3px 0;
    font-size: 13px;
}
.footer-col a:hover { color: #1a56db; }
.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.footer-bottom p { margin-bottom: 4px; }
.footer-bottom .affiliate-disclosure { font-size: 11px; color: #9ca3af; }
.blog-footer a {
    color: #6b7280;
    text-decoration: none;
}
.blog-footer a:hover { color: #1a56db; }
.blog-footer p { margin-bottom: 4px; }

/* ============ AD SLOTS ============ */
.ad-slot {
    max-width: 720px;
    margin: 32px auto;
    padding: 0 24px;
    text-align: center;
    min-height: 90px;
}
.ad-slot ins { display: block; }

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .blog-hero h1 { font-size: 24px; }
    .blog-hero { padding: 32px 16px; }
    .blog-hero-stats { gap: 20px; }
    .blog-hero-stat .stat-number { font-size: 22px; }
    .article-hero h1 { font-size: 22px; }
    .article-hero { padding: 28px 16px; }
    .article-header h1 { font-size: 24px; }
    .article-body h2 { font-size: 20px; }
    .blog-index h1 { font-size: 24px; }
    .practice-problem { padding: 16px; }
    .key-facts { padding: 16px; }
    .topic-weight-bar .topic-name { width: 120px; font-size: 12px; }
    .footer-columns { grid-template-columns: 1fr; gap: 24px; text-align: center; }
    .blog-section-heading { font-size: 14px; padding: 8px 12px; }
    .callout { flex-direction: column; gap: 6px; }
}

/* ============ BLOG DARK MODE ============ */
body.dark-mode {
    background: #0b0d1a;
    color: #c8cce0;
}
body.dark-mode .blog-hero {
    background: linear-gradient(135deg, #1a3a8a 0%, #5b21b6 100%);
}
body.dark-mode .article-body,
body.dark-mode .blog-article {
    color: #c8cce0;
}
body.dark-mode .article-body h2,
body.dark-mode .article-body h3 {
    color: #e8eaf4;
}
body.dark-mode .article-body a {
    color: #6d9efc;
}
body.dark-mode .article-body a:hover {
    color: #93b8fd;
}
body.dark-mode .article-body blockquote,
body.dark-mode .key-facts,
body.dark-mode .practice-problem,
body.dark-mode .callout {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .article-hero {
    background: linear-gradient(135deg, #1a3a8a 0%, #5b21b6 100%);
}
body.dark-mode .article-cta {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .article-cta h2 {
    color: #e8eaf4;
}
body.dark-mode .blog-footer {
    background: #0b0d1a;
    border-top-color: #1e2240;
    color: #8b8fa8;
}
body.dark-mode .blog-footer a {
    color: #6d9efc;
}
body.dark-mode .footer-col h4 {
    color: #c8cbe0;
}
body.dark-mode .footer-bottom {
    border-top-color: #1e2240;
}
body.dark-mode .blog-card {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .blog-card h2,
body.dark-mode .blog-card h2 a {
    color: #e8eaf4;
}
body.dark-mode .blog-card p {
    color: #8b8fa8;
}
body.dark-mode .topic-weight-bar .bar-bg {
    background: #1e2240;
}
body.dark-mode table {
    border-color: #1e2240;
}
body.dark-mode th {
    background: #13152a;
    color: #e8eaf4;
    border-color: #1e2240;
}
body.dark-mode td {
    border-color: #1e2240;
    color: #c8cce0;
}
body.dark-mode .btn-dark-toggle, body.dark-mode .site-nav-mobile-dark {
    color: #e8eaf4;
}
body.dark-mode .btn-dark-toggle:hover, body.dark-mode .site-nav-mobile-dark:hover {
    background: #1a1d35;
}

/* ---------- Inline-style background overrides ---------- */
/* Blue info boxes: background: #eff6ff or #e0f2fe or #f0f7ff */
body.dark-mode div[style*="background: #eff6ff"],
body.dark-mode div[style*="background: #e0f2fe"],
body.dark-mode div[style*="background: #f0f7ff"],
body.dark-mode p[style*="background: #f0f7ff"] {
    background: #111633 !important;
    border-color: #1e2a5a !important;
    color: #c8cce0 !important;
}
/* Green success boxes: background: #f0fdf4 or #ecfdf5 */
body.dark-mode div[style*="background: #f0fdf4"],
body.dark-mode tr[style*="background: #f0fdf4"] {
    background: #0f1f18 !important;
    border-color: #1a3d2a !important;
    color: #c8cce0 !important;
}
/* Yellow/amber warning boxes: background: #fffbeb */
body.dark-mode div[style*="background: #fffbeb"] {
    background: #1f1a0a !important;
    border-color: #3d3015 !important;
    color: #c8cce0 !important;
}
/* Orange boxes: background: #fff7ed */
body.dark-mode div[style*="background: #fff7ed"] {
    background: #1f170a !important;
    border-color: #3d2a15 !important;
    color: #c8cce0 !important;
}
/* Red boxes: background: #fef2f2 */
body.dark-mode div[style*="background: #fef2f2"] {
    background: #1f0f0f !important;
    border-color: #3d1a1a !important;
    color: #c8cce0 !important;
}
/* Light gray boxes: background: #f8fafc or #f8f9fa or #f9fafb */
body.dark-mode div[style*="background: #f8fafc"],
body.dark-mode div[style*="background: #f8f9fa"],
body.dark-mode div[style*="background: #f9fafb"],
body.dark-mode tr[style*="background: #f8f9fa"] {
    background: #13152a !important;
    border-color: #1e2240 !important;
    color: #c8cce0 !important;
}
/* Gray borders on product cards */
body.dark-mode div[style*="border: 1px solid #e5e7eb"] {
    border-color: #1e2240 !important;
}

/* ---------- Inline-style text color overrides ---------- */
body.dark-mode [style*="color: #1e40af"] { color: #6d9efc !important; }
body.dark-mode [style*="color: #166534"] { color: #4ade80 !important; }
body.dark-mode [style*="color: #92400e"] { color: #fbbf24 !important; }
body.dark-mode [style*="color: #475569"] { color: #94a3b8 !important; }
body.dark-mode [style*="color: #888"]    { color: #8b8fa8 !important; }
body.dark-mode [style*="color: #374151"] { color: #c8cce0 !important; }

/* Inline border overrides */
body.dark-mode [style*="border-bottom: 1px solid #dee2e6"] { border-bottom-color: #1e2240 !important; }
body.dark-mode [style*="border-bottom: 1px solid #bfdbfe"] { border-bottom-color: #1e2a5a !important; }

/* ---------- CSS class dark mode overrides ---------- */
/* Article body text */
body.dark-mode .article-body p,
body.dark-mode .article-body li { color: #c8cce0; }
body.dark-mode .article-body strong { color: #e8eaf4; }
body.dark-mode .article-body blockquote {
    background: #111633;
    border-left-color: #3b6cf6;
    color: #93b8fd;
}
body.dark-mode .article-body th {
    background: #13152a;
    color: #e8eaf4;
    border-bottom-color: #1e2240;
}
body.dark-mode .article-body td { border-bottom-color: #1e2240; }
body.dark-mode .article-body tr:hover { background: #1a1d35; }

/* Article header (legacy) */
body.dark-mode .article-header { border-bottom-color: #1e2240; }
body.dark-mode .article-header h1 { color: #e8eaf4; }
body.dark-mode .article-meta { color: #8b8fa8; }

/* Article CTA */
body.dark-mode .article-cta p { color: #8b8fa8; }

/* Key facts */
body.dark-mode .key-facts {
    background: #13152a;
    border-color: #1e2240;
    box-shadow: none;
}
body.dark-mode .key-facts h3 { color: #6d9efc; }
body.dark-mode .key-facts li { border-bottom-color: #1e2240; color: #c8cce0; }

/* Callout classes */
body.dark-mode .callout-tip {
    background: #0f1f18;
    border-color: #1a3d2a;
}
body.dark-mode .callout-tip .callout-icon { color: #34d399; }
body.dark-mode .callout-tip strong { color: #a7f3d0; }
body.dark-mode .callout-warning {
    background: #1f1a0a;
    border-color: #3d3015;
}
body.dark-mode .callout-warning .callout-icon { color: #fbbf24; }
body.dark-mode .callout-warning strong { color: #fde68a; }
body.dark-mode .callout-info {
    background: #111633;
    border-color: #1e2a5a;
}
body.dark-mode .callout-info .callout-icon { color: #6d9efc; }
body.dark-mode .callout-info strong { color: #93b8fd; }

/* Topic weight bars */
body.dark-mode .topic-weight-bar .topic-name { color: #c8cce0; }
body.dark-mode .topic-weight-bar .bar-track { background: #1e2240; }
body.dark-mode .topic-weight-bar .bar-value { color: #8b8fa8; }

/* Practice problems */
body.dark-mode .practice-problem {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .practice-problem h3 { color: #6d9efc; }
body.dark-mode .problem-question { color: #e8eaf4; }
body.dark-mode .problem-options li:hover {
    background: #1a1d35;
    border-color: #2a2d45;
}
body.dark-mode .problem-solution { border-top-color: #1e2240; }
body.dark-mode .problem-solution summary { color: #6d9efc; }
body.dark-mode .problem-solution summary:hover { color: #93b8fd; }

/* Feature cards */
body.dark-mode .feature-card {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .feature-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
body.dark-mode .feature-card h3 { color: #e8eaf4; }
body.dark-mode .feature-card p { color: #8b8fa8; }

/* Stat row */
body.dark-mode .stat-row { background: #13152a; }
body.dark-mode .stat-item .stat-num { color: #6d9efc; }
body.dark-mode .stat-item .stat-lbl { color: #8b8fa8; }

/* Diagram showcase */
body.dark-mode .diagram-showcase-item {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .diagram-showcase-item .diagram-label { color: #8b8fa8; }

/* Compare table */
body.dark-mode .compare-table {
    background: #13152a;
    border-color: #1e2240;
}
body.dark-mode .compare-table td { border-bottom-color: #1e2240; color: #c8cce0; }
body.dark-mode .compare-table .highlight-row { background: #111633; }
body.dark-mode .compare-table .check { color: #34d399; }

/* Blog index */
body.dark-mode .blog-section-heading {
    background: #13152a;
    color: #e8eaf4;
}
body.dark-mode .blog-index .blog-subtitle { color: #8b8fa8; }
body.dark-mode .blog-card:hover {
    border-color: #3b6cf6;
    box-shadow: 0 6px 20px rgba(59,108,246,0.15);
}

/* Card tags */
body.dark-mode .card-tag-guide { background: #1e2a5a; color: #93b8fd; }
body.dark-mode .card-tag-study { background: #0f2618; color: #6ee7b7; }
body.dark-mode .card-tag-practice { background: #2a2210; color: #fcd34d; }
body.dark-mode .card-tag-tool { background: #1e1533; color: #c4b5fd; }
body.dark-mode .card-tag-calculator { background: #1a1d35; color: #c8cce0; }

/* ============ BLOG SIDEBAR ============ */
.blog-layout {
    max-width: 960px; margin: 0 auto; display: flex; gap: 32px; padding: 0 24px;
}
.blog-layout .blog-article-content {
    flex: 1; min-width: 0; max-width: 720px;
}
.blog-sidebar {
    width: 220px; flex-shrink: 0; position: sticky; top: 72px;
    align-self: flex-start; max-height: calc(100vh - 88px); overflow-y: auto;
    font-size: 13px;
}
.sidebar-header { display: none; }
.sidebar-links { display: block; }
.sidebar-section-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: #6b7280; padding: 14px 0 6px; margin-top: 4px; border-top: 1px solid #e5e7eb;
}
.sidebar-section-label:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.sidebar-link {
    display: block; padding: 6px 10px; border-radius: 6px; color: #374151;
    text-decoration: none; transition: background 0.15s;
}
.sidebar-link:hover { background: #f3f4f6; }
.sidebar-active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.sidebar-disc-link { color: #6b7280; }

/* Related articles grid */
.related-articles {
    max-width: 720px; margin: 32px auto; padding: 24px 24px 0;
    border-top: 1px solid #e5e7eb;
}
.related-articles h3 { font-size: 18px; font-weight: 700; margin: 0 0 16px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.related-card {
    border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px;
    text-decoration: none; color: #374151; font-size: 14px; font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.related-card:hover { border-color: #2563eb; box-shadow: 0 4px 12px rgba(37,99,235,0.1); color: #1d4ed8; }

@media (max-width: 960px) {
    .blog-layout { flex-direction: column; padding: 0; }
    .blog-layout .blog-article { max-width: 100%; }
    .blog-sidebar {
        width: 100%; position: static; max-height: none; order: -1;
        border: 1px solid #e5e7eb; border-radius: 10px; margin: 0 24px 16px; padding: 0;
    }
    .sidebar-header { display: block; }
    .sidebar-toggle {
        display: flex; align-items: center; justify-content: space-between; width: 100%;
        background: none; border: none; padding: 14px 16px; cursor: pointer;
        font-size: 14px; font-weight: 600; color: #374151;
    }
    .sidebar-caret { font-size: 10px; transition: transform 0.2s; }
    .sidebar-open .sidebar-caret { transform: rotate(180deg); }
    .sidebar-links { display: none; padding: 0 16px 16px; }
    .sidebar-open .sidebar-links { display: block; }
}

/* Sidebar dark mode */
body.dark-mode .sidebar-section-label { color: #8b8fa8; border-color: #1e2240; }
body.dark-mode .sidebar-link { color: #c8cce0; }
body.dark-mode .sidebar-link:hover { background: #1a1d35; }
body.dark-mode .sidebar-active { background: #1a2654; color: #93b8fd; }
body.dark-mode .sidebar-disc-link { color: #8b8fa8; }
body.dark-mode .blog-sidebar { border-color: #1e2240; }
body.dark-mode .sidebar-toggle { color: #e8eaf4; }
body.dark-mode .related-articles { border-color: #1e2240; }
body.dark-mode .related-articles h3 { color: #e8eaf4; }
body.dark-mode .related-card { border-color: #1e2240; color: #c8cce0; }
body.dark-mode .related-card:hover { border-color: #3b6cf6; color: #93b8fd; }
body.dark-mode .nav-menu-sublabel { color: #6b7280; }

/* Blog footer */
body.dark-mode .blog-footer a:hover { color: #93b8fd; }
