:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-2: #f1f5f9;
    --ink: #0f172a;
    --muted: #475569;
    --line: #e2e8f0;
    --brand: #4f46e5;
    --brand-2: #6366f1;
    --brand-3: #ec4899;
    --shadow: 0 14px 38px rgba(15, 23, 42, 0.1);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Manrope', 'Segoe UI', sans-serif;
}

html[data-bs-theme="dark"] {
    --bg: #0f172a;
    --panel: #111827;
    --panel-2: #1f2937;
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #334155;
    --brand: #6366f1;
    --brand-2: #818cf8;
    --brand-3: #ec4899;
    --shadow: 0 16px 46px rgba(2, 6, 23, 0.45);
}

* {
    box-sizing: border-box;
}

body.blog-body {
    position: relative;
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 12% 8%, rgba(79, 70, 229, 0.14), transparent 34%),
        radial-gradient(circle at 86% 14%, rgba(236, 72, 153, 0.12), transparent 34%),
        var(--bg);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

.bg-orb {
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.4;
}

.orb-a {
    width: 320px;
    height: 320px;
    top: -110px;
    right: -80px;
    background: rgba(99, 102, 241, 0.42);
}

.orb-b {
    width: 280px;
    height: 280px;
    bottom: 4%;
    left: -100px;
    background: rgba(236, 72, 153, 0.34);
}

.blog-nav {
    background: color-mix(in srgb, var(--panel) 84%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.blog-brand {
    color: var(--ink) !important;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 1.6rem;
}

.blog-brand span,
.blog-footer h5 span {
    color: var(--brand);
}

.blog-nav .nav-link {
    color: var(--muted) !important;
    font-weight: 650;
    padding: 0.5rem 0.82rem !important;
    border-radius: 10px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.blog-nav .nav-link:hover,
.blog-nav .nav-link.active {
    color: var(--ink) !important;
    background: color-mix(in srgb, var(--brand) 12%, transparent);
}

.theme-toggle-btn {
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    border-color: var(--brand-2);
    color: var(--brand-2);
    background: color-mix(in srgb, var(--brand-2) 12%, transparent);
}

.cta-btn {
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    border: none;
    color: #fff;
    border-radius: 11px;
    padding: 0.56rem 1rem;
    font-weight: 700;
}

.cta-btn:hover {
    color: #fff;
    filter: brightness(1.05);
}

.blog-hero {
    padding: 2.9rem 0 2rem;
}

.hero-content,
.hero-panel {
    background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 92%, transparent), color-mix(in srgb, var(--panel-2) 96%, transparent));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-content {
    padding: 2.35rem;
    animation: fadeInUp 0.65s ease;
}

.hero-kicker {
    margin: 0 0 0.75rem;
    color: var(--brand);
    font-weight: 800;
    letter-spacing: 0.11em;
    font-size: 0.78rem;
}

.hero-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.6vw, 3.15rem);
    line-height: 1.11;
}

.hero-subtitle {
    margin: 1.1rem 0 1.35rem;
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 56ch;
}

.hero-search {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel);
}

.hero-search .input-group-text,
.hero-search .form-control {
    border: none;
    background: transparent;
    color: var(--ink);
}

.hero-search .input-group-text {
    padding-left: 0.92rem;
}

.hero-search .form-control {
    height: 52px;
    font-size: 0.98rem;
}

.hero-search .form-control::placeholder {
    color: color-mix(in srgb, var(--muted) 88%, transparent);
}

.hero-chip-row {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.52rem;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.36rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 8%, var(--panel-2));
    color: var(--ink);
    font-weight: 650;
    font-size: 0.84rem;
    padding: 0.36rem 0.74rem;
}

.hero-chip i {
    width: 14px;
    height: 14px;
}

.hero-panel {
    height: 100%;
    padding: 1.8rem 1.6rem;
    animation: fadeInUp 0.8s ease;
}

.hero-panel h2 {
    margin: 0 0 0.9rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.hero-panel ul {
    margin: 0 0 0.85rem;
    padding-left: 1.2rem;
    color: var(--muted);
}

.hero-panel li {
    margin-bottom: 0.44rem;
}

.hero-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.blog-main {
    padding-top: 2.1rem;
    padding-bottom: 1.3rem;
}

.listing-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.1rem;
    margin: 0.3rem 0 1.35rem;
}

.section-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
}

.section-subtitle {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.filter-shell {
    background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 95%, transparent), color-mix(in srgb, var(--panel-2) 95%, transparent));
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 0.9rem;
}

.results-summary {
    margin: 0;
    color: color-mix(in srgb, var(--muted) 92%, transparent);
    font-size: 0.9rem;
    font-weight: 700;
}

.sidebar-card {
    background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 94%, transparent), color-mix(in srgb, var(--panel-2) 95%, transparent));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 1.15rem 1.05rem;
}

.sidebar-card h3 {
    font-family: var(--font-display);
    margin: 0 0 0.72rem;
    font-size: 1.24rem;
}

.sidebar-card p {
    margin: 0;
    color: var(--muted);
}

.filter-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-pill {
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-2) 88%, transparent);
    color: var(--muted);
    border-radius: 999px;
    padding: 0.38rem 0.78rem;
    font-size: 0.84rem;
    font-weight: 700;
    transition: 0.18s ease;
}

.filter-pill:hover {
    color: var(--brand-2);
    border-color: var(--brand-2);
}

.filter-pill.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
}

.mini-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.mini-list span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--ink);
}

.mini-list i {
    width: 15px;
    height: 15px;
    color: var(--brand);
}

#postsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.15rem;
}

.post-card {
    position: relative;
    background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 94%, transparent), color-mix(in srgb, var(--panel-2) 95%, transparent));
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    animation: fadeInUp 0.45s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--brand-2) 65%, var(--line));
    box-shadow: 0 18px 42px rgba(79, 70, 229, 0.18);
}

.post-card-image {
    width: 100%;
    height: 182px;
    background-size: cover;
    background-position: center;
}

.post-card-body {
    padding: 1rem 1rem 1.05rem;
    display: flex;
    flex-direction: column;
    min-height: 245px;
}

.post-card-category {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    margin-bottom: 0.74rem;
}

.post-card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.36rem;
    line-height: 1.22;
    color: var(--ink);
}

.post-card-excerpt {
    color: var(--muted);
    font-size: 0.93rem;
    margin: 0.72rem 0 0.82rem;
    line-height: 1.58;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    margin-top: auto;
    border-top: 1px dashed var(--line);
    padding-top: 0.72rem;
    display: flex;
    align-items: center;
    gap: 0.66rem;
    color: var(--muted);
    font-size: 0.83rem;
}

.post-author-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(130deg, var(--brand), var(--brand-3));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
}

.back-link {
    color: var(--brand-2);
    font-weight: 700;
    padding-left: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.post-article {
    background: linear-gradient(160deg, color-mix(in srgb, var(--panel) 95%, transparent), color-mix(in srgb, var(--panel-2) 94%, transparent));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.post-article .badge {
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.4rem 0.72rem;
}

.single-title {
    margin: 0 0 1.1rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.2vw, 3.1rem);
    line-height: 1.1;
    color: var(--ink);
}

.post-article .back-link {
    margin-bottom: 0.65rem;
}

.single-meta {
    border-bottom-color: var(--line) !important;
}

#singlePostCover {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

.post-content {
    color: var(--ink);
    font-size: 1.01rem;
    line-height: 1.82;
}

.post-content h2,
.post-content h3 {
    font-family: var(--font-display);
    margin-top: 1.4rem;
}

.post-content h2 {
    font-size: 1.95rem;
}

.post-content h3 {
    font-size: 1.44rem;
}

.post-content code {
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-2) 85%, transparent);
    border-radius: 8px;
    padding: 0.1rem 0.42rem;
    color: var(--brand);
}

.post-content pre {
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-2) 84%, transparent);
    border-radius: 14px;
    padding: 0.85rem;
    overflow: auto;
}

.post-content blockquote {
    border-left: 4px solid var(--brand);
    margin: 1rem 0;
    padding: 0.18rem 0 0.18rem 0.95rem;
    color: var(--muted);
    font-style: italic;
}

.post-content a {
    color: var(--brand);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.12rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.44rem;
}

.post-tag {
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-2) 90%, transparent);
    color: var(--muted);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.28rem 0.62rem;
}

.share-bar .btn {
    border-radius: 10px;
}

.no-results {
    margin-top: 1.8rem;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel-2) 80%, transparent);
    text-align: center;
    color: var(--muted);
    padding: 2.1rem 1rem;
}

.no-results i {
    width: 44px;
    height: 44px;
    color: var(--brand-2);
    margin-bottom: 0.72rem;
}

.no-results p {
    margin: 0;
    font-weight: 700;
}

.blog-footer {
    margin-top: 3rem;
    border-top: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    padding: 2rem 0;
}

.blog-footer h5 {
    margin: 0 0 0.4rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
}

.blog-footer p,
.blog-footer a {
    margin: 0;
    color: var(--muted);
}

.blog-footer a {
    font-weight: 700;
    color: var(--brand);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991px) {
    .blog-hero {
        padding-top: 2rem;
    }

    .hero-content,
    .hero-panel,
    .post-article {
        padding: 1.2rem;
    }

    .listing-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575px) {
    #postsGrid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 1.85rem;
    }

    .blog-footer {
        padding: 1.4rem 0;
    }
}
