/* ==========================================================================
   Saif Modan — Blog Stylesheet
   Consistent with Main Design System (Bricolage Grotesque, Instrument Serif, JetBrains Mono)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Blog Listing Page (.blog-page-body)
   -------------------------------------------------------------------------- */
.blog-page-body {
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.blog-main-content {
  flex: 1 0 auto;
  padding-top: clamp(6.5rem, 12vh, 8.5rem);
  padding-bottom: clamp(4rem, 8vh, 6.5rem);
}

/* Page Header Block */
.blog-page-header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: clamp(2.5rem, 5vh, 4rem);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

@media (min-width: 868px) {
  .blog-page-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.blog-header-left {
  max-width: 600px;
}

.blog-top-kicker {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.5rem;
}

.blog-hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-main);
}

.blog-header-right {
  max-width: 420px;
}

.blog-header-serif {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  color: var(--text-muted);
  line-height: 1.4;
  font-style: italic;
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3rem);
  width: 100%;
}

@media (min-width: 768px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Blog Card */
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-fast), box-shadow var(--transition-smooth);
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.08);
}

.blog-card-thumbnail-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #09090b;
  overflow: hidden;
  border-bottom: 1px solid var(--border-light);
}

.blog-card-thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.blog-card:hover .blog-card-thumbnail {
  transform: scale(1.05);
}

.blog-card-tag-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 2;
}

.blog-card-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.blog-card-meta .meta-dot {
  color: var(--text-subtle);
}

.blog-card-title {
  font-size: clamp(1.1rem, 1.4vw, 1.25rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  transition: color var(--transition-fast);
}

.blog-card:hover .blog-card-title {
  color: #000000;
}

.blog-card-desc {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-main);
}

.blog-card-footer svg {
  transition: transform var(--transition-fast);
}

.blog-card:hover .blog-card-footer svg {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Individual Blog Post Page (.blog-post-page-body)
   -------------------------------------------------------------------------- */
.blog-post-page-body {
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.blog-post-main {
  flex: 1 0 auto;
  padding-top: clamp(6.5rem, 12vh, 8.5rem);
  padding-bottom: clamp(4rem, 8vh, 6.5rem);
}

.blog-article-wrapper {
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
}

/* Back Link */
.blog-back-nav {
  margin-bottom: 1.75rem;
}

.blog-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

.blog-back-link:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateX(-2px);
}

/* Article Header */
.blog-article-header {
  margin-bottom: 2.25rem;
}

.blog-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.blog-tag-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-body);
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.blog-article-title {
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.blog-article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.blog-author-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #09090b;
  border: 1px solid var(--border-light);
}

.author-info-text {
  display: flex;
  flex-direction: column;
}

.author-name-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.author-role-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blog-article-stats {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Featured Cover Image */
.blog-article-cover-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 2.75rem;
  background: #09090b;
  border: 1px solid var(--border-light);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.1);
}

.blog-article-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --------------------------------------------------------------------------
   Article Markdown Content Typography
   -------------------------------------------------------------------------- */
.blog-article-content {
  font-family: var(--font-primary);
  font-size: clamp(1.05rem, 1.25vw, 1.15rem);
  line-height: 1.8;
  color: #27272a;
  word-break: break-word;
}

.blog-article-content p {
  margin-bottom: 1.6rem;
}

.blog-article-content h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-main);
  margin-top: 2.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
}

.blog-article-content h3 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text-main);
  margin-top: 2.2rem;
  margin-bottom: 0.75rem;
}

.blog-article-content h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.6rem;
  margin-bottom: 0.5rem;
}

.blog-article-content ul,
.blog-article-content ol {
  margin-bottom: 1.6rem;
  padding-left: 1.6rem;
}

.blog-article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.blog-article-content strong {
  font-weight: 700;
  color: var(--text-main);
}

.blog-article-content a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.blog-article-content a:hover {
  color: var(--accent-emerald);
}

.blog-article-content blockquote {
  border-left: 3px solid var(--text-main);
  padding: 0.75rem 0 0.75rem 1.4rem;
  margin: 1.8rem 0;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--text-body);
}

.blog-article-content blockquote p {
  margin-bottom: 0;
}

.blog-article-content hr {
  border: 0;
  border-top: 1px solid var(--border-light);
  margin: 2.5rem 0;
}

/* Code Blocks & Inline Code */
.blog-article-content pre {
  background: #09090b;
  color: #f4f4f5;
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin: 1.8rem 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.25);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.blog-article-content pre code {
  background: transparent;
  padding: 0;
  border: 0;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
}

.blog-article-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: #18181b;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
}

/* Tables */
.blog-article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.blog-article-content th,
.blog-article-content td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.blog-article-content th {
  background: var(--bg-card-hover);
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-article-content tr:last-child td {
  border-bottom: none;
}

/* Author Box at Bottom of Article */
.blog-post-author-box {
  margin-top: 3.5rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .blog-post-author-box {
    flex-direction: row;
    align-items: center;
  }
}

.author-box-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #09090b;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
}

.author-box-details {
  flex: 1 1 auto;
}

.author-box-kicker {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-subtle);
  display: block;
  margin-bottom: 0.25rem;
}

.author-box-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.author-box-bio {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.author-box-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.author-box-links a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-box-links a:hover {
  color: var(--accent-emerald);
}

/* Bottom Post Navigation */
.blog-bottom-nav {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
