@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --bg-light: #f8fafc;
    --border: #e2e8f0;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
}

*,*::before,*::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.8;
    color: var(--text-primary);
    background: #fff;
    margin: 0;
    padding: 0;
    transition: background 0.3s, color 0.3s;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

/* Update CTA with Glassmorphism */
.cta-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin: 48px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Navigation */
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 40px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}
.back-home:hover { text-decoration: underline; }

/* Header */
.header {
    margin-bottom: 48px;
    text-align: center;
}

.category-tag {
    display: inline-block;
    padding: 5px 14px;
    background: #eff6ff;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin: 0 0 20px;
}

.intro {
    font-size: 19px;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

.meta { font-size: 14px; color: var(--text-secondary); margin-top: 12px; }

/* Article Content */
.article-content {
    font-size: 17px;
    line-height: 1.85;
}
.article-content p  { margin: 0 0 22px; }
.article-content ul,
.article-content ol { margin: 0 0 24px; padding-left: 24px; }
.article-content li { margin-bottom: 10px; }

h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 52px 0 20px;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 36px 0 14px;
}

/* Tables */
.comparison-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0 32px;
    font-size: 15px;
}

.comparison-table th,
.comparison-table td,
.data-table th,
.data-table td {
    padding: 14px 16px;
    border: 1px solid var(--border);
    text-align: left;
}

.comparison-table thead th,
.data-table thead th {
    background: var(--bg-light);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.check { color: #10b981; font-weight: 700; }
.cross { color: #ef4444; font-weight: 700; }

/* Code Blocks */
.code-block {
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: 10px;
    padding: 24px;
    margin: 24px 0 32px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.7;
}
.code-block code { color: inherit; background: none; }

code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin: 48px 0;
}
.cta-box h3 { font-size: 22px; margin: 0 0 12px; }
.cta-box p  { color: var(--text-secondary); margin-bottom: 20px; }

.btn-cta {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    transition: background 0.2s, transform 0.15s;
}
.btn-cta:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* FAQ */
.faq-section { margin: 48px 0; }
.faq-section h2 { margin-bottom: 24px; }

.faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.faq-item summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 20px; color: var(--accent); }
.faq-item[open] summary::after { content: '−'; }
.faq-item[open] summary { background: var(--bg-light); }

.faq-body {
    padding: 16px 20px 20px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Key Takeaway / Highlight */
.key-takeaway {
    background: #fefce8;
    border-left: 4px solid #eab308;
    padding: 20px 24px;
    border-radius: 0 10px 10px 0;
    margin: 32px 0;
    font-size: 16px;
}
.key-takeaway strong { display: block; margin-bottom: 6px; color: #854d0e; }

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 60px;
}

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 40px 16px 60px; }
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    .comparison-table, .data-table { font-size: 14px; }
    .comparison-table th, .comparison-table td,
    .data-table th, .data-table td { padding: 10px 12px; }
    .cta-box { padding: 28px 20px; }
}

/* --- God Lvl UX Upgrades --- */

/* Scroll Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 9999;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #10b981);
    width: 0%;
    transition: width 0.1s ease;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { color: #94a3b8; }

/* Table of Contents */
.toc-wrapper {
    margin-bottom: 40px;
    padding: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.toc-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 8px;
    font-size: 15px;
}

.toc-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
    display: block;
    line-height: 1.4;
}

.toc-link:hover { color: var(--accent); }

/* Clean single-column — professional blog standard */
@media (min-width: 900px) {
    .container {
        max-width: 820px;
        padding: 80px 40px 100px;
    }
}

/* Sidebar Support */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
        display: grid;
        grid-template-columns: 1fr 300px;
        grid-template-areas: 
            "nav nav"
            "breadcrumb breadcrumb"
            "header header"
            "content sidebar"
            "footer footer";
        gap: 0 60px;
        align-items: start;
    }
    .back-home { grid-area: nav; margin-bottom: 24px; }
    .breadcrumbs { grid-area: breadcrumb; margin-bottom: 40px; }
    .header { grid-area: header; text-align: left; }
    .header .intro { margin: 0; }
    .article-content { grid-area: content; max-width: 780px; }
    .toc-wrapper { 
        grid-area: sidebar; 
        position: sticky; 
        top: 40px; 
        height: fit-content; 
        margin-top: 0;
    }
    footer { grid-area: footer; text-align: left; }
}

/* Read Time Badge */
@media (max-width: 1199px) {
    .toc-wrapper {
        margin-bottom: 40px;
        padding: 24px;
    }
}

/* Read Time Badge */
.read-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 12px;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-dark);
    transform: translateY(-4px);
}

/* Dark Mode Overrides — MOVED TO BOTTOM TO FIX CASCADE */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --accent: #60a5fa;
        --accent-dark: #3b82f6;
        --bg-light: #0f172a;
        --border: #334155;
        --code-bg: #020617;
        --code-text: #cbd5e1;
        --glass-bg: rgba(15, 23, 42, 0.8);
        --glass-border: rgba(51, 65, 85, 0.6);
    }
    body { background: #020617; color: var(--text-primary); }
    .category-tag { background: #1e3a5f; color: #93c5fd; }
    .key-takeaway { background: #422006; border-left-color: #f59e0b; }
    .key-takeaway strong { color: #fbbf24; }
    .cta-box { background: linear-gradient(135deg, #0f172a 0%, #0f2027 100%); border-color: #334155; }
    code { background: #1e293b; color: #e2e8f0; }
    .comparison-table tbody td, .data-table tbody td { color: #cbd5e1; }
    .comparison-table thead th, .data-table thead th { background: #1e293b; color: #e2e8f0; }
    .faq-item { border-color: #334155; }
    .faq-item[open] summary { background: #1e293b; }
    .read-time-badge { background: #1e293b; }
    .glass { background: var(--glass-bg); border-color: var(--glass-border); }
}
