/* 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 { padding: 16px 20px; margin: 20px 0; background: var(--accent-soft); border-radius: 12px; }
.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); }

/* Zoomable images — click to expand */
.article .img-zoom-wrap {
  position: relative;
  cursor: zoom-in;
  margin: 24px 0;
}
.article .img-zoom-wrap img {
  transition: transform 0.2s, box-shadow 0.2s;
  margin: 0;
}
.article .img-zoom-wrap:hover img {
  transform: scale(1.01);
  box-shadow: none;
  border-color: rgba(239, 68, 68, 0.3);
}
.article .img-zoom-wrap::after {
  content: '\1F50D  Ampliar imagen';
  position: absolute;
  bottom: 16px;
  right: 12px;
  background: rgba(15, 15, 24, 0.88);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.article .img-zoom-wrap:hover::after {
  opacity: 1;
}

/* Lightbox overlay */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.img-lightbox.lb-visible {
  opacity: 1;
  pointer-events: auto;
}
.img-lightbox img {
  max-width: 95vw;
  max-height: 92vh;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}
.img-lightbox .lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}
.img-lightbox .lb-close:hover { opacity: 1; }
.img-lightbox .lb-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted, #aaa);
  font-size: 13px;
  text-align: center;
  max-width: 600px;
}

/* Tables — premium style */
.article table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 2px;
  border-radius: 14px;
  overflow: hidden;
  font-size: 0.9rem;
  margin: 28px 0;
  border: 1px solid var(--glass-border);
}
.article thead tr {
  background: rgba(239, 68, 68, 0.06);
}
.article th {
  padding: 16px 22px;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 2px solid rgba(239, 68, 68, 0.15);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.article td {
  padding: 18px 22px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.7;
  vertical-align: middle;
}
.article tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
.article tbody tr:hover {
  background: rgba(239, 68, 68, 0.03);
}
.article tbody tr:last-child td {
  border-bottom: none;
}
.article td strong {
  color: var(--text);
}
/* Responsive: horizontal scroll on small screens */
.article .table-wrap {
  overflow-x: auto;
  margin: 24px -8px;
  padding: 0 8px;
  -webkit-overflow-scrolling: touch;
}
/* Table color-coded cells */
.article td.t-green, .article td.t-green strong { color: #22c55e; }
.article td.t-blue, .article td.t-blue strong { color: #3b82f6; }
.article td.t-amber, .article td.t-amber strong { color: #f59e0b; }
.article td.t-red, .article td.t-red strong { color: #ef4444; }
.article td.t-cyan, .article td.t-cyan strong { color: #06b6d4; }
.article td.t-muted { color: var(--text-dim, #6b7280); }

/* Numeric cells: tabular figures */
.article td.t-num {
  font-family: var(--font-code, 'JetBrains Mono', monospace);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Highlight row (sweet spot, winner, etc.) */
.article tbody tr.t-highlight {
  background: rgba(239, 68, 68, 0.06);
}
.article tbody tr.t-highlight td {
  color: var(--text);
  font-weight: 600;
}
.article tbody tr.t-highlight-green {
  background: rgba(34, 197, 94, 0.06);
}
.article tbody tr.t-highlight-green td {
  font-weight: 600;
}
.article tbody tr.t-highlight-amber {
  background: rgba(245, 158, 11, 0.06);
}

/* Inline badge inside table */
.t-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-left: 6px;
}
.t-badge-green { background: rgba(34, 197, 94, 0.12); color: #6ee7b7; border: 1px solid rgba(34, 197, 94, 0.24); }
.t-badge-amber { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.24); }
.t-badge-red { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.24); }
.t-badge-blue { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.24); }

/* Star ratings — colored inline */
.stars { white-space: nowrap; letter-spacing: 1px; font-size: 0.9em; }
.stars .on { color: #f59e0b; }
.stars .off { color: rgba(255,255,255,0.12); }
/* Semantic color variants */
.stars.stars-green .on { color: #22c55e; }
.stars.stars-red .on { color: #ef4444; }
.stars.stars-blue .on { color: #3b82f6; }

/* Provider/feature pill in tables */
.t-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.t-pill-cloud { background: rgba(59,130,246,0.12); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.t-pill-self { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.2); }
.t-pill-gpu { background: rgba(59,130,246,0.12); color: #3B82F6; border: 1px solid rgba(59,130,246,0.2); }
.t-pill-free { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }

/* Winner/best row glow */
.article tbody tr.t-winner {
  background: rgba(34,197,94,0.06);
  box-shadow: inset 3px 0 0 #22c55e;
}
.article tbody tr.t-winner td:first-child { font-weight: 700; color: var(--text); }

/* Vs separator row */
.article tbody tr.t-separator td {
  background: rgba(239,68,68,0.04);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  padding: 8px 22px;
  border-bottom: 2px solid rgba(239,68,68,0.12);
}

/* Table caption */
.article table caption {
  caption-side: bottom;
  text-align: left;
  font-size: 0.78rem;
  color: var(--text-dim, #6b7280);
  padding: 10px 18px 0;
  line-height: 1.5;
}

.article .table-wrap table {
  min-width: 600px;
  margin: 0;
}

/* 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: var(--surface); 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); 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); 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);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 8px;
  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: 13px; font-weight: 700; color: var(--text-dim);
  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: rgba(239, 68, 68, 0.06);
  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; }
}
