/* ============================================================
   SR7 TRANSPORT — BLOG SYSTEM STYLES
   Transport Operations Journal
============================================================ */

/* ---- BLOG HERO ---- */
.blog-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(204,0,0,0.06) 0%, transparent 60%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(255,255,255,0.015) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      rgba(255,255,255,0.015) 40px
    );
  pointer-events: none;
}
.blog-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, transparent 60%);
}
.blog-hero-inner {
  position: relative;
  z-index: 1;
  padding: 80px 0 60px;
  width: 100%;
}
.blog-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.2rem;
}
.blog-hero-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--red);
}
.blog-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.0;
  margin-bottom: 1rem;
  max-width: 700px;
}
.blog-hero h1 span { color: var(--red); }
.blog-hero p {
  font-size: 1.1rem;
  color: var(--grey);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

/* ---- BLOG SEARCH ---- */
.blog-search-bar {
  display: flex;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.blog-search-bar:focus-within {
  border-color: var(--red);
}
.blog-search-bar input {
  flex: 1;
  padding: 0.85rem 1.2rem;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 0.95rem;
  outline: none;
}
.blog-search-bar input::placeholder { color: var(--grey); }
.blog-search-bar button {
  padding: 0 1.2rem;
  background: var(--red);
  border: none;
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition);
}
.blog-search-bar button:hover { background: var(--red-light); }

/* ---- CATEGORY FILTER ---- */
.blog-cats {
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  /* Contain the scroll inside this element, not inside .container */
  overflow: hidden;
}
.blog-cats-inner {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
  /* Padding lives here, not in .container, so it applies inside the
     scroll area — first and last items get equal breathing room
     even when the list overflows the viewport width.
     On wide screens the calc() centres the content like .container does. */
  padding-left:  max(1.5rem, calc((100vw - var(--max-w)) / 2 + 1.5rem));
  padding-right: max(1.5rem, calc((100vw - var(--max-w)) / 2 + 1.5rem));
  /* Smooth momentum scrolling on iOS */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.blog-cats-inner::-webkit-scrollbar { display: none; }
.blog-cat-btn {
  flex-shrink: 0;
  padding: 1rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.blog-cat-btn:hover,
.blog-cat-btn.active {
  color: var(--white);
  border-bottom-color: var(--red);
}
.blog-cat-btn.active { color: var(--red); }

/* ---- FEATURED POST ---- */
.blog-featured {
  padding: 60px 0 0;
}
.blog-featured-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.blog-featured-inner:hover {
  border-color: rgba(204,0,0,0.5);
  box-shadow: 0 0 40px rgba(204,0,0,0.08);
}
.blog-featured-img {
  position: relative;
  min-height: 400px;
  background: var(--bg-alt);
  overflow: hidden;
}
.blog-featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* keep van/subject visible, not cropped at top */
  display: block;
  transition: transform 0.4s ease;
}
.blog-featured-inner:hover .blog-featured-img img {
  transform: scale(1.03);
}
.blog-featured-img-placeholder {
  width: 100%;
  height: 100%;
  min-height: 400px;
  background:
    linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: rgba(204,0,0,0.2);
}
.blog-featured-badge {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
}
.blog-featured-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.blog-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid rgba(204,0,0,0.3);
  padding: 0.25rem 0.7rem;
  border-radius: 2px;
  margin-bottom: 1rem;
  text-decoration: none;
  transition: all var(--transition);
}
.blog-tag:hover {
  background: rgba(204,0,0,0.1);
  border-color: var(--red);
  color: var(--red-light);
}
.blog-featured-content h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  margin-bottom: 1rem;
  line-height: 1.15;
  text-transform: uppercase;
}
.blog-featured-content h2 a {
  color: var(--white);
  text-decoration: none;
  transition: color var(--transition);
}
.blog-featured-content h2 a:hover { color: var(--red); }
.blog-featured-content p {
  color: var(--grey);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}
.blog-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--grey);
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.05em;
}
.blog-meta-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.blog-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
}

/* ---- POSTS GRID ---- */
.blog-grid-section {
  padding: 50px 0 80px;
}
.blog-grid-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.blog-grid-header h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--grey);
}
.blog-grid-header span {
  font-size: 0.8rem;
  color: var(--grey);
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ---- BLOG CARD ---- */
.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.blog-card:hover {
  transform: translateY(-4px);
  border-color: rgba(204,0,0,0.45);
  box-shadow: 0 8px 40px rgba(204,0,0,0.1), 0 2px 8px rgba(0,0,0,0.4);
}
.blog-card-img {
  position: relative;
  height: 210px;              /* slightly taller than 200 — shows more image */
  background: var(--bg-alt);
  overflow: hidden;
}
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* transport images: van/subject usually in upper half */
  display: block;
  transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-img img {
  transform: scale(1.05);
}
.blog-card-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #111 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: rgba(204,0,0,0.15);
}
.blog-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card-body .blog-tag {
  margin-bottom: 0.8rem;
}
.blog-card h3 {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.blog-card h3 a {
  color: var(--white);
  text-decoration: none;
  transition: color var(--transition);
}
.blog-card h3 a:hover { color: var(--red); }
.blog-card-excerpt {
  color: var(--grey);
  font-size: 0.875rem;
  line-height: 1.65;
  margin-bottom: 1.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.blog-card-read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  text-decoration: none;
  transition: gap var(--transition), color var(--transition);
}
.blog-card-read:hover {
  color: var(--red-light);
  gap: 0.6rem;
}
.blog-card-read svg { transition: transform var(--transition); }
.blog-card:hover .blog-card-read svg { transform: translateX(3px); }

/* ---- PAGINATION ---- */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 40px 0 80px;
}
.blog-pagination a,
.blog-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--grey);
  text-decoration: none;
  transition: all var(--transition);
}
.blog-pagination a:hover,
.blog-pagination .current {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}
.blog-pagination .prev-next {
  width: auto;
  padding: 0 1rem;
  gap: 0.4rem;
}

/* ============================================================
   SINGLE POST STYLES
============================================================ */

/* Reading progress bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* Post hero */
.post-hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--bg-alt);
}

/* ---- Featured image layer ---- */
.post-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;  /* default — override with modifier classes */
  background-repeat: no-repeat;
  transform: scale(1.02);
  transition: transform 8s ease;
  /* Reduced from 0.35 — let the image show through clearly */
  filter: brightness(0.78);
}

/* ---- Position modifier classes (set via PHP custom field _hero_position) ---- */
.post-hero.hero-pos-top    .post-hero-bg { background-position: center top;    }
.post-hero.hero-pos-bottom .post-hero-bg { background-position: center bottom; }
.post-hero.hero-pos-left   .post-hero-bg { background-position: left center;   }
.post-hero.hero-pos-right  .post-hero-bg { background-position: right center;  }

/* ---- Contain mode — shows the full image without cropping ---- */
/*
   Activated by:
     a) PHP auto-detection (slug list in single.php), OR
     b) WordPress custom field  _hero_size = contain  on the post.

   Use for graphic/banner images that have their own background and should
   not be cropped. The image is shown at full size; black fills any gaps.
*/

/* Section-level overrides for contain mode */
.post-hero.blog-hero-contain {
  min-height: 420px;          /* shorter than default 520px — fits wide banners */
  align-items: center;        /* vertically centre the text overlay */
  background: #000;           /* black fills any gaps around the contained image */
}

/* Background image: show it fully, no zoom, no dimming */
.post-hero.blog-hero-contain .post-hero-bg {
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  filter: none;               /* graphic already has its own dark background */
  transform: none;            /* disable the subtle scale animation */
}

/* Override the ::before gradient — much lighter for graphic images.
   The image provides its own contrast; we only need a slight bottom shadow
   to keep the white text legible. */
.post-hero.blog-hero-contain::before {
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.55) 0%,     /* gentle bottom shadow for headline */
    rgba(0,0,0,0.08) 30%,    /* fades out quickly */
    rgba(0,0,0,0.00) 100%    /* top — clear */
  );
}

/* Mobile: shrink height proportionally for landscape graphics */
@media (max-width: 768px) {
  .post-hero.blog-hero-contain {
    min-height: 280px;
  }
}
@media (max-width: 480px) {
  .post-hero.blog-hero-contain {
    min-height: 220px;
  }
}

/* ---- No featured image fallback ---- */
.post-hero-bg-placeholder {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, #1a1a1a 0%, #080808 100%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(204,0,0,0.02) 10px,
      rgba(204,0,0,0.02) 11px
    );
}

/* ---- Text-readability gradient overlay ---- */
/* Softer than before: bottom area darkened for legibility,
   upper area stays light so the image reads through clearly. */
.post-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.60) 0%,    /* text strip — readable, not crushing */
    rgba(0,0,0,0.18) 40%,   /* mid zone — light */
    rgba(0,0,0,0.02) 100%   /* top — essentially transparent */
  );
  z-index: 1;
}

/* ---- Red accent line at bottom ---- */
.post-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, transparent 70%);
  z-index: 2;
}

/* ---- Content sits above image and overlay ---- */
.post-hero-content {
  position: relative;
  z-index: 2;
  padding: 60px 0 50px;
  width: 100%;
}

/* ---- Mobile hero adjustments ---- */
@media (max-width: 768px) {
  .post-hero {
    min-height: 380px;
    align-items: flex-end;
  }
  /* On mobile default to center-top so subjects aren't cropped at the bottom */
  .post-hero-bg {
    background-position: center top;
    /* Slightly lighter on mobile — small screens compress contrast */
    filter: brightness(0.78);
  }
  /* Respect explicit position overrides on mobile too */
  .post-hero.hero-pos-bottom .post-hero-bg { background-position: center bottom; }
  .post-hero.hero-pos-left   .post-hero-bg { background-position: left top;     }
  .post-hero.hero-pos-right  .post-hero-bg { background-position: right top;    }
  .post-hero.hero-pos-top    .post-hero-bg { background-position: center top;   }
}

@media (max-width: 480px) {
  .post-hero { min-height: 300px; }
  .post-hero-content h1 { font-size: 1.6rem; }
}

/* Breadcrumb */
.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.post-breadcrumb a,
.post-breadcrumb span {
  font-size: 0.8rem;
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post-breadcrumb a {
  color: var(--grey);
  text-decoration: none;
  transition: color var(--transition);
}
.post-breadcrumb a:hover { color: var(--red); }
.post-breadcrumb .sep { color: var(--grey); opacity: 0.4; }
.post-breadcrumb .current-post {
  color: var(--grey);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.post-hero-content h1 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  max-width: 780px;
  line-height: 1.1;
  margin-bottom: 1.2rem;
}
.post-hero-meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

/* Article layout */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 4rem;
  padding: 60px 0 80px;
  align-items: start;
}
.post-content-col { min-width: 0; }

/* Article typography */
.post-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--grey-light);
}
.post-content h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  color: var(--white);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}
.post-content h3 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--white);
  margin: 2rem 0 0.8rem;
  text-transform: uppercase;
}
.post-content h4 {
  font-size: 1.1rem;
  color: var(--grey-light);
  margin: 1.5rem 0 0.6rem;
  text-transform: uppercase;
  font-family: var(--font-heading);
}
.post-content p {
  margin-bottom: 1.3rem;
  color: var(--grey-light);
}
.post-content a:not([class*="btn"]) {
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.post-content a:not([class*="btn"]):hover { color: var(--red-light); }

/* Buttons inside post content — restore correct colours that the
   .post-content a rule would otherwise override via higher specificity.
   Applies to every article-cta block in any blog post. */
.post-content .btn             { text-decoration: none; }
.post-content .btn-primary     { color: var(--white) !important; background: var(--red); }
.post-content .btn-primary:hover { color: var(--white) !important; background: var(--red-dark); }
.post-content .btn-outline     { color: var(--white) !important; border-color: var(--white); }
.post-content .btn-outline:hover { color: var(--black) !important; background: var(--white); }
.post-content .btn-red-outline { color: var(--red) !important; border-color: var(--red); }
.post-content .btn-red-outline:hover { color: var(--white) !important; background: var(--red); }

/* Styled lists */
.post-content ul,
.post-content ol {
  margin: 1.2rem 0 1.5rem 0;
  padding-left: 0;
  list-style: none;
}
.post-content ul li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.6rem;
  color: var(--grey-light);
  font-size: 1rem;
}
.post-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
}
.post-content ol {
  counter-reset: post-counter;
}
.post-content ol li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.6rem;
  color: var(--grey-light);
  counter-increment: post-counter;
}
.post-content ol li::before {
  content: counter(post-counter);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--red);
  background: rgba(204,0,0,0.1);
  border: 1px solid rgba(204,0,0,0.2);
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

/* Styled table */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}
.post-content th {
  background: var(--bg-section);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}
.post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  color: var(--grey-light);
  vertical-align: top;
}
.post-content tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

/* Pull quote */
.post-content blockquote,
.wp-block-quote {
  position: relative;
  margin: 2.5rem 0;
  padding: 1.8rem 2rem 1.8rem 2rem;
  background: var(--bg-card);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-content blockquote::before,
.wp-block-quote::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1.2rem;
  font-family: var(--font-heading);
  font-size: 4rem;
  color: var(--red);
  opacity: 0.3;
  line-height: 1;
}
.post-content blockquote p,
.wp-block-quote p {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--white);
  margin: 0;
  line-height: 1.65;
}
.post-content blockquote cite,
.wp-block-quote cite {
  display: block;
  margin-top: 0.8rem;
  font-size: 0.8rem;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  font-style: normal;
}

/* Callout box */
.post-callout {
  background: var(--bg-card);
  border: 1px solid var(--border-red);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 1.5rem 1.8rem;
  margin: 2rem 0;
}
.post-callout strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.5rem;
}

/* Post sidebar */
.post-sidebar { position: sticky; top: calc(var(--header-h) + 2rem); }

/* Social share */
.post-share {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.post-share h4 {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 1rem;
}
.share-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.share-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
  color: var(--grey-light);
  background: transparent;
}
.share-btn:hover { border-color: var(--red); color: var(--red); }
.share-btn svg { flex-shrink: 0; }

/* TOC */
.post-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.post-toc h4 {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-list li { margin: 0; }
.toc-list a {
  display: block;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  color: var(--grey);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.4;
}
.toc-list a:hover,
.toc-list a.active {
  color: var(--red);
  border-left-color: var(--red);
  padding-left: 0.8rem;
}

/* ---- ARTICLE CTA ---- */
.article-cta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.article-cta-text h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.article-cta-text p {
  font-size: 0.9rem;
  color: var(--grey);
  margin: 0;
}
.article-cta-btns {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ---- POST FOOTER CTA ---- */
.post-cta-section {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 80px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.post-cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(204,0,0,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.post-cta-section .section-label { justify-content: center; }
.post-cta-section h2 { margin-bottom: 1rem; }
.post-cta-section p {
  font-size: 1.05rem;
  color: var(--grey);
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

/* ---- RELATED POSTS ---- */
.related-posts {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  padding: 60px 0 80px;
}
.related-posts h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}
.related-posts-sub {
  color: var(--grey);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ---- ARCHIVE PAGE ---- */
.archive-hero {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 60px 0 40px;
}
.archive-hero::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--red);
  margin-top: 1.2rem;
}
.archive-hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); margin-bottom: 0.5rem; }
.archive-hero p { color: var(--grey); font-size: 1rem; margin: 0; }
.archive-cat-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.5rem;
}

/* ---- NO RESULTS ---- */
.no-posts {
  text-align: center;
  padding: 80px 0;
}
.no-posts svg { opacity: 0.15; margin: 0 auto 1.5rem; }
.no-posts h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.no-posts p { color: var(--grey); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .post-layout { grid-template-columns: 1fr; gap: 3rem; }
  .post-sidebar { position: static; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-featured-inner { grid-template-columns: 1fr; }
  .blog-featured-img { min-height: 280px; }
}

@media (max-width: 768px) {
  .blog-hero { min-height: 360px; }
  .blog-hero-inner { padding: 60px 0 40px; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-cats { top: 0; }
  .blog-featured { padding: 40px 0 0; }
  .blog-featured-content { padding: 1.5rem; }
  .related-grid { grid-template-columns: 1fr; }
  .article-cta { flex-direction: column; align-items: flex-start; }
  .share-btns { flex-direction: row; flex-wrap: wrap; }
  .share-btn { flex: 1; min-width: 100px; justify-content: center; }
  .blog-pagination a, .blog-pagination span { width: 38px; height: 38px; }

  /* ── Search bar: prevent overflow on narrow screens ── */
  .blog-search-bar {
    max-width: 100%;           /* fill the container, never wider */
    width: 100%;
  }
  .blog-search-bar input {
    min-width: 0;              /* allow flex item to shrink below content size */
  }
}

/* Stack search bar vertically on very narrow screens (< 480px) */
@media (max-width: 480px) {
  .blog-grid-section { padding: 30px 0 60px; }
  .blog-featured-content { padding: 1.2rem; }
  .blog-search-bar {
    flex-direction: column;
  }
  .blog-search-bar input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
  }
  .blog-search-bar button {
    width: 100%;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }
}
