:root {
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Merriweather', Georgia, serif;

    --bg-color: #d9d9d9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --hover-bg: #f8fafc;
    --tag-bg: #f1f5f9;

    --text-main: #334155;
    --text-heading: #0f172a;
    --text-muted: #64748b;
    --text-meta: #94a3b8;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;

    --bento-radius: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

    --transition: all 0.2s ease-in-out;
}

:root.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --hover-bg: #27354c;
    --tag-bg: #27354c;

    --text-main: #cbd5e1;
    --text-heading: #f8fafc;
    --text-muted: #94a3b8;
    --text-meta: #64748b;

    --accent: #3b82f6;
    --accent-hover: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    line-height: 1.3;
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0 2rem;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.brand-logo img {
    max-height: 48px;
    width: auto;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-menu > li {
    position: relative;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--hover-bg);
    color: var(--accent);
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    min-width: 200px;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1001;
}

.dropdown::-webkit-scrollbar {
    width: 6px;
}

.dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

li:hover > .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li {
    position: relative;
}

.dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: var(--transition);
}

.dropdown a:hover {
    background-color: var(--hover-bg);
    color: var(--accent);
}

.scrollable-menu {
    max-height: 400px;
    overflow-y: auto;
}

.scrollable-menu::-webkit-scrollbar {
    width: 4px;
}

.scrollable-menu::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.has-children > a::after {
    content: "▾";
    font-size: 0.7rem;
    margin-left: 6px;
}

.dropdown .has-children > a::after {
    content: "▸";
    float: right;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
    color: var(--accent);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sun-icon { display: none; }
:root.dark-mode .sun-icon { display: block; }
:root.dark-mode .moon-icon { display: none; }

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: var(--transition);
}

.layout-wrapper {
    max-width: 1300px;
    margin: 110px auto 4rem;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.bento-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bento-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.post-card.featured {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
}

.post-image {
    width: 100%;
    height: 220px;
    background-color: var(--hover-bg);
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 1.25rem;
}

.post-card.featured .post-image {
    width: 50%;
    height: 320px;
    margin-bottom: 0;
}

.post-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.post-title {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.post-card.featured .post-title {
    font-size: 1.75rem;
}

.post-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.post-meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-meta);
    gap: 0.75rem;
    margin-top: auto;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    grid-column: 1 / -1;
}

.page-info {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0.5rem;
}

.page-link {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover {
    background-color: var(--hover-bg);
    color: var(--accent);
}

.page-link-disabled {
    opacity: 0.4;
    cursor: default;
}

.page-link.active {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-heading);
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
    width: 100%;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-2px);
}

.tag.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.archive-list li {
    margin-bottom: 0.4rem;
}

.archive-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.archive-list a:hover {
    background-color: var(--hover-bg);
    color: var(--accent);
}

.archive-count {
    background: var(--tag-bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ad-block {
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--bento-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    box-shadow: none;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-icon {
    width: 42px;
    height: 42px;
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-main);
}

.social-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.social-icon:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Content Area (Post Page) */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Single Post & Article Body */
.single-post-header {
    margin-bottom: 2rem;
}

.single-post-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

.single-post-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2.5rem;
    background-color: var(--border-color);
}

.single-post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: var(--text-meta);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.author-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--border-color);
}

.article-body {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-main);
    overflow: hidden;
    min-width: 0;
}

.article-body p { margin-bottom: 1.5rem; }

.article-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.article-body h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem;
    color: var(--text-heading);
}

.article-body h3 {
    font-size: 1.35rem;
    margin: 2rem 0 1rem;
    color: var(--text-heading);
}

.article-body a {
    color: var(--text-main);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--border-color);
    transition: var(--transition);
}

.article-body a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
}

.article-body blockquote {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.25rem;
    border-left: 4px solid var(--accent);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-muted);
}

.article-body ul, .article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-body li { margin-bottom: 0.5rem; }

.article-body pre {
    position: relative;
    margin: 2rem 0;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 3rem 1.25rem 1.25rem;
    overflow-x: auto;
}

.article-body pre::before {
    content: '';
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

.article-body pre code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    display: block;
    color: #e6edf3;
    background: none;
    padding: 0;
    border: none;
}

.article-body code {
    font-family: 'Fira Code', 'Courier New', monospace;
    background-color: var(--hover-bg);
    color: var(--accent);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.terminal-copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
}

.terminal-copy-btn:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.terminal-copy-btn:active {
    transform: scale(0.95);
}

/* Author Box */
.author-box {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.author-box-avatar-wrap {
    flex-shrink: 0;
}

.author-box-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.author-box-avatar-initial {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--hover-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
    font-family: var(--font-heading);
}

.author-box-content {
    flex: 1;
}

.author-box-content h3 {
    font-family: var(--font-body);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.author-box-bio {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.author-socials {
    display: flex;
    gap: 0.75rem;
}

.social-icon-small {
    width: 32px;
    height: 32px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.social-icon-small svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.social-icon-small:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Tag Header */
.tag-header {
    text-align: center;
    padding: 3.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.tag-meta-info {
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.tag-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-header h1::before {
    content: '#';
    color: var(--border-color);
}

:root.dark-mode .tag-header h1::before {
    color: var(--text-muted);
}

.tag-description {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.7;
}

/* Author Profile */
.author-profile {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.author-profile-avatar-wrap {
    flex-shrink: 0;
}

.author-profile-avatar-initial {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--hover-bg);
    border: 4px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
    font-family: var(--font-heading);
}

.author-profile-content {
    flex: 1;
}

.author-profile-content h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.author-meta-info {
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.25rem;
    display: block;
}

.author-profile-bio {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.author-profile-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-heading {
    font-size: 1.5rem;
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Related Posts */
.related-posts-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.related-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.related-img {
    width: 100%;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    background-color: var(--border-color);
    transition: var(--transition);
}

.related-card:hover .related-img { opacity: 0.8; }

.related-card-title {
    font-size: 1.1rem;
    font-family: var(--font-body);
    line-height: 1.4;
}

/* Comments Section */
.comments-section { min-height: 200px; }

.comments-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    background: var(--hover-bg);
}

.site-footer {
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 2rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-footer a {
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
}

.site-footer a:hover {
    color: var(--accent);
}

@media (max-width: 1024px) {
    .layout-wrapper {
        grid-template-columns: 1fr;
    }
    .post-card.featured {
        flex-direction: column;
    }
    .post-card.featured .post-image {
        width: 100%;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 0 1.25rem;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        position: absolute;
        top: 72px;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
        padding: 1rem;
        display: none;
    }

    .main-nav.active {
        display: block;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.25rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }

    .dropdown, .dropdown .dropdown {
        position: static;
        box-shadow: none;
        border: none;
        opacity: 1;
        visibility: visible;
        display: none;
        transform: none;
        padding: 0.25rem 0 0.25rem 1.5rem;
        background: transparent;
    }

    .dropdown.mobile-open {
        display: block;
    }

    .has-children > a::after {
        content: "+";
        margin-left: auto;
    }

    .layout-wrapper {
        padding: 0 1.25rem;
        gap: 1.5rem;
        margin-top: 100px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}
