/* === CSS Variables & Theme === */
:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 720px;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-header: #12121f;
    --text: #e4e4ed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #2d2d44;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-light: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background var(--transition), color var(--transition);
}

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

img { max-width: 100%; height: auto; }

::selection { background: var(--accent); color: #fff; }

/* === Container === */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Header === */
header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    max-width: 960px;
}

.brand-link { text-decoration: none; color: inherit; }

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.site-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--text);
    background: var(--accent-light);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

/* === Theme Toggle === */
.theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    width: 36px;
    height: 36px;
}

.theme-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--accent-light);
}

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

/* === Hero Section === */
.hero {
    padding: 5rem 0 3rem;
    text-align: center;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text);
}

.hero-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    background: var(--accent-light);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

/* === Section Titles === */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.page-section {
    padding: 3rem 0;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.page-desc {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.section-footer {
    text-align: center;
    margin-top: 2rem;
}

/* === Post Cards === */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.post-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.post-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0.5rem 0 0.75rem;
    line-height: 1.4;
}

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

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

.post-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.post-read-more {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* === Single Post === */
.post-single {
    padding: 3rem 0;
}

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

.post-title-single {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.3;
    margin-top: 0.5rem;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
}

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

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    letter-spacing: -0.3px;
}

.post-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

.post-content ul, .post-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

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

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--accent-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

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

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

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content a { text-decoration: underline; }

.post-nav {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* === About Page === */
.about-content {
    max-width: 650px;
}

.about-content p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

/* === Labs Page === */
.labs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.lab-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.lab-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.lab-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

/* === Footer === */
footer {
    margin-top: auto;
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    transition: background var(--transition), border-color var(--transition);
}

.footer-inner {
    text-align: center;
}

.footer-inner p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-tagline {
    margin-top: 0.25rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .main-nav {
        gap: 0;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 0.35rem 0.6rem;
    }

    .hero { padding: 3rem 0 2rem; }
    .hero-title { font-size: 1.75rem; }
    .hero-text { font-size: 1rem; }

    .post-title-single { font-size: 1.6rem; }
    .post-card { padding: 1.25rem; }
    .post-title { font-size: 1.15rem; }

    .labs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.5rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .btn { width: 100%; justify-content: center; }
}
