/* ========================================
   Blog Shared Styles
   ======================================== */
.container--narrow {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========================================
   Blog Hero
   ======================================== */
.blog-hero {
  padding: calc(var(--nav-height) + 60px) 0 48px;
  background: var(--black);
  border-bottom: 1px solid var(--gray-medium);
}

.blog-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  margin-bottom: 12px;
}

.blog-hero p {
  color: var(--gray-text);
  font-size: 1.1rem;
  margin-bottom: 28px;
  max-width: 560px;
}

.blog-hero--compact {
  padding-bottom: 32px;
}

.blog-hero--compact h1 {
  font-size: 2rem;
}

/* Blog Search */
.blog-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 480px;
  transition: border-color 0.2s;
}

.blog-search:focus-within {
  border-color: var(--red);
}

.blog-search svg {
  color: var(--gray-text);
  flex-shrink: 0;
}

.blog-search input {
  background: none;
  border: none;
  color: var(--white);
  font-size: 0.95rem;
  width: 100%;
  outline: none;
}

.blog-search input::placeholder {
  color: var(--gray-text);
}

/* ========================================
   Blog Layout
   ======================================== */
.blog-listing {
  padding: 48px 0 80px;
  background: var(--black);
}

.blog-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
}

@media (max-width: 960px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Blog Filters
   ======================================== */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-text);
  border: 1px solid var(--gray-medium);
  transition: all 0.2s;
}

.filter-pill:hover {
  color: var(--white);
  border-color: var(--gray-text);
}

.filter-pill.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* ========================================
   Post Card Grid
   ======================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

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

@media (max-width: 560px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

.post-card {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.post-card__link {
  display: block;
}

.post-card__image {
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: var(--gray-medium);
}

.post-card__image--placeholder {
  background-image:
    linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, transparent 50%),
    linear-gradient(225deg, rgba(220, 38, 38, 0.05) 0%, transparent 50%);
  background-color: var(--gray-medium);
}

.post-card__body {
  padding: 20px;
}

.post-card__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--red);
  margin-bottom: 8px;
}

.post-card h2,
.post-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}

.post-card h2 a,
.post-card h3 a {
  color: var(--white);
  transition: color 0.2s;
}

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

.post-card p {
  font-size: 0.875rem;
  color: var(--gray-text);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--gray-text);
  opacity: 0.8;
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gray-text);
  flex-shrink: 0;
}

.post-card__tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.post-card__tags a {
  font-size: 0.75rem;
  color: var(--gray-text);
  transition: color 0.2s;
}

.post-card__tags a:hover {
  color: var(--red);
}

/* Compact card for related posts */
.post-card--compact .post-card__image {
  height: 140px;
}

.post-card--compact .post-card__body {
  padding: 16px;
}

.post-card--compact h3 {
  font-size: 0.95rem;
}

.post-card--compact time {
  font-size: 0.8rem;
  color: var(--gray-text);
  opacity: 0.7;
}

/* ========================================
   Blog Empty State
   ======================================== */
.blog-empty {
  text-align: center;
  padding: 80px 0;
}

.blog-empty p {
  color: var(--gray-text);
  font-size: 1.1rem;
  margin-bottom: 16px;
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-text);
  border: 1px solid var(--gray-medium);
  transition: all 0.2s;
}

.pagination__link:hover {
  color: var(--white);
  border-color: var(--gray-text);
}

.pagination__link.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.pagination__dots {
  color: var(--gray-text);
  padding: 0 4px;
}

/* ========================================
   Sidebar
   ======================================== */
.blog-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  align-self: start;
}

.sidebar-section {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: var(--gray-text);
}

.sidebar-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-categories a {
  font-size: 0.9rem;
  color: var(--gray-light);
  transition: color 0.2s;
}

.sidebar-categories a:hover {
  color: var(--red);
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-text);
  border: 1px solid var(--gray-medium);
  transition: all 0.2s;
}

.tag-pill:hover {
  color: var(--white);
  border-color: var(--gray-text);
}

.sidebar-cta {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-top: 3px solid var(--red);
}

.sidebar-cta h3 {
  color: var(--white);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
}

.sidebar-cta p {
  font-size: 0.875rem;
  color: var(--gray-text);
  line-height: 1.5;
  margin-bottom: 16px;
}

@media (max-width: 960px) {
  .blog-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }

  .sidebar-section {
    margin-bottom: 0;
  }
}

/* ========================================
   Article / Single Post
   ======================================== */
.article__header {
  padding: calc(var(--nav-height) + 48px) 0 32px;
  background: var(--black);
}

.article__back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--gray-text);
  margin-bottom: 24px;
  transition: color 0.2s;
}

.article__back:hover {
  color: var(--red);
}

.article__meta-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--gray-text);
}

.article__category {
  display: inline-block;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.article__category:hover {
  color: var(--red-dark);
}

.article__header h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Featured Image */
.article__featured-image {
  padding: 24px 0;
  background: var(--black);
}

.article__featured-image img {
  width: 100%;
  border-radius: 8px;
}

/* Video Embed */
.article__video {
  padding: 0 0 24px;
  background: var(--black);
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* External Link Banner */
.article__external-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  margin-bottom: 24px;
}

.article__external-link svg {
  color: var(--red);
  flex-shrink: 0;
}

.article__external-link a {
  color: var(--red);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.article__external-link a:hover {
  color: var(--red-dark);
}

/* Article Layout with TOC */
.article__body-wrapper {
  padding: 32px 0;
  background: var(--black);
}

.article__layout {
  position: relative;
}

/* Table of Contents */
.article__toc {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 32px;
}

.article__toc h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-text);
  margin-bottom: 14px;
}

.article__toc ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article__toc li {
  list-style: none;
}

.article__toc a {
  font-size: 0.9rem;
  color: var(--gray-light);
  transition: color 0.2s;
}

.article__toc a:hover {
  color: var(--red);
}

.toc-level-3 {
  padding-left: 16px;
}

.toc-level-4 {
  padding-left: 32px;
}

/* ========================================
   Prose Content Styling
   ======================================== */
.prose {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--gray-light);
}

.prose h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  margin: 48px 0 16px;
  line-height: 1.25;
}

.prose h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  margin: 40px 0 14px;
  line-height: 1.3;
}

.prose h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin: 32px 0 12px;
  line-height: 1.35;
}

.prose h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin: 28px 0 10px;
}

.prose p {
  margin-bottom: 20px;
}

.prose strong {
  color: var(--white);
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

.prose del {
  text-decoration: line-through;
  opacity: 0.6;
}

.prose a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

.prose a:hover {
  color: var(--red-dark);
}

.prose ul,
.prose ol {
  margin: 0 0 20px 20px;
}

.prose li {
  margin-bottom: 8px;
}

.prose ul li {
  list-style: disc;
}

.prose ol li {
  list-style: decimal;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 24px 0;
}

.prose blockquote {
  border-left: 3px solid var(--red);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--gray-dark);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--gray-light);
}

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

.prose pre {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.prose code {
  background: var(--gray-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--red);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.prose pre code {
  background: none;
  padding: 0;
  color: var(--gray-light);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.prose th {
  text-align: left;
  padding: 12px 16px;
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  font-weight: 700;
  color: var(--white);
}

.prose td {
  padding: 10px 16px;
  border: 1px solid var(--gray-medium);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--gray-medium);
  margin: 40px 0;
}

/* Info / Callout boxes */
.prose .callout,
.prose .info-box,
.prose .note {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 24px 0;
}

.prose mark {
  background: rgba(220, 38, 38, 0.2);
  color: var(--white);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ========================================
   Article Tags
   ======================================== */
.article__tags {
  padding: 24px 0;
  background: var(--black);
}

.article__tags .container--narrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========================================
   Share Buttons
   ======================================== */
.article__share {
  padding: 24px 0;
  background: var(--black);
  border-top: 1px solid var(--gray-medium);
  border-bottom: 1px solid var(--gray-medium);
}

.article__share .container--narrow {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.article__share > .container--narrow > span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-text);
}

.share-buttons {
  display: flex;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-text);
  border: 1px solid var(--gray-medium);
  background: transparent;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}

.share-btn:hover {
  color: var(--white);
  border-color: var(--gray-text);
}

/* ========================================
   Author Box
   ======================================== */
.article__author {
  padding: 40px 0;
  background: var(--black);
}

.author-box {
  display: flex;
  gap: 20px;
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  padding: 24px;
}

.author-box__avatar {
  flex-shrink: 0;
}

.author-box__avatar img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.author-box__avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gray-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--red);
}

.author-box__info h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.author-box__info p {
  font-size: 0.9rem;
  color: var(--gray-text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.author-box__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--red);
  font-weight: 500;
  transition: color 0.2s;
}

.author-box__link:hover {
  color: var(--red-dark);
}

@media (max-width: 480px) {
  .author-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ========================================
   FAQ Section
   ======================================== */
.article__faq {
  padding: 48px 0;
  background: var(--black);
  border-top: 1px solid var(--gray-medium);
}

.article__faq h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--gray-dark);
  border: 1px solid var(--gray-medium);
  border-radius: 8px;
  overflow: hidden;
}

.faq-item__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  background: none;
  border: none;
}

.faq-item__question svg {
  flex-shrink: 0;
  color: var(--gray-text);
  transition: transform 0.3s;
}

.faq-item__question[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.faq-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item__answer p {
  padding: 0 20px 16px;
  font-size: 0.95rem;
  color: var(--gray-text);
  line-height: 1.6;
}

/* ========================================
   Related Articles
   ======================================== */
.article__related {
  padding: 48px 0;
  background: var(--black);
  border-top: 1px solid var(--gray-medium);
}

.article__related h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
}

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

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

/* ========================================
   Nav active state for blog
   ======================================== */
.nav__links a.active {
  color: var(--white);
}

.nav__links a.active::after {
  width: 100%;
}