:root {
    --paper: #f4f5f7;        /* page */
    --paper-2: #eceef1;      /* placeholder / sunken */
    --panel: #ffffff;        /* cards */
    --ink: #16181d;          /* primary text */
    --ink-2: #3a3f49;        /* secondary text */
    --muted: #5d646e;        /* meta / labels (AA-contrast on paper) */
    --rule: #e1e4e8;         /* hairline */
    --rule-strong: #cfd3da;  /* stronger hairline */
    --accent: #b3122a;       /* editorial red */
    --accent-ink: #8c0e20;

    --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-body: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

    --radius: 2px;
    --wrap: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* faint newsprint grain for depth */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: .03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

/* Keyboard focus ring + skip link + screen-reader-only helper */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link {
    position: absolute; left: 8px; top: -52px; z-index: 100;
    background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius);
    font-family: var(--font-mono); font-size: .78rem; transition: top .15s;
}
.skip-link:focus { top: 8px; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; position: relative; z-index: 2; }
#main:focus { outline: none; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; color: var(--ink); }

/* shared editorial label */
.kicker, .section-title, .meta, .post-meta, .chip, .ranklist-meta, .widget h2,
.sectionbar a, .masthead-edition, .footer-nav, .breadcrumb, .page-of, .fineprint, .pagination a, .topic-card em {
    font-family: var(--font-mono);
}

/* ---------- Header / masthead ---------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(244, 245, 247, .94);
    backdrop-filter: blur(8px);
    border-top: 3px solid var(--accent);
    border-bottom: 1px solid var(--rule-strong);
}
.masthead { display: flex; align-items: center; gap: 24px; height: 78px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-rule { width: 4px; height: 32px; background: var(--accent); display: block; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -.025em; color: var(--ink); line-height: 1; }
.masthead-edition { flex: 1; margin: 0; color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .16em; }
.search { margin-left: auto; flex: none; }
.search input {
    background: var(--panel); border: 1px solid var(--rule-strong); color: var(--ink);
    border-radius: var(--radius); padding: 9px 13px; width: 200px; font-size: .8rem; font-family: var(--font-mono); outline: none;
    transition: border-color .12s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); }

/* section bar (one row, never wraps; scrolls on narrow screens) */
.sectionbar { border-top: 1px solid var(--rule); background: var(--panel); }
.sectionbar-inner { display: flex; align-items: stretch; gap: 6px; justify-content: space-between; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.sectionbar-inner::-webkit-scrollbar { display: none; }
.sectionbar a {
    white-space: nowrap; color: var(--ink-2); font-size: .68rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .07em; padding: 13px 2px;
    border-bottom: 2px solid transparent; transition: color .12s, border-color .12s;
}
.sectionbar a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.sectionbar .sec-about { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: 52px 0 30px; border-bottom: 1px solid var(--rule); margin-bottom: 34px; }
.kicker { color: var(--accent); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: .68rem; margin: 0 0 14px; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin: 0 0 16px; line-height: 1.05; max-width: 17ch; }
.lede { color: var(--ink-2); font-size: 1.08rem; max-width: 64ch; margin: 0; }

/* ---------- Featured ---------- */
.featured {
    display: grid; grid-template-columns: 1.3fr 1fr; gap: 0; margin: 0 0 46px;
    background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--radius);
    overflow: hidden; transition: border-color .15s;
}
.featured:hover { border-color: var(--ink-2); }
.featured-cover { min-height: 300px; border-right: 1px solid var(--rule); }
.featured-cover svg, .post-cover svg, .card-cover svg, .article-figure svg,
.featured-cover img, .post-cover img, .card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.featured-body { padding: 34px 36px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.featured-body h2 { font-size: 1.95rem; margin: 0; line-height: 1.12; }
.featured-body p { color: var(--ink-2); margin: 0; }

/* ---------- Chips (rectangular tags) ---------- */
.chip {
    align-self: flex-start; display: inline-flex; align-items: center;
    font-size: .62rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: var(--chip, var(--accent));
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--chip, var(--accent)) 45%, transparent);
    border-left: 3px solid var(--chip, var(--accent));
    padding: 4px 9px; border-radius: 0;
}

/* ---------- Two-column layout ---------- */
.layout-2col { display: grid; grid-template-columns: 1fr 290px; gap: 40px; align-items: start; }
.section-title {
    font-size: .76rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; color: var(--ink);
    margin: 0 0 20px; padding-bottom: 12px; border-bottom: 2px solid var(--ink);
}

/* ---------- Card grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(246px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
/* hairline-separated editorial grid: cards sit on a 1px gap that reads as rules */
.card {
    background: var(--panel); display: flex; flex-direction: column; transition: background .15s;
}
.card:hover { background: #fbfcfd; }
.card-cover { display: block; aspect-ratio: 16 / 9; background: var(--paper-2); border-bottom: 1px solid var(--rule); }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body h3 { font-size: 1.16rem; margin: 0; line-height: 1.24; font-weight: 600; }
.card-body h3 a { background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .2s; }
.card-body h3 a:hover { color: var(--accent); background-size: 100% 1px; }
.excerpt { color: var(--ink-2); font-size: .92rem; margin: 0; flex: 1; }
.meta, .post-meta, .ranklist-meta { color: var(--muted); font-size: .7rem; letter-spacing: .02em; margin: 0; }

/* When a grid holds a single row (related / 404) keep it tidy */
.related .grid, .home-grid { }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 26px; position: sticky; top: 134px; }
.widget { background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 20px 20px 22px; }
.widget h2 { margin: 0 0 16px; font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink); padding-bottom: 10px; border-bottom: 2px solid var(--ink); font-weight: 600; }
.ranklist { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.ranklist li { counter-increment: rank; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.ranklist li:last-child { border-bottom: 0; padding-bottom: 0; }
.ranklist li::before { content: counter(rank, decimal-leading-zero); grid-row: 1 / 3; font-family: var(--font-mono); font-weight: 600; font-size: .9rem; color: var(--accent); }
.ranklist li a { font-family: var(--font-display); font-size: 1rem; font-weight: 500; line-height: 1.3; }
.ranklist li a:hover { color: var(--accent); }
.ranklist-meta { margin-top: 3px; }
.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.taglist li { border-bottom: 1px solid var(--rule); }
.taglist li:last-child { border-bottom: 0; }
.taglist a {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-mono); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 0 10px 12px; border-left: 3px solid var(--chip); color: var(--ink-2);
    transition: color .12s, background .12s;
}
.taglist a:hover { color: var(--chip); background: color-mix(in srgb, var(--chip) 6%, transparent); }
.taglist a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.newsletter { background: var(--ink); border-color: var(--ink); }
.newsletter h2 { color: #fff; border-bottom-color: rgba(255,255,255,.25); }
.newsletter p { color: #c4c8d0; font-size: .86rem; margin: 0 0 14px; font-family: var(--font-body); }
.newsletter form { display: flex; gap: 8px; }
.newsletter input { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--ink); color: var(--ink); border-radius: var(--radius); padding: 9px 11px; font-size: .82rem; font-family: var(--font-mono); }
.newsletter button, .btn {
    background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
    padding: 9px 15px; font-weight: 600; cursor: pointer; font-size: .72rem; font-family: var(--font-mono);
    text-transform: uppercase; letter-spacing: .08em; transition: background .12s;
}
.newsletter button:hover, .btn:hover { background: var(--accent-ink); }

/* ---------- Breadcrumb / page head ---------- */
.breadcrumb { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: 26px 0 0; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 7px; opacity: .5; }
.page-head { padding: 28px 0 30px; border-bottom: 2px solid var(--ink); margin-bottom: 34px; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0 0 12px; line-height: 1.08; }

/* ---------- Post ---------- */
.post-head { padding: 26px 0 20px; max-width: 780px; }
.post-head h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin: 14px 0 16px; line-height: 1.08; }
.post-meta { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.post-meta strong { color: var(--ink); }
.post-cover-wrap { margin: 10px 0 40px; }
.post-cover { border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; aspect-ratio: 24 / 10; background: var(--paper-2); }
.cover-credit { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .02em; color: var(--muted); margin: 8px 0 0; }
.cover-credit a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.cover-credit a:hover { color: var(--accent); }
.post-body { font-size: 1.12rem; line-height: 1.72; max-width: 740px; color: var(--ink-2); }
.post-body > p:first-of-type::first-letter {
    float: left; font-family: var(--font-display); font-weight: 700; color: var(--accent);
    font-size: 3.4em; line-height: .76; padding: 6px 10px 0 0;
}
.post-body h2 { font-size: 1.5rem; margin: 38px 0 14px; color: var(--ink); padding-top: 8px; }
.post-body p { margin: 0 0 18px; }
.post-body ul { padding-left: 20px; margin: 0 0 20px; list-style: none; }
.post-body li { margin: 9px 0; padding-left: 18px; position: relative; }
.post-body li::before { content: '—'; position: absolute; left: -2px; color: var(--accent); font-weight: 600; }
.article-figure { margin: 28px 0; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.article-figure svg { aspect-ratio: 19 / 8; }
.article-figure figcaption { color: var(--muted); font-family: var(--font-mono); font-size: .72rem; padding: 10px 14px; border-top: 1px solid var(--rule); }
.post-tags { display: flex; align-items: center; gap: 12px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--rule-strong); }
.post-tags span { color: var(--muted); font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Related / pagination ---------- */
.related { margin: 52px 0 20px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 36px 0 8px; padding-top: 22px; border-top: 1px solid var(--rule-strong); }
.pagination a { border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 9px 16px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; transition: border-color .12s, color .12s; }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.page-of { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.empty { color: var(--muted); padding: 34px 0; }

/* ---------- About ---------- */
.prose-narrow { max-width: 760px; font-size: 1.08rem; color: var(--ink-2); line-height: 1.72; }
.prose-narrow p { margin: 0 0 18px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; margin: 24px 0 28px; background: var(--rule); border: 1px solid var(--rule); }
.topic-card { display: flex; flex-direction: column; gap: 5px; padding: 18px; background: var(--panel); border-left: 3px solid var(--chip); transition: background .12s; }
.topic-card:hover { background: #fbfcfd; }
.topic-card strong { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; }
.topic-card span { color: var(--ink-2); font-size: .88rem; }
.topic-card em { color: var(--chip); font-style: normal; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.disclaimer { color: var(--muted); font-size: .85rem; }
.btn { display: inline-block; margin-top: 16px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 3px solid var(--ink); margin-top: 70px; background: var(--panel); }
.footer-inner { padding: 40px 0; display: grid; grid-template-columns: 1.5fr 2fr; gap: 26px; align-items: start; }
.footer-inner strong { font-family: var(--font-display); font-size: 1.2rem; }
.footer-inner p { color: var(--muted); margin: 6px 0 0; font-size: .9rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.footer-nav a { color: var(--ink-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.footer-nav a:hover { color: var(--accent); }
.fineprint { grid-column: 1 / -1; color: var(--muted); font-size: .7rem; letter-spacing: .04em; border-top: 1px solid var(--rule); padding-top: 20px; margin-top: 12px; }

/* ---------- Page-load reveal (one orchestrated motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
    .featured, .grid > .card, .hero-copy { animation: rise .5s cubic-bezier(.2,.7,.2,1) backwards; }
    .hero-copy { animation-delay: .02s; }
    .featured { animation-delay: .08s; }
    .grid > .card:nth-child(1) { animation-delay: .12s; }
    .grid > .card:nth-child(2) { animation-delay: .17s; }
    .grid > .card:nth-child(3) { animation-delay: .22s; }
    .grid > .card:nth-child(4) { animation-delay: .27s; }
    .grid > .card:nth-child(5) { animation-delay: .31s; }
    .grid > .card:nth-child(6) { animation-delay: .35s; }
    .grid > .card:nth-child(n+7) { animation-delay: .39s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
/* Below the width where all sections fit, scroll from the first item
   (space-between would clip the start of an overflowing flex row). */
@media (max-width: 1080px) {
    .sectionbar-inner { justify-content: flex-start; gap: 26px; }
}
@media (max-width: 940px) {
    .layout-2col { grid-template-columns: 1fr; }
    .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
    .sidebar .widget { flex: 1; min-width: 240px; }
    .featured { grid-template-columns: 1fr; }
    .featured-cover { min-height: 210px; border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (max-width: 820px) {
    .masthead-edition { display: none; }
}
@media (max-width: 640px) {
    .wrap { padding: 0 18px; }
    .masthead { height: 66px; gap: 14px; }
    .brand-name { font-size: 1.4rem; }
    .sectionbar-inner { gap: 20px; }
    .footer-inner { grid-template-columns: 1fr; }
    .search input { width: 124px; }
    .post-body { font-size: 1.05rem; }
}
