:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #fbfcfa;
  --surface-strong: #ffffff;
  --ink: #171a18;
  --muted: #69736e;
  --soft: #88938d;
  --line: #d9dfda;
  --green: #2e6b4e;
  --blue: #315f99;
  --rust: #9f513f;
  --gold: #8b6d2f;
  --shadow: 0 18px 48px rgba(31, 39, 34, 0.09);
  --content: 1180px;
  --article: 760px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111412;
  --surface: #171b18;
  --surface-strong: #1d231f;
  --ink: #edf2ed;
  --muted: #a5b0aa;
  --soft: #7f8b84;
  --line: #303a34;
  --green: #7bb58f;
  --blue: #85a9dd;
  --rust: #d08371;
  --gold: #d3b667;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 32px, var(--content));
  min-height: 72px;
  margin: 0 auto;
  padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
}

.nav-links a:hover,
.icon-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.icon-button {
  width: 36px;
  padding: 0;
}

main {
  width: min(100% - 32px, var(--content));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 40px;
  align-items: end;
  padding: 52px 0 44px;
  border-bottom: 1px solid var(--line);
}

.home-hero__intro {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.home-hero h1 {
  font-size: 4rem;
  font-weight: 800;
}

.lede {
  max-width: 670px;
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.3rem;
}

.home-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.home-hero__stats div {
  min-height: 108px;
  padding: 18px;
  background: var(--surface);
}

.home-hero__stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.2;
}

.home-hero__stats span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.content-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  padding-top: 42px;
}

.side-panel {
  position: sticky;
  top: 96px;
  align-self: start;
}

.side-panel h2,
.stream-header h2,
.featured-band h2,
.toc h2 {
  font-size: 1.1rem;
}

.filter-group {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.filter-group button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  text-align: left;
}

.filter-group button:hover,
.filter-group button.is-active {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: var(--surface-strong);
}

.filter-group span {
  color: var(--soft);
  font-size: 0.82rem;
}

.stream-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.search-box {
  display: grid;
  gap: 6px;
  width: min(100%, 310px);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-strong);
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  min-height: 178px;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.post-card[hidden] {
  display: none;
}

.post-card__body {
  padding: 22px;
}

.post-card__meta,
.article-meta {
  color: var(--soft);
  font-size: 0.86rem;
}

.post-card h2 {
  max-width: 680px;
  margin-top: 8px;
  font-size: 1.35rem;
}

.post-card h2 a {
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--blue);
}

.post-card p {
  margin: 12px 0 0;
  color: var(--muted);
}

.post-card__media,
.post-card__mark {
  min-height: 178px;
  color: var(--surface-strong);
  background: var(--ink);
  text-decoration: none;
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card__media img[src$=".svg"] {
  padding: 14px;
  background: var(--surface-strong);
  object-fit: contain;
}

.post-card__mark {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.post-card__mark span {
  font-family: var(--serif);
  font-size: 2rem;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.featured-band {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  margin-top: 52px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.featured-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.featured-links a {
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.featured-links a:hover {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: var(--surface-strong);
}

.featured-links span {
  display: block;
  margin-bottom: 8px;
  color: var(--rust);
  font-size: 0.8rem;
  font-weight: 800;
}

.page-heading {
  max-width: 760px;
  padding: 52px 0 34px;
}

.about-page {
  max-width: 860px;
  min-height: 62vh;
  padding: 76px 0 34px;
}

.about-page h1 {
  font-size: 4rem;
}

.about-copy {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.about-copy p {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.78;
}

.page-heading h1 {
  font-size: 3rem;
}

.page-heading p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.archive-list {
  display: grid;
  gap: 28px;
  max-width: 840px;
}

.archive-year {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.archive-year h2 {
  color: var(--green);
  font-size: 1.4rem;
}

.archive-year ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-year li {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 16px;
}

.archive-year time {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}

.archive-year a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.archive-year a:hover {
  color: var(--blue);
}

.article-layout {
  width: 100%;
  padding-top: 36px;
}

.article-header {
  max-width: var(--article);
  margin: 0 auto 32px;
}

.back-link,
.text-link {
  display: inline-flex;
  margin-bottom: 22px;
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover,
.text-link:hover {
  color: var(--blue);
}

.article-header h1 {
  margin-top: 10px;
  font-size: 3.2rem;
}

.article-header p:last-child {
  margin: 18px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.14rem;
}

.article-body-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--article)) minmax(170px, 1fr);
  gap: 28px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 100px;
  grid-column: 1;
  justify-self: end;
  width: min(100%, 210px);
  padding-top: 4px;
}

.toc h2 {
  margin-bottom: 12px;
  color: var(--soft);
}

.toc a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  text-decoration: none;
}

.toc a:hover {
  color: var(--blue);
}

.toc .toc-level-2 {
  padding-left: 12px;
}

.article-content {
  grid-column: 2;
  min-width: 0;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.82;
}

.article-content > *:first-child {
  margin-top: 0;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 2.2em 0 0.7em;
  font-family: var(--sans);
  line-height: 1.25;
}

.article-content h1 {
  font-size: 2rem;
}

.article-content h2 {
  font-size: 1.55rem;
}

.article-content h3 {
  font-size: 1.25rem;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote {
  margin: 1em 0;
}

.article-content a {
  color: var(--blue);
}

.article-content img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.article-figure {
  margin: 30px 0;
}

.article-figure img {
  width: 100%;
  margin: 0 auto;
}

.article-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
}

.article-content pre {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
}

.article-content code {
  font-family: var(--mono);
  font-size: 0.92em;
}

.article-content :not(pre) > code {
  padding: 0.12em 0.28em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.article-content blockquote {
  margin-left: 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--green);
  color: var(--muted);
}

.article-content table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
}

.article-content th,
.article-content td {
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.katex {
  font-size: 1em;
}

.article-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: var(--article);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-footer a {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.article-footer a:hover {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: var(--surface-strong);
}

.article-footer span {
  display: block;
  margin-bottom: 6px;
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.not-found {
  min-height: 52vh;
}

@media (max-width: 980px) {
  .home-hero,
  .content-shell,
  .featured-band {
    grid-template-columns: 1fr;
  }

  .home-hero {
    gap: 26px;
  }

  .home-hero h1 {
    font-size: 3rem;
  }

  .side-panel {
    position: static;
  }

  .filter-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-body-shell {
    display: block;
  }

  .toc {
    position: static;
    width: 100%;
    max-width: var(--article);
    margin: 0 auto 28px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .article-content {
    max-width: var(--article);
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  .topbar {
    min-height: 72px;
    padding-top: 12px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  main {
    width: min(100% - 24px, var(--content));
    padding-top: 18px;
  }

  .home-hero {
    padding-top: 24px;
  }

  .home-hero h1,
  .about-page h1,
  .page-heading h1,
  .article-header h1 {
    font-size: 2.35rem;
  }

  .lede,
  .article-header p:last-child {
    font-size: 1.02rem;
  }

  .home-hero__stats,
  .filter-group,
  .featured-links,
  .article-footer {
    grid-template-columns: 1fr;
  }

  .stream-header {
    display: grid;
    align-items: start;
  }

  .search-box {
    width: 100%;
  }

  .post-card {
    grid-template-columns: 1fr;
  }

  .post-card__media,
  .post-card__mark {
    order: -1;
    min-height: 160px;
    max-height: 210px;
  }

  .archive-year,
  .archive-year li {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .article-content {
    font-size: 1rem;
    line-height: 1.75;
  }
}
