/* Font Definitions */
@font-face {
    font-family: 'Berkeley Mono';
    src: url('../fonts/BerkeleyMono-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Berkeley Mono';
    src: url('../fonts/BerkeleyMono-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables */
:root {
    --font-mono: 'Berkeley Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-gray: #666666;
    --color-light-gray: #999999;
    --color-border: #e0e0e0;
    
    --spacing-unit: 1rem;
    --content-width: 640px;
    --line-height: 1.6;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: var(--line-height);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-unit);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-unit);
}

a {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration: none;
}

/* Layout */
.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/* Header */
.site-header {
    padding: calc(var(--spacing-unit) * 3) 0 calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--color-border);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.site-nav-home {
    font-weight: 700;
}

.site-nav-divider {
    color: var(--color-light-gray);
}

.site-nav-link {
    color: var(--color-gray);
}

.site-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.site-title a {
    text-decoration: none;
}

.site-description {
    font-size: 0.875rem;
    color: var(--color-gray);
}

/* Main Content */
.site-main {
    flex: 1;
    padding: calc(var(--spacing-unit) * 3) 0;
}

/* Post Feed */
.post-feed {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.post-card {
    margin-bottom: calc(var(--spacing-unit) * 2);
    padding-bottom: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--color-border);
}

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

.post-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.post-card-title a {
    text-decoration: none;
}

.post-card-title a:hover {
    text-decoration: underline;
}

.post-card-date {
    font-size: 0.8125rem;
    color: var(--color-gray);
}

.post-card-excerpt {
    margin-top: 0.5rem;
    color: var(--color-gray);
}

/* Single Post */
.post-full {
    max-width: var(--content-width);
    margin: 0 auto;
}

.post-header {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.post-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-unit);
}

.post-meta {
    font-size: 0.8125rem;
    color: var(--color-gray);
}

.post-meta-divider {
    margin: 0 0.5rem;
}

/* Post Content */
.post-content {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.75;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    font-family: var(--font-mono);
    margin-top: calc(var(--spacing-unit) * 2);
    margin-bottom: var(--spacing-unit);
}

.post-content p {
    margin-bottom: calc(var(--spacing-unit) * 1.25);
}

.post-content blockquote {
    margin: calc(var(--spacing-unit) * 2) 0;
    padding-left: var(--spacing-unit);
    border-left: 3px solid var(--color-border);
    font-style: italic;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: #f5f5f5;
    padding: 0.125em 0.25em;
    border-radius: 3px;
}

.post-content pre {
    margin: calc(var(--spacing-unit) * 2) 0;
    padding: var(--spacing-unit);
    background: #f5f5f5;
    border-radius: 4px;
    overflow-x: auto;
}

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

.post-content ul,
.post-content ol {
    margin-bottom: calc(var(--spacing-unit) * 1.25);
    padding-left: calc(var(--spacing-unit) * 1.5);
}

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

.post-content hr {
    margin: calc(var(--spacing-unit) * 3) 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

/* Post Navigation */
.post-footer {
    margin-top: calc(var(--spacing-unit) * 4);
    padding-top: calc(var(--spacing-unit) * 2);
    border-top: 1px solid var(--color-border);
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-unit);
}

.post-nav-prev,
.post-nav-next {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    font-size: 0.875rem;
}

.post-nav-next {
    text-align: right;
}

.post-nav-label {
    font-size: 0.75rem;
    color: var(--color-gray);
    margin-bottom: 0.25rem;
}

.post-nav-title {
    text-decoration: underline;
}

/* Footer */
.site-footer {
    padding: calc(var(--spacing-unit) * 2) 0;
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-gray);
}

/* Koenig Editor Classes */
.kg-width-wide {
    max-width: 85vw;
    width: 85vw;
    margin-left: calc(50% - 42.5vw);
    margin-right: calc(50% - 42.5vw);
}

.kg-width-full {
    max-width: 100vw;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-unit);
    font-size: 0.875rem;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: calc(var(--spacing-unit) * 4) 0;
    color: var(--color-gray);
}

/* Responsive */
@media (max-width: 680px) {
    html {
        font-size: 15px;
    }
    
    .site-header {
        padding: calc(var(--spacing-unit) * 2) 0 var(--spacing-unit);
    }
    
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-navigation {
        flex-direction: column;
    }
    
    .post-nav-next {
        text-align: left;
    }
}