/* style.css - Blog */

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-tertiary: #243044;
    --text-primary: #e7edf4;
    --text-secondary: #8b9eb3;
    --text-muted: #5c7089;
    --accent: #3d9eff;
    --accent-hover: #5eb0ff;
    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.15);
    --danger: #f85149;
    --danger-bg: rgba(248, 81, 73, 0.15);
    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.15);
    --border: #2d3f54;
    --border-light: #3d5068;
    --radius: 6px;
    --radius-lg: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

html {
    font-size: 15px;
}

body {
    font-family: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.home-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.home-link:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

header h1 a {
    color: var(--text-primary);
    text-decoration: none;
}

header h1 a:hover {
    color: var(--accent);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
}

.app-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
}

.badge-muted {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2, .section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

/* ============== BLOG-SPECIFIC ============== */

/* Directory table */
.blog-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
.blog-table th,
.blog-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.blog-table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}
.blog-table tbody tr:last-child td { border-bottom: none; }
.blog-table tbody tr:hover { background: var(--bg-tertiary); }

.blog-table .date-cell { color: var(--text-muted); white-space: nowrap; width: 10rem; }
.blog-table .title-cell { font-weight: 500; }
.blog-table .lang-col,
.blog-table .lang-cell { text-align: center; width: 5rem; }
.blog-table .lang-cell a {
    text-decoration: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s ease;
}
.blog-table .lang-cell a:hover {
    background: var(--bg-tertiary);
    text-decoration: none;
}

/* Article page */
.article {
    max-width: 760px;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.article-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.article-meta .lang-switch {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.article-meta .lang-switch:hover { text-decoration: underline; }
.article-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.back-link {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.back-link a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
}
.back-link a:hover { text-decoration: underline; }

/* Prose styling — wraps all markdown output */
.article-content {
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 0.95rem;
}
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 1.75rem 0 0.75rem;
    line-height: 1.3;
}
.article-content h1 { font-size: 1.5rem; }
.article-content h2 { font-size: 1.25rem; }
.article-content h3 { font-size: 1.1rem; }
.article-content h4 { font-size: 1rem; }
.article-content p { margin: 0 0 1rem; }
.article-content a {
    color: var(--accent);
    text-decoration: none;
}
.article-content a:hover { text-decoration: underline; }
.article-content strong { color: var(--text-primary); font-weight: 600; }
.article-content em { color: var(--text-secondary); }
.article-content ul,
.article-content ol { margin: 0 0 1rem 1.5rem; }
.article-content li { margin-bottom: 0.35rem; }
.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}
.article-content code {
    font-family: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
    background: var(--bg-tertiary);
    color: var(--accent-hover);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}
.article-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    margin: 0 0 1.25rem;
}
.article-content pre code {
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    font-size: 0.85rem;
}
.article-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 0 0 1rem;
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    margin: 1rem 0;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1rem;
    font-size: 0.85rem;
}
.article-content th,
.article-content td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}
.article-content th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Make the table responsive: stack as cards below 600px */
@media (max-width: 600px) {
    .blog-table thead { display: none; }
    .blog-table, .blog-table tbody, .blog-table tr, .blog-table td { display: block; width: 100%; }
    .blog-table tr {
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
    }
    .blog-table td {
        border-bottom: none;
        padding: 0.4rem 1rem;
    }
    .blog-table .date-cell,
    .blog-table .title-cell { width: auto; }
    .blog-table .lang-cell { display: inline-block; width: 50%; text-align: left; }
}

/* Responsive */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .page-header h2 {
        font-size: 1.1rem;
    }

    .article-title {
        font-size: 1.4rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }
}
