:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --fg: #1c1f23;
    --muted: #5c636a;
    --line: #e3e6ea;
    --link: #2f5f92;
    --surface: #fafbfc;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --fg: #e6e8ea;
        --muted: #9aa1a9;
        --line: #2a2e34;
        --link: #7fb0e0;
        --surface: #1d2025;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

main {
    max-width: 1040px;
    margin: auto;
    padding: 24px 20px 64px;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 42px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--fg);
    font-weight: 750;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

article {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

article img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
}

article > div {
    padding: 18px;
}

.tag {
    color: var(--link);
    font-size: 0.82rem;
    font-weight: 700;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.12;
}

h2 {
    font-size: 1.3rem;
    line-height: 1.25;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.prose {
    max-width: 760px;
    margin: auto;
}

.prose img {
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
}

.prose p {
    font-size: 1.08rem;
}

.source,
.related {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.source {
    font-size: 0.9rem;
    color: var(--muted);
}

.related ul {
    padding-left: 1.2rem;
}

footer.site {
    margin-top: 56px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

footer.site p {
    margin: 0 0 10px;
}

footer.site p:last-child {
    margin-bottom: 0;
}

.site-note {
    max-width: 640px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 22px 0 30px;
}

.categories a {
    padding: 5px 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.86rem;
}

@media (max-width: 520px) {
    main {
        padding-inline: 14px;
    }

    article img {
        height: 160px;
    }
}
