:root {
    --bg-primary: #fff;
    --bg-secondary: #f5f5f0;
    --text-primary: #000;
    --text-secondary: #333;
    --text-muted: #666;
    --border-color: #ccc;
    --accent: #0066cc;
    --code-bg: #f0f0ec;
    --font-sans: "Bitstream Vera Sans", "Trebuchet MS", "Tahoma", sans-serif;
    --font-mono: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
    --max-width: 55em;
    --page-margin: 3em;
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --border-color: #444;
    --accent: #4da6ff;
    --code-bg: #333;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    padding: 1em var(--page-margin);
    transition: background 0.3s, color 0.3s;
}

.site-header {
    display: none;
}

.nav {
    max-width: var(--max-width);
    margin: 0 auto 2em auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1em;
    border-bottom: 2px solid var(--text-primary);
}

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

.site-title {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 1.5em;
    font-size: 0.9em;
}

.nav-links a:hover {
    color: var(--accent);
}

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

h1 {
    font-size: 1.8em;
    border-bottom: 1px solid var(--text-primary);
    padding-bottom: 0.3em;
    margin-bottom: 0.8em;
}

h2 {
    font-size: 1.4em;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.2em;
}

h3 {
    font-size: 1.2em;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
    text-align: justify;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    text-align: justify;
}

.post-preview {
    padding: 1em 0;
    border-bottom: 1px solid var(--border-color);
}

.post-preview h2 {
    margin-top: 0;
    font-size: 1.3em;
    border: none;
}

.post-preview h2 a {
    color: var(--text-primary);
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 0.5em;
}

.category {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.1em 0.4em;
    margin-left: 1em;
    font-size: 0.8em;
}

.excerpt {
    color: var(--text-secondary);
}

.post-full .content {
    font-family: var(--font-mono);
    font-size: 0.95em;
    line-height: 1.6;
    white-space: pre-wrap;
}

.post-full .content h2 {
    font-family: var(--font-sans);
    margin-top: 2em;
}

.post-full .content pre {
    background: var(--code-bg);
    padding: 1em;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin: 1em 0;
}

.post-full .content code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.1em 0.3em;
}

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

.comments-section {
    margin-top: 2em;
    padding-top: 1em;
    border-top: 2px solid var(--text-primary);
}

.comments-section h3 {
    margin-bottom: 1em;
}

.comment {
    padding: 0.8em 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3em;
}

.comment-author {
    font-weight: bold;
}

.comment-date {
    font-family: var(--font-mono);
    font-size: 0.8em;
    color: var(--text-muted);
}

.comment-content {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.comment-form {
    margin-top: 1.5em;
    background: var(--bg-secondary);
    padding: 1em;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 0.8em;
}

.form-group label {
    display: block;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 0.2em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.4em;
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.95em;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.4em 1em;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
}

.btn:hover {
    background: #0052a3;
    text-decoration: none;
}

.btn-secondary {
    background: var(--text-muted);
}

.site-footer {
    max-width: var(--max-width);
    margin: 3em auto 0 auto;
    padding-top: 1em;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.85em;
    color: var(--text-muted);
}

.site-footer p {
    text-align: center;
}

.site-footer a {
    color: #666;
    text-decoration: none;
    margin: 0 0.3em;
}

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



.login-container {
    max-width: 350px;
    margin: 3em auto;
    padding: 1.5em;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.login-container h1 {
    font-size: 1.2em;
    border: none;
    text-align: center;
    margin-bottom: 1em;
}

.alert {
    padding: 0.5em 0.8em;
    margin-bottom: 0.8em;
    font-size: 0.9em;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Admin styles */
.admin-layout {
    display: flex;
    min-height: 70vh;
}

.admin-sidebar {
    width: 160px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1em;
    flex-shrink: 0;
}

.admin-sidebar h3 {
    font-size: 0.9em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5em;
    margin-bottom: 0.8em;
}

.admin-sidebar a {
    display: block;
    padding: 0.4em 0.6em;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.admin-content {
    flex: 1;
    padding: 1em 2em;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5em;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.6em;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-size: 0.8em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.status-published {
    color: #2e7d32;
}

.status-draft {
    color: #e65100;
}

.logout-link {
    color: #c62828;
}

/* RFC Document Style */
.rfc-document {
    font-family: var(--font-mono);
    font-size: 0.95em;
    line-height: 1.5;
}

.rfc-header-block {
    display: flex;
    justify-content: space-between;
    border-bottom: 3px double var(--text-primary);
    padding-bottom: 1em;
    margin-bottom: 1.5em;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

.rfc-header-left,
.rfc-header-right {
    width: 48%;
}

.rfc-field {
    margin-bottom: 0.3em;
}

.rfc-title-block {
    text-align: center;
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--border-color);
}

.rfc-title-block h1 {
    font-size: 1.4em;
    border: none;
    padding: 0;
    margin: 0;
}

.rfc-meta-table {
    margin-bottom: 1.5em;
}

.rfc-meta-table table {
    width: 100%;
    border-collapse: collapse;
}

.rfc-meta-table td {
    padding: 0.3em 0;
}

.rfc-meta-table td:first-child {
    width: 80px;
    font-weight: bold;
}

.rfc-abstract {
    background: var(--bg-secondary);
    padding: 1em;
    margin-bottom: 1.5em;
    border-left: 4px solid var(--text-primary);
}

.rfc-abstract h3 {
    margin-top: 0;
    font-size: 1.1em;
}

.rfc-content {
    white-space: pre-wrap;
    line-height: 1.6;
}

.rfc-content h2,
.rfc-content h3 {
    font-family: var(--font-sans);
    margin-top: 1.5em;
}

.rfc-content pre {
    background: var(--code-bg);
    padding: 1em;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.rfc-content code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.1em 0.3em;
}

.rfc-content,
.rfc-content p {
    text-align: justify;
}

@media (max-width: 600px) {
    :root {
        --max-width: 100%;
        --page-margin: 1em;
    }
    
    .nav {
        flex-direction: column;
        gap: 0.8em;
    }
    
    .rfc-header-block {
        flex-direction: column;
    }
    
    .rfc-header-left,
    .rfc-header-right {
        width: 100%;
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}