/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #fafafa;
    --color-fg: #1a1a1a;
    --color-muted: #666;
    --color-border: #e0e0e0;
    --color-accent: #0066cc;
    --color-tag: #f0f0f0;
    --spacing-unit: 1rem;
    --max-width: 680px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1a1a1a;
        --color-fg: #e0e0e0;
        --color-muted: #999;
        --color-border: #333;
        --color-accent: #4d9fff;
        --color-tag: #2a2a2a;
    }
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-fg);
    background-color: var(--color-bg);
    transition: background-color 0.3s ease;
}

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

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

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header .subtitle {
    color: var(--color-muted);
    font-size: 1rem;
    margin-bottom: 1rem;
}

header .stats {
    font-size: 0.875rem;
    color: var(--color-muted);
    font-family: var(--font-mono);
}

header .stats .separator {
    margin: 0 0.5rem;
}

/* Post */
.post {
    margin-bottom: calc(var(--spacing-unit) * 3);
    padding-bottom: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--color-border);
    animation: fadeIn 0.4s ease-out;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-new {
    animation: slideIn 0.6s ease-out;
    background-color: var(--color-tag);
    padding: var(--spacing-unit);
    margin: 0 calc(-1 * var(--spacing-unit)) var(--spacing-unit);
    border-radius: 4px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.post-meta {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.post-meta time {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-muted);
}

.post-relative-time {
    font-size: 0.75rem;
    color: var(--color-muted);
    opacity: 0.7;
}

.post-content {
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Loading e no-more */
.loading, .no-more {
    text-align: center;
    padding: calc(var(--spacing-unit) * 2);
    color: var(--color-muted);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-more {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    opacity: 0.5;
}

/* Footer */
footer {
    margin-top: calc(var(--spacing-unit) * 4);
    padding: calc(var(--spacing-unit) * 2) 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-muted);
    font-size: 0.875rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer .hint {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header .subtitle {
        font-size: 0.95rem;
    }

    .post-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .post-content {
        font-size: 0.95rem;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-muted);
}

/* Print styles */
@media print {
    .loading, .no-more, footer .hint {
        display: none;
    }

    .post {
        page-break-inside: avoid;
    }
}
