/* Blog styles - extends style.css */
.blog-hero { padding: 140px 0 40px; text-align: center; }
.blog-hero h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 44px); font-weight: 400; margin-bottom: 16px; line-height: 1.15; letter-spacing: -0.015em; }
.blog-hero h1 span { color: var(--accent); }
.blog-hero .meta { font-size: 14px; color: var(--text-dim); }
.blog-hero .meta time { color: var(--text-muted); }

/* Article body */
.article { max-width: 760px; margin: 0 auto; padding: 0 24px 80px; }
.article h2 { font-family: var(--font-display); font-size: 26px; font-weight: 400; margin: 48px 0 16px; color: var(--text); letter-spacing: -0.01em; }
.article h3 { font-size: 20px; font-weight: 700; margin: 32px 0 12px; color: var(--text); }
.article p { font-size: 17px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 16px; }
.article a { color: var(--accent); text-decoration: underline; }
.article strong { color: var(--text); }
.article ul, .article ol { padding-left: 24px; margin: 16px 0 20px; }
.article li { font-size: 16px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 8px; }
.article li strong { color: var(--text); }
.article code { font-family: var(--font-code); background: rgba(239, 68, 68, 0.08); padding: 2px 8px; border-radius: 6px; font-size: 14px; color: var(--accent); border: 1px solid rgba(239, 68, 68, 0.12); }
.article pre { background: #0a0a14; border: 1px solid var(--glass-border); border-radius: 12px; padding: 20px; overflow-x: auto; margin: 20px 0; }
.article pre code { background: none; padding: 0; font-size: 14px; color: var(--text); line-height: 1.6; border: none; }
.article blockquote { border-left: 3px solid var(--accent); padding: 16px 20px; margin: 20px 0; background: var(--accent-soft); border-radius: 0 12px 12px 0; }
.article blockquote p { color: var(--text); margin-bottom: 0; }
.article img, .article video { width: 100%; border-radius: 12px; margin: 24px 0; border: 1px solid var(--glass-border); }

/* Info box / callout */
.callout { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 16px; padding: 24px; margin: 24px 0; }
.callout h4 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.callout p { margin-bottom: 8px; }
.callout p:last-child { margin-bottom: 0; }

/* Video embed */
.video-embed { position: relative; width: 100%; border-radius: 12px; overflow: hidden; margin: 24px 0; border: 1px solid var(--glass-border); background: var(--bg-card); aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; }
.video-embed .placeholder { text-align: center; color: var(--text-dim); }
.video-embed .placeholder span { font-size: 48px; display: block; margin-bottom: 8px; }
.video-embed .placeholder p { font-size: 14px; }
.video-embed video { width: 100%; height: 100%; object-fit: cover; }

/* Diagram / illustration */
.diagram { background: var(--bg-light); border: 1px solid var(--glass-border); border-radius: 16px; padding: 32px; margin: 24px 0; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.diagram .caption { font-size: 13px; color: var(--text-dim); margin-top: 12px; }

/* Related articles */
.related-articles { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 16px; padding: 28px; margin: 40px 0 24px; }
.related-articles h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.related-articles ul { list-style: none; padding: 0; margin: 0; }
.related-articles li { padding: 8px 0; border-bottom: 1px solid var(--glass-border); }
.related-articles li:last-child { border-bottom: none; }
.related-articles a { color: var(--accent); text-decoration: none; font-size: 15px; }
.related-articles a:hover { text-decoration: underline; }

/* CTA box */
.article-cta { background: linear-gradient(135deg, var(--surface), var(--accent-soft)); border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 20px; padding: 36px; text-align: center; margin: 40px 0; }
.article-cta h3 { font-family: var(--font-display); font-size: 24px; font-weight: 400; margin-bottom: 8px; }
.article-cta p { color: var(--text-muted); margin-bottom: 20px; }
.article-cta .btn-primary { display: inline-flex; }

/* TOC */
.toc { background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 16px; padding: 24px; margin: 0 0 40px; }
.toc h4 { font-size: 14px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.toc ol { padding-left: 20px; margin: 0; }
.toc li { font-size: 15px; padding: 4px 0; }
.toc a { color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Blog index */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.blog-card { background: var(--surface); border: 1px solid var(--surface-alt); border-radius: var(--radius); padding: 28px; transition: all 0.3s ease; box-shadow: var(--shadow-card); }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-elevated); }
.blog-card .tag { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.blog-card h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.blog-card h3 a { color: var(--text); text-decoration: none; }
.blog-card h3 a:hover { color: var(--accent); }
.blog-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.blog-card .read-time { font-size: 13px; color: var(--text-dim); }

@media (max-width: 768px) {
  .article { padding: 0 16px 60px; }
  .article h2 { font-size: 22px; }
  .blog-grid { grid-template-columns: 1fr; }
}

/* Experience boxes */
.experience-box {
  background: var(--bg-alt);
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.95em;
  line-height: 1.6;
}
.experience-box strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
}

/* Breadcrumbs */
.breadcrumb { padding: 12px 0; font-size: 0.8em; color: var(--text-muted); max-width: 760px; margin: 0 auto; padding-left: 24px; padding-right: 24px; padding-top: 80px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; }


/* Exit-intent popup */
.exit-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.exit-overlay.exit-visible { opacity: 1; pointer-events: auto; }
.exit-card {
  background: var(--surface); border: 1px solid var(--surface-alt);
  border-radius: 20px; padding: 36px 32px; max-width: 420px; width: 90%;
  text-align: center; position: relative;
  box-shadow: var(--shadow-elevated);
}
.exit-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text-muted); font-size: 24px;
  cursor: pointer; line-height: 1;
}
.exit-close:hover { color: var(--text); }
.exit-card h2 { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--text); margin-bottom: 8px; }
.exit-card p { font-size: 15px; color: var(--text-secondary); margin-bottom: 20px; }
.exit-form { display: flex; gap: 10px; margin-bottom: 16px; }
.exit-input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 15px; font-family: inherit;
}
.exit-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.exit-input::placeholder { color: var(--text-faded); }
.exit-btn {
  background: var(--accent); color: #fff; padding: 12px 20px;
  border-radius: var(--radius-pill); font-size: 15px; font-weight: 700;
  border: none; cursor: pointer; white-space: nowrap;
  transition: background 0.2s;
}
.exit-btn:hover { background: var(--accent-dark); }
.exit-dismiss {
  background: none; border: none; color: var(--text-faded); font-size: 13px;
  cursor: pointer; text-decoration: underline;
}
.exit-dismiss:hover { color: var(--text-muted); }
@media (max-width: 768px) {
  .exit-form { flex-direction: column; }
  .exit-card { padding: 28px 20px; }
}

/* === ENGAGEMENT FEATURES === */

/* Reading progress bar */
#reading-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px;
  z-index: 9999; background: transparent;
}
#reading-progress-fill {
  height: 100%; width: 0; background: var(--accent);
  transition: width 0.1s linear;
}

/* Code copy button */
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(239, 68, 68, 0.15); color: var(--accent);
  border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 6px;
  padding: 4px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; opacity: 0; transition: opacity 0.2s;
  font-family: var(--font-body);
}
.article pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(239, 68, 68, 0.25); }
.copy-btn.copied { background: rgba(34, 197, 94, 0.2); color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }

/* Sticky TOC (desktop only) */
#sticky-toc {
  position: fixed; top: 120px; right: 24px; width: 220px;
  background: var(--bg-card); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 16px 20px;
  max-height: calc(100vh - 200px); overflow-y: auto;
  z-index: 100; opacity: 0.85; transition: opacity 0.2s;
}
#sticky-toc:hover { opacity: 1; }
#sticky-toc h4 {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
#sticky-toc ul { list-style: none; padding: 0; margin: 0; }
#sticky-toc li { padding: 3px 0; }
#sticky-toc a {
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  display: block; padding: 2px 0; border-left: 2px solid transparent;
  padding-left: 10px; transition: all 0.2s;
}
#sticky-toc a:hover { color: var(--accent); }
#sticky-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

@media (max-width: 1200px) {
  #sticky-toc { display: none; }
}
@media (min-width: 1201px) and (max-width: 1400px) {
  #sticky-toc { width: 180px; right: 12px; }
}

/* Section highlight on click */
.section-highlight {
  animation: highlight-flash 2s ease-out;
}
@keyframes highlight-flash {
  0% { background: rgba(239, 68, 68, 0.1); }
  100% { background: transparent; }
}

/* Quiz CTA inline */
.quiz-cta-inline {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06), rgba(139, 92, 246, 0.04));
  border: 1px solid rgba(239, 68, 68, 0.15); border-radius: 16px;
  padding: 24px; margin: 32px 0;
}
.quiz-cta-inner {
  display: flex; align-items: center; gap: 16px;
}
.quiz-cta-icon { font-size: 32px; flex-shrink: 0; }
.quiz-cta-inner strong { font-size: 16px; color: var(--text); display: block; margin-bottom: 4px; }
.quiz-cta-inner p { font-size: 14px; color: var(--text-muted); margin: 0; }
.quiz-cta-inner .btn-small {
  padding: 8px 20px; font-size: 14px; white-space: nowrap;
  flex-shrink: 0; margin-left: auto;
}
@media (max-width: 768px) {
  .quiz-cta-inner { flex-direction: column; text-align: center; }
  .quiz-cta-inner .btn-small { margin-left: 0; }
}
