* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a1a;
    background: #ffffff;
}

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

/* Header */
.header {
    padding: 2rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: #1a1a1a;
}

/* Main Content */
.main {
    padding: 4rem 0;
}

.hero {
    margin-bottom: 4rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.125rem;
    color: #666;
    line-height: 1.7;
    max-width: 700px;
}

/* Posts Grid */
.posts {
    display: grid;
    gap: 3rem;
}

.post-card {
    display: block;
}

.post-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-image {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.post-excerpt {
    font-size: 1rem;
    line-height: 1.7;
    color: #666;
}

.post-card a:hover .post-title {
    color: #0066cc;
}

/* Footer */
.footer {
    padding: 3rem 0;
    border-top: 1px solid #e5e5e5;
    margin-top: 6rem;
}

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.back-to-top {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #0066cc;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s;
}

.back-to-top:hover {
    background: #0052a3;
    color: #ffffff;
}

.footer p {
    color: #999;
    font-size: 0.9rem;
}

/* Page Title */
.page-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Single Post */
.container-narrow {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 2rem;
}

.post-header {
    margin-bottom: 2rem;
}

.post-title-full {
    font-size: 2.75rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.post-meta {
    color: #999;
    font-size: 0.95rem;
}

.post-featured-image {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    margin-bottom: 3rem;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

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

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

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

.post-content blockquote {
    border-left: 3px solid #1a1a1a;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #666;
}

.back-link {
    display: inline-block;
    margin-top: 3rem;
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

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

/* Content Pages */
.content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.content p {
    margin-bottom: 1.5rem;
}

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

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

.content hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 3rem 0;
}

/* Section Headers */
.content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 6rem;
    margin-bottom: 3.5rem;
    padding-top: 3.5rem;
    border-top: 2px solid #1a1a1a;
}

.content h1:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-bottom: 3.5rem;
}

.content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
}

.content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Sticky Table of Contents */
.toc {
    position: fixed;
    left: 2rem;
    top: 8rem;
    width: 200px;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    padding: 1rem;
    background: #ffffff;
    border-right: 1px solid #e5e5e5;
}

.toc h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #666;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.75rem;
    padding-left: 0;
}

.toc li:before {
    content: none;
}

.toc a {
    color: #333;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    transition: color 0.2s;
}

.toc a:hover {
    color: #0066cc;
    text-decoration: none;
}

/* Adjust container for sticky TOC - center the content */
.container-narrow {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 0 280px;
}

/* Add offset for anchor targets */
h1[id], h2[id] {
    scroll-margin-top: 2rem;
}

/* Projects */
.projects {
    display: grid;
    gap: 3rem;
}

.project {
    padding-bottom: 3rem;
    border-bottom: 1px solid #e5e5e5;
}

.project:last-child {
    border-bottom: none;
}

.project h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.project p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #666;
    margin-bottom: 1rem;
}

.project a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

.project a:hover {
    text-decoration: underline;
}

/* Contact Info */
.contact-info {
    margin-top: 2rem;
}

.contact-info p {
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .nav-wrapper {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .nav {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 0.9rem;
    }
    
    .nav a {
        font-size: 0.9rem;
    }
    
    .main {
        padding: 2rem 0;
    }
    
    .hero {
        margin-bottom: 2rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .post-title-full {
        font-size: 2rem;
    }
    
    .post-content h2 {
        font-size: 1.75rem;
    }
    
    .container,
    .container-narrow {
        padding: 0 1.5rem;
        margin-left: auto;
    }
    
    .toc {
        position: static;
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        margin-bottom: 2rem;
        background: #f8f9fa;
        padding: 1.5rem;
        border-radius: 4px;
    }
    
    .toc h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .toc li {
        margin-bottom: 1rem;
        padding-left: 1.5rem;
        position: relative;
    }
    
    .toc li:before {
        content: "→";
        position: absolute;
        left: 0;
        color: #666;
    }
    
    .toc a {
        font-size: 1rem;
        color: #0066cc;
        font-weight: 500;
    }
    
    .content h1 {
        font-size: 2rem;
        margin-top: 4rem;
        margin-bottom: 2.5rem;
        padding-top: 2.5rem;
    }
    
    .content h2 {
        font-size: 1.5rem;
        margin-top: 2.5rem;
        margin-bottom: 1.25rem;
    }
    
    .content h3 {
        font-size: 1.125rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .footer {
        padding: 2rem 0;
        margin-top: 3rem;
    }
}

/* Running Knowledge specific styles */
.content h3 {
    background: #f8f9fa;
    padding: 0.75rem 1.25rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #333;
    font-size: 1.25rem;
}

.content h3:first-of-type {
    margin-top: 1rem;
}

/* Different colors for Problem/Solution/Implementation */
.content h3:nth-of-type(3n+1) {
    border-left-color: #e74c3c; /* Problem - red */
    background: #fef5f5;
}

.content h3:nth-of-type(3n+2) {
    border-left-color: #3498db; /* Solution - blue */
    background: #f0f8ff;
}

.content h3:nth-of-type(3n) {
    border-left-color: #95a5a6; /* Implementation - gray */
    background: #f5f5f5;
}

/* Add breathing room to paragraphs under h3 */
.content h3 + p {
    margin-left: 1.5rem;
    margin-bottom: 2rem;
}

/* Space out major topic sections */
.content h2 {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e5e5;
}

.content h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

/* Better list formatting under implementation sections */
.content ul {
    margin-left: 1.5rem;
    margin-bottom: 2rem;
}

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

/* Code blocks if you have any */
.content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.content pre code {
    background: none;
    padding: 0;
}

.content h3 {
    font-size: 1.125rem; /* Reduce from 1.25rem - less shouty */
    font-weight: 500; /* Lighter weight */
}

.content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0 2rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.content pre code {
    color: inherit;
}

.toc {
    border-right: none;
    background: transparent;
}

.toc a {
    font-size: 0.85rem;
    color: #666;
}

.toc a:hover {
    color: #1a1a1a;
}

.content p {
    max-width: 75ch; /* Optimal line length for reading */
}