:root {
  --bg: #fbfaf8;
  --text: #161616;
  --muted: #66605b;
  --line: #ddd8d0;
  --accent: #9d2f2f;
  --accent-dark: #742323;
  --paper: #ffffff;
  --max: 720px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  font-size: 18px;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.citation {
  font-size: 0.92em;
  font-weight: 650;
  text-decoration: none;
}

.citation:hover {
  text-decoration: underline;
}

.reference-target {
  scroll-margin-top: 24px;
}

.reference-target:target + .reference-number {
  background: rgba(157, 47, 47, 0.14);
  border-radius: 3px;
}

.reference-number {
  font-weight: 700;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.wrap {
  width: min(var(--page-max, var(--max)), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 248, 0.96);
}

.site-header .wrap {
  padding: 28px 0 18px;
}

.brand {
  display: inline-block;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.subtitle {
  max-width: 840px;
  margin: 8px 0 18px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

.nav a,
.nav summary {
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.nav a:hover,
.nav summary:hover {
  color: var(--accent);
}

.nav-categories {
  position: relative;
}

.category-menu {
  position: absolute;
  z-index: 4;
  display: grid;
  min-width: 280px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.category-menu a {
  padding: 5px 6px;
}

.main {
  --page-max: 1080px;
  padding: 44px 0 72px;
}

.post,
.page {
  max-width: var(--max);
  margin-inline: auto;
}

.intro {
  margin-bottom: 44px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3 {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(36px, 7vw, 64px);
}

.post-head h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
}

.prose h1 {
  margin: 24px 0 10px;
  font-size: 24px;
}

h2 {
  margin: 36px 0 10px;
  font-size: 28px;
}

h3 {
  margin: 28px 0 8px;
  font-size: 22px;
}

.intro p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
}

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

.index-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--max)) minmax(190px, 260px);
  gap: 44px;
  align-items: start;
}

.index-posts {
  min-width: 0;
}

.filter-bar {
  position: sticky;
  top: 18px;
  display: block;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
  font-size: 14px;
}

.filter-bar h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.filter-bar div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.filter-bar a,
.tag-list a {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--accent-dark);
  background: var(--paper);
  text-decoration: none;
}

.filter-bar a:hover,
.tag-list a:hover {
  border-color: var(--accent);
}

.filter-bar small {
  color: var(--muted);
  font-size: 11px;
}

.post-teaser {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.post-teaser h2 {
  margin: 4px 0 10px;
}

.post-teaser h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-teaser h2 a:hover {
  color: var(--accent);
}

.teaser-image {
  float: left;
  width: 30%;
  min-width: 140px;
  margin: 4px 18px 10px 0;
  overflow: hidden;
  background: var(--paper);
}

.teaser-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter 160ms ease;
}

.teaser-image:hover img,
.teaser-image:focus-visible img {
  filter: grayscale(0);
}

.post-teaser p {
  margin: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
}

.post-teaser::after {
  display: block;
  clear: both;
  content: "";
}

.meta,
.empty,
.more-link,
.archive-note,
.pagination,
.filter-bar,
.tag-list,
.editor-actions,
.post-navigation,
.share,
.site-footer {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.archive-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: #f1ede7;
  color: #3a3430;
  font-size: 14px;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 36px;
  font-size: 15px;
}

.pagination a:last-child {
  justify-self: end;
}

.pagination > span {
  color: var(--muted);
}

.post-head {
  margin-bottom: 30px;
}

.media-grid {
  display: grid;
  gap: 14px;
  margin: 0 0 32px;
}

.media-gallery {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(92px, 1fr);
  gap: 14px;
  align-items: start;
  margin: 0 0 32px;
}

.media-stage {
  margin: 0;
}

.media-thumbnails {
  display: grid;
  gap: 10px;
}

.media-thumb {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 2px solid transparent;
  background: var(--paper);
  cursor: pointer;
}

.media-thumb:hover,
.media-thumb:focus-visible,
.media-thumb.is-active {
  border-color: var(--accent);
}

.media-thumb img,
.thumb-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb-video {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.media-grid figure {
  margin: 0;
}

.media-grid img,
.media-grid video,
.media-stage img,
.media-stage video {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
}

.media-grid figcaption,
.media-stage figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  line-height: 1.35;
}

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

.prose p,
.prose li {
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  margin: 24px 0;
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

.prose th,
.prose td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.prose th {
  background: var(--paper);
  font-weight: 700;
}

.prose blockquote {
  margin: 28px 0;
  padding-left: 18px;
  border-left: 4px solid var(--line);
  color: #3f3b36;
}

.prose code {
  padding: 0.1em 0.25em;
  background: #eee8df;
  font-size: 0.92em;
}

.prose pre {
  overflow-x: auto;
  padding: 16px;
  background: #eee8df;
}

.podcast,
.shared-embed,
.share {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.podcast h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.podcast audio {
  width: 100%;
  max-width: 720px;
}

.shared-embed iframe {
  width: min(500px, 100%);
  max-width: 100%;
  background: var(--paper);
}

.shared-missing {
  margin-top: 34px;
  padding: 12px 14px;
  border-left: 4px solid var(--line);
  background: #f1ede7;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 15px;
}

.share button {
  appearance: none;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.share button:hover {
  color: var(--accent);
}

.share small {
  color: var(--muted);
  font-size: 13px;
}

.editor-actions {
  display: none;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 28px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

body.local-editor .editor-actions {
  display: flex;
}

.delete-post-button {
  appearance: none;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid #8c1f1f;
  background: #8c1f1f;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
}

.delete-post-button:hover {
  background: #6f1818;
}

.delete-post-button:disabled {
  border-color: var(--line);
  background: #7a7470;
  cursor: wait;
}

.delete-post-button span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1;
}

.editor-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.post-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.post-arrow {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.post-arrow:hover {
  border-color: var(--accent);
}

.post-arrow-next {
  justify-content: flex-end;
  text-align: right;
}

.arrow-symbol {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 30px;
  line-height: 1;
}

.arrow-label,
.arrow-title {
  display: block;
}

.arrow-label {
  color: var(--muted);
  font-size: 13px;
}

.arrow-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.35;
}

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-note {
  margin: 0;
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 760px) {
  .media-grid:has(figure:nth-child(2), video:nth-child(2)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .wrap {
    width: min(var(--page-max, var(--max)), calc(100% - 24px));
  }

  .site-header .wrap {
    padding-top: 22px;
  }

  .category-menu {
    position: fixed;
    right: 12px;
    left: 12px;
    min-width: 0;
  }

  .main {
    padding-top: 32px;
  }

  .index-layout {
    display: flex;
    flex-direction: column;
    gap: 34px;
  }

  .filter-bar {
    position: static;
    order: 2;
    width: 100%;
    padding-top: 24px;
    border-top: 1px solid var(--line);
  }

  .index-posts {
    order: 1;
    width: 100%;
  }

  .pagination {
    grid-template-columns: 1fr;
  }

  .pagination a:last-child {
    justify-self: start;
  }

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

  .media-gallery {
    grid-template-columns: 1fr;
  }

  .media-thumbnails {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .teaser-image {
    float: none;
    width: 100%;
    min-width: 0;
    margin: 12px 0;
  }
}
