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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
    /* Performance optimizations */
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 20px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
}

/* About Section */
.about {
    margin-bottom: 40px;
    padding: 24px 0;
}

.about p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #666;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

/* Snapshot Notice */
.snapshot-notice {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    margin: 40px 0;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.snapshot-notice code {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85em;
}

/* Homepage Post Previews */
.posts {
    margin-top: 60px;
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 30px;
}

.posts h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.01em;
}

.archive-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.archive-link:hover {
    color: #1a1a1a;
}

.post-preview {
    padding: 24px 0;
    border-bottom: 1px solid #e5e5e5;
}

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

.post-preview h3 {
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 8px;
}

.post-preview h3 a {
    color: #1a1a1a;
    text-decoration: none;
}

.post-preview h3 a:hover {
    color: #666;
}

.post-date {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.post-excerpt {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.continue-reading {
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-block;
    transition: color 0.2s ease, transform 0.1s ease;
    will-change: transform; /* Performance: hint for GPU acceleration */
}

.continue-reading:hover {
    color: #666;
    transform: translateX(2px);
}

/* Archive Page */
.archive {
    margin-top: 40px;
}

.archive-intro {
    margin-bottom: 40px;
    text-align: center;
}

.archive-intro p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.archive-posts {
    max-width: 700px;
    margin: 0 auto;
}

.archive-item {
    padding: 24px 0;
    border-bottom: 1px solid #e5e5e5;
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-date {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.archive-item h3 {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.3;
}

.archive-item h3 a {
    color: #1a1a1a;
    text-decoration: none;
}

.archive-item h3 a:hover {
    color: #666;
}

.archive-excerpt {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

/* Footer */
.footer {
    margin-top: 80px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

.footer a {
    color: #666;
    text-decoration: none;
}

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

/* Article Page Styles */
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    color: #1a1a1a;
}

.post-navigation {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 12px 0;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #1a1a1a;
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
    margin-left: auto;
}

.post-header {
    margin-bottom: 40px;
}

.post-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 40px;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.7;
}

.post-content p {
    margin-bottom: 20px;
}

.post-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9em;
}

.code-block {
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 20px;
    border-radius: 8px;
    margin: 24px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Error messages */
.error-message {
    background: #fff3f3;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: center;
}

.error-message h3 {
    color: #721c24;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.error-message p {
    color: #856404;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.error-message button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.error-message button:hover {
    background: #c82333;
}

/* Search functionality */
.search-container {
    margin-top: 30px;
    position: relative;
}

.search-box {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

#search-input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    background: white;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#search-input:focus {
    border-color: #666;
    box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.1);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.search-results.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-result {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover,
.search-result.selected {
    background-color: #f8f8f8;
}

.search-result.no-results {
    text-align: center;
    color: #666;
    cursor: default;
}

.search-result.no-results:hover {
    background-color: transparent;
}

.result-title a {
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
}

.result-date {
    color: #999;
    font-size: 0.85rem;
    margin: 4px 0;
}

.result-excerpt {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.search-result mark {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    margin-top: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    border-color: #666;
    color: #1a1a1a;
    transform: translateY(-1px);
}

.theme-icon {
    font-size: 1.1rem;
}

.theme-label {
    font-weight: 500;
}

/* Dark theme styles */
.theme-dark {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #333;
    --accent-color: #f0f0f0;
    --code-bg: #2a2a2a;
    --search-bg: #2a2a2a;
    --search-border: #444;
}

.theme-dark body {
    background: var(--bg-color);
    color: var(--text-color);
}

.theme-dark h1,
.theme-dark h2,
.theme-dark h3 {
    color: var(--accent-color);
}

.theme-dark .subtitle,
.theme-dark .post-date,
.theme-dark .archive-date {
    color: var(--text-secondary);
}

.theme-dark .snapshot-notice {
    background: var(--code-bg);
    color: var(--text-secondary);
}

.theme-dark .snapshot-notice code {
    background: #333;
}

.theme-dark .post-preview,
.theme-dark .archive-item {
    border-bottom-color: var(--border-color);
}

.theme-dark .post-preview h3 a,
.theme-dark .archive-item h3 a {
    color: var(--accent-color);
}

.theme-dark .post-preview h3 a:hover,
.theme-dark .archive-item h3 a:hover {
    color: var(--text-secondary);
}

.theme-dark .post-excerpt,
.theme-dark .archive-excerpt {
    color: var(--text-secondary);
}

.theme-dark .continue-reading {
    color: var(--accent-color);
}

.theme-dark .continue-reading:hover {
    color: var(--text-secondary);
}

.theme-dark .archive-link {
    color: var(--text-secondary);
}

.theme-dark .archive-link:hover {
    color: var(--accent-color);
}

.theme-dark .footer {
    color: var(--text-secondary);
}

.theme-dark .footer a {
    color: var(--text-secondary);
}

.theme-dark .footer a:hover {
    color: var(--accent-color);
}

.theme-dark .code-block {
    background: var(--code-bg);
    color: var(--accent-color);
}

.theme-dark .post-content code {
    background: var(--code-bg);
    color: var(--accent-color);
}

.theme-dark #search-input {
    background: var(--search-bg);
    border-color: var(--search-border);
    color: var(--text-color);
}

.theme-dark #search-input:focus {
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(176, 176, 176, 0.1);
}

.theme-dark .search-results {
    background: var(--search-bg);
    border-color: var(--search-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.theme-dark .search-result {
    border-bottom-color: var(--border-color);
}

.theme-dark .search-result:hover,
.theme-dark .search-result.selected {
    background-color: #333;
}

.theme-dark .result-title a {
    color: var(--accent-color);
}

.theme-dark .theme-toggle {
    border-color: var(--search-border);
    color: var(--text-secondary);
}

.theme-dark .theme-toggle:hover {
    border-color: var(--text-secondary);
    color: var(--accent-color);
}

.theme-dark .search-result mark {
    background-color: #4a4a00;
    color: #ffff99;
}

/* Theme transitions */
.theme-transitioning * {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
} 