/* ============================================================
   BLOG.CSS — Matt Dunham Blog
   Covers: listing page, single post, TOC, author bio,
   related posts, reading progress bar, typography.

   Uses semantic color tokens from style.css:
     var(--bg)         page background
     var(--surface)    cards / panels
     var(--surface-2)  slightly elevated surface (TOC, bio)
     var(--text-1)     primary text
     var(--text-2)     muted/secondary text
     var(--border)     lines and dividers
     var(--border-light) very subtle borders
   These automatically flip for dark mode — no extra code needed.
============================================================ */


/* ============================================================
   READING PROGRESS BAR
============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-accent);
  z-index: 200;
  transition: width 0.1s linear;
}


/* ============================================================
   BLOG LISTING — Hero header
============================================================ */
.blog-hero {
  padding-top: calc(64px + 56px);
  padding-bottom: 56px;
}

.blog-hero h1 {
  margin-bottom: 12px;
}

.blog-hero h1::after {
  display: none;
}

.blog-hero-intro {
  font-size: 17px;
  opacity: 0.8;
  max-width: 560px;
}


/* ============================================================
   BLOG LISTING — Featured Post Card
============================================================ */
.blog-listing {
  padding-block: var(--section-padding);
}

.featured-post {
  margin-bottom: 56px;
}

.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--surface);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition), transform var(--transition);
}

.featured-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.featured-card-image {
  display: block;
  background: var(--color-dark-navy);
  min-height: 280px;
}

.featured-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card-placeholder {
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: linear-gradient(135deg, var(--color-dark-navy) 0%, #1a3a5c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.12);
  letter-spacing: -1px;
}

.featured-card-body {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  background: var(--surface);
}

.featured-card-body h2 {
  font-size: clamp(18px, 2.5vw, 26px);
  line-height: 1.3;
  margin-bottom: 0;
  color: var(--text-1);
}

.featured-card-body h2::after {
  display: none;
}

.featured-card-body h2 a {
  color: var(--text-1);
  text-decoration: none;
  transition: color var(--transition);
}

.featured-card-body h2 a:hover {
  color: var(--color-accent);
}

.card-excerpt {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.75;
  margin: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}

.card-footer time {
  font-size: 13px;
  color: var(--text-2);
}


/* ============================================================
   TAGS + READ TIME BADGES
============================================================ */
.card-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  background: rgba(153, 153, 255, 0.12);
  color: #6655cc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 3px 10px;
  border-radius: 100px;
}

@media (prefers-color-scheme: dark) {
  .tag {
    background: rgba(153, 153, 255, 0.18);
    color: var(--color-accent);
  }
}

.tag-dark {
  background: rgba(153, 153, 255, 0.18);
  color: var(--color-accent);
}

.read-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.read-time-badge-dark {
  color: rgba(255, 255, 255, 0.5);
}

.read-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
  /* 44px touch target */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.read-more:hover {
  text-decoration: underline;
}

.read-more-dark {
  color: var(--color-accent);
}


/* ============================================================
   POST GRID — 3 columns → 2 tablet → 1 mobile
============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* Dark section cards (related posts) */
.dark-section .post-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-section .post-card h2,
.dark-section .post-card h3 {
  color: var(--color-white);
}

.dark-section .post-card h2::after,
.dark-section .post-card h3::after {
  display: none;
}

.dark-section .post-card h2 a,
.dark-section .post-card h3 a {
  color: var(--color-white);
}

.dark-section .post-card h2 a:hover,
.dark-section .post-card h3 a:hover {
  color: var(--color-accent);
}

.dark-section .card-footer time {
  color: rgba(255, 255, 255, 0.4);
}

.card-image-link {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-dark-navy);
}

.card-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .card-image-link img {
  transform: scale(1.04);
}

.card-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--color-dark-navy), #1e3a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.12);
}

.card-body {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  background: var(--surface);
}

.card-body h2,
.card-body h3 {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-1);
}

.card-body h2::after,
.card-body h3::after {
  display: none;
}

.card-body h2 a,
.card-body h3 a {
  color: var(--text-1);
  text-decoration: none;
  transition: color var(--transition);
}

.card-body h2 a:hover,
.card-body h3 a:hover {
  color: var(--color-accent);
}


/* ============================================================
   SINGLE POST — Hero Header
============================================================ */
.post-hero {
  padding-top: calc(64px + 48px);
  padding-bottom: 48px;
}

.post-hero-inner {
  max-width: 800px;
}

.post-hero .breadcrumb {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.post-hero .breadcrumb a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color var(--transition);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.post-hero .breadcrumb a:hover {
  color: var(--color-accent);
}

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.post-hero h1 {
  font-size: clamp(26px, 5vw, 46px);
  line-height: 1.15;
  margin-bottom: 24px;
  color: var(--color-white);
  letter-spacing: -0.5px;
}

.post-hero h1::after {
  display: none;
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
}

.post-meta-row a {
  color: var(--color-accent);
  text-decoration: none;
}

.post-meta-row a:hover {
  text-decoration: underline;
}

.meta-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.meta-divider {
  opacity: 0.4;
}

.read-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}


/* ============================================================
   SINGLE POST — Featured Image
============================================================ */
.post-featured-image-wrapper {
  background: var(--color-dark-navy);
}

.post-featured-image {
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  transform: translateY(32px);
}

.post-featured-image img {
  width: 100%;
  height: auto;
  display: block;
}


/* ============================================================
   SINGLE POST — Two-column layout: Content + TOC
============================================================ */
.post-body-wrapper {
  padding-top: 56px;
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr 256px;
  gap: 56px;
  align-items: start;
}

.toc-sidebar { order: 2; }
.post-content { order: 1; min-width: 0; }


/* ============================================================
   TABLE OF CONTENTS
============================================================ */
.toc-sticky {
  position: sticky;
  top: 84px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.toc-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-2);
  margin-bottom: 12px;
}

#toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#toc-list li a {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: color var(--transition), background var(--transition),
              border-color var(--transition);
}

#toc-list li a:hover {
  color: var(--text-1);
  background: var(--border-light);
  text-decoration: none;
}

#toc-list li a.toc-active {
  color: var(--color-accent);
  background: rgba(153, 153, 255, 0.10);
  border-left-color: var(--color-accent);
  font-weight: 600;
}

#toc-list li.toc-h3 a {
  padding-left: 20px;
  font-size: 12px;
}


/* ============================================================
   POST CONTENT TYPOGRAPHY
============================================================ */
.post-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-1);
  max-width: 680px;
}

.post-intro {
  font-size: 19px;
  line-height: 1.75;
  color: var(--text-1);
  font-weight: 400;
  margin-bottom: 32px;
  border-left: 3px solid var(--color-accent);
  padding-left: 20px;
}

.post-content p {
  margin-bottom: 24px;
  color: var(--text-1);
}

.post-content h2 {
  font-size: clamp(20px, 2.5vw, 26px);
  color: var(--text-1);
  margin-top: 52px;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.post-content h2::after {
  display: none;
}

.post-content h3 {
  font-size: 19px;
  color: var(--text-1);
  margin-top: 36px;
  margin-bottom: 12px;
}

.post-content h3::after {
  display: none;
}

.post-content ul,
.post-content ol {
  padding-left: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-content li {
  line-height: 1.75;
  color: var(--text-1);
}

.post-content strong {
  font-weight: 700;
  color: var(--text-1);
}

.post-content em {
  font-style: italic;
}

.post-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity var(--transition);
}

.post-content a:hover {
  opacity: 0.8;
}

.post-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 16px 20px;
  margin: 36px 0;
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 18px;
  font-style: italic;
  color: var(--text-1);
  line-height: 1.7;
}

.post-content figure {
  margin: 36px 0;
}

.post-content figure img {
  border-radius: var(--radius-sm);
  width: 100%;
}

.post-content figcaption {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

.post-content code {
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
  font-size: 14px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-1);
}


/* ============================================================
   AUTHOR BIO
============================================================ */
.author-bio-section {
  border-top: 1px solid var(--border-light);
  padding-block: 48px;
}

.author-bio {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 760px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
}

.author-bio-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--color-accent);
}

.author-bio-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.author-bio-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0;
}

.author-bio-title {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}

.author-bio-text p:last-of-type {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 12px;
}

.author-bio-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.author-bio-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: opacity var(--transition);
}

.author-bio-links a:hover {
  text-decoration: underline;
}


/* ============================================================
   RELATED POSTS
============================================================ */
.related-posts {
  padding-block: var(--section-padding);
}

.related-heading {
  margin-bottom: 32px;
  color: var(--color-white);
}

.related-grid {
  grid-template-columns: repeat(3, 1fr);
}


/* ============================================================
   POST FOOTER
============================================================ */
.post-nav-footer {
  border-top: 1px solid var(--border-light);
  padding-block: 32px;
}


/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
  }

  .toc-sidebar {
    order: 1;
  }

  .post-content {
    order: 2;
    max-width: 100%;
  }

  .toc-sticky {
    position: static;
    max-height: none;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-card-image,
  .featured-card-placeholder {
    min-height: auto;
    aspect-ratio: 16 / 9;
  }

  .featured-card-body {
    padding: 22px 18px;
  }

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

  .author-bio {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .author-bio-links {
    justify-content: center;
  }

  .post-meta-row {
    font-size: 13px;
    gap: 8px;
  }

  .post-hero h1 {
    font-size: clamp(24px, 7vw, 36px);
  }
}


/* ============================================================
   LINKEDIN / SOCIAL EMBEDS
============================================================ */

.embed-block {
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.embed-block p {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: var(--text-2);
  font-style: italic;
}

.embed-block iframe {
  max-width: 100%;
  border-radius: 8px;
  border: none;
}

.embed-caption {
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
  margin-top: 4px;
}
