/* Enhanced blog template — Task 2
   Adds TOC sidebar, sticky on desktop, share buttons, optimized typography,
   and the affiliate CTA banner styling (Task 4). */

:root {
  --bpe-reading: 740px;
  --bpe-sidebar: 240px;
  --bpe-gap: 48px;
  --bpe-cta-grad-start: #ffb648;
  --bpe-cta-grad-end:   #ff7a00;
}

/* ─────── Header ─────────────────────────────────────────────── */
.blog-post-enhanced .bpe-head {
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0 var(--space-3);
  text-align: center;
}
.blog-post-enhanced .bpe-head-inner { max-width: 820px; }
.blog-post-enhanced .bpe-head h1 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  line-height: 1.18;
  margin: 8px 0 var(--space-2);
  color: var(--color-primary);
  letter-spacing: -0.01em;
}
.blog-post-enhanced .bpe-sub {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 720px;
  margin: 0 auto var(--space-2);
}
.blog-post-enhanced .bpe-meta {
  display: inline-flex; flex-wrap: wrap; gap: 10px;
  font-size: .92rem; color: var(--color-text-muted);
  align-items: center; justify-content: center;
}
.blog-post-enhanced .bpe-meta i { margin-right: 4px; }
.blog-post-enhanced .bpe-meta-sep { opacity: .55; }

/* ─────── Two-column layout (article + sidebar) ──────────────── */
.bpe-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--bpe-gap);
  padding: var(--space-4) var(--space-2);
  max-width: calc(var(--bpe-reading) + var(--bpe-sidebar) + var(--bpe-gap) + 64px);
}
@media (min-width: 1024px) {
  .bpe-layout {
    grid-template-columns: var(--bpe-sidebar) minmax(0, var(--bpe-reading));
    justify-content: center;
    padding: var(--space-5) var(--space-3);
  }
}

/* ─────── Article body — optimized typography ────────────────── */
.bpe-body {
  max-width: var(--bpe-reading);
  font-size: 1.075rem;
  line-height: 1.75;
  color: var(--color-text);
}
.bpe-body p { margin: 0 0 1.25em; }
.bpe-body h2 {
  font-size: 1.65rem;
  margin: 2.4rem 0 1rem;
  color: var(--color-primary);
  scroll-margin-top: 90px;        /* TOC anchor offset under sticky nav */
  letter-spacing: -.005em;
}
.bpe-body h3 {
  font-size: 1.25rem;
  margin: 1.8rem 0 .7rem;
  color: var(--color-primary);
  scroll-margin-top: 90px;
}
.bpe-body ul, .bpe-body ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.bpe-body li { margin-bottom: .55em; }
.bpe-body strong { color: var(--color-primary); font-weight: 700; }
.bpe-body a { color: var(--color-blue); font-weight: 500; }
.bpe-body a:hover { text-decoration: underline; }
.bpe-body img { max-width: 100%; height: auto; border-radius: 8px; }
.bpe-body .lead {
  font-size: 1.18rem; line-height: 1.6;
  background: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  padding: 14px 20px; border-radius: 8px; margin-bottom: 24px;
}

/* ─────── Comparison table — responsive, alternating rows ───── */
.bpe-body .compare-wrap {
  overflow-x: auto;
  margin: 0 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.bpe-body table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: .98rem;
  min-width: 560px;
}
.bpe-body th, .bpe-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}
.bpe-body thead th {
  background: #0a1628;
  color: #fff;
  font-weight: 600;
  position: sticky; top: 0;
  border-bottom: 0;
}
.bpe-body tbody tr:nth-child(even) { background: #f7f9fc; }
.bpe-body tbody tr.is-top {
  background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%) !important;
  font-weight: 600;
}
.bpe-body tbody tr.is-top td:first-child::before {
  content: "★ "; color: #059669; margin-right: 4px;
}

/* ─────── Pros / Cons blocks ─────────────────────────────────── */
.bpe-body .pros-cons { display: grid; gap: 18px; grid-template-columns: 1fr; margin: 0 0 var(--space-3); }
@media (min-width: 600px) { .bpe-body .pros-cons { grid-template-columns: 1fr 1fr; } }
.bpe-body .pros-cons > div {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 18px;
  background: #fff;
}
.bpe-body .pros-cons h4 { margin: 0 0 8px; font-size: 1rem; }
.bpe-body .pros-cons .pros { border-left: 4px solid #10b981; }
.bpe-body .pros-cons .cons { border-left: 4px solid #ef4444; }
.bpe-body .pros-cons .pros h4 { color: #047857; }
.bpe-body .pros-cons .cons h4 { color: #b91c1c; }
.bpe-body .pros-cons ul { padding-left: 1.2em; margin: 0; }

/* ─────── Spec list (efficiency / temp coef / warranty) ──────── */
.bpe-body .spec-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin: 0 0 var(--space-3);
}
.bpe-body .spec-grid .spec {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 8px; padding: 14px;
}
.bpe-body .spec-grid .spec-label {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-muted); margin-bottom: 4px;
}
.bpe-body .spec-grid .spec-value {
  font-size: 1.15rem; color: var(--color-primary); font-weight: 700;
}

/* ─────── Inline review CTA (small, between sections) ────────── */
.bpe-body .review-cta {
  display: inline-block;
  margin: 8px 0 24px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--color-accent);
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
}
.bpe-body .review-cta:hover { background: #1d4ed8; text-decoration: none; }

/* ─────── FAQ accordion (no JS) ──────────────────────────────── */
.bpe-faq { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.bpe-faq h2 { margin-bottom: 16px; }
.bpe-faq-list { display: flex; flex-direction: column; gap: 10px; }
.bpe-faq-item {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 8px; padding: 0;
}
.bpe-faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--color-primary);
  display: flex; justify-content: space-between; align-items: center;
}
.bpe-faq-item summary::-webkit-details-marker { display: none; }
.bpe-faq-item .bpe-faq-icon { transition: transform .2s; color: var(--color-accent); }
.bpe-faq-item[open] .bpe-faq-icon { transform: rotate(45deg); }
.bpe-faq-answer { padding: 0 18px 14px; color: var(--color-text); }
.bpe-faq-answer p { margin: 0; line-height: 1.7; }

/* ─────── Sidebar (TOC + share + related companies) ──────────── */
.bpe-sidebar { display: none; }
@media (min-width: 1024px) {
  .bpe-sidebar {
    display: block;
    position: sticky;
    top: 90px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 6px;
  }
}
.bpe-toc-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.bpe-toc-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  border-left: 2px solid var(--color-border);
}
.bpe-toc-list li { margin: 0; padding: 0; }
.bpe-toc-list a {
  display: block;
  padding: 6px 12px;
  font-size: .9rem;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  margin-left: -2px;
  text-decoration: none;
  line-height: 1.4;
}
.bpe-toc-list a:hover { color: var(--color-accent); }
.bpe-toc-list a.is-active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  background: rgba(79,142,255,0.05);
  font-weight: 600;
}
.bpe-toc-list .toc-h3 a { padding-left: 26px; font-size: .85rem; }

.bpe-related-co { margin-bottom: 28px; }
.bpe-related-co-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.bpe-related-co-list a {
  display: block;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--color-text);
  font-weight: 500;
}
.bpe-related-co-list a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.bpe-share { margin-bottom: 16px; }
.bpe-share-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bpe-share-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  background: #fff; border-radius: 8px;
  color: var(--color-text); cursor: pointer; font-size: .95rem;
  transition: background .15s, border-color .15s, color .15s;
}
.bpe-share-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.bpe-share-toast {
  font-size: .82rem;
  background: #052e16;
  color: #d1fae5;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ─────── Affiliate CTA banner (Task 4) ───────────────────────── */
.affiliate-cta {
  margin: 28px 0;
  padding: 24px 28px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--bpe-cta-grad-start), var(--bpe-cta-grad-end));
  color: #fff;
  box-shadow: 0 12px 28px -16px rgba(255, 122, 0, 0.55);
}
.affiliate-cta-inner {
  display: flex; gap: 22px; align-items: center;
  flex-wrap: wrap; justify-content: space-between;
}
.affiliate-cta-copy { flex: 1 1 320px; min-width: 0; }
.affiliate-cta-headline {
  margin: 0 0 6px;
  font-size: 1.18rem;
  line-height: 1.35;
  color: #fff;
  font-weight: 700;
}
.affiliate-cta-sub { margin: 0; color: rgba(255,255,255,0.92); font-size: .95rem; }
.affiliate-cta-btn {
  background: #0a1628 !important;
  color: #fff !important;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.affiliate-cta-btn:hover { background: #111827 !important; transform: translateY(-1px); }

/* ─────── Closing banner (full-width gradient under article) ── */
.bpe-closing-banner {
  margin: 56px 0 24px;
  padding: 44px 28px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 100%);
  color: #fff;
  text-align: center;
}
.bpe-closing-banner h2 { color: #fff; margin: 0 0 10px; font-size: 1.6rem; }
.bpe-closing-banner p { color: #cbd5e1; margin: 0 0 20px; }
.bpe-closing-banner .btn { padding: 14px 26px; font-weight: 700; }

/* ─────── Author/date icon spacing ───────────────────────────── */
.bpe-meta i { color: var(--color-accent); }

/* ─────── AEO: answer block (after every H2) ─────────────────── */
.bpe-body .answer-block {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.06);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 24px 0;
  font-weight: 500;
}
.bpe-body .answer-block p { margin: 0; }
.bpe-body .answer-block strong { color: var(--color-primary); }

/* ─────── AEO: stat callout (extracted as a quick fact) ──────── */
.bpe-body .stat-callout {
  text-align: center;
  padding: 28px 24px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 32px 0;
}
.bpe-body .stat-callout .stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #f59e0b;
  display: block;
  line-height: 1.1;
}
.bpe-body .stat-callout .stat-label {
  font-size: 0.95rem;
  color: #64748b;
  margin-top: 8px;
  display: block;
}

/* ─────── AEO: numbered HowTo list (semantic emphasis) ───────── */
.bpe-body ol.bpe-howto {
  counter-reset: aeo-step;
  list-style: none;
  padding-left: 0;
  margin: 0 0 28px;
}
.bpe-body ol.bpe-howto > li {
  counter-increment: aeo-step;
  position: relative;
  padding: 14px 18px 14px 60px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.bpe-body ol.bpe-howto > li::before {
  content: counter(aeo-step);
  position: absolute;
  left: 14px; top: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}

/* ─────── AEO: external citations (References footer) ────────── */
.bpe-body .aeo-citations {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.bpe-body .aeo-citations h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}
.bpe-body .aeo-citations ol {
  padding-left: 22px;
  font-size: .92rem;
  color: var(--color-text-muted);
}
.bpe-body .aeo-citations li { margin-bottom: 6px; }
.bpe-body .aeo-citations a {
  color: var(--color-blue);
  word-break: break-word;
}

/* ─────── AEO: deadline urgency banner ───────────────────────── */
.bpe-body .aeo-deadline-banner {
  margin: 56px 0 24px;
  padding: 44px 28px;
  border-radius: 14px;
  background: linear-gradient(135deg, #b91c1c 0%, #ea580c 100%);
  color: #fff;
  text-align: center;
}
.bpe-body .aeo-deadline-banner h2 { color: #fff; margin: 0 0 10px; font-size: 1.6rem; line-height: 1.25; }
.bpe-body .aeo-deadline-banner h2 strong { color: #ffe2aa; font-weight: 800; }
.bpe-body .aeo-deadline-banner p { color: rgba(255,255,255,0.92); margin: 0 0 20px; }
.bpe-body .aeo-deadline-banner .btn {
  background: #fff !important;
  color: #b91c1c !important;
  font-weight: 700;
  padding: 14px 26px;
}
.bpe-body .aeo-deadline-banner .btn:hover { background: #fef2f2 !important; }
