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

:root {
    --bg: #f4f0e8;
    --surface: #f8f4ec;
    --card: #fffdf8;
    --text: #171717;
    --muted: #6d6257;
    --line: #d9d0c3;
    --accent: #9f1f1f;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 0.92rem;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 28px 36px;
    background: rgba(248, 244, 236, 0.96);
    border-bottom: 1px solid rgba(23, 23, 23, 0.06);
    backdrop-filter: blur(10px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    min-width: 0;
}

.brand-mark {
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    flex: 0 0 auto;
}

.brand-ring {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 4px solid #111;
    border-right-color: #d9d9d9;
    border-bottom-color: #d9d9d9;
    transform: rotate(-22deg);
    display: inline-block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px 34px;
    flex-wrap: wrap;
}

.nav-links a,
.dropdown-btn {
    color: var(--text);
    text-decoration: none;
    font-family: "Merriweather", serif;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-links a:hover,
.dropdown-btn:hover {
    color: var(--accent);
}

.dropdown {
    position: relative;
}

.dropdown-btn {
    background: var(--card);
    border: 1px solid rgba(23, 23, 23, 0.08);
    cursor: pointer;
    font-family: inherit;
    padding: 10px 16px;
    border-radius: 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 260px;
    padding: 10px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}

.dropdown-content a {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 0 0 auto;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-chip {
    min-width: 300px;
    padding: 16px 20px;
    background: #68676e;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b88d54, #3757a6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.profile-name {
    font-family: "Merriweather", serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.hero {
    max-width: 1500px;
    margin: 0 auto;
    padding: 44px 36px 20px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero h1 {
    font-family: "Merriweather", serif;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    line-height: 1.05;
    max-width: 900px;
}

.hero-copy {
    max-width: 760px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 1rem;
}

.tags {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 36px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tags span {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.8);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.posts {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 36px 60px;
}

.about-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 44px 36px 60px;
}

.about-hero {
    max-width: 900px;
    margin-bottom: 36px;
}

.about-hero h1 {
    font-family: "Merriweather", serif;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    line-height: 1.08;
}

.about-lead {
    max-width: 760px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 1.05rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.about-card,
.about-links {
    background: rgba(255, 253, 248, 0.82);
    border: 1px solid var(--line);
    padding: 24px;
}

.about-card h2,
.about-links h2 {
    font-family: "Merriweather", serif;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

.about-card p,
.about-links p {
    color: #2f2a25;
    line-height: 1.75;
}

.about-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.about-link-list a {
    padding: 10px 14px;
    border: 1px solid var(--line);
    text-decoration: none;
    color: var(--text);
    font-family: "Merriweather", serif;
    font-size: 0.95rem;
    font-weight: 700;
    background: var(--card);
}

.post-section {
    margin-top: 24px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 26px;
}

.section-heading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
}

.section-heading h2 {
    font-family: "Merriweather", serif;
    font-size: 1.7rem;
    line-height: 1.2;
}

.section-heading p {
    max-width: 520px;
    color: var(--muted);
    font-size: 0.95rem;
}

.post-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card {
    height: 100%;
    padding-left: 24px;
    border-left: 1px solid var(--line);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    margin-bottom: 18px;
    background: var(--surface);
}

.card-content h3 {
    font-family: "Merriweather", serif;
    font-size: 1.5rem;
    /* font-size: clamp(1.1rem, 1.8vw, 2rem); */
    line-height: 1.24;
    margin-bottom: 12px;
}

.card-content p {
    color: #2f2a25;
    font-size: 1rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-date {
    display: inline-block;
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.92rem;
}

.site-footer {
    padding: 32px 20px 48px;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid rgba(23, 23, 23, 0.08);
}

.home-footer {
    max-width: 1500px;
    margin: 32px auto 0;
    padding: 18px 36px 28px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
}

.home-footer .brand-mark {
    justify-self: start;
}

.home-footer-link,
.home-footer-credit,
.home-footer-credit a {
    font-family: "Merriweather", serif;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.home-footer-link {
    justify-self: center;
}

.home-footer-credit {
    justify-self: end;
}

.post-navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.post-navigation a {
    padding: 10px 20px;
    border-radius: 8px;
    background: #2196f3;
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

@media (max-width: 1200px) {
    .post-section {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {

    .navbar,
    .hero,
    .tags,
    .posts,
    .about-page {
        padding-left: 20px;
        padding-right: 20px;
    }

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

    .nav-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .profile-chip {
        min-width: 0;
    }

    .post-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .card {
        padding-left: 18px;
    }

    .home-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .nav-links {
        gap: 12px 18px;
    }

    .nav-links a,
    .dropdown-btn,
    .profile-name {
        font-size: 0.9rem;
    }

    .nav-right {
        gap: 12px;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
        font-size: 1.25rem;
    }

    .profile-chip {
        width: 100%;
        justify-content: flex-start;
        padding: 14px 16px;
    }

    .home-footer {
        grid-template-columns: 1fr;
        gap: 14px;
        justify-items: start;
    }

    .home-footer-link,
    .home-footer-credit {
        justify-self: start;
    }

    .hero {
        padding-top: 28px;
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .post-section {
        grid-template-columns: 1fr;
    }

    .card {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--line);
        padding-top: 18px;
    }

    .card img {
        margin-bottom: 14px;
    }
}
/* =========================================
   NEW FEATURES (Dark Mode, Progress, Scroll)
   ========================================= */

/* Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent, #0056b3);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Scroll to Top Button */
#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

#scroll-to-top:hover {
    background-color: var(--accent);
    color: white;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg: #121212;
    --card: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #333333;
    --accent: #66b2ff;
}

body.dark-mode .post-content h2,
body.dark-mode .post-content h3 {
    color: #ffffff;
}

body.dark-mode .navbar {
    background: rgba(30, 30, 30, 0.85);
}

body.dark-mode .card {
    background: var(--card);
    border-color: var(--border);
}

body.dark-mode .card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .article-toc .active {
    color: var(--accent);
    background: rgba(102, 178, 255, 0.1);
    border-color: var(--accent);
}

body.dark-mode .dropdown-btn, 
body.dark-mode .dropdown-content {
    background: var(--card);
    border-color: var(--border);
}

body.dark-mode .dropdown-content a:hover {
    background-color: #2a2a2a;
}

/* Search & Filter */
.search-filter-container {
    max-width: 1200px;
    margin: 0 auto 40px auto;
    padding: 0 5vw;
}

#search-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: var(--accent);
}

.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tag-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.tag-btn.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

body.dark-mode .tag-btn.active {
    background: var(--accent);
    color: #121212;
    border-color: var(--accent);
}

/* Fixes for text colors in Dark Mode */
body.dark-mode {
    --muted: #a0a0a0;
    --line: #333333;
}

body.dark-mode .card-content p,
body.dark-mode .section-heading p {
    color: #b0b0b0;
}

body.dark-mode .card-content h3 {
    color: #e0e0e0;
}

body.dark-mode .section-heading h2 {
    color: #ffffff;
}

body.dark-mode .post-date {
    color: #888888;
}

body.dark-mode .search-filter-container input {
    color: #e0e0e0;
}
body.dark-mode .search-filter-container input::placeholder {
    color: #888888;
}
