/* The blog, on the site's paper and midnight: serif headlines, quiet details, and the writing.
   These classes belong to the CMS templates alone; the shared site stylesheet is not changed. */

/* The blog's topbar and banner share the same horizontal sky, without a color seam. */
.blog-bar,
.blog-index-banner {
  --fg: #fdf3dc;
  --fg-muted: #e0d9f2;
  --fg-faint: #d0c7e7;
  --bg-elev: rgba(253, 243, 220, 0.08);
  --bg-hover: rgba(253, 243, 220, 0.12);
  --border-strong: rgba(253, 243, 220, 0.4);
  --accent: #f3d9a4;
  --accent-fg: #2a2550;
  --accent-hover: #fdf3dc;
  --accent-soft: rgba(243, 217, 164, 0.15);
  --focus-ring: 0 0 0 2px #3d3182, 0 0 0 4px #fdf3dc;
  color: var(--fg);
  background:
    radial-gradient(circle at 8% 24%, #fdf3dc 0 1.5px, transparent 2px),
    radial-gradient(circle at 17% 68%, rgba(253, 243, 220, 0.7) 0 1px, transparent 1.5px),
    radial-gradient(circle at 29% 12%, rgba(253, 243, 220, 0.8) 0 1px, transparent 1.5px),
    radial-gradient(circle at 41% 84%, rgba(253, 243, 220, 0.5) 0 1px, transparent 1.5px),
    radial-gradient(circle at 58% 9%, rgba(253, 243, 220, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 71% 78%, rgba(253, 243, 220, 0.75) 0 1.5px, transparent 2px),
    radial-gradient(circle at 83% 30%, #fdf3dc 0 1px, transparent 1.5px),
    radial-gradient(circle at 93% 62%, rgba(253, 243, 220, 0.6) 0 1px, transparent 1.5px),
    linear-gradient(90deg, #2a2550, #3d3182 55%, #6a4fc4);
}
.blog-bar {
  /* Opaque dropdown surfaces stay readable over the articles while the bar is sticky. */
  --bg-elev: #30265e;
}

/* ---------- Landing page ---------- */
.blog-index {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem) clamp(3.5rem, 8vw, 6rem);
}
.blog-index-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
  max-width: 70rem;
  margin: 0 auto;
  padding: clamp(1.75rem, 3.5vw, 2.5rem) clamp(1rem, 4vw, 2.5rem);
}
.blog-index-title {
  flex: 1 1 16rem;
  min-width: 0;
}
.blog-index-header h1 {
  font: 600 clamp(2.6rem, 7vw, 4rem) / 1.05 var(--font-serif);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.blog-index-title p {
  max-width: 40rem;
  margin: 0.9rem 0 0;
  color: var(--fg-muted);
  font-size: 1.1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.blog-index-tools {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 0.35rem;
}
.blog-search {
  position: relative;
  flex: 1 1 auto;
  width: 17rem;
  min-width: 0;
  margin: 0;
}
.blog-search input {
  width: 100%;
  height: 2.6rem;
  padding: 0 2.75rem 0 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg);
  font: 0.92rem var(--font-ui);
  -webkit-appearance: none;
  appearance: none;
}
.blog-search input::placeholder {
  color: var(--fg-faint);
  opacity: 1;
}
.blog-search input::-webkit-search-cancel-button {
  display: none;
}
.blog-search input:focus-visible {
  border-color: var(--accent);
  border-radius: 999px;
}
.blog-search button {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--fg-muted);
  cursor: pointer;
}
.blog-search button:hover {
  background: var(--bg-hover);
  color: var(--fg);
}
.blog-search button:focus-visible {
  border-radius: 50%;
}
.blog-rss {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.25rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.blog-rss:hover {
  color: var(--fg);
}
.blog-rss .icon {
  width: 1em;
  height: 1em;
}
.blog-filter {
  margin: 1.75rem 0 0;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}
.blog-filter a {
  margin-left: 0.6rem;
  white-space: nowrap;
}

.blog-posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.75rem, 5vw, 4rem) clamp(2rem, 4.5vw, 3.75rem);
  padding: clamp(2rem, 4vw, 3rem) 0 0;
}
/* The whole card opens the post: its title's link stretches over the card. */
.blog-post-card {
  position: relative;
  min-width: 0;
}
.blog-post-image {
  overflow: hidden;
  margin-bottom: 1.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-l);
  background: var(--bg-sunken);
  aspect-ratio: 16 / 9;
}
.blog-post-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.blog-post-text {
  min-width: 0;
}
.blog-post-kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.blog-post-card h2 {
  font: 600 clamp(1.45rem, 2.4vw, 1.75rem) / 1.22 var(--font-serif);
  letter-spacing: -0.018em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.blog-post-card h2 a {
  color: var(--fg);
  text-decoration: none;
}
.blog-post-card h2 a::after {
  content: '';
  position: absolute;
  inset: -0.6rem;
  border-radius: calc(var(--radius-l) + 0.5rem);
}
.blog-post-card:hover h2 a {
  color: var(--accent);
}
.blog-post-card h2 a:focus-visible {
  box-shadow: none;
}
.blog-post-card h2 a:focus-visible::after {
  box-shadow: var(--focus-ring);
}
.blog-post-excerpt {
  margin: 0.7rem 0 0;
  color: var(--fg-muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.blog-post-meta {
  margin: 1rem 0 0;
  color: var(--fg-faint);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}
/* The newest post leads the first page, with its picture beside it. */
.blog-post-lead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 4.5vw, 3.75rem);
  padding-bottom: clamp(2.75rem, 5vw, 4rem);
  border-bottom: 1px solid var(--border);
}
.blog-post-lead h2 a::after {
  bottom: calc(clamp(2.75rem, 5vw, 4rem) - 0.6rem);
}
.blog-post-lead .blog-post-image {
  margin-bottom: 0;
  box-shadow: var(--shadow);
}
.blog-post-lead .blog-post-text:only-child {
  grid-column: 1 / -1;
  max-width: 44rem;
}
.blog-post-lead h2 {
  font-size: clamp(1.75rem, 3.1vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.blog-post-lead .blog-post-excerpt {
  margin-top: 0.9rem;
  font-size: 1.1rem;
}
.blog-empty {
  grid-column: 1 / -1;
  margin: 0.5rem 0 2rem;
  color: var(--fg-muted);
  font: 400 1.25rem / 1.5 var(--font-serif);
}
.blog-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-strong);
  color: var(--fg-faint);
  font-size: 0.92rem;
}
.blog-pagination > :last-child {
  text-align: right;
}
.blog-pagination a {
  font-weight: 600;
  text-decoration: none;
}
.blog-pagination a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
@media (max-width: 46rem) {
  .blog-index-tools {
    flex: 1 1 100%;
  }
  .blog-posts {
    grid-template-columns: minmax(0, 1fr);
  }
  .blog-post-lead {
    display: block;
  }
  .blog-post-lead .blog-post-image {
    margin-bottom: 1.4rem;
  }
}

/* ---------- Article ---------- */
.post-header {
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) clamp(1rem, 4vw, 2.5rem) 0;
  text-align: center;
}
.post-kicker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.6rem;
  margin: 0 0 1.3rem;
  color: var(--fg-faint);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}
.post-kicker a {
  font-weight: 600;
  text-decoration: none;
}
.post-kicker a:hover,
.post-back:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.post-header h1 {
  font: 600 clamp(2.1rem, 5.2vw, 3.5rem) / 1.1 var(--font-serif);
  letter-spacing: -0.028em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.post-deck {
  max-width: 40rem;
  margin: 1.3rem auto 0;
  color: var(--fg-muted);
  font: 400 clamp(1.12rem, 2.2vw, 1.3rem) / 1.5 var(--font-serif);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.post-meta {
  margin: 1.6rem 0 0;
  color: var(--fg-faint);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.post-author {
  color: var(--fg);
  font-weight: 500;
}
.post-cover {
  box-sizing: content-box;
  max-width: 56rem;
  margin: clamp(2rem, 5vw, 3.25rem) auto 0;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}
.post-cover img,
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}

/* One reading column. On a wide window the contents sit beside it and follow along. */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 41rem);
  justify-content: center;
  padding: clamp(2.25rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem) 0;
}
.post-story {
  min-width: 0;
}
.post-toc {
  display: none;
}
.post-toc ol,
.post-toc-inline ol,
.post-more ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.post-toc-inline {
  margin: 0 0 2.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-l);
  background: var(--bg-elev);
  font-size: 0.95rem;
}
.post-toc-inline summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-l);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.post-toc-inline summary::-webkit-details-marker {
  display: none;
}
.post-toc-inline summary::after {
  content: '';
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: -0.2rem;
  border: solid var(--fg-muted);
  border-width: 0 1.75px 1.75px 0;
  rotate: 45deg;
}
.post-toc-inline[open] summary::after {
  margin-top: 0.25rem;
  rotate: 225deg;
}
.post-toc-inline ol {
  padding: 0 1.1rem 0.6rem;
}
.post-toc-inline a {
  display: block;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.post-toc-inline a:hover,
.post-toc a:hover {
  color: var(--fg);
}

.post-body {
  font-family: var(--font-serif);
  font-size: clamp(1.06rem, 0.99rem + 0.36vw, 1.17rem);
  line-height: 1.72;
  overflow-wrap: break-word;
}
.post-body p,
.post-body ul,
.post-body ol {
  margin: 1.15em 0 0;
}
.post-body > :first-child > :first-child {
  margin-top: 0;
}
/* The opening paragraph is set a size larger. */
.post-body > .block-paragraph:first-child > p:first-child {
  font-size: 1.12em;
  line-height: 1.62;
}
.post-body h2 {
  margin: clamp(2.75rem, 6vw, 3.5rem) 0 0;
  font: 600 clamp(1.5rem, 3.2vw, 1.9rem) / 1.2 var(--font-serif);
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.post-body .block-heading + .block-paragraph > :first-child {
  margin-top: 0.9rem;
}
.post-body h3 {
  margin: 2.1rem 0 0;
  font: 600 1.28rem / 1.35 var(--font-serif);
  letter-spacing: -0.01em;
}
.post-body h4 {
  margin: 1.75rem 0 0;
  font: 600 1rem / 1.4 var(--font-ui);
}
.post-body h3 + p,
.post-body h4 + p {
  margin-top: 0.5rem;
}
.post-body a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.post-body a:hover {
  text-decoration-thickness: 2px;
}
.post-body ul,
.post-body ol {
  padding-left: 1.4em;
}
.post-body li {
  margin-top: 0.5em;
  padding-left: 0.2em;
}
.post-body li::marker {
  color: var(--fg-faint);
}
.post-body hr {
  width: 4rem;
  margin: clamp(2.25rem, 5vw, 3rem) auto;
  border: 0;
  border-top: 1px solid var(--border-strong);
}
.post-body blockquote:not(.post-quote) {
  margin: 1.5em 0 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border-strong);
  color: var(--fg-muted);
}
.post-quote {
  margin: clamp(2.25rem, 5vw, 3rem) 0;
  padding-left: clamp(1.1rem, 3vw, 1.75rem);
  border-left: 3px solid var(--accent);
  font: italic 500 clamp(1.3rem, 2.8vw, 1.65rem) / 1.42 var(--font-serif);
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
/* Pictures are a little wider than the text where there's room. */
.post-figure {
  margin: clamp(2.25rem, 5vw, 3rem) calc(-1 * var(--bleed, 0rem));
}
.post-figure figcaption {
  margin: 0.85rem var(--bleed, 0rem) 0;
  color: var(--fg-faint);
  font: 0.86rem / 1.5 var(--font-ui);
  text-align: center;
}
.post-body table {
  display: block;
  max-width: 100%;
  margin: 1.75rem 0 0;
  overflow-x: auto;
  border-collapse: collapse;
  font: 0.92rem / 1.5 var(--font-ui);
}
.post-body th,
.post-body td {
  padding: 0.6rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-body th {
  border-bottom-color: var(--border-strong);
  font-weight: 600;
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-top: clamp(2.75rem, 6vw, 3.75rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-strong);
  font-size: 0.9rem;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}
.post-tags a {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: 0.84rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.post-tags a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.post-tags a:focus-visible {
  border-radius: 999px;
}
.post-back {
  margin-left: auto;
  font-weight: 600;
  text-decoration: none;
}

.post-more {
  box-sizing: content-box;
  max-width: 41rem;
  margin: clamp(3rem, 7vw, 4.5rem) auto 0;
}
.post-more h2 {
  color: var(--fg-faint);
  font: 600 0.74rem / 1.5 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-more ul {
  margin-top: 0.9rem;
}
.post-more li {
  position: relative;
  padding: 1.15rem 0 1.2rem;
  border-top: 1px solid var(--border);
}
.post-more a {
  color: var(--fg);
  font: 600 clamp(1.2rem, 2.4vw, 1.4rem) / 1.3 var(--font-serif);
  letter-spacing: -0.015em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.post-more a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.post-more li:hover a {
  color: var(--accent);
}
.post-more p {
  margin: 0.35rem 0 0;
  color: var(--fg-faint);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

/* On a phone the byline is two lines: who, then when. */
@media (max-width: 30rem) {
  .post-author {
    display: block;
  }
  .post-meta-dot {
    display: none;
  }
}
@media (min-width: 52rem) {
  .post-layout {
    --bleed: 2.5rem;
  }
}
@media (min-width: 80rem) {
  .post-layout {
    grid-template-columns: 12rem minmax(0, 41rem) 12rem;
    column-gap: 4.5rem;
  }
  .post-story {
    grid-column: 2;
  }
  .post-toc-inline {
    display: none;
  }
  .post-toc {
    position: sticky;
    top: 6.5rem;
    display: block;
    align-self: start;
    max-height: calc(100vh - 8.5rem);
    padding: 0.25rem;
    overflow-y: auto;
    font-size: 0.84rem;
    line-height: 1.45;
  }
  .post-toc p {
    margin: 0 0 0.8rem;
    color: var(--fg-faint);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .post-toc ol {
    border-left: 1px solid var(--border-strong);
  }
  .post-toc a {
    display: block;
    margin-left: -1px;
    padding: 0.4rem 0 0.4rem 1rem;
    border-left: 1px solid transparent;
    color: var(--fg-muted);
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  .post-toc a[aria-current] {
    border-left-color: var(--accent);
    color: var(--fg);
    font-weight: 500;
  }
}
