/* Blog post — shared styles. CSS variables come from /styles.css */

/* Hero — uses the article's cover image as a full-bleed background with a
   dark overlay (both set inline in render-post.mjs). White text on dark. */
.blog-hero {
  position: relative;
  background-color: var(--dark);
  background-size: cover;
  background-position: center;
  color: var(--white);
  padding: 8rem 0 6rem;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-hero-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 3rem;
  text-align: center;
}

.blog-hero .blog-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1.75rem;
}

.blog-hero .blog-eyebrow .label-line {
  background: rgba(255, 255, 255, 0.7);
}

.blog-eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1.75rem;
}

.blog-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.6vw, 3.8rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--white);
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

.blog-hero h1 em {
  color: var(--rust);
  font-style: italic;
}

.blog-deck {
  margin: 1.5rem auto 0;
  font-size: 1.2rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  max-width: 680px;
  text-wrap: balance;
}

/* Article meta — small line just above the body copy (no longer in hero). */
.blog-body-inner .blog-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--gray);
}

.blog-hero-ctas {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
}

/* Secondary button — dark text on the hero's cream background.
   The site's existing .btn-outline is white-on-dark, so we add this
   cream-friendly variant for any place the primary needs a partner
   on a light background. */
.btn-secondary {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.9rem 2rem;
  background: transparent;
  color: var(--dark);
  border: 1.5px solid rgba(26, 26, 26, 0.25);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  background: rgba(26, 26, 26, 0.05);
  border-color: rgba(26, 26, 26, 0.55);
}

.blog-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gray);
  display: inline-block;
}

/* The standalone hero figure was removed in favor of the background-image
   hero. Selectors kept (hidden) in case other pages reference them. */
.blog-image {
  display: none;
}

.blog-image-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 3rem;
}

.blog-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.blog-image figcaption {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--gray);
  text-align: right;
}

.blog-image figcaption a {
  color: var(--gray);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Layout that hosts the body + the sticky TOC. Two-column grid so the TOC
   sits right next to the body (rather than stranded in the far-left margin).
   The whole pair is centered with a generous max-width, which naturally
   places the body slightly right of page-center because the TOC takes the
   space on the left. On narrow screens the TOC hides and the body returns
   to a centered single-column layout. */
.blog-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  column-gap: 4rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 4rem 1.5rem 0;
  align-items: start;
}

.blog-layout > .blog-toc {
  grid-column: 1;
}

.blog-layout > .blog-body {
  grid-column: 2;
  min-width: 0;
}

@media (max-width: 1080px) {
  .blog-layout {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    padding-top: 3rem;
  }
  .blog-layout > .blog-body {
    grid-column: 1;
  }
}

.blog-body {
  padding: 0 0 5rem;
}

.blog-body-inner {
  max-width: 880px;
  margin: 0;
  padding: 0;
  font-size: 1.075rem;
  line-height: 1.8;
  color: #2a2a2a;
}

@media (max-width: 1080px) {
  .blog-body-inner {
    margin: 0 auto;
  }
}

.blog-body-inner p {
  margin-bottom: 1.5rem;
}

.blog-body-inner .lead {
  font-size: 1.25rem;
  line-height: 1.65;
  color: var(--dark);
  margin-bottom: 2rem;
}

.blog-body-inner h2 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--dark);
  margin: 3rem 0 1.25rem;
  text-wrap: balance;
}

.blog-body-inner h2 em {
  color: var(--rust);
  font-style: italic;
}

.blog-body-inner h3 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--dark);
  margin: 2.25rem 0 0.75rem;
}

.blog-body-inner a {
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.blog-body-inner ul,
.blog-body-inner ol {
  margin: 0 0 1.5rem 1.25rem;
  padding: 0;
}

.blog-body-inner li {
  margin-bottom: 0.6rem;
  padding-left: 0.4rem;
}

.blog-body-inner li strong {
  color: var(--dark);
}

.blog-body-inner blockquote {
  margin: 2.25rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 3px solid var(--rust);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.4;
  color: var(--dark);
  font-style: italic;
}

.blog-body-inner hr {
  border: none;
  border-top: 1px solid #d5d0c8;
  margin: 3rem 0;
}

.blog-cta {
  background: var(--navy);
  color: var(--white);
  padding: 5rem 3rem;
  text-align: center;
}

.blog-cta-inner {
  max-width: 640px;
  margin: 0 auto;
}

.blog-cta h2 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.blog-cta h2 em {
  color: var(--rust);
  font-style: italic;
}

.blog-cta p {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.blog-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .blog-hero {
    padding: 7rem 0 2rem;
  }

  .blog-hero-inner,
  .blog-image-inner,
  .blog-body-inner {
    padding: 0 1.5rem;
  }

  .blog-deck {
    font-size: 1.05rem;
  }

  .blog-image {
    padding: 0.5rem 0 2.5rem;
  }

  .blog-image img {
    aspect-ratio: 4 / 3;
  }

  .blog-body {
    padding: 0 0 3rem;
  }

  .blog-body-inner {
    font-size: 1rem;
    line-height: 1.75;
  }

  .blog-body-inner .lead {
    font-size: 1.1rem;
  }

  .blog-body-inner h2 {
    font-size: 1.5rem;
    margin-top: 2.25rem;
  }

  .blog-body-inner blockquote {
    font-size: 1.15rem;
  }

  .blog-cta {
    padding: 3.5rem 1.5rem;
  }

  .blog-cta h2 {
    font-size: 1.7rem;
  }
}

/* Blog Index */
.blog-index-hero {
  background: var(--navy);
  color: var(--white);
  padding: 9rem 0 4rem;
}

.blog-index-hero-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 3rem;
}

.blog-index-hero .blog-eyebrow {
  color: var(--rust);
}

.blog-index-hero .label-line {
  background: var(--rust);
}

.blog-index-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--white);
  margin-top: 1rem;
  text-wrap: balance;
}

.blog-index-hero h1 em {
  color: var(--rust);
  font-style: italic;
}

.blog-index-hero p {
  margin-top: 1.25rem;
  font-size: 1.1rem;
  color: rgba(255,255,255,0.72);
  max-width: 620px;
  line-height: 1.6;
  text-wrap: balance;
}

.blog-index-list {
  background: var(--cream);
  padding: 4rem 0 6rem;
}

.blog-index-list-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 3rem;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2rem;
}

.blog-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.blog-card-image {
  width: 100%;
  height: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 1.25rem;
  background: #e8e3db;
  transition: opacity 0.2s;
}

.blog-card:hover .blog-card-image {
  opacity: 0.92;
}

.blog-card-meta {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--gray);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.blog-card-meta .blog-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gray);
  display: inline-block;
}

.blog-card h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--dark);
  margin-bottom: 0.6rem;
  text-wrap: balance;
  transition: color 0.2s;
}

.blog-card h3 em {
  color: var(--rust);
  font-style: italic;
}

.blog-card:hover h3 {
  color: var(--rust);
}

.blog-card p {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.55;
  text-wrap: balance;
}

@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .blog-index-hero {
    padding: 7rem 0 2.5rem;
  }

  .blog-index-hero-inner,
  .blog-index-list-inner {
    padding: 0 1.5rem;
  }

  .blog-index-list {
    padding: 2.5rem 0 4rem;
  }

  .blog-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

/* Reading-progress bar — thin strip at the very top of the page. */
.blog-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  z-index: 100;
  pointer-events: none;
}

.blog-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--rust);
  transition: width 0.08s linear;
}

/* Sidebar Table of Contents — plain text list, no card, sticky as you
   scroll. Width comes from its grid column (.blog-layout). Hidden on
   narrow screens via the .blog-layout media query above. */
.blog-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}

.blog-toc-inner {
  /* no card chrome */
}

.blog-toc-header {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  font-weight: 600;
  margin-bottom: 1rem;
}

.blog-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog-toc-list li {
  margin: 0;
}

.blog-toc-list a {
  position: relative;
  display: block;
  padding: 0.45rem 0;
  color: #777;
  text-decoration: none;
  transition: color 0.15s ease;
  text-wrap: balance;
}

.blog-toc-list a:hover {
  color: var(--dark);
}

/* Faux-bold via text-shadow keeps active items visually heavier without
   widening glyphs, so toggling the .active class doesn't reflow neighbours. */
.blog-toc-list a.active {
  color: var(--dark);
  text-shadow: 0.4px 0 0 currentColor;
}

/* Rust vertical accent sits in the gutter to the LEFT of the entry text,
   so adding/removing it doesn't shift the text horizontally. */
.blog-toc-list a.active::before {
  content: "";
  position: absolute;
  left: -0.875rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 2px;
  background: var(--rust);
  border-radius: 1px;
}

@media (max-width: 1080px) {
  .blog-toc {
    display: none;
  }
}

/* Anchor scroll offset so jumping to a section doesn't hide it behind the
   fixed nav. Note: html { scroll-padding-top: 60px } from /styles.css also
   applies, so the effective landing position is roughly 60 + 36 = 96px below
   the viewport top — comfortably below the 73px nav. */
.blog-body-inner h2[id] {
  scroll-margin-top: 36px;
}

/* "What to read next" — related posts grid at the end of an article. */
.blog-related {
  background: var(--cream);
  padding: 5rem 0 6rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.blog-related-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 3rem;
}

.blog-related-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3rem;
  gap: 2rem;
}

.blog-related-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 400;
  margin: 0;
  color: var(--dark);
  letter-spacing: -0.01em;
}

.blog-related-more {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  white-space: nowrap;
}

.blog-related-more:hover {
  color: var(--rust);
}

.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

@media (max-width: 900px) {
  .blog-related {
    padding: 3.5rem 0 4.5rem;
  }

  .blog-related-inner {
    padding: 0 1.5rem;
  }

  .blog-related-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .blog-related-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}
