/*
 * Minimal blog theme inspired by bearblog.dev & herman.bearblog.dev
 * Clean programmer aesthetic with monospace font
 */

@import url('https://cdn.jsdelivr.net/npm/hack-font@3/build/web/hack.css');

:root {
    --text: #2d2d2d;
    --text-secondary: #6b6560;
    --bg: #F4F5ED;
    --bg-alt: #f0efed;
    --accent: #3273dc;
    --border: #e0dfdd;
    --code-bg: #f0efed;
    --font-mono: 'Hack', 'SF Mono', Consolas, monospace;
}

/* Dark mode - system preference fallback */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --text: #d4d4d4;
        --text-secondary: #a09890;
        --bg: #111118;
        --bg-alt: #1a1b26;
        --accent: #7aa2f7;
        --border: #2a2b3d;
        --code-bg: #1a1b26;
    }
}

/* Explicit dark mode */
:root[data-theme="dark"] {
    --text: #d4d4d4;
    --text-secondary: #a09890;
    --bg: #111118;
    --bg-alt: #1a1b26;
    --accent: #7aa2f7;
    --border: #2a2b3d;
    --code-bg: #1a1b26;
}

/* Explicit light mode */
:root[data-theme="light"] {
    --text: #2d2d2d;
    --text-secondary: #6b6560;
    --bg: #F4F5ED;
    --bg-alt: #f0efed;
    --accent: #3273dc;
    --border: #e0dfdd;
    --code-bg: #f0efed;
}

* {
    box-sizing: border-box;
}

html {
    font-family: var(--font-mono);
    font-size: 20px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: var(--bg);
    color: var(--text);
}

/* Header & Navigation */
header {
    margin-bottom: 3rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.site-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.02em;
}

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

.site-logo {
    height: 36px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

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

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 0;
    transition: color 0.15s;
}

#theme-toggle:hover {
    color: var(--accent);
}

/* Main Content */
main {
    min-height: calc(100vh - 280px);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.4;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p {
    margin: 1.25rem 0;
}

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

a:hover {
    text-decoration: underline;
}

strong {
    font-weight: 600;
}

/* Lists */
ul, ol {
    padding-left: 1.5rem;
    margin: 1.25rem 0;
}

li {
    margin: 0.5rem 0;
}

li::marker {
    color: var(--text-secondary);
}

/* Blockquotes */
blockquote {
    border-left: 2px solid var(--accent);
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    color: var(--text-secondary);
}

blockquote p {
    margin: 0;
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

pre {
    background: var(--code-bg);
    padding: 1.25rem;
    overflow-x: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Post List - Herman style with date on right */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
    border-bottom: none;
}

.post-list a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}

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

.post-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.post-description {
    display: none; /* Keep it minimal like Herman's */
}

/* Post Header */
.post-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.post-header h1 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.post-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tags */
.tags {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.tags a {
    display: inline-block;
    margin-right: 0.75rem;
    color: var(--text-secondary);
}

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

/* Tag List */
.tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.tag-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.tag-list li:last-child {
    border-bottom: none;
}

.tag-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

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

.tag-list .tag-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Page Title */
.page-title {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Intro/Bio section */
.intro {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.intro p {
    margin: 0;
    color: var(--text-secondary);
}

/* Section headers */
.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

th, td {
    padding: 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

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

/* Selection */
::selection {
    background: var(--accent);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    html {
        font-size: 18px;
    }

    body {
        padding: 1.5rem 1rem;
    }

    .post-list li {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }

    .post-date {
        font-size: 0.8rem;
    }
}
