/* ========================================
   BLOG THEME — Dark palette overrides
   Loaded only on /blog routes via BlogShell.
   ======================================== */

:root {
    --bg: #0e0d18;
    --card: #15132a;
    --text: #e5e7eb;
    --muted: #a9a7bc;
    --border: rgba(255, 255, 255, 0.08);
    --link: #B3B0D6;
    --accent: #7B78AA;
}

/* Body — must use !important to override base style.css */
body {
    font-family: var(--font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    background: radial-gradient(1200px 800px at 10% 10%, #2d2a4a 0%, var(--bg) 55%) !important;
    color: #e5e7eb !important;
    min-height: 100vh;
}

body::after {
    display: none !important;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #e5e7eb !important;
}

/* ========================================
   Blog page root layout
   ======================================== */
.blog-page-root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.blog-page-root > main {
    flex: 1;
}

/* ========================================
   Navbar — transparent default, dark on scroll
   ======================================== */
.blog-page-root .navbar {
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
}

.blog-page-root .navbar.scrolled {
    background: rgba(14, 13, 24, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.blog-page-root .navbar .logo {
    color: #e5e7eb;
}

.blog-page-root .navbar .logo-text {
    color: #e5e7eb;
}

.blog-page-root .navbar .nav-links {
    background: none;
    border-left-color: rgba(255, 255, 255, 0.12);
}

.blog-page-root .navbar .nav-links a {
    color: #a9a7bc;
}

.blog-page-root .navbar .nav-links a:hover {
    color: #ffffff;
}

.blog-page-root .navbar .nav-links a::after {
    background: #7B78AA;
}

.blog-page-root .navbar .nav-login-btn {
    background: #7B78AA;
    color: #fff;
}

.blog-page-root .navbar .nav-login-btn:hover {
    background: #9B98C6;
}

@media (max-width: 768px) {
    .blog-page-root .navbar .nav-links {
        background: none;
        border-left: none;
    }

    .blog-page-root .nav-login-li {
        border-top-color: rgba(255, 255, 255, 0.08);
    }

    .blog-page-root .nav-login-link-mobile {
        background: #7B78AA;
        color: #fff;
    }

    .blog-page-root .nav-login-link-mobile:hover {
        background: #9B98C6;
    }
}

/* ========================================
   Footer — dark theme
   ======================================== */
.blog-page-root footer,
.blog-page-root .site-footer {
    background: rgba(10, 9, 20, 0.95);
    color: #a9a7bc;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.blog-page-root footer::before {
    display: none;
}

.blog-page-root .footer-grid h4 {
    color: #d0cee2;
}

.blog-page-root footer a,
.blog-page-root .site-footer a {
    color: #8a88a3;
}

.blog-page-root footer a:hover,
.blog-page-root .site-footer a:hover {
    color: #e5e7eb;
}

.blog-page-root .footer-brand .logo {
    color: #e5e7eb;
}

.blog-page-root .footer-brand .logo-text {
    color: #e5e7eb;
}

.blog-page-root .footer-tagline {
    color: #8a88a3;
}

.blog-page-root .footer-tagline a {
    color: #B3B0D6;
}

.blog-page-root .footer-bottom {
    border-top-color: rgba(255, 255, 255, 0.06);
    color: #6e6c85;
}

.blog-page-root .footer-bottom a {
    color: #8a88a3;
}

/* ========================================
   Blog listing layout
   ======================================== */
.blog-wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 128px 24px 64px;
}

@media (max-width: 639px) {
    .blog-wrap {
        padding: 112px 18px 48px;
    }
}

/* --- Breadcrumbs --- */

.breadcrumbs {
    margin-bottom: 1.5rem;
}

.breadcrumbs-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.breadcrumbs-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs-sep {
    margin: 0 0.5rem;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 400;
    user-select: none;
}

.breadcrumbs-item a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs-item a:hover {
    color: var(--link);
}

.breadcrumbs-item span[aria-current="page"] {
    color: var(--text);
    font-weight: 500;
    /* Truncate long titles */
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

@media (max-width: 640px) {
    .breadcrumbs-item span[aria-current="page"] {
        max-width: 180px;
    }
}

/* Remove old back-link (replaced by breadcrumbs) */
.blog-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    color: #a9a7bc;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.blog-back-link:hover {
    color: #B3B0D6;
}

/* Listing header */
.blog-list-header {
    margin-bottom: 48px;
}

.blog-list-header h1 {
    font-size: 3rem;
    letter-spacing: -0.03em;
    margin: 0 0 12px;
    line-height: 1.1;
}

.blog-list-header p {
    color: #a9a7bc;
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.6;
}

@media (max-width: 639px) {
    .blog-list-header h1 {
        font-size: 2.2rem;
    }
}

/* Post grid — 3 cols desktop, 2 tablet, 1 mobile */
.blog-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 640px) {
    .blog-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .blog-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Post cards */
.blog-list-item {
    display: flex;
    flex-direction: column;
    background: rgba(21, 19, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
    cursor: pointer;
}

.blog-list-item:hover {
    border-color: rgba(123, 120, 170, 0.45);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    transform: translateY(-4px);
}

.blog-list-item-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.blog-list-item-body {
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-list-item h2 {
    font-size: 1.25rem;
    margin: 0 0 10px 0;
    color: #f0eef8;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.blog-list-item p {
    color: #b8b6cc;
    line-height: 1.6;
    margin: 0 0 auto 0;
    font-size: 0.92rem;
    padding-bottom: 16px;
}

.blog-list-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.blog-list-meta {
    font-size: 0.8rem;
    color: #a9a7bc;
    opacity: 0.8;
}

.blog-read-more {
    font-size: 0.82rem;
    color: #B3B0D6;
    font-weight: 600;
    white-space: nowrap;
}

/* Empty state */
.blog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(21, 19, 42, 0.4);
}

.blog-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.blog-empty p {
    color: #a9a7bc;
    font-size: 1.05rem;
    margin: 0;
}

/* ========================================
   Individual article
   ======================================== */
.blog-article-wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 128px 24px 80px;
}

@media (max-width: 640px) {
    .blog-article-wrap {
        padding: 112px 18px 48px;
    }
}

.blog-header {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.blog-header h1 {
    font-size: 2.8rem;
    margin: 0 0 20px 0;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.18;
    font-weight: 800;
}

@media (max-width: 640px) {
    .blog-header h1 {
        font-size: 1.8rem;
    }
}

@media (min-width: 641px) and (max-width: 1080px) {
    .blog-header h1 {
        font-size: 2.3rem;
    }
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-tag {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(123, 120, 170, 0.08);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--muted);
}

.blog-tag-link {
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    cursor: pointer;
}

.blog-tag-link:hover {
    background: rgba(123, 120, 170, 0.2);
    border-color: rgba(123, 120, 170, 0.35);
    color: #B3B0D6;
}

.blog-hero-img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 40px;
    max-height: 440px;
    object-fit: cover;
}

/* Article prose */
.blog-content {
    max-width: 860px;
    margin: 0 auto;
    font-size: 1.06rem;
}

.blog-content h2 {
    margin-top: 40px;
    margin-bottom: 16px;
    font-size: 1.55rem;
    color: #D8D4F0;
    letter-spacing: -0.01em;
    font-weight: 700;
}

.blog-content h3 {
    margin-top: 32px;
    margin-bottom: 12px;
    font-size: 1.25rem;
    color: #E2DFF5;
}

.blog-content h4 {
    margin-top: 24px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #E2DFF5;
}

.blog-content p {
    line-height: 1.85;
    margin: 16px 0;
    color: #dddce6;
}

.blog-content ul,
.blog-content ol {
    margin: 14px 0 18px 28px;
    padding: 0;
}

.blog-content li {
    margin: 10px 0;
    line-height: 1.75;
    color: #dddce6;
}

.blog-content a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: rgba(179, 176, 214, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}

.blog-content a:hover {
    text-decoration-color: var(--link);
}

.blog-content strong {
    color: #f0eef8;
}

.blog-content em {
    color: #d4d1e8;
}

.blog-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 36px 0;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 24px 0;
}

.blog-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 20px 0;
    padding: 12px 20px;
    color: var(--muted);
    background: rgba(123, 120, 170, 0.05);
    border-radius: 0 10px 10px 0;
}

.blog-content blockquote p {
    color: var(--muted);
}

.blog-content pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.blog-content code {
    background: rgba(123, 120, 170, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.blog-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ========================================
   Related Posts
   ======================================== */
.related-posts {
    max-width: 860px;
    margin: 56px auto 0;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.related-posts-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0eef8;
    margin: 0 0 24px;
    letter-spacing: -0.01em;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .related-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.related-post-card {
    display: flex;
    flex-direction: column;
    background: rgba(21, 19, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.related-post-card:hover {
    border-color: rgba(123, 120, 170, 0.45);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
    transform: translateY(-3px);
}

.related-post-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.related-post-body {
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.related-post-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f0eef8;
    margin: 0 0 8px;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.related-post-desc {
    font-size: 0.85rem;
    color: #b8b6cc;
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   Blog Article CTA
   ======================================== */
.blog-article-cta {
    max-width: 860px;
    margin: 48px auto 0;
    padding: 40px 32px;
    background: rgba(123, 120, 170, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    text-align: center;
}

.blog-article-cta-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f0eef8;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.blog-article-cta-desc {
    font-size: 1rem;
    color: #a9a7bc;
    line-height: 1.6;
    margin: 0 0 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.blog-article-cta-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.blog-article-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #7B78AA;
    color: #fff;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.24s ease, transform 0.15s ease;
}

.blog-article-cta-btn:hover {
    background: #9B98C6;
    color: #fff;
    transform: translateY(-1px);
}

.blog-article-cta-btn:active {
    transform: scale(0.97);
}

.blog-article-cta-link {
    font-size: 0.85rem;
    color: #a9a7bc;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-article-cta-link:hover {
    color: #B3B0D6;
}

@media (max-width: 639px) {
    .blog-article-cta {
        padding: 28px 20px;
        margin-top: 36px;
    }

    .blog-article-cta-title {
        font-size: 1.25rem;
    }
}

/* ========================================
   Article body layout (TOC sidebar + main)
   ======================================== */
.blog-article-body {
    display: flex;
    gap: 48px;
    max-width: 1120px;
    margin: 0 auto;
}

.blog-article-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1080px) {
    .blog-article-body {
        flex-direction: column;
        gap: 0;
    }
}

/* ========================================
   Table of Contents
   ======================================== */
.toc {
    flex-shrink: 0;
    width: 220px;
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.toc-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8a88a3;
    margin: 0 0 12px;
    padding-left: 14px;
}

.toc-toggle {
    display: none;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.toc-item {
    margin: 0;
}

.toc-item-nested {
    padding-left: 12px;
}

.toc-link {
    display: block;
    padding: 5px 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #8a88a3;
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.toc-link:hover {
    color: #B3B0D6;
}

.toc-item-active > .toc-link {
    color: #B3B0D6;
    border-left-color: #7B78AA;
}

/* TOC mobile: collapsible accordion */
@media (max-width: 1080px) {
    .toc {
        position: static;
        width: 100%;
        max-width: 860px;
        margin: 0 auto 28px;
        max-height: none;
        overflow: visible;
        background: rgba(21, 19, 42, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 12px;
        padding: 0;
    }

    .toc-heading {
        display: none;
    }

    .toc-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 14px 16px;
        background: none;
        border: none;
        color: #a9a7bc;
        font-size: 0.88rem;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        transition: color 0.2s;
    }

    .toc-toggle:hover {
        color: #B3B0D6;
    }

    .toc-toggle-icon {
        flex-shrink: 0;
    }

    .toc-chevron {
        margin-left: auto;
        transition: transform 0.2s;
    }

    .toc-chevron-open {
        transform: rotate(180deg);
    }

    .toc-list {
        display: none;
        border-left: none;
        padding: 0 16px 14px;
    }

    .toc-list-open {
        display: block;
    }

    .toc-link {
        border-left: none;
        margin-left: 0;
        padding: 6px 0;
    }

    .toc-item-active > .toc-link {
        border-left: none;
    }
}

/* ========================================
   Share Buttons
   ======================================== */
.share-buttons {
    max-width: 860px;
    margin: 40px auto 0;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.share-buttons-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #8a88a3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.share-buttons-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(123, 120, 170, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #a9a7bc;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    line-height: 1;
}

.share-btn:hover {
    background: rgba(123, 120, 170, 0.18);
    border-color: rgba(123, 120, 170, 0.35);
    color: #B3B0D6;
}

.share-btn svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .share-btn-text {
        display: none;
    }

    .share-btn {
        padding: 8px 10px;
    }
}

/* ========================================
   Author Bio
   ======================================== */
.author-bio {
    max-width: 860px;
    margin: 48px auto 0;
    padding: 28px 28px;
    background: rgba(21, 19, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.author-bio-inner {
    display: flex;
    align-items: center;
    gap: 18px;
}

.author-bio-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.author-bio-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(123, 120, 170, 0.15);
    color: #B3B0D6;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.author-bio-text {
    flex: 1;
    min-width: 0;
}

.author-bio-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f0eef8;
    margin: 0 0 4px;
}

.author-bio-desc {
    font-size: 0.85rem;
    color: #a9a7bc;
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 639px) {
    .author-bio {
        padding: 22px 20px;
        margin-top: 36px;
    }

    .author-bio-inner {
        gap: 14px;
    }
}
