:root {
    color-scheme: light;
    --bg: #fcfcfa;
    --ink: #1c2428;
    --muted: #687078;
    --line: #e2e5e5;
    --surface: #f1f3f2;
    --hover: #e7ebea;
    --accent: #343b40;
    --focus: #6b747c;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111416;
    --ink: #edf0ef;
    --muted: #a0a9ad;
    --line: #2b3236;
    --surface: #1b2023;
    --hover: #272f32;
    --accent: #dde1e4;
    --focus: #c0c7cd;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg: #111416;
        --ink: #edf0ef;
        --muted: #a0a9ad;
        --line: #2b3236;
        --surface: #1b2023;
        --hover: #272f32;
        --accent: #dde1e4;
        --focus: #c0c7cd;
    }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 "Avenir Next", Avenir, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
header, main, footer { max-width: 1200px; margin: auto; padding: 32px 40px; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 4px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding-top: 52px; padding-bottom: 64px; }
.brand { color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-name { display: block; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.brand h1, .brand-title { display: block; margin: 0; font-size: clamp(52px, 7vw, 80px); line-height: 1; letter-spacing: -.065em; font-weight: 600; }
.brand-dot { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px 5px 3px 18px; }
.search:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 3px; }
.search input:focus-visible { outline: none; }
.search input { width: 190px; min-width: 0; padding: 8px 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; }
.search input::placeholder { color: var(--muted); }
.search button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.search button:hover { background: var(--hover); color: var(--ink); }
.theme-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.theme-toggle:hover { background: var(--hover); }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
:root img.theme-img-dark { display: none; }
:root[data-theme="dark"] img.theme-img-light { display: none; }
:root[data-theme="dark"] img.theme-img-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) img.theme-img-light { display: none; }
    :root:not([data-theme]) img.theme-img-dark { display: block; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px 14px; margin: 0 0 42px; }
.filter { flex: 0 0 auto; padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 15px; font-weight: 500; line-height: 1.5; text-decoration: none; }
.filter:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.filter[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; }
.tag-filters .filter { max-width: 100%; min-width: 0; text-align: center; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(34px, 5vw, 52px); margin: 12px 0 24px; }
h2 { font-size: 28px; }
.listing-heading { font-size: 24px; font-weight: 500; margin: 0 0 32px; }
.intro, time, .reading-time { color: var(--muted); }
.intro { margin: 0 0 30px; }
time { font-size: 12px; font-variant-numeric: tabular-nums; }
.article-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 44px 26px; }
.preview { min-width: 0; grid-column: span 2; }
.preview.featured { grid-column: span 3; }
.latest-heading { grid-column: 1 / -1; font-size: 18px; font-weight: 500; letter-spacing: -.01em; margin: 26px 0 -12px; }
.preview-image { display: block; position: relative; aspect-ratio: 16 / 9; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.preview-image img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 180ms ease; }
.preview-image:hover img { transform: scale(1.025); }
.preview h2 { margin: 0 0 16px; font-size: 23px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.preview.featured h2 { font-size: clamp(25px, 2.8vw, 34px); }
.preview h2 a { color: var(--ink); text-decoration: none; }
.preview h2 a:hover { color: var(--accent); }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--surface); font-size: 12px; line-height: 1.5; color: var(--muted); text-decoration: none; }
.tag:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.tag[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.preview p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.pagination a, .current-page { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; line-height: 1.5; text-decoration: none; }
.pagination a:hover { background: var(--hover); color: var(--ink); }
.current-page { color: var(--bg); background: var(--ink); border-color: var(--ink); font-weight: 600; }
.article-page { max-width: 1200px; padding-top: 0; }
.article-page .article-back { margin-top: 0; font-size: 13px; color: var(--muted); }
.article-heading { max-width: 900px; margin: 52px auto 48px; text-align: center; }
.article-heading h1 { font-size: clamp(34px, 4.5vw, 60px); font-weight: 500; line-height: 1.15; margin: 24px 0 22px; }
.article-description { max-width: 640px; margin: 0 auto 26px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.article-author { margin: 0 0 18px; font-size: 13px; }
.article-heading .tags { justify-content: center; }
.article-header-image { min-width: 0; max-width: 680px; margin: 0 auto 48px; }
.article-header-image img { display: block; width: 100%; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.article-page .prose, .article-page > .back:last-child { max-width: 680px; margin-left: auto; margin-right: auto; }
.article-page > .back:last-child { display: block; }
.prose { overflow-wrap: anywhere; color: var(--muted); font-size: 18px; line-height: 1.85; }
.prose h1, .prose h2 { color: var(--ink); }
.prose h3, .prose h4, .prose h5, .prose h6 { color: var(--accent); }
.prose strong, .prose b { color: var(--ink); }
.prose pre, .prose code, .prose th { color: var(--ink); }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 32px 0; }
.prose h2, .prose h3 { margin-top: 40px; font-weight: 600; }
.prose img { display: block; max-width: 100%; height: auto; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; margin: 28px auto; }
.prose blockquote { margin-left: 0; padding-left: 22px; border-left: 3px solid var(--accent); color: var(--muted); }
pre { overflow-x: auto; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; line-height: 1.65; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .83em; }
table { display: block; overflow-x: auto; border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 8px 14px; }
.back { display: inline-block; margin-top: 30px; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 60px; padding-top: 28px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer a { color: var(--muted); text-decoration: none; }
@media (max-width: 1000px) {
    header, main, footer { padding-left: 28px; padding-right: 28px; }
    .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .preview, .preview.featured { grid-column: span 1; }
    .header-actions { gap: 8px; }
    .search input { width: 145px; }
}
@media (max-width: 650px) {
    header, main, footer { padding-left: 20px; padding-right: 20px; }
    .site-header { align-items: flex-start; flex-direction: column; gap: 28px; padding-top: 32px; padding-bottom: 24px; }
    .header-actions { width: 100%; }
    .search { flex: 1; min-width: 0; }
    .search input { width: 100%; }
    .theme-toggle { padding: 12px; }
    .theme-toggle span { display: none; }
    .article-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
    .preview.featured h2 { font-size: 27px; }
    .tag-filters { margin-bottom: 28px; }
    .latest-heading { margin-top: 12px; }
    .pagination { gap: 6px; margin-top: 40px; }
    .prose { font-size: 16px; }
    .article-heading { margin-top: 36px; margin-bottom: 36px; }
    .article-description { font-size: 15px; }
    .article-header-image { margin-bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) {
    .preview-image img { transition: none; }
    .preview-image:hover img { transform: none; }
}
