:root {
    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-alt: #f1f5fb;
    --text: #1f2937;
    --muted: #515f7d;
    --primary: #0d6efd;
    --primary-strong: #0a58ca;
    --accent: #ffc107;
    --border: rgba(15, 23, 42, 0.08);
    --shadow: 0 22px 55px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

[data-theme="dark"] {
    --bg: #06112a;
    --surface: #0f172a;
    --surface-alt: #111827;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.24);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

body {
    background: var(--bg);
    color: var(--text);
}

.navbar {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
}

.hero-blog {
    background: radial-gradient(circle at top right, rgba(13, 110, 253, 0.18), transparent 28%),
                linear-gradient(180deg, rgba(13, 110, 253, 0.18), rgba(255, 255, 255, 0.97));
    padding: 70px 0 60px;
}

.hero-copy {
    max-width: 900px;
    text-align: left;
}

.content-area,
.question-card,
.question-body,
.section-intro,
.answer-section,
.faq-toggle,
.faq-body,
.tips-card,
.cta-card,
.footer-grid {
    text-align: left;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.hero h1 {
    font-size: clamp(2.5rem, 3.8vw, 4.4rem);
    line-height: 1.05;
    margin-bottom: 20px;
    color: var(--text);
}

.hero-description {
    font-size: 1.1rem;
    max-width: 760px;
    margin-bottom: 26px;
    color: var(--muted);
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.hero-badges span {
    background: rgba(13, 110, 253, 0.12);
    color: var(--primary-strong);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    color: var(--muted);
    font-size: 0.95rem;
}

.page-shell {
    padding-bottom: 60px;
}

.page-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 32px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 20px;
}

.sidebar {
    position: relative;
}

.sticky-card {
    position: sticky;
    top: 90px;
}

.sidebar-card,
.content-area,
.tips-card,
.faq-section,
.related-articles,
.cta-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.sidebar-card h2,
.tips-card h2,
.faq-section h2,
.related-articles h2,
.cta-card h2 {
    margin-bottom: 18px;
    color: var(--primary-strong);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.toc a {
    display: block;
    padding: 12px 16px;
    background: var(--surface-alt);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.25s ease;
}

.toc a:hover,
.toc a:focus-visible {
    background: rgba(13, 110, 253, 0.08);
}

.share-buttons {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.share-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-alt);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.share-buttons a:hover,
.share-buttons a:focus-visible {
    background: rgba(13, 110, 253, 0.1);
    transform: translateY(-1px);
}

.content-area {
    display: grid;
    gap: 30px;
}

.section-intro {
    font-size: 1rem;
    margin-bottom: 0;
    color: var(--muted);
}

.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.question-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.question-toggle:hover,
.faq-toggle:hover {
    background: rgba(13, 110, 253, 0.04);
}

.question-number {
    display: inline-flex;
    min-width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.14);
    color: var(--primary-strong);
    font-weight: 700;
}

.question-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.question-body,
.faq-body {
    padding: 0 24px 24px;
    animation: fadeIn 0.24s ease;
}

.question-body p,
.answer-section p,
.answer-section li,
.faq-body p,
.tips-card p,
.related-card,
.cta-card p {
    color: var(--muted);
}

.answer-section h3,
.answer-section h4 {
    margin-top: 18px;
    margin-bottom: 10px;
    color: var(--text);
}

.answer-section ul,
.tips-card ul,
.faq-body ul {
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
}

.answer-section li,
.tips-card li {
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0 0;
}

thead th {
    text-align: left;
    padding: 14px 16px;
    background: var(--surface-alt);
    color: var(--text);
    font-weight: 700;
}

tbody td {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.code-wrapper {
    position: relative;
    margin-top: 16px;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.copy-btn:hover {
    background: white;
}

.code-block {
    overflow-x: auto;
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 18px 18px 18px 70px;
    margin: 0;
    position: relative;
}

.code-block code {
    display: block;
    counter-reset: line;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-break: normal;
}

.code-block code span {
    display: block;
    position: relative;
    padding-left: 3.5rem;
}

.code-block code span::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0;
    width: 3rem;
    text-align: right;
    color: rgba(226, 232, 240, 0.65);
}

.bottom-sections {
    display: grid;
    gap: 30px;
}

.tips-card ul {
    display: grid;
    gap: 12px;
}

.faq-section .faq-item {
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
}

.faq-toggle {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 18px 22px;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.faq-body {
    padding: 0 22px 18px;
    color: var(--muted);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.related-card {
    display: block;
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--surface-alt);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.related-card:hover {
    transform: translateY(-3px);
    background: rgba(13, 110, 253, 0.08);
}

.cta-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 24px;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.35rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 40px rgba(13, 110, 253, 0.2);
}

.footer-blog {
    padding: 40px 20px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 22px;
}

.footer-grid h3 {
    color: var(--primary-strong);
    margin-bottom: 14px;
}

.footer-grid p,
.footer-grid a {
    color: var(--muted);
    text-decoration: none;
}

.footer-bottom {
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 200;
}

.reading-progress__bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #ffc107);
    transition: width 0.15s ease;
}

@media (max-width: 1130px) {
    .page-grid {
        grid-template-columns: 1fr;
    }

    .sticky-card {
        position: static;
    }
}

@media (max-width: 840px) {
    .navbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-meta {
        grid-template-columns: 1fr;
    }

    .cta-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-blog {
        padding-top: 48px;
    }

    .question-toggle {
        grid-template-columns: 1fr;
    }

    .copy-btn {
        top: 8px;
        right: 8px;
        padding: 8px 10px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
