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

:root {
    /* PNW Color Palette */
    --deep-forest-green: #3A653A;
    --slate-blue: #37647A;
    --muted-gray: #84947C;
    --earthy-brown: #B6864B;
    --soft-sky-blue: #8DBDBF;
    --mossy-green: #92B070;
    
    /* Light mode colors */
    --primary-color: var(--deep-forest-green);
    --primary-hover: var(--earthy-brown);
    --text-primary: #2d3e2d;
    --text-secondary: var(--muted-gray);
    --bg-primary: #ffffff;
    --bg-secondary: #f0f7f7;
    --border-color: #c4d4d4;
    --accent-color: var(--mossy-green);
    --shadow: 0 1px 3px 0 rgba(58, 101, 58, 0.1), 0 1px 2px 0 rgba(58, 101, 58, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(58, 101, 58, 0.15), 0 4px 6px -2px rgba(58, 101, 58, 0.1);
}

/* Dark mode */
[data-theme="dark"] {
    /* Dark mode PNW-inspired colors */
    --primary-color: #92B070;
    --primary-hover: #B6864B;
    --text-primary: #f5f5f5;
    --text-secondary: #d0d0d0;
    --bg-primary: #1a241a;
    --bg-secondary: #0f1610;
    --border-color: #2d3e2d;
    --accent-color: var(--soft-sky-blue);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    background-image: linear-gradient(to bottom, #f8fbfb 0%, var(--bg-secondary) 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--slate-blue) 0%, var(--deep-forest-green) 100%);
    color: white;
    padding: 3rem 0;
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .header {
    background: linear-gradient(135deg, #1a2d3a 0%, #1a2d1a 100%);
}

.header .container {
    text-align: center;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dark-mode-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

[data-theme="dark"] .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 300;
    margin-bottom: 2rem;
}

/* Navigation Styles */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    display: inline-block;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background-color: white;
    border-radius: 2px;
}

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

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow);
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.page-content h2 {
    font-size: 1.875rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.page-content .intro-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.page-content ul {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.page-content li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* About Page Styles */
.about-intro {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.about-text {
    flex: 1;
}

.about-image-container {
    flex-shrink: 0;
    width: 250px;
}

.about-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    object-fit: cover;
}

.contact-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--deep-forest-green);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.contact-link:hover {
    background-color: var(--slate-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Blog Posts Grid */
.blog-posts {
    display: grid;
    gap: 2rem;
}

.post-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

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

.post-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.post-card h2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card h2 a:hover {
    color: var(--primary-color);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.post-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag.ml { background-color: #e8f4e8; color: var(--deep-forest-green); }
.tag.ai { background-color: #e0eef0; color: var(--slate-blue); }
.tag.deep-learning { background-color: #f0f7e8; color: var(--mossy-green); }
.tag.research { background-color: #f5ead4; color: var(--earthy-brown); }
.tag.f1 { background-color: #fee2e2; color: #991b1b; }

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
    gap: 0.5rem;
}

.read-more:hover {
    color: var(--primary-hover);
}

.read-more::after {
    content: '→';
    transition: transform 0.2s ease;
}

.read-more:hover::after {
    transform: translateX(4px);
}

/* Post Page Styles */
.post-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.post-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.post-content h2 {
    font-size: 1.875rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.post-content h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

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

.post-content ul, .post-content ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

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

.post-content code {
    background-color: #e8f4e8;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: var(--deep-forest-green);
}

[data-theme="dark"] .post-content code {
    background-color: #2d3e2d;
    color: var(--mossy-green);
}

.post-content pre {
    background-color: #2d3e2d;
    color: #f0f7f7;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--mossy-green);
}

[data-theme="dark"] .post-content pre {
    background-color: #0a150a;
    border-left-color: var(--soft-sky-blue);
}

.post-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

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

/* KaTeX: allow long equations to scroll instead of overflowing */
.post-content .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 2rem;
    font-weight: 500;
    transition: color 0.2s ease;
    gap: 0.5rem;
}

.back-link:hover {
    color: var(--primary-hover);
}

[data-theme="dark"] .back-link {
    color: var(--slate-blue);
}

[data-theme="dark"] .back-link:hover {
    color: var(--deep-forest-green);
}

.back-link::before {
    content: '←';
}

/* Footer */
.footer {
    background: linear-gradient(to top, var(--bg-primary) 0%, #fafcfc 100%);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--muted-gray);
    font-size: 0.875rem;
}

[data-theme="dark"] .footer {
    background: #0a0a0a;
    color: var(--text-secondary);
    border-top-color: var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .main-nav {
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 2rem 0;
    }

    .post-card {
        padding: 1.5rem;
    }

    .post-card h2 {
        font-size: 1.5rem;
    }

    .post-content {
        padding: 2rem 1.5rem;
    }

    .post-content h1 {
        font-size: 2rem;
    }

    .page-content {
        padding: 2rem 1.5rem;
    }

    .page-content h1 {
        font-size: 2rem;
    }

    .about-intro {
        flex-direction: column;
    }

    .about-image-container {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .header-top {
        margin-bottom: 0.5rem;
    }

    .dark-mode-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

