:root {
  color-scheme: light dark;
  --background: #f4f2ec;
  --surface: #fffdf8;
  --header: #e3e8f8;
  --text: #172033;
  --muted: #5e6675;
  --line: #ccd2dc;
  --accent: #344f91;
  --accent-soft: #dce4ff;
  --focus: #8b3dff;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #171a1f;
    --surface: #1d222a;
    --header: #303d61;
    --text: #e8e9ed;
    --muted: #abb1bd;
    --line: #393f49;
    --accent: #afbeff;
    --accent-soft: #273253;
    --focus: #d8a8ff;
  }
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.site-header { background: var(--header); border-bottom: 1px solid var(--line); }
.nav-frame, .page-frame { width: min(72rem, calc(100% - 2rem)); margin-inline: auto; }
.site-header .nav-frame {
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.wordmark { color: var(--text); font-size: 1.05rem; font-weight: 750; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.site-header nav a { color: var(--text); text-decoration: none; }
.page-frame { min-height: calc(100vh - 10rem); padding-block: clamp(3rem, 8vw, 7rem); }
.page-intro { max-width: 49rem; margin-bottom: clamp(3rem, 8vw, 6rem); }
.page-intro.compact { margin-bottom: 3rem; }
.page-intro h1, .article-header h1 {
  max-width: 18ch;
  margin: 0.2rem 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.98;
}
.page-intro.compact h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); }
.page-intro > p:last-of-type, .standfirst {
  color: var(--muted);
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
}
.kicker, .entry-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.kicker a, .entry-meta a { color: inherit; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-heading h2 { font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase; }
.feed-list, .directory-list { border-top: 1px solid var(--line); }
.feed-entry, .directory-list article { padding-block: 2.25rem; border-bottom: 1px solid var(--line); }
.feed-entry h2, .directory-list h2 {
  max-width: 34ch;
  margin: 0.5rem 0 0.65rem;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4vw, 2.55rem);
  line-height: 1.08;
}
.feed-entry h2 a, .directory-list h2 a { color: var(--text); text-decoration: none; }
.entry-summary, .directory-list article > p:last-child { max-width: 48rem; color: var(--muted); }
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}
.tag-list a, .feed-link {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.8rem;
  text-decoration: none;
}
.tag-list a:hover, .feed-link:hover { background: var(--accent-soft); }
.tag-directory { max-width: 44rem; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.tag-directory li {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.reading-page { max-width: 48rem; margin-inline: auto; }
.article-header { margin-bottom: 3.5rem; }
.article-header h1 { max-width: 21ch; font-size: clamp(2.6rem, 6.5vw, 5rem); }
.prose { font-family: var(--serif); font-size: clamp(1.08rem, 2vw, 1.24rem); line-height: 1.5; }
.prose h2, .prose h3 { margin-top: 2.4em; line-height: 1.15; }
.prose h2 { font-size: 1.7em; }
.prose h3 { font-size: 1.32em; }
.prose pre { overflow-x: auto; padding: 1rem; background: var(--surface); border: 1px solid var(--line); }
.prose code { font-size: 0.88em; }
.prose blockquote {
  margin-inline: 0;
  padding-left: 1.25rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
}
.prose img { max-width: 100%; height: auto; }
.series-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.series-nav a { padding: 1rem; background: var(--surface); text-decoration: none; }
.series-nav a[rel="next"] { text-align: right; }
.series-nav span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.site-footer .nav-frame {
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 42rem) {
  .site-header .nav-frame {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
    padding-block: 1rem;
  }
  .site-header nav { gap: 0.45rem 0.9rem; }
  .page-frame { padding-block: 3rem; }
  .series-nav { grid-template-columns: 1fr; }
  .series-nav a[rel="next"] { text-align: left; }
}
