/* ─── Blog ──────────────────────────────────────────────────────────────────
   Loaded after ../styles.css: reuses the site's variables, nav, footer,
   buttons and light/dark theme. Only blog-specific layout lives here. */

/* Current page in the nav */
.nav-links a.active { color: var(--text-primary); }
.nav-links a.active::after { transform: scaleX(1); }

.nav-logo a { display: flex; }

/* First section sits under the fixed nav */
.blog-top {
  padding-top: calc(var(--nav-height) + 32px);
}

.blog-top .section-header .hero-eyebrow { margin-bottom: 20px; }

.blog-title {
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

/* ─── Blog index: article cards ─────────────────────────────────────────── */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 36px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.post-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}

.post-card:hover::before { opacity: 1; }

.post-tag,
.article-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 12px;
}

.post-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.post-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 20px;
  flex-grow: 1;
}

.post-meta,
.article-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.post-card .project-link { align-self: flex-start; }

/* ─── Article page ──────────────────────────────────────────────────────── */
.article-wrap {
  max-width: 740px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 40px;
  transition: color var(--transition);
}

.back-link:hover { color: var(--accent-text); }

.article-header {
  padding-bottom: 32px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 20px;
}

.article-meta { margin-bottom: 0; }

.article-body {
  font-size: 1.07rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-body p { margin-bottom: 22px; }

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 48px 0 16px;
}

.article-body strong { color: var(--text-primary); font-weight: 600; }

.article-body a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 24px;
  padding-inline-start: 24px;
}

.article-body li { margin-bottom: 12px; padding-inline-start: 6px; }
.article-body li::marker { color: var(--accent-text); font-weight: 700; }

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 32px 0 12px;
}

/* Highlighted box (definitions, key takeaways) */
.article-note {
  margin: 32px 0;
  padding: 24px 28px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent-secondary);
  border-radius: var(--radius-md);
}

.article-note > strong:first-child {
  display: block;
  margin-bottom: 12px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-secondary-text);
}

/* Diagrams: inline SVG drawn with the theme variables, so they follow light/dark mode */
.article-figure {
  margin: 36px 0;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.article-figure svg { display: block; width: 100%; height: auto; }

.article-figure figcaption {
  margin-top: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-muted);
}

.fig-line   { stroke: var(--text-muted); stroke-opacity: 0.35; stroke-width: 1; }
.fig-wire   { stroke: var(--accent-text); stroke-linecap: round; fill: none; }
.fig-node   { fill: var(--bg-primary); stroke: var(--accent-text); stroke-width: 2; }
.fig-box    { fill: var(--bg-primary); stroke: var(--text-muted); stroke-opacity: 0.45; }
.fig-fill   { fill: var(--accent); }
.fig-soft   { fill: var(--accent); fill-opacity: 0.4; }
.fig-arrow  { fill: var(--accent-text); }
.fig-text   { fill: var(--text-secondary); font-family: inherit; font-size: 15px; }
.fig-strong { fill: var(--text-primary); font-weight: 700; }
.fig-label  { fill: var(--text-muted); font-family: inherit; font-size: 13px; }
.fig-on-fill { fill: #FFFFFF; font-weight: 700; }

/* Comparison table */
.article-table {
  margin: 32px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.article-table table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.6; }
.article-table th,
.article-table td { padding: 14px 16px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.article-table tr:last-child td { border-bottom: 0; }
.article-table thead th { background: var(--bg-card); color: var(--text-primary); font-weight: 700; }
.article-table tbody th { color: var(--text-primary); font-weight: 600; }

/* "What the AI actually receives": a labelled card, one block per part */
.article-prompt {
  margin: 32px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.article-prompt-head {
  padding: 12px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.article-prompt-part {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.7;
}

.article-prompt-part:last-child { border-bottom: 0; }

.article-prompt-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.article-prompt-part p { margin: 0; }
.article-prompt-part p + p { margin-top: 8px; }
.article-prompt-answer { background: var(--bg-primary); }

.fig-dash { stroke: var(--accent-text); stroke-width: 1.5; stroke-dasharray: 5 5; fill: none; }

/* End-of-article call to action */
.article-cta {
  margin-top: 56px;
  padding: 40px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.article-cta::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
}

.article-cta h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.article-cta p {
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

/* ─── Arabic ────────────────────────────────────────────────────────────── */
body.font-arabic .article-body { font-size: 1.12rem; line-height: 2; }
body.font-arabic .post-card p  { font-size: 0.97rem; line-height: 1.85; }
body.font-arabic .post-tag,
body.font-arabic .article-tag,
body.font-arabic .article-prompt-head,
body.font-arabic .article-prompt-label { letter-spacing: 0; }

@media (max-width: 768px) {
  .post-list { grid-template-columns: 1fr; }
  .article-cta { padding: 28px 22px; }
  /* Keep diagram labels readable: scroll sideways instead of shrinking */
  .article-figure { padding: 16px; overflow-x: auto; }
  .article-figure svg { min-width: 520px; }
}
