/* ============================================================
   TelescopeGuides — Light Magazine Theme with Sticky Sidebar TOC
   ============================================================ */

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

:root {
    --bg-base:       #fafafa;
    --bg-card:       #ffffff;
    --bg-hero:       #f5f5f7;
    --bg-sidebar:    #f8f9fb;
    --border:        #e5e7eb;
    --border-light:  #f0f1f3;
    --text-body:     #374151;
    --text-muted:    #6b7280;
    --text-dim:      #9ca3af;
    --text-dark:     #111827;
    --text-heading:  #1f2937;
    --indigo:        #4f46e5;
    --indigo-light:  #6366f1;
    --indigo-dark:   #4338ca;
    --indigo-bg:     #eef2ff;
    --cat-guide:     #2563eb;
    --cat-review:    #d97706;
    --cat-astro:     #7c3aed;
    --cat-kb:        #4f46e5;
    --cat-gear:      #059669;
    --cat-events:    #dc2626;
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius:        12px;
    --content-max:   720px;
    --sidebar-width: 260px;
    --layout-max:    1120px;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg-base);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Arial, sans-serif;
    color: var(--text-body);
    line-height: 1.8;
    font-size: 17px;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { color: var(--indigo-light); }

img { max-width: 100%; height: auto; border-radius: 8px; }

/* ── CONTAINER ── */
.container {
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ================================================================
   NAV / HEADER
   ================================================================ */
.site-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 200;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--layout-max);
}
.site-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.site-logo:hover { color: var(--indigo); text-decoration: none; }
.site-nav { display: flex; gap: 24px; }
.site-nav a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    padding: 4px 0;
}
.site-nav a:hover { color: var(--text-dark); text-decoration: none; }

/* ================================================================
   CATEGORY BADGE COLORS
   ================================================================ */
.category-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #fff;
}
.cat-guides        { background: var(--cat-guide); }
.cat-reviews       { background: var(--cat-review); }
.cat-astrophotography { background: var(--cat-astro); }
.cat-knowledge-base   { background: var(--cat-kb); }
.cat-recommended-gear { background: var(--cat-gear); }
.cat-events        { background: var(--cat-events); }
.cat-general       { background: var(--indigo); }

.cat-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.cat-badge-guides        { background: rgba(37,99,235,0.1); color: var(--cat-guide); }
.cat-badge-reviews       { background: rgba(217,119,6,0.1); color: var(--cat-review); }
.cat-badge-astrophotography { background: rgba(124,58,237,0.1); color: var(--cat-astro); }
.cat-badge-knowledge-base   { background: rgba(79,70,229,0.1); color: var(--cat-kb); }
.cat-badge-recommended-gear { background: rgba(5,150,105,0.1); color: var(--cat-gear); }
.cat-badge-events        { background: rgba(220,38,38,0.1); color: var(--cat-events); }

/* ================================================================
   POST HERO
   ================================================================ */
.post-hero {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 56px 24px 44px;
    text-align: center;
}
.post-hero .category-badge { margin-bottom: 16px; }
.post-hero h1 {
    font-size: clamp(1.75rem, 4.5vw, 2.6rem);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    max-width: 760px;
    margin: 0 auto 16px;
    letter-spacing: -0.02em;
}
.post-meta {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}
.post-meta .sep { margin: 0 6px; opacity: 0.4; }

/* ================================================================
   POST LAYOUT — Two-column with Sticky Sidebar TOC
   ================================================================ */
.post-layout {
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 48px;
    align-items: start;
}

/* ── Sidebar TOC ── */
.toc-sidebar {
    position: sticky;
    top: 72px; /* below sticky header */
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    padding: 32px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.toc-sidebar::-webkit-scrollbar { width: 4px; }
.toc-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.toc-sidebar .toc-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 16px;
    padding-left: 16px;
}
.toc-sidebar ol {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc-sidebar ol li {
    margin-bottom: 2px;
}
.toc-sidebar ol li a {
    display: block;
    padding: 6px 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: all 0.15s;
    line-height: 1.4;
    text-decoration: none;
}
.toc-sidebar ol li a:hover {
    color: var(--indigo);
    background: var(--indigo-bg);
    border-left-color: var(--indigo);
    text-decoration: none;
}
.toc-sidebar ol li a.active {
    color: var(--indigo);
    background: var(--indigo-bg);
    border-left-color: var(--indigo);
    font-weight: 600;
}

/* ================================================================
   POST CONTENT (right column)
   ================================================================ */
.post-content {
    max-width: var(--content-max);
    padding: 40px 0 64px;
    color: var(--text-body);
}

.post-content h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--indigo-bg);
    line-height: 1.3;
    scroll-margin-top: 80px;
}
.post-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 32px 0 12px;
    line-height: 1.35;
}
.post-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 24px 0 10px;
}
.post-content p { margin-bottom: 18px; }

.post-content a {
    color: var(--indigo);
    text-decoration: none;
    border-bottom: 1px solid rgba(79,70,229,0.25);
    transition: border-color 0.2s, color 0.2s;
}
.post-content a:hover {
    color: var(--indigo-dark);
    border-bottom-color: var(--indigo);
    text-decoration: none;
}

/* Lists */
.post-content ul, .post-content ol {
    margin: 0 0 20px 0;
    padding-left: 0;
    list-style: none;
}
.post-content ul li, .post-content ol li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 8px;
}
.post-content ul li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 11px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--indigo);
}
.post-content ol {
    counter-reset: ol-counter;
}
.post-content ol li::before {
    content: counter(ol-counter) ".";
    counter-increment: ol-counter;
    position: absolute;
    left: 0;
    color: var(--indigo);
    font-weight: 700;
    font-size: 0.9em;
}

/* Blockquotes */
.post-content blockquote {
    border-left: 3px solid var(--indigo);
    margin: 28px 0;
    padding: 18px 22px;
    background: var(--indigo-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-body);
    font-style: italic;
}
.post-content blockquote p { margin-bottom: 0; }

/* Code */
.post-content code {
    background: #f3f4f6;
    color: var(--indigo-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
}
.post-content pre {
    background: #1e1e2e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 24px;
}
.post-content pre code { background: none; padding: 0; color: #e2e8f0; }

/* Tables */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.9rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.post-content table th {
    background: #f9fafb;
    color: var(--text-dark);
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
}
.post-content table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}
.post-content table tr:last-child td { border-bottom: none; }
.post-content table tr:hover td { background: #f9fafb; }

/* Images */
.article-image {
    margin: 32px 0;
    text-align: center;
}
.article-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.article-image figcaption {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.5;
    font-style: italic;
}
.post-content figure { margin: 32px 0; text-align: center; }
.post-content figcaption { font-size: 0.82rem; color: var(--text-muted); margin-top: 10px; }
.post-content .wp-block-image { margin: 28px 0; }
.post-content .wp-block-image img { display: block; margin: 0 auto; box-shadow: var(--shadow-md); }
.post-content .wp-block-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 36px 0;
}

/* Hide WP old TOC widget */
.post-content .ez-toc-v2_0_82_1,
.post-content #ez-toc-container { display: none !important; }
.post-content .ez-toc-section,
.post-content .ez-toc-section-end { display: none; }

/* ================================================================
   CONTENT CARDS — Skimmable highlights
   ================================================================ */

/* Key Takeaway / Summary card */
.content-card {
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 28px 0;
    font-size: 0.92rem;
    line-height: 1.7;
}
.content-card p:last-child { margin-bottom: 0; }

.card-takeaway {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 4px solid #059669;
}
.card-takeaway .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #059669;
    margin-bottom: 8px;
    display: block;
}

/* Tip / Pro Tip card */
.card-tip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
}
.card-tip .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2563eb;
    margin-bottom: 8px;
    display: block;
}

/* Warning card */
.card-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #d97706;
}
.card-warning .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d97706;
    margin-bottom: 8px;
    display: block;
}

/* Comparison card */
.card-compare {
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-left: 4px solid #7c3aed;
}
.card-compare .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7c3aed;
    margin-bottom: 8px;
    display: block;
}

/* Quick Answer / In This Section card */
.card-answer {
    background: var(--indigo-bg);
    border: 1px solid #c7d2fe;
    border-left: 4px solid var(--indigo);
}
.card-answer .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--indigo);
    margin-bottom: 8px;
    display: block;
}
.card-answer ul li {
    padding-left: 20px !important;
    margin-bottom: 4px !important;
    font-size: 0.9rem;
    color: var(--text-body);
}
.card-answer ul li::before {
    content: "→" !important;
    background: none !important;
    color: var(--indigo) !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    font-size: 0.85em;
    font-weight: 600;
}

/* Key Point / Lightbulb card */
.card-keypoint {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-left: 4px solid #eab308;
}
.card-keypoint .card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ca8a04;
    margin-bottom: 8px;
    display: block;
}
.card-keypoint p {
    margin-bottom: 0;
    color: #713f12;
    font-size: 0.92rem;
}

/* ================================================================
   PRODUCT CARDS (Amazon links)
   ================================================================ */
.amazon-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 16px 0 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: var(--shadow-sm);
}
.amazon-card:hover {
    border-color: rgba(217, 119, 6, 0.5);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
}
.amazon-card .amz-img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 6px;
    background: #f9fafb;
    padding: 4px;
}
.amazon-card .amz-info {
    flex: 1;
    min-width: 0;
}
.amazon-card .amz-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d97706;
    margin-bottom: 3px;
    display: block;
}
.amazon-card .amz-text {
    color: var(--text-dark);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.3;
    display: block;
    margin-bottom: 4px;
}
.amazon-card .amz-cta {
    color: #d97706;
    font-size: 0.82rem;
    display: inline-block;
    font-weight: 600;
    background: rgba(217, 119, 6, 0.08);
    padding: 4px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}
.amazon-card:hover .amz-cta {
    background: rgba(217, 119, 6, 0.15);
}

@media (max-width: 480px) {
    .amazon-card { flex-direction: column; text-align: center; }
    .amazon-card .amz-img { width: 80px; height: 80px; }
}

/* ================================================================
   INLINE TOC (mobile fallback — shown only on mobile)
   ================================================================ */
.toc-inline {
    display: none; /* hidden on desktop, shown on mobile */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}
.toc-inline .toc-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.toc-inline ol {
    list-style: none;
    counter-reset: toc-counter;
    margin: 0;
    padding: 0;
}
.toc-inline ol li {
    counter-increment: toc-counter;
    position: relative;
    padding-left: 28px;
    margin-bottom: 6px;
}
.toc-inline ol li::before {
    content: counter(toc-counter) ".";
    position: absolute;
    left: 0;
    color: var(--indigo);
    font-weight: 700;
    font-size: 0.82em;
    top: 3px;
}
.toc-inline a {
    color: var(--text-muted);
    font-size: 0.88rem;
    border-bottom: none;
    text-decoration: none;
}
.toc-inline a:hover { color: var(--indigo); }

/* Old toc-box — hide it in favor of sidebar */
.toc-box { display: none !important; }

/* ── Footnote references ── */
.footnote-ref {
    font-size: 0.72em;
    vertical-align: super;
    line-height: 0;
    margin-left: 1px;
}
.footnote-ref a {
    color: var(--indigo) !important;
    border-bottom: none !important;
    font-weight: 600;
}
.footnote-ref a:hover {
    color: var(--indigo-dark) !important;
}

/* ── Sources section ── */
.sources-section {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.sources-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 12px;
}
.sources-list {
    counter-reset: sources-counter !important;
    padding-left: 0 !important;
}
.sources-list li {
    counter-increment: sources-counter;
    padding-left: 28px !important;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.sources-list li::before {
    content: counter(sources-counter) "." !important;
    color: var(--indigo) !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    top: 0 !important;
    font-weight: 700;
}
.sources-list a {
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border) !important;
}
.sources-list a:hover {
    color: var(--indigo) !important;
}

/* ================================================================
   RELATED POSTS
   ================================================================ */
.related-posts-section {
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 24px 64px;
}
.related-posts-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}
.related-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.related-card .category-badge { align-self: flex-start; }
.related-card h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
    flex-grow: 1;
}
.related-card h4 a { color: inherit; border-bottom: none !important; }
.related-card h4 a:hover { color: var(--indigo); text-decoration: none; }
.related-card .related-excerpt {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.related-card .related-date {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: auto;
}

/* ================================================================
   COURSE CTA
   ================================================================ */
.course-cta-section {
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 0 24px 64px;
}
.course-cta {
    background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
    border-radius: 16px;
    padding: 44px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.course-cta h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
}
.course-cta p {
    color: #c7d2fe;
    margin-bottom: 24px;
    font-size: 1rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.course-cta p:last-of-type { margin-bottom: 24px; }
.course-cta a {
    display: inline-block;
    background: #fff;
    color: var(--indigo-dark);
    padding: 14px 36px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
    border-bottom: none !important;
}
.course-cta a:hover {
    background: #eef2ff;
    text-decoration: none;
    transform: translateY(-1px);
}
.course-price {
    font-size: 0.85rem;
    color: #a5b4fc;
    margin-top: 12px;
    margin-bottom: 0 !important;
}

/* ================================================================
   HOMEPAGE HERO
   ================================================================ */
.hero {
    background: linear-gradient(135deg, #312e81 0%, #1e1b4b 50%, #312e81 100%);
    padding: 72px 0 60px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 18px;
    line-height: 1.2;
}
.hero p {
    font-size: 1.1rem;
    color: #c7d2fe;
    max-width: 580px;
    margin: 0 auto 32px;
}
.hero-btn {
    display: inline-block;
    background: #fff;
    color: var(--indigo-dark);
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
}
.hero-btn:hover {
    background: #eef2ff;
    color: var(--indigo-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

/* ================================================================
   POST GRID / CARDS (homepage + blog index)
   ================================================================ */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.4;
    flex-grow: 1;
}
.post-card h3 a { color: inherit; }
.post-card h3 a:hover { color: var(--indigo); text-decoration: none; }
.post-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.post-card .read-more { font-size: 0.85rem; color: var(--indigo); font-weight: 600; margin-top: auto; }
.post-card .post-date { font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; }

/* Category pills */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 48px;
}
.category-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 9px 20px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.category-pill:hover { background: var(--indigo); border-color: var(--indigo); color: #fff; text-decoration: none; }
.category-pill span { color: var(--text-dim); font-size: 0.8rem; margin-left: 4px; }

/* Blog index */
.blog-header { padding: 56px 0 36px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.blog-header h1 { font-size: 2.2rem; font-weight: 800; color: var(--text-dark); margin-bottom: 10px; }
.blog-header p { color: var(--text-muted); font-size: 1rem; }
.all-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 64px;
}

.homepage-section { padding: 56px 0; }
.homepage-section:nth-child(even) { background: #f3f4f6; }

/* ================================================================
   NEWSLETTER INLINE
   ================================================================ */
.newsletter-inline {
    background: linear-gradient(135deg, #312e81, #1e1b4b);
    border-radius: 16px;
    padding: 28px 24px;
    margin: 32px 0;
    text-align: center;
}
.newsletter-inline .nl-tag {
    font-size: 0.7rem;
    color: #a5b4fc;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}
.newsletter-inline .nl-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}
.newsletter-inline .nl-desc {
    font-size: 0.85rem;
    color: #c7d2fe;
    margin-bottom: 16px;
}
.newsletter-inline form {
    display: flex;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}
.newsletter-inline input[type="email"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border-radius: 50px;
    border: 1px solid rgba(165,180,252,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    outline: none;
}
.newsletter-inline input[type="email"]::placeholder { color: #a5b4fc; }
.newsletter-inline button {
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    background: #fff;
    color: var(--indigo-dark);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.newsletter-inline button:hover { background: #eef2ff; }
.newsletter-inline .nl-trust {
    font-size: 0.68rem;
    color: #818cf8;
    margin-top: 8px;
}

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
    background: #1e1b4b;
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: #a5b4fc;
    font-size: 0.85rem;
}
.site-footer a { color: #c7d2fe; }
.site-footer a:hover { color: #fff; }
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.footer-sep { opacity: 0.3; }

/* ================================================================
   TOC ACTIVE STATE (JS-driven)
   ================================================================ */
.toc-sidebar ol li a.is-active {
    color: var(--indigo);
    background: var(--indigo-bg);
    border-left-color: var(--indigo);
    font-weight: 600;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    .post-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .toc-sidebar {
        display: none;
    }
    .toc-inline {
        display: block;
    }
    .post-content {
        max-width: 100%;
        padding: 32px 0 48px;
    }
}

@media (max-width: 768px) {
    .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .site-header .container { flex-direction: column; gap: 8px; align-items: flex-start; }
    .site-nav { gap: 16px; }
    .post-grid, .all-posts-grid { grid-template-columns: 1fr; }
    .course-cta { padding: 28px 20px; }
    .post-hero { padding: 40px 16px 32px; }
    .related-posts-section, .course-cta-section { padding-left: 16px; padding-right: 16px; }
    .hero { padding: 48px 0 40px; }
    .container { padding: 0 16px; }
}
