:root {
  color-scheme: light dark;
  --bg: #f5efe7;
  --bg-alt: #fffaf4;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text: #18212b;
  --muted: #5f6d7a;
  --border: rgba(24, 33, 43, 0.12);
  --accent: #16324f;
  --accent-2: #b35c1e;
  --shadow: 0 18px 40px rgba(24, 33, 43, 0.10);
  --radius: 22px;
  --radius-sm: 14px;
  --max-width: 74rem;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --bg-alt: #121b26;
    --surface: rgba(18, 27, 38, 0.84);
    --surface-strong: #13202d;
    --text: #eff4f8;
    --muted: #b0bcc7;
    --border: rgba(239, 244, 248, 0.12);
    --accent: #9cc7ff;
    --accent-2: #f4b26a;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #ffffff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--text);
  background: #ffffff;
}

a {
  color: #c61f1f;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #8f1313;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(-200%);
  z-index: 20;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

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

.site-shell {
  width: min(100% - 1.5rem, var(--max-width));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.site-header {
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: stretch;
  margin: 0 0 1.5rem;
  padding: 0 0 1rem;
}

.brand-block {
  display: block;
}

.header-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
}

.site-title {
  display: inline-flex;
  align-items: stretch;
  color: #fff;
  font-family: var(--font-body);
  font-weight: bold;
  font-size: clamp(1.15rem, 1vw + 1rem, 1.65rem);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover,
.site-title:focus,
.site-title:active,
.site-title:visited {
  color: #fff;
  text-decoration: none;
}

.site-title__box {
  display: grid;
  gap: 0;
  min-width: min(13rem, 100%);
  padding: 0.8rem 1rem;
  border: 5px solid #111111;
  border-radius: 0;
  background: #000;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset;
}

.site-title__word {
  display: block;
  line-height: 1.15;
  text-transform: uppercase;
}

.site-title__word--last {
  display: inline-flex;
  align-items: baseline;
}

.site-title__period {
  color: #c61f1f;
}

.site-tagline {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  text-align: right;
}

.site-nav ul,
.social-links,
.topic-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.social-links a,
.footer-actions a,
.topic-chip,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.6rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #c61f1f;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
  backdrop-filter: blur(14px);
}

.site-nav a[aria-current="page"],
.social-links a:hover,
.footer-actions a:hover,
.topic-chip:hover,
.button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, #c61f1f 55%, var(--border));
}

.site-nav a,
.social-links a,
.footer-actions a,
.topic-chip,
.button,
.page-card a,
.section-card a,
.pager a,
.toc a,
.prose a {
  color: #c61f1f;
}

.site-nav a:hover,
.social-links a:hover,
.footer-actions a:hover,
.topic-chip:hover,
.button:hover,
.page-card a:hover,
.section-card a:hover,
.pager a:hover,
.toc a:hover,
.prose a:hover {
  color: #8f1313;
}

.site-nav a {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c61f1f;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.18em;
  backdrop-filter: none;
  transition: color 160ms ease;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: #8f1313;
}

.site-main {
  display: grid;
  gap: 1.25rem;
}

.card,
.page-hero,
.site-footer,
.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.card,
.page-hero,
.site-footer {
  padding: clamp(1.2rem, 1vw + 1rem, 2rem);
}

.card--soft,
.toc {
  background: var(--surface-strong);
}

.hero,
.page-hero {
  position: relative;
  overflow: hidden;
}

.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  inset: auto -8rem -8rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  pointer-events: none;
}

.hero {
  display: grid;
  gap: 1.5rem;
}

.hero-copy,
.hero-prose {
  position: relative;
  z-index: 1;
}

.page-hero--compact {
  padding-bottom: 1.4rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
}

h1 {
  font-size: clamp(2.2rem, 4vw + 1rem, 4.4rem);
}

h2 {
  font-size: clamp(1.4rem, 1.8vw + 1rem, 2.2rem);
}

h3 {
  font-size: clamp(1.1rem, 1vw + 1rem, 1.45rem);
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions,
.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  font-weight: 700;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-secondary {
  background: transparent;
}

.home-grid,
.card-grid {
  display: grid;
  gap: 1.25rem;
}

.home-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 1fr);
}

.panel {
  display: block;
}

.panel > * + * {
  margin-top: 1rem;
}

.panel-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
}

.panel-header a {
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack-compact {
  gap: 0.85rem;
}

.page-card,
.section-card,
.archive-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.page-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
}

.page-card h3 {
  margin-bottom: 0.35rem;
}

.page-card p,
.section-card p,
.archive-item p,
.site-footer p {
  margin: 0;
  color: var(--muted);
}

.page-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.92rem;
}

.page-card__meta span::before,
.post-meta span::before {
  content: "•";
  margin-right: 0.55rem;
  color: var(--border);
}

.card-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.section-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
}

.section-card p {
  text-decoration: none;
}

.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.topic-cloud--tight {
  gap: 0.5rem;
}

.topic-chip {
  font-size: 0.95rem;
}

.topic-chip span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.topic-chip span::before {
  content: "(";
}

.topic-chip span::after {
  content: ")";
}

.callout {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(22, 50, 79, 0.06), rgba(179, 92, 30, 0.06));
}

.article {
  display: grid;
  gap: 1.25rem;
}

.article-header {
  display: grid;
  gap: 0.75rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--muted);
}

.prose {
  max-width: 72ch;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table,
.prose figure,
.prose .highlight {
  margin: 0 0 1.1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose blockquote {
  padding: 0.8rem 1rem;
  border-inline-start: 4px solid var(--accent-2);
  background: rgba(179, 92, 30, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose em,
.prose i,
em,
i {
  font-style: italic;
  padding: 0.03em 0.14em 0.1em 0.24em;
  margin: 0 -0.05em 0 -0.11em;
  border-radius: 0.36em 0.18em 0.24em 0.3em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image:
    radial-gradient(
      125% 125% at -4% 62%,
      rgba(255, 232, 107, 0.98) 0%,
      rgba(255, 232, 107, 0.78) 38%,
      rgba(255, 232, 107, 0.16) 68%,
      rgba(255, 232, 107, 0) 82%
    ),
    linear-gradient(
      174deg,
      rgba(255, 232, 107, 0) 0%,
      rgba(255, 232, 107, 0) 34%,
      rgba(255, 232, 107, 0.9) 35%,
      rgba(255, 232, 107, 0.78) 100%
    ),
    radial-gradient(
      150% 82% at 14% 88%,
      rgba(255, 232, 107, 0.36) 0%,
      rgba(255, 232, 107, 0) 62%
    ),
    radial-gradient(
      162% 72% at 88% 86%,
      rgba(255, 232, 107, 0.22) 0%,
      rgba(255, 232, 107, 0) 62%
    );
  background-size: 100% 100%, 100% 100%, 88% 100%, 100% 100%;
  background-position: -0.05em 0, 0 0, -0.08em 0.02em, 0 0;
}

body.section-stories .prose em,
body.section-stories .prose i,
body.section-stories em,
body.section-stories i {
  padding: 0;
  margin: 0;
  border-radius: 0;
  -webkit-box-decoration-break: slice;
  box-decoration-break: slice;
  background: none;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.heading-anchor {
  margin-inline-start: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
h5:hover .heading-anchor,
h6:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.toc {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
}

.toc nav ul {
  padding-left: 1.2rem;
  margin: 0;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.topic-list__label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.topic-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.topic-list a {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  text-decoration: none;
}

.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.pager__item {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  text-decoration: none;
}

.pager__item--next {
  text-align: right;
}

.site-footer {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.footer-title {
  color: var(--text) !important;
  font-weight: 700;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.media--image figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.archives {
  scroll-margin-top: 1rem;
}

.archive-year {
  padding: 1rem;
}

.archive-item {
  padding: 0.95rem 1rem;
}

.archive-item h3 {
  margin-top: 0.25rem;
}

.track-card {
  grid-template-columns: 3.2rem minmax(0, 1fr);
  align-items: center;
}

.track-card__index {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 1rem 0 1rem 1rem;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(22, 50, 79, 0.12), rgba(179, 92, 30, 0.16));
  font-family: var(--font-display);
  font-weight: 700;
}

@media (max-width: 56rem) {
  .site-header,
  .panel-header,
  .home-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .site-header,
  .panel-header {
    align-items: start;
  }

  .header-side {
    align-items: flex-start;
  }

  .site-tagline {
    text-align: left;
  }

  .site-nav ul {
    justify-content: flex-start;
  }
}

@media (max-width: 42rem) {
  .site-shell {
    width: min(100% - 1rem, var(--max-width));
  }

  .site-header {
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .button,
  .social-links a,
  .footer-actions a,
  .topic-chip {
    width: 100%;
    justify-content: center;
  }

  .hero-actions,
  .footer-actions,
  .social-links,
  .site-nav ul {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
