/* ==========================================================================
   Yudira — Engineering Blog
   Extends css/style.css. Uses the same design tokens (colors, radii, fonts).
   ========================================================================== */

/* ---------- Blog listing grid ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border-strong);
}

.blog-card-media {
  aspect-ratio: 16/9;
  background: var(--gradient-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  box-sizing: border-box;
  transition: transform 0.5s var(--ease);
}
.blog-card:hover .blog-card-media img { transform: scale(1.05); }
.blog-card-media .blog-card-fallback {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  opacity: 0.7;
}

.blog-card-body {
  padding: 24px 24px 26px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.blog-card-meta span:first-child {
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blog-card-body h3 {
  font-size: 19px;
  line-height: 1.3;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-body p {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 18px;
}
.blog-card-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
}
.blog-card-cta .arrow { transition: transform 0.3s var(--ease); }
.blog-card:hover .blog-card-cta .arrow { transform: translateX(3px); }

.blog-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

/* ---------- Single post ---------- */
.blog-post {
  padding: calc(var(--nav-h) + 90px) 0 100px;
}
.blog-post-container {
  max-width: 760px;
}
.blog-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 36px;
  transition: color 0.25s var(--ease);
}
.blog-back:hover { color: var(--blue); }

.blog-post-header { margin-bottom: 32px; }
.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.blog-post-meta .cat { color: var(--blue); }
.blog-post-meta .date { white-space: nowrap; }
.blog-post-header h1 {
  font-size: clamp(30px, 4.6vw, 46px);
  margin-bottom: 16px;
}
.blog-post-excerpt {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.blog-post-media {
  margin-bottom: 40px;
}
.blog-post-media figure {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card-bg);
}
.blog-post-media figure img {
  width: 100%;
  height: auto;
  display: block;
}
.blog-post-media figcaption {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.blog-post-media video,
.blog-post-media iframe {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #000;
  display: block;
}
.blog-post-media iframe { height: 560px; border: 1px solid var(--border); }
.blog-video-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-strong);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.blog-video-link:hover { border-color: var(--blue); color: var(--blue); }

.blog-not-found {
  text-align: center;
  padding: 80px 20px;
}
.blog-not-found h1 { margin-bottom: 16px; }
.blog-not-found p { color: var(--text-secondary); margin-bottom: 28px; }

/* ---------- Markdown prose ---------- */
.prose { font-size: 17px; color: var(--text-secondary); line-height: 1.75; }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text);
  margin: 40px 0 16px;
}
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 21px; }
.prose h4 { font-size: 17px; }
.prose p { margin: 0 0 20px; }
.prose a { color: var(--blue); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--blue); }
.prose a.btn { text-decoration: none; color: #fff; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 8px; }
.prose blockquote {
  margin: 0 0 24px;
  padding: 4px 20px;
  border-left: 3px solid var(--blue);
  color: var(--text);
  font-style: italic;
  background: var(--gradient-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.prose img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 8px 0 24px;
}
.prose code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--chip-bg);
  color: var(--chip-text);
  padding: 2px 6px;
  border-radius: 5px;
}
.prose pre {
  margin: 0 0 24px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  background: #0d1117;
  border: 1px solid var(--border);
}
.prose pre code {
  background: none;
  color: #e6edf3;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 28px;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.prose th {
  background: var(--bg-alt);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .blog-grid { grid-template-columns: 1fr; }
  .blog-post-media iframe { height: 380px; }
}
