﻿/**
 * Blog styles — list (blog/index) + detail (blog/show)
 * Extracted from inline <style> for caching + performance (Cache-Control: 1y immutable)
 */

/* ========================================
   Blog list (blog/index.ejs)
   ======================================== */
.blog-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(220, 38, 38,0.3), transparent 70%);
  filter: blur(80px);
}
.blog-hero .container { position: relative; z-index: 1; }
.blog-hero .eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary-light);
  margin-bottom: 14px;
}
.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
}
.blog-hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.6);
  max-width: 560px;
  margin: 0 auto;
}

.blog-categories {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.cat-pill {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.cat-pill:hover { border-color: var(--primary); color: var(--primary); }
.cat-pill.active { background: var(--primary); color: white; border-color: var(--primary); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 60px;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
  color: inherit;
}
.blog-card--featured { grid-column: span 2; grid-row: span 2; }
.blog-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
  font-size: 3rem;
}
.blog-card--featured .blog-card-thumb-placeholder { aspect-ratio: 4/3; font-size: 4rem; }
.blog-card-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.blog-card--featured .blog-card-thumb { aspect-ratio: 4/3; }
.blog-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.blog-card-cat {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(220, 38, 38,0.1);
  padding: 3px 10px;
  border-radius: 999px;
}
.blog-card-date { font-size: 0.78rem; color: var(--text-muted); }
.blog-card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card--featured .blog-card-title { font-size: 1.5rem; -webkit-line-clamp: 3; }
.blog-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
  flex: 1;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}
.blog-card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}
.blog-card-author { font-size: 0.82rem; font-weight: 600; }
.blog-card-read { margin-left: auto; font-size: 0.82rem; color: var(--text-muted); }

.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-bottom: 60px;
}
.blog-pagination a {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
}
.blog-pagination a:hover { border-color: var(--primary); color: var(--primary); }
.blog-pagination a.active { background: var(--primary); color: white; border-color: var(--primary); }

@media (max-width: 900px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-card--featured { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 600px) {
  .blog-grid { grid-template-columns: 1fr; }
  .blog-card--featured { grid-column: span 1; }
}

/* ========================================
   Blog detail (blog/show.ejs)
   ======================================== */
.breadcrumb { padding: 20px 0; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 8px; }
.breadcrumb-current { color: var(--text); }

.article-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
  padding-bottom: 60px;
}
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
}

.article-header { margin-bottom: 32px; }
.article-cat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(220, 38, 38,0.1);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  text-decoration: none;
}
.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.article-meta-author {
  display: flex;
  align-items: center;
  gap: 10px;
}
.article-meta-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}
.article-meta-name { font-weight: 600; color: var(--text); }
.article-meta-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); }

.article-featured-img {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #e0e7ff, #fce7f3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  margin-bottom: 36px;
  overflow: hidden;
}
.article-featured-img img { width: 100%; height: 100%; object-fit: cover; }

.article-content { font-size: 1.05rem; line-height: 1.85; color: var(--text-light); }
.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.article-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
}
.article-content h2,
.article-content h3 { scroll-margin-top: 90px; }
.article-content p { margin-bottom: 18px; }
.article-content ul,
.article-content ol { margin: 16px 0; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  margin: 24px 0;
  background: rgba(220, 38, 38,0.05);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-style: italic;
  color: var(--text);
}
.article-content code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--primary);
}
.article-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px 24px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
.article-content pre code { background: transparent; color: inherit; padding: 0; }
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  margin: 24px 0;
}
.article-content figure { margin: 24px 0; }
.article-content figure img { margin: 0; }
.article-content figcaption {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.article-tag {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
  text-decoration: none;
}
.article-tag:hover { border-color: var(--primary); color: var(--primary); }

.article-share {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.article-share span { font-size: 0.88rem; font-weight: 600; }
.share-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-light);
}
.share-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* Sidebar */
.sidebar { position: sticky; top: 24px; }
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.sidebar-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-cta {
  background: linear-gradient(135deg, #dc2626, #475569);
  border: none;
  color: white;
  text-align: center;
}
.sidebar-cta h3 { color: white; border-bottom-color: rgba(255,255,255,0.2); }
.sidebar-cta p { font-size: 0.88rem; color: rgba(255,255,255,0.8); margin-bottom: 16px; }
.sidebar-cta .cta-btn {
  display: inline-block;
  padding: 12px 24px;
  background: white;
  color: var(--primary);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.15s;
  text-decoration: none;
}
.sidebar-cta .cta-btn:hover { transform: translateY(-2px); color: var(--primary); }

/* Table of contents */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}
.toc-list li {
  border-left: 2px solid var(--border);
  padding: 6px 0 6px 14px;
  margin-left: 2px;
  transition: all 0.15s;
}
.toc-list li.toc-h3 { padding-left: 28px; font-size: 0.84rem; }
.toc-list a {
  display: block;
  color: var(--text-light);
  font-size: 0.88rem;
  line-height: 1.4;
  text-decoration: none;
  font-weight: 500;
}
.toc-list a:hover { color: var(--primary); }
.toc-list li.active { border-left-color: var(--primary); }
.toc-list li.active a { color: var(--primary); font-weight: 700; }
.toc-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 0;
}

/* Related posts */
.related-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  margin-bottom: 60px;
}
.related-section h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 1000px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .related-grid { grid-template-columns: 1fr; }
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  color: inherit;
}
.related-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, #e0e7ff, #fce7f3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  object-fit: cover;
}
.related-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.related-cat {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
}
.related-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.related-date { font-size: 0.78rem; color: var(--text-muted); margin-top: auto; }
