/* Synced from packages/shared/src/blog-css.ts (blogArticleCss). Regenerate if shared styles change. */
@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;500;600;700;800&display=swap');

/* WordPress: scope base vars; single template sets --blog-accent via wp_add_inline_style */
body.wfcp-styled-page {
  background: var(--blog-bg) !important;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
.blog-page-wrapper { direction: rtl; }


/* ============================================================
   Blog Article — Shared Core (Single Source of Truth)
   ============================================================ */

:root {
  --blog-bg: #fbfbfd;
  --blog-text: #1d1d1f;
  --blog-text-secondary: #86868b;
  --blog-text-body: #333336;
  --blog-accent: #000;
  --blog-border: #d2d2d7;
  --blog-toc-active: #1d1d1f;
  --blog-toc-inactive: #a1a1a6;
}

/* Reading Progress Bar */
.blog-progress-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px;
  background: transparent; z-index: 1000;
}
.blog-progress-bar {
  height: 100%; background: var(--blog-accent, var(--blog-text)); width: 0%;
  transition: width 0.1s ease;
}

/* Page Wrapper */
.blog-page-wrapper {
  max-width: 1440px; margin: 0 auto; padding: 120px 5vw 60px;
  display: flex; align-items: flex-start; gap: 100px; position: relative;
  min-width: 0;
  box-sizing: border-box;
}

/* Sidebar */
.blog-sidebar {
  position: sticky; top: 120px; width: 280px; flex-shrink: 0;
  max-height: calc(100vh - 140px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
  opacity: 0; transform: translateX(20px);
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.5s;
  scrollbar-width: none; -ms-overflow-style: none;
}
.blog-sidebar::-webkit-scrollbar { display: none; }

/* TOC */
.blog-toc-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.blog-toc-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--blog-text-secondary); font-weight: 700;
}
.blog-toc-counter {
  font-size: 12px; font-weight: 600; color: var(--blog-toc-inactive);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
.blog-toc-progress {
  width: 100%; height: 2px; background: var(--blog-border);
  border-radius: 2px; margin-bottom: 20px; overflow: hidden;
}
.blog-toc-progress-fill {
  height: 100%; background: var(--blog-accent, #1d1d1f);
  border-radius: 2px; transition: width 0.4s ease; min-width: 0;
}
.blog-toc-list {
  list-style: none; padding: 0; margin: 0 0 12px 0; position: relative;
}
.blog-toc-list::before {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 1px; background: var(--blog-border); z-index: 1;
}
.blog-toc-item {
  position: relative; margin-bottom: 6px;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}
.blog-toc-faded { opacity: 0.3; }
.blog-toc-link {
  display: block; text-decoration: none; color: var(--blog-toc-inactive);
  font-size: 14px; font-weight: 500; padding-right: 16px; cursor: pointer;
  transition: all 0.3s ease; position: relative; z-index: 2;
  border: none; background: none; text-align: right; width: 100%;
  font-family: 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.4; padding-top: 4px; padding-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.blog-toc-link:hover { color: var(--blog-text); text-decoration: none; }
.blog-toc-link.active { color: var(--blog-toc-active); font-weight: 700; }
.blog-toc-link.active::before {
  content: ''; position: absolute; right: -1px; top: 2px;
  height: calc(100% - 4px); width: 2px; background: var(--blog-accent);
  border-radius: 4px;
}
.blog-toc-toggle {
  display: block; width: 100%; border: none; background: none;
  font-size: 13px; font-weight: 600; color: var(--blog-toc-inactive);
  cursor: pointer; text-align: right; padding: 8px 16px 8px 0;
  transition: color 0.2s; margin-bottom: 24px;
  font-family: 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
}
.blog-toc-toggle:hover { color: var(--blog-toc-active); }

/* Side CTA */
.blog-side-cta {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,0.05); border-radius: 20px;
  padding: 32px 24px; text-align: right;
  box-shadow: 0 10px 30px rgba(0,0,0,0.03);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  flex-shrink: 0;
}
.blog-side-cta:hover {
  transform: translateY(-4px); box-shadow: 0 20px 40px rgba(0,0,0,0.06);
}
.blog-side-cta-logo { max-height: 32px; width: auto; margin-bottom: 16px; }
.blog-side-cta h4 { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: #000; }
.blog-side-cta p { font-size: 15px; color: var(--blog-text-secondary); margin-bottom: 20px; line-height: 1.5; }
.blog-side-cta .btn-small {
  display: inline-block; background: #000; color: #fff;
  padding: 10px 20px; border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 600; transition: background 0.2s;
}
.blog-side-cta .btn-small:hover { background: #333; }

/* Article Main */
.blog-article-main { flex-grow: 1; max-width: 720px; min-width: 0; }

/* Meta */
.blog-meta {
  font-size: 15px; color: var(--blog-text-secondary); margin-bottom: 32px; font-weight: 500;
  display: flex; gap: 24px; opacity: 0;
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow-wrap: break-word;
}

/* Title */
.blog-title {
  font-size: clamp(3rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -0.03em;
  font-weight: 800; margin-bottom: 32px; color: #000; opacity: 0;
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.1s;
  overflow-wrap: break-word;
}

/* Lead text */
.blog-lead {
  font-size: 1.5rem; line-height: 1.5; color: var(--blog-text-secondary); font-weight: 400;
  margin-bottom: 80px; opacity: 0;
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s;
  overflow-wrap: break-word;
}

/* Hero Image */
.blog-hero-image {
  width: 100%; border-radius: 24px; overflow: hidden;
  margin-bottom: 32px; opacity: 0;
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.3s;
  box-shadow: 0 30px 60px rgba(0,0,0,0.08);
}
.blog-hero-image img {
  width: 100%; height: auto; display: block;
  aspect-ratio: 16/9; object-fit: cover;
}

/* Hero Placeholder */
.blog-hero-placeholder {
  width: 100%; aspect-ratio: 21/9;
  background: linear-gradient(135deg, #111 0%, #333 50%, #111 100%);
  display: flex; align-items: center; justify-content: center;
}
.blog-hero-placeholder-inner {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.blog-hero-placeholder-icon {
  width: 56px; height: 56px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -1px;
}
.blog-hero-placeholder-brand {
  font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px; text-transform: uppercase;
}

/* Colorful Tags */
.blog-tags {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 80px; opacity: 0;
  animation: blogFadeSlideIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s;
}
.blog-tag {
  padding: 8px 16px; border-radius: 999px; font-size: 15px;
  font-weight: 700; letter-spacing: 0.02em; display: inline-block;
  transition: transform 0.2s ease; cursor: default; text-decoration: none;
}
.blog-tag:hover { transform: translateY(-2px); }
.tag-green  { background: #e8f5e9; color: #2e7d32; }
.tag-purple { background: #f3e5f5; color: #7b1fa2; }
.tag-blue   { background: #e3f2fd; color: #1565c0; }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-pink   { background: #fce4ec; color: #c62828; }
.tag-cyan   { background: #e0f7fa; color: #00838f; }

/* Key takeaways (TLDR) */
.key-takeaways {
  border-radius: 12px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
  border-inline-start: 4px solid var(--blog-brand-primary, #6366f1);
  background: color-mix(in srgb, var(--blog-brand-primary, #6366f1) 6%, #fff);
}
.key-takeaways h3 {
  font-size: 1.05rem; font-weight: 600; margin-bottom: 0.75rem;
  color: var(--blog-brand-primary, #1a1a2e);
}
.key-takeaways ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.key-takeaways li {
  padding-inline-start: 1.25rem; position: relative;
  font-size: 0.95rem; line-height: 1.7; color: #333;
}
.key-takeaways li::before {
  content: '•'; position: absolute; inset-inline-start: 0;
  color: var(--blog-brand-primary, #6366f1);
}

/* Article summary */
.article-summary { font-size: 1.15rem; line-height: 1.8; color: #444; }

/* Article prose */
.blog-prose {
  min-width: 0;
  overflow-wrap: break-word;
}
.blog-prose h1 {
  font-size: 2.75rem; font-weight: 800; letter-spacing: -0.03em;
  margin-bottom: 36px; margin-top: 72px; color: #000; scroll-margin-top: 120px;
}
.blog-prose h2 {
  font-size: 2.25rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 32px; margin-top: 64px; color: #000; scroll-margin-top: 120px;
}
.blog-prose h3 {
  font-size: 1.625rem; font-weight: 700; margin-bottom: 20px;
  margin-top: 48px; color: #000; scroll-margin-top: 120px;
}
.blog-prose p {
  font-size: 1.3125rem; margin-bottom: 32px; color: #333336; line-height: 1.7;
}
.blog-prose ul, .blog-prose ol {
  font-size: 1.3125rem; margin-bottom: 32px;
  padding-inline-start: 28px; color: #333336; line-height: 1.7;
}
.blog-prose li { margin-bottom: 12px; }
.blog-prose a {
  color: var(--blog-text); font-weight: 600;
  text-decoration: underline; text-underline-offset: 4px;
}
.blog-prose strong { font-weight: 700; color: #000; }
.blog-prose hr {
  border: none; height: 1px; background: var(--blog-border); margin: 60px 0;
}
.blog-prose img { max-width: 100%; border-radius: 20px; margin: 40px 0; }

/* Inline code */
.blog-prose code {
  background: #f0f0f3; color: #c7254e; padding: 2px 8px; border-radius: 6px;
  font-size: 0.875em; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  border: 1px solid #e0e0e3;
}

/* Code blocks */
.blog-prose pre {
  background: #1e1e1e; border: 1px solid #333; border-radius: 16px;
  padding: 0; margin: 32px 0; overflow: hidden; position: relative;
}
.blog-prose pre code {
  display: block; padding: 1.25rem;
  font-size: 0.875rem; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  line-height: 1.6; color: #d4d4d4; overflow-x: auto;
  background: transparent; border: none;
}

/* Tables */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 32px 0; border-radius: 12px; border: 1px solid #e5e5e5;
}
.table-wrap table { margin: 0; border: none; border-radius: 0; min-width: 500px; }
.blog-prose table {
  width: 100%; border-collapse: collapse; margin: 32px 0;
  border-radius: 12px; overflow: hidden; border: 1px solid #e5e5e5;
}
.blog-prose th {
  background: #f5f5f7; padding: 12px 16px; text-align: right;
  font-size: 0.875rem; font-weight: 700; border-bottom: 1px solid #e5e5e5;
}
.blog-prose td {
  padding: 12px 16px; font-size: 0.875rem; border-bottom: 1px solid #f0f0f0;
}

/* Author box */
.author-box {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.5rem; background: #f8f8ff; border-radius: 16px; margin-top: 2.5rem;
}

/* FAQ */
.blog-faq {
  margin-top: 100px; padding-top: 60px;
  border-top: 1px solid var(--blog-border);
}
.blog-faq h2 {
  margin-bottom: 48px; font-size: 2.25rem; font-weight: 700; color: #000;
}
.blog-faq-item { border-bottom: 1px solid var(--blog-border); }
.blog-faq-question {
  width: 100%; text-align: right; background: none; border: none;
  padding: 32px 0; font-size: 1.375rem; font-weight: 600; color: #000;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  font-family: 'Assistant', -apple-system, sans-serif; transition: color 0.2s;
}
.blog-faq-question:hover { color: var(--blog-text-secondary); }
.blog-faq-icon {
  font-size: 28px; font-weight: 300; color: var(--blog-text-secondary);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.blog-faq-question.active .blog-faq-icon { transform: rotate(45deg); color: #000; }
.blog-faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.blog-faq-answer p {
  font-size: 1.1875rem; color: var(--blog-text-secondary);
  margin-top: 0; padding-bottom: 32px; line-height: 1.7;
}

/* Premium Bottom CTA */
.blog-cta-premium {
  margin-top: 80px; padding: 80px 60px; border-radius: 32px;
  background: linear-gradient(145deg, #1d1d1f 0%, #000 100%);
  color: #fff; text-align: center; position: relative; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.15);
}
.blog-cta-premium::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}
.blog-cta-premium h3 {
  color: #fff; font-size: 2.625rem; font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 16px; position: relative; z-index: 1;
}
.blog-cta-premium p {
  color: #a1a1a6; font-size: 1.25rem; margin-bottom: 48px;
  max-width: 500px; margin-left: auto; margin-right: auto;
  position: relative; z-index: 1;
}
.btn-apple {
  display: inline-block; background: #fff; color: #000; text-decoration: none;
  padding: 20px 48px; border-radius: 999px; font-size: 18px; font-weight: 700;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  position: relative; z-index: 1;
}
.btn-apple:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 15px 30px rgba(255,255,255,0.15); text-decoration: none;
}

/* Animations */
@keyframes blogFadeSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive: Tablet ── */
@media (max-width: 1024px) {
  .blog-page-wrapper { flex-direction: column; padding: 80px 5vw 40px; gap: 40px; }
  .blog-sidebar {
    position: static; width: 100%; max-width: 100%; opacity: 1; transform: none; animation: none;
    display: flex; flex-direction: column; gap: 24px;
    min-width: 0;
  }
  .blog-article-main { max-width: 100%; }
  .blog-toc-list::before { display: none; }
  .blog-toc-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 0; }
  .blog-toc-link { padding-right: 0; white-space: normal; font-size: 13px; }
  .blog-toc-link.active::before { display: none; }
  .blog-toc-link.active {
    text-decoration: underline; text-underline-offset: 8px; text-decoration-thickness: 2px;
  }
  .blog-toc-progress { display: none; }
  .blog-toc-toggle { text-align: center; padding-right: 0; }
  .blog-hero-image img { aspect-ratio: 16/10; }
  .blog-hero-image { border-radius: 16px; }
  .blog-cta-premium { padding: 48px 20px; border-radius: 20px; }
  .blog-cta-premium h3 { font-size: 1.75rem; }
  .blog-title { margin-bottom: 20px; }
  .blog-lead { margin-bottom: 40px; font-size: 1.2rem; }
  .blog-prose h1 { font-size: 2rem; margin-top: 56px; margin-bottom: 28px; }
  .blog-prose h2 { font-size: 1.75rem; margin-top: 48px; margin-bottom: 24px; }
  .blog-prose h3 { font-size: 1.35rem; margin-top: 36px; margin-bottom: 16px; }
  .blog-prose p, .blog-prose ul, .blog-prose ol { font-size: 1.125rem; margin-bottom: 24px; }
  .blog-prose hr { margin: 40px 0; }
  .blog-tags { margin-bottom: 48px; gap: 8px; }
  .blog-tag { font-size: 13px; padding: 6px 14px; }
}

/* ── Responsive: Mobile ── */
@media (max-width: 640px) {
  .blog-page-wrapper { padding: 72px 16px 32px; gap: 24px; }
  .blog-sidebar { gap: 16px; }
  .blog-title {
    font-size: clamp(1.75rem, 7vw, 2.5rem); line-height: 1.15;
    letter-spacing: -0.02em; margin-bottom: 16px;
  }
  .blog-lead { font-size: 1.05rem; line-height: 1.6; margin-bottom: 28px; }
  .blog-meta { font-size: 13px; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
  .blog-hero-image {
    border-radius: 12px; margin-bottom: 24px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.06);
  }
  .blog-hero-image img { aspect-ratio: 16/10; }
  .blog-hero-placeholder { aspect-ratio: 16/10; }
  .blog-hero-placeholder-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
  .blog-hero-placeholder-brand { font-size: 12px; letter-spacing: 1.5px; }
  .blog-tags { margin-bottom: 32px; gap: 6px; }
  .blog-tag { font-size: 12px; padding: 5px 12px; }
  .blog-prose h1 { font-size: 1.75rem; margin-top: 48px; margin-bottom: 20px; scroll-margin-top: 80px; }
  .blog-prose h2 { font-size: 1.5rem; margin-top: 40px; margin-bottom: 16px; scroll-margin-top: 80px; }
  .blog-prose h3 { font-size: 1.2rem; margin-top: 32px; margin-bottom: 12px; scroll-margin-top: 80px; }
  .blog-prose p, .blog-prose ul, .blog-prose ol {
    font-size: 1rem; line-height: 1.75; margin-bottom: 20px;
  }
  .blog-prose ul, .blog-prose ol { padding-inline-start: 20px; }
  .blog-prose li { margin-bottom: 8px; }
  .blog-prose img { border-radius: 12px; margin: 24px 0; }
  .blog-prose hr { margin: 32px 0; }
  .blog-prose blockquote { margin: 32px 0; padding: 16px 20px 16px 0; }
  .blog-prose blockquote p { font-size: 1.1rem; }
  .key-takeaways { padding: 1rem 1.25rem; border-radius: 10px; }
  .key-takeaways h3 { font-size: 0.95rem; }
  .key-takeaways li { font-size: 0.875rem; }
  .article-summary { font-size: 1rem; }
  .blog-faq { padding: 0; }
  .blog-faq h2 { font-size: 1.5rem; }
  .blog-faq-question { font-size: 0.95rem; padding: 14px 0; }
  .blog-faq-answer { font-size: 0.9rem; }
  .blog-toc-list { gap: 6px; }
  .blog-toc-link { font-size: 12px; }
  .blog-side-cta { padding: 20px 16px; border-radius: 14px; }
  .blog-side-cta h4 { font-size: 17px; }
  .blog-side-cta p { font-size: 14px; }
  .blog-cta-premium { padding: 36px 16px; border-radius: 16px; }
  .blog-cta-premium h3 { font-size: 1.5rem; }
  .blog-cta-premium p { font-size: 0.95rem; }
  .btn-apple { padding: 14px 28px; font-size: 15px; }
  .author-box { padding: 1.25rem; }
}

/* Inline TOC after tags — desktop uses sidebar only */
.blog-toc-after-tags { display: none; }

@media (max-width: 1024px) {
  .blog-sidebar .toc-wrapper { display: none; }

  .blog-toc-after-tags {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 28px;
  }
}

/* ── WordPress plugin extras (TOC windowing + blockquote parity with hosted template) ── */
.blog-toc-item.blog-toc-hidden {
  display: none;
}

@media (max-width: 1024px) {
  .blog-toc-item.blog-toc-hidden {
    display: inline;
  }
}

@media (min-width: 641px) {
  .blog-prose blockquote {
    position: relative;
    margin: 48px 0;
    padding: 0;
    border: none;
    background: none;
    font-style: normal;
  }
  .blog-prose blockquote::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--blog-accent);
    border-radius: 2px;
  }
  .blog-prose blockquote p {
    font-size: clamp(22px, 2.5vw, 28px);
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: #1a1a1a;
    padding-right: 24px;
    margin-bottom: 0;
  }
}

.blog-section {
  margin-bottom: 48px;
}

/* Related posts grid (was inline <style> in PHP; wp_kses_post strips <style> and leaked CSS as text) */
.wfcp-related {
  max-width: 100%;
}
@media (max-width: 768px) {
  .wfcp-related div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}
