/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --color-bg: #f5f5f5;
    --color-bg-alt: #ffffff;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-accent: #2c5282;
    --color-accent-hover: #1a365d;
    --color-border: #e2e2e2;
    --color-code-bg: #f8f8f8;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

    --max-width: 750px;
    --spacing: 1.5rem;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

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

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

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

.site-nav a {
    color: var(--color-text-light);
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.95rem;
    transition: color 0.2s;
}

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

/* ==========================================================================
   Main Content
   ========================================================================== */
.site-content {
    flex: 1;
    padding: 3rem 0;
}

/* ==========================================================================
   Post List (Index)
   ========================================================================== */
.post-list {
    list-style: none;
}

.post-list-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

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

.post-list-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

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

.post-list-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

.post-list-excerpt {
    color: var(--color-text-light);
}

/* ==========================================================================
   Post & Page
   ========================================================================== */
.post-header,
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.post-title,
.page-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

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

.post-categories {
    margin-left: 1rem;
}

.category {
    background: var(--color-accent);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.post-content,
.page-content {
    line-height: 1.8;
}

.post-content h2,
.page-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.post-content h3,
.page-content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.post-content p,
.page-content p {
    margin-bottom: 1.25rem;
}

.post-content a,
.page-content a {
    color: var(--color-accent);
    text-decoration: underline;
}

.post-content a:hover,
.page-content a:hover {
    color: var(--color-accent-hover);
}

/* ==========================================================================
   Images
   ========================================================================== */
.post-content img,
.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-content figure {
    margin: 2rem 0;
}

.post-content figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
}

/* ==========================================================================
   Code
   ========================================================================== */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

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

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

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

/* ==========================================================================
   Lists
   ========================================================================== */
.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.post-content li,
.page-content li {
    margin-bottom: 0.5rem;
}

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

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

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

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
}

.site-footer p {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.social-links {
    margin-top: 0.75rem;
}

.social-links a {
    color: var(--color-accent);
    text-decoration: none;
    margin: 0 0.5rem;
}

.social-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Back Link
   ========================================================================== */
.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.back-link {
    color: var(--color-accent);
    text-decoration: none;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .site-header .container {
        flex-direction: column;
        text-align: center;
    }

    .site-nav {
        margin-top: 0.75rem;
    }

    .site-nav a {
        margin: 0 0.75rem;
    }

    .post-title,
    .page-title {
        font-size: 1.5rem;
    }
}
