/*-----------------------------------*\
  blog-reading.css
  Shared reading-experience styles for
  all Kaevor blog posts (EN + FR).
  Covers: progress bar, logo, header,
  back button, TL;DR, share buttons,
  FAQ, sources, WhatsApp CTA,
  continue-reading reveal, both themes.
\*-----------------------------------*/

/* ── Reading progress bar ─────────── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, #6c47ff, #00d4ff);
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}
@media (prefers-reduced-motion: reduce) {
  #reading-progress { transition: none; }
}

/* ── Logo sizing fix ──────────────── */
.navbar a.logo-link,
.navbar-brand {
  display: inline-flex;
  align-items: center;
}
.navbar .logo-light,
.navbar .logo-dark,
footer .footer-logo {
  width: auto;
  height: 44px;
  object-fit: contain;
  display: block;
}
footer .footer-logo {
  height: 52px;
}
.light-theme .logo-dark,
.dark-theme .logo-light { display: none !important; }
.light-theme .logo-light,
.dark-theme .logo-dark  { display: block !important; }

/* ── Back to blog button ──────────── */
.back-to-blog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--foreground-secondary);
  background: var(--action-secondary);
  border: 1px solid var(--action-primary);
  border-radius: 6px;
  padding: 6px 14px;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: background 0.2s, color 0.2s;
}
.back-to-blog:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.dark-theme .back-to-blog {
  color: var(--foreground-secondary);
  background: var(--action-secondary);
  border-color: var(--action-primary);
}

/* ── TL;DR box ────────────────────── */
.tldr-box {
  background: linear-gradient(135deg, #1a1040 0%, #2a1860 100%);
  border-left: 4px solid #6c47ff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.tldr-box strong {
  color: #c4b0ff;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 0.5rem;
}
/* ALWAYS light text inside tldr-box — bg is always dark */
.tldr-box p,
.tldr-box li {
  color: #ddd8f0 !important;
  margin: 0;
  line-height: 1.65;
  font-size: 0.95rem;
}
.dark-theme .tldr-box {
  background: linear-gradient(135deg, #1a1040 0%, #251a55 100%);
}
.dark-theme .tldr-box p,
.dark-theme .tldr-box li {
  color: #e0dbf8 !important;
}

/* ── Post content typography ─────── */
.post-content {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.05rem;
  line-height: 1.78;
}
.post-content h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  line-height: 1.3;
  color: var(--foreground-primary);
}
.post-content h3 {
  font-size: 1.15rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--foreground-primary);
}
.post-content p {
  margin-bottom: 1.2rem;
  color: var(--foreground-primary);
}
.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}
.post-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  color: var(--foreground-primary);
}
.post-content strong {
  color: var(--foreground-primary);
  font-weight: 700;
}
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  margin: 1.5rem 0;
  color: var(--foreground-secondary);
  font-style: italic;
  background: var(--action-secondary);
  border-radius: 0 6px 6px 0;
}
.post-content code {
  background: var(--action-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
}
.post-content pre {
  background: #0f1117;
  color: #e8e6e3;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Post meta */
.post-meta {
  font-size: 0.875rem;
  color: var(--foreground-secondary);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.post-meta a { color: var(--accent); text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }

/* Post hero image */
.post-hero-img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 2rem;
  display: block;
}

/* ── Continue Reading ─────────────── */
.read-more-section {
  overflow: hidden;
  transition: max-height 0.5s ease;
}
.read-more-section.collapsed {
  max-height: 0;
}
.read-more-section.expanded {
  max-height: none;
}
.read-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: var(--action-secondary);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  margin: 1.5rem 0;
  transition: background 0.2s, color 0.2s;
}
.read-more-btn:hover {
  background: var(--accent);
  color: #fff;
}
.read-more-btn[aria-expanded="true"] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .read-more-section { transition: none; }
}

/* Segment progress "Module x / y" */
.read-progress-label {
  font-size: 0.78rem;
  color: var(--foreground-tertiary);
  text-align: right;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

/* ── Share buttons ────────────────── */
.share-inline {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.share-inline > span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--foreground-secondary);
  margin-right: 4px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}
.share-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.share-btn:active { transform: translateY(0); }
.share-btn.fb  { background: #1877f2; color: #fff; }
.share-btn.x   { background: #000; color: #fff; }
.share-btn.li  { background: #0a66c2; color: #fff; }
.share-btn.wa  { background: #25d366; color: #fff; }
.share-btn.copy { background: var(--action-primary); color: var(--foreground-primary); }

/* ── WhatsApp CTA box ─────────────── */
.cta-box {
  margin-top: 2.5rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, #4a2db5, #6c47ff);
  border-radius: 10px;
  color: #fff;
  text-align: center;
}
.cta-box p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  opacity: 0.92;
  color: #fff !important;
  line-height: 1.55;
}
.cta-box .cta-btn {
  display: inline-block;
  background: #fff;
  color: #4a2db5;
  font-weight: 700;
  padding: 0.65rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}
.cta-box .cta-btn:hover { opacity: 0.88; }

/* ── Sources section ──────────────── */
.sources-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--action-primary);
  font-size: 0.875rem;
  color: var(--foreground-secondary);
}
.sources-section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground-tertiary);
  margin-bottom: 0.75rem;
  font-weight: 700;
}
.sources-section ol { padding-left: 1.2rem; }
.sources-section li { margin-bottom: 0.4rem; line-height: 1.5; }
.sources-section a { color: var(--accent); }
.sources-section a:hover { text-decoration: underline; }

/* ── FAQ section ──────────────────── */
.faq-section { margin-top: 2.5rem; }
.faq-section > h2 { font-size: 1.25rem; margin-bottom: 1rem; color: var(--foreground-primary); }
.faq-item {
  border-bottom: 1px solid var(--action-primary);
  padding: 1rem 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--foreground-primary);
  font-weight: 700;
}
.faq-item p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--foreground-secondary);
  line-height: 1.65;
}

/* ── Author box ───────────────────── */
.author-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--action-secondary);
  border-radius: 10px;
  border: 1px solid var(--action-primary);
}
.author-box img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.author-box .author-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--foreground-primary);
}
.author-box .author-bio {
  font-size: 0.85rem;
  color: var(--foreground-secondary);
  margin: 3px 0 0;
}

/* ── Key takeaways box ────────────── */
.key-takeaways {
  background: var(--action-secondary);
  border: 1px solid var(--action-primary);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
}
.key-takeaways h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 700;
}
.key-takeaways ul { padding-left: 1.2rem; margin: 0; }
.key-takeaways li {
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0.4rem;
  color: var(--foreground-primary);
}

/* ── Language switcher (post nav) ─── */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
}
.language-switcher .lang-link {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 9px;
  color: var(--foreground-secondary);
  transition: 0.2s;
  border-radius: 5px;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.language-switcher .lang-link:hover {
  color: var(--accent);
  background: var(--action-secondary);
}
.language-switcher .active {
  color: var(--accent);
  font-weight: 800;
  border-bottom: 2px solid var(--accent);
  pointer-events: none;
}

/* ── Responsive / mobile ──────────── */
@media (max-width: 768px) {
  .main .container {
    flex-direction: column;
    padding: 10px 16px;
  }
  .blog { width: 100%; padding-right: 0; margin-bottom: 2rem; }
  .aside {
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    order: 1 !important;
  }
  .post-content { font-size: 1rem; }
  .share-btn { padding: 7px 10px; font-size: 0.78rem; }
  #reading-progress { height: 3px; }
  .read-more-btn { font-size: 0.9rem; padding: 12px 18px; }
}
