/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-secondary: #666666;
    --accent-color: #047bc2;
    --border-color: #eeeeee;
    --code-bg: #f5f5f5;
    --link-color: #047bc2;
}

/* Dark theme - manual toggle */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-color: #5eb8e8;
    --border-color: #333333;
    --code-bg: #2a2a2a;
    --link-color: #5eb8e8;
}

/* Dark theme - automatic (only when no manual preference set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --text-secondary: #a0a0a0;
        --accent-color: #5eb8e8;
        --border-color: #333333;
        --code-bg: #2a2a2a;
        --link-color: #5eb8e8;
    }
}

body {
    font-family:
        "Roboto",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    max-width: 45rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header and Navigation */
.site-header {
    padding: 2rem 0 1.5rem 0;
    border-bottom: none;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 400;
}

.nav-brand a {
    text-decoration: none;
    color: var(--text-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    font-size: 1.1rem;
}

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

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

/* Show sun icon in dark mode (manual toggle) */
[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

/* Show sun icon in dark mode (automatic) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .sun-icon {
        display: block;
    }

    :root:not([data-theme]) .theme-toggle .moon-icon {
        display: none;
    }
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 1.8rem;
    margin-top: 0;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

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

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding-top: 1rem;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family:
        "Roboto",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 0.8rem;
}

h2 {
    font-size: 1.6rem;
}

h3 {
    font-size: 1.3rem;
}

h4 {
    font-size: 1.1rem;
}

p {
    margin-bottom: 1.2rem;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

a:hover {
    opacity: 0.8;
}

/* Lists */
ul,
ol {
    margin-left: 1.5rem;
    margin-bottom: 1.2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Code */
code {
    background-color: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.85em;
}

pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    font-style: italic;
    color: var(--text-secondary);
}

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

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

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

th {
    font-weight: bold;
}

/* Footer */
.site-footer {
    padding: 1.5rem 0;
    margin-top: 4rem;
    border-top: none;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        margin-top: 1rem;
    }

    body {
        font-size: 16px;
        padding: 0 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.4rem;
    }
}

/* Article List Styles */
.article-list {
    list-style: none;
    margin-left: 0;
}

.article-list li {
    margin-bottom: 2.5rem;
}

/* Page Header Styles */
.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
    font-style: italic;
}

/* Tags Section */
.tags-section {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: none;
}

.tags-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.tags-label {
    font-weight: 600;
    color: var(--text-color);
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.tags {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tag {
    display: inline-block;
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
