/* SPDX-FileCopyrightText: 2026 Viktor Ostashevskyi <ostash@ostash.kiev.ua>
   SPDX-License-Identifier: CC-BY-SA-4.0 */

:root {
    --bg: #0f1117;
    --bg-subtle: #161b22;
    --border: #30363d;
    --fg: #c9d1d9;
    --fg-muted: #6e7681;
    --accent: #58a6ff;
    --green: #3fb950;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-body: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
    --max-width: 740px;
    --line: 1.7;
}

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

html {
    font-size: 16px;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    line-height: var(--line);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* ── Header ── */
header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-title {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--green);
    white-space: nowrap;
}

.site-title:hover {
    text-decoration: none;
    opacity: 0.85;
}

.site-subtitle {
    color: var(--fg-muted);
    font-size: 0.875rem;
    flex: 1;
}

nav {
    display: flex;
    gap: 1.25rem;
    margin-left: auto;
}

nav a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-muted);
    text-transform: lowercase;
}

nav a:hover {
    color: var(--fg);
    text-decoration: none;
}

/* ── Main ── */
main {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ── Post list ── */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.post-entry {
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

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

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-muted);
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.post-tags a {
    color: var(--fg-muted);
    font-size: 0.75rem;
}

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

.post-entry h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.post-entry h2 a {
    color: var(--fg);
}

.post-entry h2 a:hover {
    color: var(--accent);
    text-decoration: none;
}

.post-summary {
    color: var(--fg-muted);
    font-size: 0.9rem;
}

/* ── Article ── */
.article-header {
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.article-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.article-tags a {
    color: var(--fg-muted);
}

.article-tags a:hover {
    color: var(--accent);
}

.modified {
    color: var(--fg-muted);
}

.article-content {
    line-height: var(--line);
}

.article-content h2 {
    font-size: 1.3rem;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.article-content h3 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem;
}

.article-content h4 {
    font-size: 1rem;
    margin: 1.25rem 0 0.4rem;
    color: var(--fg-muted);
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1.25rem 1.5rem;
}

.article-content li {
    margin-bottom: 0.3rem;
}

.article-content blockquote {
    border-left: 3px solid var(--border);
    margin: 1.5rem 0;
    padding: 0.5rem 1.25rem;
    color: var(--fg-muted);
    font-style: italic;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.article-content th {
    background: var(--bg-subtle);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ── Code ── */
code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-subtle);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.5;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
}

/* Pygments syntax highlight */
.highlight {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 1.5rem 0;
}

.highlight pre {
    border: none;
    margin: 0;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
    color: #6e7681;
    font-style: italic;
}

.highlight .k,
.highlight .kn,
.highlight .kd {
    color: #ff7b72;
}

.highlight .s,
.highlight .s1,
.highlight .s2 {
    color: #a5d6ff;
}

.highlight .n {
    color: var(--fg);
}

.highlight .nf,
.highlight .nc {
    color: #d2a8ff;
}

.highlight .mi,
.highlight .mf {
    color: #79c0ff;
}

.highlight .o {
    color: #ff7b72;
}

.highlight .cp {
    color: #ffa657;
}

.highlight .nn,
.highlight .na {
    color: #79c0ff;
}

/* ── Article nav ── */
.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    gap: 1rem;
}

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

/* ── Comments ── */
.comments {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.comments h2 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--fg-muted);
    text-transform: lowercase;
    margin-bottom: 1.5rem;
}

/* ── Archive ── */
.archive-year h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--fg-muted);
    margin: 1.5rem 0 0.75rem;
}

.archive ul {
    list-style: none;
}

.archive li {
    display: flex;
    gap: 1.5rem;
    padding: 0.3rem 0;
    align-items: baseline;
}

.archive time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-muted);
    white-space: nowrap;
}

/* ── Tags ── */
.tag-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag-list li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tag-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--fg-muted);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ── Footer ── */
footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.85rem;
}

.social {
    display: flex;
    gap: 1rem;
}

.social a,
.feed-link {
    color: var(--fg-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.social a:hover,
.feed-link:hover {
    color: var(--fg);
    text-decoration: none;
}

.feed-link {
    margin-left: auto;
}

.site-copyright {
    text-align: center;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--fg-muted);
    opacity: 0.6;
    border-top: 1px solid var(--border);
}

/* ── 404 ── */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-family: var(--font-mono);
    font-size: 4rem;
    color: var(--fg-muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        gap: 0.75rem;
    }

    nav {
        margin-left: 0;
    }

    .article-nav {
        flex-direction: column;
    }

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