/* CSS Custom Properties */
:root {
    /* Colors */
    --color-primary: #1a1a1a;
    --color-secondary: #666;
    --color-accent: #2563eb;
    --color-background: #ffffff;
    --color-border: #e5e7eb;
    --color-branch: #f1f5f9;
    
    /* Typography */
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 4rem;
    
    /* Typography Scale */
    --text-xs: 0.875rem;
    --text-sm: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-xxl: 2rem;
    --text-xxxl: 2.5rem;
    
    /* Layout */
    --max-width: 75ch;
    --header-height: 6rem;
}

/* Import Inter font for display typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

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

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

body {
    font-family: var(--font-serif);
    font-size: var(--text-md);
    line-height: 1.6;
    color: var(--color-primary);
    background-color: var(--color-background);
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: 
        "header"
        "main"
        "footer";
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.2;
    color: var(--color-primary);
    position: relative;
    transition: padding-left 0.3s ease;
}

h1 {
    font-size: var(--text-xxxl);
    margin-bottom: var(--space-sm);
    font-weight: 300;
}

h2 {
    font-size: var(--text-xxl);
    margin-bottom: var(--space-md);
    padding-left: var(--space-xs);
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 1.2em;
    background-color: var(--color-branch);
    transition: background-color 0.3s ease;
}

h2:hover {
    padding-left: var(--space-sm);
}

h2:hover::before {
    background-color: var(--color-accent);
}

h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    padding-left: var(--space-sm);
}

h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 1em;
    background-color: var(--color-branch);
    transition: background-color 0.3s ease;
}

h3:hover {
    padding-left: var(--space-md);
}

h3:hover::before {
    background-color: var(--color-secondary);
}

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

time {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-secondary);
}

/* Layout Components */
.site-header {
    grid-area: header;
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.site-title {
    font-size: var(--text-xxxl);
    font-weight: 300;
    margin-bottom: var(--space-xs);
    position: relative;
    display: inline-block;
}

.site-title::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1px;
    background-color: var(--color-border);
}

.site-title::after {
    content: '';
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1px;
    background-color: var(--color-border);
}

.site-tagline {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    color: var(--color-secondary);
    margin-bottom: 0;
}

.content {
    grid-area: main;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
    width: 100%;
}

.section-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-lg);
    color: var(--color-secondary);
    font-weight: 400;
}

/* Post Listings */
.posts {
    display: grid;
    gap: var(--space-xxl);
}

.no-posts {
    text-align: center;
    color: var(--color-secondary);
    font-style: italic;
    padding: var(--space-xl);
}

.no-posts code {
    background-color: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.post-preview {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-lg);
    margin-right: var(--space-md);
    position: relative;
}

.post-preview::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--color-branch) 20%, var(--color-branch) 80%, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-preview:hover::before {
    opacity: 1;
}

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

.post-title {
    margin-bottom: var(--space-xs);
}

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

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

.post-date {
    display: block;
    margin-bottom: var(--space-sm);
}

.post-excerpt {
    color: var(--color-secondary);
    margin-bottom: 0;
}

/* Poem Section */
.poem {
    margin-bottom: var(--space-xxl);
    text-align: center;
}

.poem-text {
    border: none;
    margin: 0;
    padding: var(--space-xl) 0;
    font-style: italic;
    font-size: var(--text-lg);
    line-height: 1.8;
    color: var(--color-secondary);
    position: relative;
}

.poem-text::before,
.poem-text::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 1px;
    background-color: var(--color-border);
}

.poem-text::before {
    top: 0;
}

.poem-text::after {
    bottom: 0;
}

.poem-line {
    margin-bottom: var(--space-xs);
    font-weight: 300;
}

.poem-line:last-child {
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    grid-area: footer;
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    border-top: 1px solid var(--color-border);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --space-xl: 2rem;
        --space-xxl: 2.5rem;
    }
    
    .site-header {
        padding: var(--space-lg) var(--space-md);
    }
    
    .site-title {
        font-size: var(--text-xxl);
    }
    
    .content {
        padding: var(--space-lg) var(--space-md);
    }
}

@media (max-width: 480px) {
    :root {
        --text-xxxl: 1.875rem;
        --text-xxl: 1.5rem;
    }
    
    .posts {
        gap: var(--space-lg);
    }
    
    .post-preview {
        padding-bottom: var(--space-md);
    }
    
    .poem-text {
        font-size: var(--text-md);
        padding: var(--space-lg) 0;
    }
    
    .poem-text::before,
    .poem-text::after {
        width: 2rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer {
        display: none;
    }
    
    .content {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    a {
        color: var(--color-primary);
        text-decoration: underline;
    }
}