:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --sunken: #ece9e1;
  --ink: #17181c;
  --ink-2: #4b4e57;
  --ink-3: #777a84;
  --line: #dedad0;
  --accent: #c8401f;
  --accent-ink: #ffffff;
  --mark: #ffe58a;
  --ok: #1d7a4c;
  --bad: #b3261e;
  --article: #2f5fd0;
  --video: #c8401f;
  --release: #1d7a4c;
  --project: #7a4bc4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 10px;
  --wrap: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114;
    --surface: #181a1f;
    --sunken: #1f2228;
    --ink: #eceae4;
    --ink-2: #b4b6bd;
    --ink-3: #868993;
    --line: #2b2e36;
    --accent: #ff7d5c;
    --accent-ink: #1a0f0b;
    --mark: #6b5a12;
    --ok: #5fd39a;
    --bad: #ff8a80;
    --article: #8fb0ff;
    --video: #ff9a80;
    --release: #6fd6a3;
    --project: #c3a2f5;
  }
}
:root[data-theme="dark"] {
  --bg: #101114;
  --surface: #181a1f;
  --sunken: #1f2228;
  --ink: #eceae4;
  --ink-2: #b4b6bd;
  --ink-3: #868993;
  --line: #2b2e36;
  --accent: #ff7d5c;
  --accent-ink: #1a0f0b;
  --mark: #6b5a12;
  --ok: #5fd39a;
  --bad: #ff8a80;
  --article: #8fb0ff;
  --video: #ff9a80;
  --release: #6fd6a3;
  --project: #c3a2f5;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 7rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-block: 1.75rem 3.5rem; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--sunken); padding: 0.1em 0.4em; border-radius: 5px; }
mark { background: var(--mark); color: inherit; padding: 0 0.1em; border-radius: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, select { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 0.5rem 0.9rem; z-index: 20; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 1rem; padding-block: 0.8rem 0.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand svg { color: var(--accent); }
.brand:hover { color: var(--ink); }
.search-box { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex: 0 1 340px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; color: var(--ink-3); }
.search-box:focus-within { border-color: var(--accent); }
.search-box input { border: 0; background: none; outline: none; width: 100%; min-width: 0; color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { color: var(--accent); }
.site-nav { display: flex; gap: 1.4rem; overflow-x: auto; scrollbar-width: none; font-size: 0.93rem; font-weight: 500; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { padding-block: 0.55rem 0.65rem; color: var(--ink-2); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav-gap { flex: 1; min-width: 0.5rem; }

/* Shared bits */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; font-size: 0.78rem; color: var(--ink-3); }
.meta-source { font-weight: 600; color: var(--ink-2); }
.kind { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.kind-article { color: var(--article); }
.kind-video { color: var(--video); }
.kind-release { color: var(--release); }
.kind-project { color: var(--project); }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 0 0.45rem; font-size: 0.7rem; }
.excerpt { color: var(--ink-2); font-size: 0.92rem; overflow-wrap: anywhere; }
.note { font-size: 0.78rem; color: var(--ink-3); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-top: 2px solid var(--ink); padding-top: 0.6rem; margin: 2.75rem 0 1rem; }
.section-head h2 { font-size: 1.3rem; }
.section-head a, .link-btn { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover, .section-head a:hover { color: var(--accent); }
.split > section > .section-head:first-child, .rail > section:first-child > .section-head { margin-top: 0; }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.page-head p { color: var(--ink-2); margin-top: 0.4rem; max-width: 62ch; }

.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: var(--sunken) repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--line) 60%, transparent) 14px 15px); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-logo img { object-fit: contain; padding: 14%; }
.thumb-sm { width: 132px; }
.thumb .play { position: absolute; inset: auto auto 0.5rem 0.5rem; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: rgb(0 0 0 / 0.72); color: #fff; }
img.is-broken { display: none; }

.avatar { display: block; width: 2.5rem; height: 2.5rem; flex: none; border-radius: 9px; overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 4rem; height: 4rem; border-radius: 14px; }

.save { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 0; background: none; color: var(--ink-3); cursor: pointer; }
.save svg { fill: none; }
.save:hover { color: var(--accent); background: var(--sunken); }
.save[aria-pressed="true"] { color: var(--accent); }
.save[aria-pressed="true"] svg { fill: currentColor; }

.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.save-wide .when-on, .save-wide[aria-pressed="true"] .when-off { display: none; }
.save-wide[aria-pressed="true"] .when-on { display: inline; }
.save-wide[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-block: 1.25rem; }
.chips-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-right: 0.3rem; }
.chip { display: inline-flex; gap: 0.4rem; align-items: baseline; padding: 0.25rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.84rem; color: var(--ink-2); white-space: nowrap; }
.chip span { font-size: 0.72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 2rem; }
.lead { position: relative; }
.lead .thumb { margin-bottom: 1rem; }
.lead h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-block: 0.4rem 0.6rem; }
.lead .excerpt { font-size: 1.02rem; max-width: 60ch; }
.lead .save { position: absolute; top: 0.6rem; right: 0.6rem; background: var(--surface); }
.hero-side { display: flex; flex-direction: column; }
.hero-side .row:first-child { padding-top: 0; }

/* Rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; gap: 1rem; align-items: flex-start; padding-block: 1rem; border-bottom: 1px solid var(--line); }
.rows .row:last-child, .hero-side .row:last-child { border-bottom: 0; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.row h3 { font-size: 1.1rem; }
.row-tight h3 { font-size: 1.02rem; }
.rows-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; }
.rows-2 .row:nth-last-child(2):nth-child(odd) { border-bottom: 0; }

/* Layout */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 3rem; margin-top: 2.75rem; }
.rail { display: flex; flex-direction: column; min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.75rem 1.5rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-projects { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.card { position: relative; display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.card-body { display: flex; flex-direction: column; gap: 0.35rem; padding-right: 1.75rem; }
.card h3 { font-size: 1.08rem; }
.card .save { position: absolute; right: -0.4rem; bottom: -0.35rem; }

.ranked { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranked li { counter-increment: rank; display: grid; grid-template-columns: 2rem 1fr; padding-block: 0.7rem; border-bottom: 1px solid var(--line); }
.ranked li::before { content: counter(rank); grid-row: span 2; font-family: var(--serif); font-size: 1.5rem; line-height: 1.1; color: var(--accent); }
.ranked a { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
.ranked li:last-child { border-bottom: 0; }

.release-list { display: flex; flex-direction: column; }
.release { display: flex; gap: 0.8rem; align-items: center; padding-block: 0.7rem; border-bottom: 1px solid var(--line); }
.release:last-child { border-bottom: 0; }
.release h3 { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.release h3 code { font-weight: 500; }

.project { display: flex; flex-direction: column; gap: 0.7rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.project-head { display: flex; gap: 0.75rem; align-items: center; }
.project-head > div { flex: 1; min-width: 0; }
.project h3 { font-family: var(--sans); font-size: 1rem; letter-spacing: 0; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto; font-size: 0.74rem; color: var(--ink-2); }
.facts span { background: var(--sunken); border-radius: 5px; padding: 0.1rem 0.45rem; }
.facts:empty { display: none; }

/* Filters, forms */
.filters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem 2rem; margin-bottom: 1.5rem; }
.filters .chips { margin: 0; flex: 1 1 520px; }
.source-filter { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--ink-2); }
select, input[type="date"], .search-form input { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 0.45rem 0.7rem; min-width: 0; }
.search-form { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.search-form input { flex: 1 1 280px; font-size: 1.05rem; padding: 0.6rem 0.9rem; }
.result-count { color: var(--ink-2); font-size: 0.92rem; margin-bottom: 0.5rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.5rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.plain-list li:last-child { border-bottom: 0; }
.day-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.day-nav > :last-child { justify-self: end; }
.day-nav > :first-child { justify-self: start; }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-weight: 500; }
.pagination > :last-child { justify-self: end; }
.page-count { color: var(--ink-3); font-size: 0.85rem; font-weight: 400; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 4rem 1rem 1.5rem; }
.empty h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.empty p { color: var(--ink-2); max-width: 46ch; margin-inline: auto; }

/* Story page */
.story { max-width: 780px; margin-inline: auto; }
.story-video { max-width: 960px; }
.crumbs { display: flex; gap: 0.5rem; font-size: 0.82rem; color: var(--ink-3); margin-bottom: 1rem; }
.crumbs a { color: var(--ink-2); font-weight: 500; }
.story-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; }
.story-head h1 { font-size: clamp(1.8rem, 4.4vw, 2.7rem); margin-bottom: 0.7rem; overflow-wrap: anywhere; }
.story-head .meta { font-size: 0.85rem; }
.story-image { margin: 0 0 1.5rem; border-radius: var(--radius); overflow: hidden; background: var(--sunken); }
.story-image img { width: 100%; max-height: 460px; object-fit: cover; }
.story-image:has(img.is-broken) { display: none; }
.player { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 1.5rem; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.story-text { font-family: var(--serif); font-size: 1.14rem; line-height: 1.7; overflow-wrap: anywhere; }
.story-text p + p { margin-top: 1em; }
.story-text h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }
.story-release .story-text, .story-video .story-text, .story-project .story-text { font-family: var(--sans); font-size: 0.98rem; line-height: 1.6; }
.story-text .bullet { padding-left: 1.1em; text-indent: -1.1em; }
.story-text .bullet + .bullet { margin-top: 0.35em; }
.story-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-block: 1.75rem 1rem; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 0 0 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fact-grid div { padding: 0.7rem 0.9rem; min-width: 0; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.fact-grid dt { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.fact-grid dd { margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.fact-grid a { text-decoration: underline; text-underline-offset: 3px; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.table th, .table td { padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td:first-child { white-space: normal; font-weight: 500; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 2rem; }
.status { font-size: 0.8rem; color: var(--ink-3); }
.status-ok { color: var(--ok); }
.status-bad { color: var(--bad); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--ink-3); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; padding-block: 1.5rem; }
.footer-row p { max-width: 60ch; }
.footer-row nav { display: flex; gap: 1.25rem; }
.footer-row a { color: var(--ink-2); }

@media (max-width: 960px) {
  .hero, .split { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .split { margin-top: 2rem; }
  .rail > section:first-child > .section-head { margin-top: 1.5rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rows-2 { grid-template-columns: minmax(0, 1fr); }
  .rows-2 .row:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .wrap { padding-inline: 1rem; }
  .header-row { flex-wrap: wrap; row-gap: 0.6rem; }
  .brand { margin-right: auto; }
  .search-box { order: 3; flex: 1 1 100%; margin-left: 0; }
  .thumb-sm { width: 96px; }
  .row h3 { font-size: 1rem; }
  .row .excerpt { display: none; }
  .grid, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .section-head { margin-top: 2.25rem; }
  .day-nav .btn { padding-inline: 0.7rem; font-size: 0.82rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .thumb img { transition: transform 0.35s ease; }
  .card:hover .thumb img, .row:hover .thumb img, .lead:hover .thumb img { transform: scale(1.03); }
}
