/* === Base Reset & Variables === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #666666;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #e5e5e5;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
    --max-width: 720px;
    --spacing: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0a0a0a;
        --color-surface: #141414;
        --color-text: #ededed;
        --color-text-muted: #a0a0a0;
        --color-primary: #60a5fa;
        --color-primary-hover: #93c5fd;
        --color-border: #2a2a2a;
    }
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Navigation === */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.nav-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-text);
    text-decoration: none;
}

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

.nav-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* === Main Content === */
.main {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing);
    width: 100%;
}

/* === Footer === */
.footer {
    padding: var(--spacing);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    text-decoration: underline;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 0.125em 0.375em;
    border-radius: 4px;
}

pre {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background: none;
    border: none;
    padding: 0;
}

blockquote {
    border-left: 3px solid var(--color-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--color-text-muted);
    font-style: italic;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* === Home Page === */
.intro {
    margin-bottom: 3rem;
}

.intro h1 {
    margin-top: 0;
}

.articles-section h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.article-preview {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.article-preview:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.article-preview a {
    display: block;
    padding: 1.25rem;
    color: inherit;
    text-decoration: none;
}

.article-preview h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: var(--color-text);
}

.article-preview time {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.article-preview p {
    margin: 0.5rem 0 0 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

/* === Article Page === */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
    margin: 0 0 0.5rem 0;
}

.article-header time {
    color: var(--color-text-muted);
}

.article-content {
    line-height: 1.75;
}

.article-content h2:first-child,
.article-content h3:first-child {
    margin-top: 0;
}

/* === CV Page === */
.cv-container {
    max-width: 800px;
}

.cv-actions {
    margin-bottom: 2rem;
}

.print-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.print-btn:hover {
    background: var(--color-primary-hover);
}

.cv-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2rem;
}

.cv-content h1 {
    margin-top: 0;
    font-size: 1.75rem;
}

.cv-content h2 {
    font-size: 1.25rem;
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.cv-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.cv-content ul {
    list-style: disc;
}

/* === Print Styles === */
@media print {
    :root {
        --color-bg: white;
        --color-surface: white;
        --color-text: black;
        --color-text-muted: #333;
        --color-primary: #000;
        --color-border: #ccc;
    }

    body {
        font-size: 11pt;
        line-height: 1.4;
    }

    .nav,
    .footer,
    .no-print {
        display: none !important;
    }

    .main {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .cv-container {
        max-width: 100%;
    }

    .cv-content {
        border: none;
        padding: 0;
        background: none;
    }

    .cv-content h1 {
        font-size: 18pt;
    }

    .cv-content h2 {
        font-size: 14pt;
        margin-top: 1rem;
        page-break-after: avoid;
    }

    .cv-content h3 {
        font-size: 12pt;
        page-break-after: avoid;
    }

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

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    ul, p {
        page-break-inside: avoid;
    }
}

/* === Responsive === */
@media (max-width: 600px) {
    :root {
        --spacing: 1rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .cv-content {
        padding: 1.25rem;
    }
}
