:root {
    /* Color Palette - Dark Theme */
    --bg-color: #0F0F11;
    --text-color: #EEEEEE;
    --text-muted: #A0A0A0;
    --primary-color: #FAFAFA;
    --accent-color: #4DAFFF;
    /* Brillaint Blue */
    --border-color: #2A2A2E;
    --card-bg: #18181B;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --font-serif: "Georgia", "Times New Roman", serif;

    /* Spacing */
    --container-width: 800px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 32px;
    --spacing-xl: 64px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(77, 175, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(130, 80, 255, 0.03) 0%, transparent 40%);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

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

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.site-header {
    background: rgba(24, 24, 27, 0.8);
    /* Semi-transparent card-bg */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.site-nav {
    display: flex;
    gap: var(--spacing-md);
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-color);
}

/* Main Content */
main {
    padding: var(--spacing-xl) 0;
    min-height: 80vh;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

/* Post Grid */
.posts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

.post-image img {
    width: 100%;
    height: 140px;
    /* Reduced from 200px */
    object-fit: cover;
}

.post-content {
    padding: var(--spacing-md);
}

.post-title {
    font-size: 2.0rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
    color:#FFD700;
    font-weight: 800;
}

.post-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: var(--spacing-sm);
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.pagination a {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pagination a:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--card-bg);
}

/* About Page */
.about-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto var(--spacing-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.about-intro {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.about-intro strong {
    color: var(--text-color);
    font-weight: 600;
}

/* Code blocks */
pre[class*="language-"] {
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

code:not([class*="language-"]) {
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Two-column post layout with sidebar */
.single-post.has-sidebar {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: var(--spacing-lg);
    max-width: 1200px;
    margin: 0 auto;
}

.post-main {
    min-width: 0;
    /* Prevent grid blowout */
}

.post-sidebar {
    position: sticky;
    top: var(--spacing-lg);
    height: fit-content;
    padding: var(--spacing-md);
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.post-sidebar img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.post-sidebar h2,
.post-sidebar h3,
.post-sidebar h4 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    font-size: 1.1rem;
}

.post-sidebar p {
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Post Content Typography & Theming */
.post-body {
    font-family: 'Calibri', sans-serif;
    font-size: 18px;
    /* Approx 1.125rem */
}

.post-body p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    margin-top: 0;
}

/* Headings (Dark Theme) */
.post-body h1 {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
}

.post-body h2 {
    font-size: 16px;
    font-weight: bold;
    color: #bbaaee;
}

.post-body h3 {
    font-size: 16px;
    font-weight: bold;
    color: #10AA90;
}

.post-body h4 {
    font-size: 14px;
    font-weight: bold;
    color: #FFA500;
}

.post-body h5 {
    font-size: 14px;
    font-weight: bold;
    color: #FFFFE0;
}

.post-body h6 {
    font-size: 12px;
    font-weight: bold;
    color: #E89C5C;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

/* Inline Styles */
.post-body strong {
    color: #eae086;
}

.post-body em,
.post-body i {
    color: #86ea9f;
}

.post-body code {
    color: #ffff00;
    /* Yellow */
}

/* Blockquotes */
.post-body blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: var(--spacing-md);
    margin: 0 0 var(--spacing-md) 0;
    font-style: italic;
    color: var(--text-muted);
    background: #333;
    /* Darker bg for contrast */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Lists with Emoji Bullets */
.post-body ul,
.post-body ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
    list-style: none;
    /* Remove default bullets */
}

.post-body li {
    margin-bottom: var(--spacing-sm);
    position: relative;
    padding-left: 0.5em;
}

/* 1st Level - ➡️ */
.post-body>ul>li::before {
    content: '➡️ ';
    margin-right: 0.5em;
}

/* 2nd Level - ↪️ */
.post-body>ul>li>ul>li::before {
    content: '↪️ ';
    margin-right: 0.5em;
}

/* 3rd Level - ⤵️ */
.post-body>ul>li>ul>li>ul>li::before {
    content: '⤵️ ';
    margin-right: 0.5em;
}

/* Tables */
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
    background: var(--card-bg);
}

.post-body th,
.post-body td {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    text-align: left;
}

.post-body th {
    background-color: #005b96;
    color: white;
}

.post-body tr:nth-child(odd) {
    background-color: #009688;
    /* Dark teal */
    color: white;
}

.post-body tr:nth-child(even) {
    background-color: #30302e;
}

/* Block-based layout with Tufte-style margin notes */
.single-post.has-margin-notes {
    /* Break out of .container constraint */
    width: calc(100vw - 40px);
    max-width: 1100px;
    margin-left: calc(-1 * (min(1100px, 100vw - 40px) - min(800px, 100vw - 40px)) / 2);
    position: relative;
}

.post-blocks {
    position: relative;
    max-width: 700px;
}

.content-section {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.section-content {
    /* Inherits .post-body styles */
}

/* Margin Notes - Tufte Style */
.margin-note {
    position: absolute;
    left: calc(100% + 40px);
    width: 280px;
    top: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    padding: var(--spacing-sm) var(--spacing-md);
    border-left: 2px solid var(--accent-color);
    background: rgba(24, 24, 27, 0.7);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.margin-note-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: var(--accent-color);
    color: var(--bg-color);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: var(--spacing-sm);
}

.margin-note-content {
    /* Inherits from margin-note */
}

.margin-note-content p {
    margin-bottom: var(--spacing-sm);
    font-size: 0.85rem;
    line-height: 1.5;
}

.margin-note-content p:last-child {
    margin-bottom: 0;
}

/* Posts without margin notes - standard layout */
.single-post:not(.has-margin-notes):not(.has-sidebar) {
    max-width: var(--container-width);
    margin: 0 auto;
}

/* Mobile: stack vertically */
@media (max-width: 900px) {
    .single-post.has-sidebar {
        grid-template-columns: 1fr;
    }

    .post-sidebar {
        position: static;
        margin-top: var(--spacing-lg);
    }
}

/* Mobile: collapse margin notes below content */
@media (max-width: 1100px) {
    .single-post.has-margin-notes {
        width: auto;
        max-width: var(--container-width);
        margin-left: 0;
    }

    .post-blocks {
        max-width: none;
    }

    .margin-note {
        position: static;
        width: 100%;
        margin: var(--spacing-md) 0;
        left: auto;
        border-left: 3px solid var(--accent-color);
        padding: var(--spacing-md);
        background: var(--card-bg);
        border-radius: var(--radius-sm);
    }

    .margin-note-indicator {
        display: inline;
        margin-right: var(--spacing-sm);
    }
}