:root {
    --bg-paper: #ffffff;
    --text-ink: #2a2a2a;
    --text-muted: #666;
    --border-line: #e0e0e0;
    --accent: #000;
    --link-color: #005b96;
    --font-masthead: 'UnifrakturMaguntia', cursive;
    --font-headline: 'Playfair Display', serif;
    --font-body: 'Libre Baskerville', serif;
    --font-ui: 'Libre Franklin', sans-serif;
    --max-width: 1100px;
    --spacing: 2rem;
    --bg-footer: #f9f9f9;
    --text-summary: #444444;
}

[data-theme="dark"] {
    --bg-paper: #121212;
    --text-ink: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-line: #333333;
    --accent: #ffffff;
    --link-color: #64b5f6;
    --bg-footer: #1e1e1e;
    --text-summary: #d0d0d0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-paper);
    color: var(--text-ink);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.8;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: 0.2s ease;
}

a:hover {
    text-decoration: underline;
    color: #003366;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
}

.site-header {
    padding: 2rem 0 1rem;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--accent);
    position: relative;
    z-index: 100;
}

.site-header .logo {
    font-family: var(--font-masthead);
    font-size: 4rem;
    color: var(--accent);
    text-decoration: none;
    display: block;
    margin-bottom: 1rem;
    line-height: 1;
}

.site-header .logo .dot {
    display: none;
}

.main-nav {
    border-top: 1px solid var(--border-line);
    border-bottom: 3px double var(--border-line);
    padding: 0.75rem 0;
    position: relative;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.main-nav a {
    color: var(--text-ink);
    text-decoration: none;
}

.main-nav a:hover {
    color: #555;
    text-decoration: underline;
}

.theme-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-ink);
    font-size: 1.25rem;
    padding: 0.5rem;
    z-index: 100;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-50%) rotate(15deg);
}

.hero {
    text-align: center;
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-line);
    margin-bottom: 3rem;
}

.hero h1 {
    font-family: var(--font-headline);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--accent);
}

.hero p {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 3rem 0;
    font-family: var(--font-ui);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.pagination a {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--border-line);
    color: var(--text-ink);
    transition: 0.2s;
}

.pagination a:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-color: var(--accent);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.post-card {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-line);
}

.post-meta {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.post-meta .category a {
    color: #d00;
    font-weight: 700;
    text-decoration: none;
}

.post-card h3 {
    font-family: var(--font-headline);
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.post-card h3 a {
    color: var(--accent);
    text-decoration: none;
}

.post-card h3 a:hover {
    color: #444;
    text-decoration: none;
}

.post-card p {
    color: var(--text-summary);
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--link-color);
}

.single-post header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-line);
    padding-bottom: 2rem;
}

.single-post h1 {
    font-family: var(--font-headline);
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.single-post .post-meta {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.featured-image {
    max-width: 740px;
    margin: 0 auto 2rem auto;
    border-radius: 12px;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-card-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.post-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-content {
    max-width: 740px;
    margin: 0 auto;
    font-size: 1.2rem;
    border: none;
    padding: 0;
    box-shadow: none;
    background: transparent;
    overflow-wrap: break-word;
    word-break: break-word;
}

.post-content>p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-headline);
    font-size: 4.5rem;
    line-height: 0.8;
    padding-right: 12px;
    padding-top: 4px;
    color: var(--accent);
}

.post-content h2,
.post-content h3 {
    font-family: var(--font-headline);
    color: var(--accent);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content p {
    margin-bottom: 1.5rem;
    color: var(--text-ink);
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5rem auto;
    border-radius: 8px;
}

.post-content pre {
    background: #282C34;
    border-left: 4px solid #61AFEF;
    border-radius: 6px;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ABB2BF;
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
}

.post-content pre code {
    background: transparent;
    color: #ABB2BF;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    font-family: inherit;
}

.post-content code {
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    color: #E06C75;
    background: rgba(40, 44, 52, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    word-break: break-word;
}

[data-theme="dark"] .post-content code {
    background: rgba(97, 175, 239, 0.1);
    color: #E06C75;
}

.post-content .highlight {
    background: #282C34;
    border-left: 4px solid #61AFEF;
    border-radius: 6px;
    margin: 2rem 0;
    overflow-x: auto;
}

.post-content .highlight pre {
    background: transparent;
    border: none;
    margin: 0;
}

.post-content pre .c,
.post-content pre .ch,
.post-content pre .cm,
.post-content pre .cp,
.post-content pre .c1,
.post-content pre .cs,
.post-content pre .cpf,
.highlight .c,
.highlight .ch,
.highlight .cm,
.highlight .cp,
.highlight .c1,
.highlight .cs {
    color: #7F848E;
}

.post-content pre .k,
.post-content pre .kd,
.post-content pre .kn,
.post-content pre .kp,
.post-content pre .kr,
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr {
    color: #C678DD;
}

.post-content pre .kc,
.post-content pre .kt,
.post-content pre .nb,
.post-content pre .nc,
.post-content pre .bp,
.highlight .kc,
.highlight .kt,
.highlight .nb,
.highlight .nc,
.highlight .bp {
    color: #E5C07B;
}

.post-content pre .s,
.post-content pre .s1,
.post-content pre .s2,
.post-content pre .sa,
.post-content pre .sb,
.post-content pre .sc,
.post-content pre .sd,
.post-content pre .se,
.post-content pre .sh,
.post-content pre .si,
.post-content pre .sr,
.post-content pre .ss,
.post-content pre .sx,
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sr,
.highlight .ss,
.highlight .sx {
    color: #98C379;
}

.post-content pre .m,
.post-content pre .mb,
.post-content pre .mf,
.post-content pre .mh,
.post-content pre .mi,
.post-content pre .mo,
.post-content pre .il,
.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il {
    color: #D19A66;
}

.post-content pre .nf,
.post-content pre .nd,
.post-content pre .fm,
.highlight .nf,
.highlight .nd,
.highlight .fm {
    color: #61AFEF;
    font-weight: bold;
}

.post-content pre .o,
.post-content pre .ow,
.highlight .o,
.highlight .ow {
    color: #56B6C2;
}

.post-content pre .n,
.post-content pre .na,
.post-content pre .ni,
.post-content pre .nl,
.post-content pre .nn,
.post-content pre .no,
.post-content pre .nt,
.post-content pre .nv,
.post-content pre .nx,
.post-content pre .ne,
.post-content pre .vc,
.post-content pre .vg,
.post-content pre .vi,
.post-content pre .vm,
.highlight .na,
.highlight .ni,
.highlight .no,
.highlight .nt,
.highlight .nv,
.highlight .ne,
.highlight .vc,
.highlight .vg,
.highlight .vi {
    color: #E06C75;
}

.post-content pre .p,
.post-content pre .w,
.highlight .p,
.highlight .w {
    color: #ABB2BF;
}

.post-content pre .hll,
.highlight .hll {
    background-color: #3E4451;
}

.post-content pre .err,
.highlight .err {
    color: #ABB2BF;
}

.article-footer-meta {
    max-width: 740px;
    margin: 4rem auto 0;
    border-top: 4px solid var(--accent);
    padding-top: 2rem;
}

.article-footer-meta strong {
    color: var(--accent);
}

.accent-text {
    color: var(--link-color);
}

.breadcrumb {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .sep {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb .current {
    color: var(--text-ink);
    font-weight: 600;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}

.tag {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tag:hover {
    background: #000;
    color: #fff;
    border-color: #000;
    text-decoration: none;
}

[data-theme="dark"] .tag {
    background: #2a2a2a;
    color: #ccc;
    border-color: #444;
}

[data-theme="dark"] .tag:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.site-footer {
    margin-top: 5rem;
    border-top: 1px solid var(--accent);
    padding: 3rem 0;
    background: var(--bg-footer);
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Mobile Menu Base Styles */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001; /* Above nav */
}

.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-ink);
    transition: all 0.3s ease-in-out;
    border-radius: 2px;
}

.mobile-menu-toggle.is-active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (max-width:768px) {
    .site-header {
        padding-left: 3.5rem;
        padding-right: 3.5rem;
    }

    .site-header .logo {
        font-size: 2.5rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .single-post h1 {
        font-size: 2.25rem;
    }

    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 2rem;
        left: 1rem;
    }

    .main-nav {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        background: var(--bg-paper);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        padding: 2rem;
        border-top: none;
        border-bottom: none;
        border-right: 1px solid var(--border-line);
    }

    [data-theme="dark"] .main-nav {
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    }

    .main-nav.menu-open {
        transform: translateX(0);
    }

    .main-nav ul {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        width: 100%;
        text-align: center;
        overflow-x: visible;
        white-space: normal;
        padding: 0;
        margin: 0;
    }

    .main-nav ul li a {
        font-size: 1.25rem;
    }

    .theme-toggle {
        position: absolute;
        top: 1rem;
        right: 1rem;
        transform: none;
        margin-left: 0;
    }

    .theme-toggle:hover {
        transform: rotate(15deg);
    }
}

/* ── Related & Latest Articles Cards ──────────────────────── */
.related-posts {
    max-width: 740px;
    margin: 4rem auto 0;
    padding-top: 3rem;
    border-top: 2px solid var(--accent);
}

.related-posts h3 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-posts h3::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-line), transparent);
}

/* 2-column grid on desktop */
.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.related-posts:first-of-type .related-posts__grid {
    grid-template-columns: 1fr; /* Keep Related as single column for focus */
}

/* Modern Card Design */
.related-post-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-paper);
    border: 1px solid var(--border-line);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

[data-theme="dark"] .related-post-card {
    background: var(--bg-footer);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.related-post-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--link-color);
    text-decoration: none;
}

[data-theme="dark"] .related-post-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* Thumbnail with Badge */
.related-post-card__img-wrap {
    flex: 0 0 110px;
    width: 110px;
    position: relative;
    overflow: hidden;
    background: var(--border-line);
}

.related-post-card__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.related-post-card:hover .related-post-card__img-wrap img {
    transform: scale(1.1);
}

.category-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--link-color);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Content Area */
.related-post-card__content {
    flex: 1;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
}

.related-post-card__title {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.related-post-card:hover .related-post-card__title {
    color: var(--link-color);
}

.related-post-card__meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-post-card__meta .dot {
    opacity: 0.5;
}

/* Arrow indicator on hover */
.related-post-card::after {
    content: '→';
    position: absolute;
    right: 1rem;
    bottom: 0.75rem;
    font-size: 1.2rem;
    color: var(--link-color);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.related-post-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 900px) {
    .related-posts__grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .related-post-card {
        min-height: 80px;
    }

    .related-post-card__img-wrap {
        flex: 0 0 80px;
        width: 80px;
    }

    .related-post-card__title {
        font-size: 0.85rem;
    }
}


    .related-post-card__title {
        font-size: 0.78rem;
    }
}