/* ==========================================================================
   05 - BLOG
   Description: Blog archive listing and single post styling
   Dependencies: 01-base.css
   ========================================================================== */

/* ===================== NEWS & INSIGHTS INDEX ===================== */
.symap-blog-page .symap-insights-library,
.symap-blog-page .symap-insights-connect {
  width: min(1280px, 90%);
  max-width: none;
  margin: 0 auto;
}
.symap-blog-page .symap-insights-library { padding: 48px 0 56px; }
.symap-insights-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.symap-insights-eyebrow {
  color: #536d83;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  margin: 0 0 8px;
}
.symap-insights-heading h2,
.symap-insights-connect h2 {
  margin: 0;
  color: #112e43;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.2;
  letter-spacing: -.025em;
}
.symap-insights-hub-link {
  flex-shrink: 0;
  font-size: .875rem;
  font-weight: 600;
  color: #1556b8;
  text-underline-offset: 4px;
}
.symap-blog-page .symap-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.symap-insights-query .wp-block-post {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 1px solid #dfe7ee;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 14px rgba(21, 54, 78, .035);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.symap-insights-query .wp-block-post:hover,
.symap-insights-query .wp-block-post:focus-within {
  transform: none;
  border-color: #9cb8d7;
  box-shadow: 0 8px 24px rgba(21, 54, 78, .08);
}
.symap-insights-query .wp-block-post-featured-image {
  order: 0;
  margin: 0;
  border-radius: 0;
  background: #f0f5fa;
  aspect-ratio: 1200 / 630;
  border-bottom: 1px solid #e7edf3;
}
.symap-insights-query .wp-block-post-featured-image a {
  display: flex;
  width: 100%;
  height: 100%;
}
.symap-insights-query .wp-block-post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: contain !important; /* Preserve text and charts in existing artwork. */
  border-radius: 0;
}
.symap-insights-query .symap-insight-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  gap: 18px;
  margin: 0;
  padding: 24px;
}
.symap-insight-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  font-size: .75rem;
  line-height: 1.5;
}
.symap-insight-meta > * { margin: 0; order: initial; }
.symap-insight-meta .wp-block-post-terms a {
  color: #21589a;
  font-weight: 600;
  text-decoration: none;
}
.symap-insight-meta .wp-block-post-terms a:hover { text-decoration: underline; }
.symap-insight-meta .wp-block-post-date { color: #627386; font-size: inherit; }
.symap-insight-meta .wp-block-post-date time { padding: 0; background: none; }
.symap-insights-query .wp-block-post-title {
  order: 0;
  margin: 0;
  font-size: clamp(1.125rem, 1.65vw, 1.375rem);
  line-height: 1.4;
  letter-spacing: -.02em;
}
.symap-insights-query .wp-block-post-title a { color: #132f43; }
.symap-insights-query .wp-block-post-title a:hover { color: #0f62fe; }
.symap-insights-query .symap-insight-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: auto 0 0;
  padding-top: 6px;
  color: #1556b8;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
.symap-insight-link::after { content: '\2192'; }
.symap-insight-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.symap-insights-query .wp-block-post:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: stretch;
}
.symap-insights-query .wp-block-post:first-child .wp-block-post-featured-image {
  position: relative;
  min-height: 280px;
  aspect-ratio: auto;
  border-bottom: 0;
  border-right: 1px solid #e7edf3;
}
.symap-insights-query .wp-block-post:first-child .wp-block-post-featured-image a {
  position: absolute;
  inset: 0;
}
.symap-insights-query .wp-block-post:first-child .symap-insight-card-body {
  padding: clamp(24px, 3vw, 42px);
  justify-content: center;
  gap: 22px;
}
.symap-insights-query .wp-block-post:first-child .wp-block-post-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.25;
}
.symap-insights-query .wp-block-post:first-child .symap-insight-link { margin-top: 0; }
.symap-insights-query .wp-block-query-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
}
.symap-blog-page .symap-insights-connect {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 32px 0 48px;
  border-top: 1px solid #dfe7ee;
  margin-bottom: 0;
}
.symap-insights-connect p:not(.symap-insights-eyebrow) { color: #526678; margin: 12px 0 0; }
.symap-insights-connect .symap-cta-row { margin: 0; flex-shrink: 0; gap: 10px; }
@media (max-width: 1000px) {
  .symap-blog-page .symap-insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .symap-blog-page .symap-insights-connect { align-items: flex-start; flex-direction: column; gap: 24px; }
}
@media (max-width: 640px) {
  .symap-blog-page .symap-insights-library { padding: 32px 0 40px; }
  .symap-insights-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  .symap-blog-page .symap-insights-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .symap-insights-query .wp-block-post:first-child { display: flex; }
  .symap-insights-query .wp-block-post:first-child .wp-block-post-featured-image { min-height: 0; aspect-ratio: 1200 / 630; border-right: 0; border-bottom: 1px solid #e7edf3; }
  .symap-insights-query .wp-block-post:first-child .wp-block-post-featured-image a { position: static; }
  .symap-insights-query .wp-block-post:first-child .symap-insight-card-body { padding: 24px; gap: 18px; }
  .symap-insights-query .wp-block-post:first-child .wp-block-post-title { font-size: 1.375rem; }
  .symap-insights-connect .symap-cta-row { justify-content: flex-start; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .symap-insights-query .wp-block-post { transition: none; }
}

/* ===================== BLOG ARCHIVE ===================== */
.wp-block-post-template {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-6);
  list-style: none;
  padding: 0;
  margin: var(--space-8) 0;
}

.wp-block-post {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.wp-block-post:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.wp-block-post-title {
  font-size: 1.5rem;
  margin: 0 0 var(--space-4);
  line-height: 1.3;
  order: 2;
}

.wp-block-post-title a {
  color: var(--color-text-dark);
  text-decoration: none;
  transition: color 0.2s;
}

.wp-block-post-title a:hover { color: var(--color-primary); }

.wp-block-post-featured-image {
  margin: 0 0 var(--space-4);
  border-radius: var(--radius);
  overflow: hidden;
  order: 1;
}

.wp-block-post-featured-image img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.wp-block-post-date {
  color: var(--color-text-light);
  font-size: 0.875rem;
  order: 3;
}

.wp-block-post-date time {
  padding: 4px 10px;
  background: var(--color-background-alt);
  border-radius: 4px;
  display: inline-block;
}

.wp-block-post-excerpt {
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-4);
  flex: 1;
  order: 4;
}

.wp-block-post-excerpt__excerpt { margin-bottom: var(--space-4); }

.wp-block-post-excerpt__more-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.wp-block-post-excerpt__more-link:hover { gap: 8px; }
.wp-block-post-excerpt__more-link::after { content: '→'; }

.wp-block-post .wp-block-spacer { display: none; }

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

/* ===================== SINGLE POST ===================== */
.single-post .site-main,
.single-post .entry-content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.single-post .entry-header {
  text-align: center;
  padding: var(--space-8) 0 var(--space-6);
  max-width: 900px;
  margin: 0 auto;
}

.single-post .entry-title,
.single-post h1.wp-block-post-title {
  font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
  letter-spacing: -0.01em;
  color: var(--color-text-dark);
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

.single-post .entry-meta,
.single-post .wp-block-post-date,
.single-post .wp-block-post-author {
  color: var(--color-text-light);
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
}

.single-post .wp-block-post-date time {
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-block;
}

.single-post .wp-block-post-featured-image,
.single-post .post-thumbnail {
  margin: 0 0 var(--space-8);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.single-post .wp-block-post-featured-image img,
.single-post .post-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

/* The post card. ONLY .entry-content gets it — see note below. */
.single-post .entry-content {
  background: var(--color-background);
  border-radius: 20px;
  padding: var(--space-8) var(--space-6);
  margin: var(--space-6) auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  max-width: 900px;
}

/* This selector used to be bundled into the card rule above, which produced a
   panel-inside-a-panel on every post. The theme has NO <article> wrapper on
   single posts, so `.single-post article` only ever matched our own inner
   <article class="symap-blog-content"> — giving it a second white card, radius
   and shadow inside .entry-content. Posts 623/727/745 escaped it because their
   per-post CSS overrides at higher specificity; 507/544/652/862 did not.
   Keep the width cap here (so nothing reflows), drop the card chrome. */
.single-post article {
  max-width: 900px;
}

/* Post Content Typography */
.single-post .entry-content p {
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-5);
  font-size: 1.0625rem;
}

.single-post .entry-content h2 {
  color: var(--color-text-dark);
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  padding-top: var(--space-4);
  border-top: 2px solid var(--color-primary-light);
}

.single-post .entry-content h3 {
  color: var(--color-text-dark);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.single-post .entry-content h4 {
  color: var(--color-primary-darker);
  font-size: 1.125rem;
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

/* Body links inside a post. Buttons are excluded deliberately: this selector
   is (0,2,1), which beats .symap-btn.primary (0,2,0), so without the :not()
   every CTA button in post content was painted link-blue on its own blue
   background - an invisible label - and underlined into the bargain. Seen
   live on /mfn-savings-cea-report/. post-544.css carried a local patch for
   exactly this; excluding buttons here fixes it for every post instead. */
.single-post .entry-content a:not(.symap-btn) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.single-post .entry-content a:not(.symap-btn):hover { color: var(--color-primary-darker); }

.single-post .entry-content ul,
.single-post .entry-content ol {
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-5);
  padding-left: var(--space-6);
}

.single-post .entry-content li { margin-bottom: var(--space-2); }

.single-post .entry-content blockquote {
  border-left: 4px solid var(--color-primary);
  margin: var(--space-6) 0;
  color: var(--color-text-dark);
  font-style: italic;
  background: var(--color-background-alt);
  padding: var(--space-5);
  border-radius: var(--radius);
}

.single-post .entry-content img {
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
  margin: var(--space-6) 0;
}

.single-post .entry-content figure { margin: var(--space-6) 0; }

.single-post .entry-content figcaption {
  color: var(--color-text-light);
  font-size: 0.875rem;
  text-align: center;
  margin-top: var(--space-2);
  font-style: italic;
}

.single-post .entry-content code {
  background: var(--color-background-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--color-primary-darker);
}

.single-post .entry-content pre {
  background: var(--color-text-dark);
  color: var(--color-background);
  padding: var(--space-5);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: var(--space-6) 0;
}

.single-post .entry-content pre code {
  background: transparent;
  color: var(--color-background);
  padding: 0;
}

.single-post .entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.single-post .entry-content th {
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
  font-weight: 600;
  padding: var(--space-3);
  text-align: left;
  border-bottom: 2px solid var(--color-primary);
}

.single-post .entry-content td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.single-post .entry-content tr:last-child td { border-bottom: none; }

.single-post .entry-footer {
  max-width: 900px;
  margin: var(--space-6) auto;
  padding: var(--space-5);
  background: var(--color-background-alt);
  border-radius: var(--radius);
  text-align: center;
}

.single-post .entry-footer a {
  color: var(--color-primary);
  text-decoration: none;
  padding: 4px 10px;
  background: var(--color-primary-light);
  border-radius: 4px;
  margin: 0 4px;
  display: inline-block;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.single-post .entry-footer a:hover {
  background: var(--color-primary);
  color: var(--color-background);
}

/* Blog Section Panels */
.symap-blog-section {
  background: var(--color-background);
  border-radius: 20px;
  padding: var(--space-8) var(--space-6);
  margin: var(--space-6) 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

.symap-blog-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f62fe, #0b3d91);
}

.symap-blog-section-alt { background: linear-gradient(135deg, #f8fafc 0%, #eef4ff 100%); }

.symap-blog-section-highlight {
  background: linear-gradient(135deg, #eef4ff 0%, #dce9ff 100%);
  border: 2px solid #cfe0ff;
}

.symap-blog-section-highlight::before { height: 6px; }

.symap-blog-section h2 {
  color: var(--color-text-dark);
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: var(--space-4);
  padding-top: 0;
  border-top: none;
}

.single-post .symap-blog-section h2 { border-top: none; padding-top: 0; }
