/* Modern Blog Styling */
:root {
    --bg-color: #ffffff;
    --text-color: #24292e;
    --link-color: #0366d6;
    --border-color: #e1e4e8;
    --code-bg: #f6f8fa;
    --callout-note-bg: #ddf4ff;
    --callout-note-border: #54aeff;
    --callout-important-bg: #dfd8fd;
    --callout-important-border: #8250df;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0d1117;
        --text-color: #c9d1d9;
        --link-color: #58a6ff;
        --border-color: #30363d;
        --code-bg: #161b22;
        --callout-note-bg: #1f2937;
        --callout-note-border: #388bfd;
        --callout-important-bg: #271a3f;
        --callout-important-border: #8957e5;
    }

    /* Code block syntax highlighting for dark mode */
    pre[data-lang]::before {
        color: #8b949e;
    }

    img {
        opacity: 0.9;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    font-size: 14px;
    padding: 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 1.4em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

h1 {
    font-size: 1.35em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

h2 {
    font-size: 1.3em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

h3 {
    font-size: 1.20em;
}

h4 {
    font-size: 1em;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    margin-bottom: 1em;
}

/* Code blocks - Pure CSS highlighting */
code {
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 85%;
}

pre {
    background-color: var(--code-bg);
    padding: 16px;
    overflow: auto;
    border-radius: 6px;
    margin-bottom: 1em;
}

pre code {
    background-color: transparent;
    padding: 0;
    font-size: 100%;
    display: block;
}

/* Language-specific styling using data attributes */
pre[data-lang]::before {
    content: attr(data-lang);
    display: block;
    text-align: right;
    font-size: 0.75em;
    color: #6a737d;
    margin-bottom: 0.5em;
}

/* Callout blocks */
.callout {
    padding: 1em;
    margin: 1em 0;
    border-left: 4px solid;
    border-radius: 4px;
}

.callout-note {
    background-color: var(--callout-note-bg);
    border-color: var(--callout-note-border);
}

.callout-important {
    background-color: var(--callout-important-bg);
    border-color: var(--callout-important-border);
}

.callout-title {
    font-weight: 600;
    margin-bottom: 0.5em;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 0.6em 1em;
    text-align: left;
}

th {
    background-color: var(--code-bg);
    font-weight: 600;
}

/* Lists */
ul,
ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

li {
    margin-bottom: 0.25em;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em 0;
}

/* Blockquotes */
blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid var(--border-color);
    margin: 1em 0;
}

/* Index page specific */
.blog-index {
    list-style: none;
    margin-left: 0;
}

.blog-index li {
    margin-bottom: 0.5em;
}

.section-title {
    margin-top: 2em;
}

/* Back to index link */
.nav-link {
    display: inline-block;
    margin-bottom: 1em;
    color: var(--link-color);
}

.nav-link:hover {
    text-decoration: underline;
}

/* Two-column layout for index page */
.index-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.index-sidebar {
    flex: 0 0 400px;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

.index-content {
    flex: 1;
    min-width: 0;
}

/* Responsive: stack on small screens */
@media (max-width: 768px) {
    .index-container {
        flex-direction: column;
    }

    .index-sidebar {
        flex: 1;
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
}