/* ============================================================
   BLOG CORE STYLES
   Extends the existing site design system (CSS variables, fonts)
   Adds blog-specific UI: blog-header, article cards, pagination,
   article view, comments, share buttons, etc.
   ============================================================ */

/* ===== BLOG-SPECIFIC HEADER REPLACES THE BANNER =====
   The site header has a 468x60 ad banner; the blog header has a
   distinct "blog command bar" with a blog title, search, and
   quick category pills — clearly different from the ad banner
   but visually consistent with the site brand. */

/* When body has class .blog-page, hide the ad banner slot and
   reveal the blog command bar inside the existing header. */
body.blog-page .header-banner-slot { display: none !important; }
/* On blog pages, the blog-bar replaces the desktop nav to avoid
   clutter and overflow. The nav is hidden on blog pages. */
body.blog-page .desktop-nav { display: none !important; }

/* Blog command bar — shown only inside the header on blog pages */
.header-blog-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin: 0;
  flex: 1;
  max-width: 100%;
  min-width: 0;
}
body.blog-page .header-blog-bar { display: flex; }

.header-blog-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(167,139,250,0.12));
  border: 1px solid rgba(99,102,241,0.28);
  border-radius: 50px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(99,102,241,0.10);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-blog-title:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.45);
}
.header-blog-title i {
  font-size: 0.85rem;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-blog-title .hbt-sub {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
}

/* Blog search box — glassy pill input */
.header-blog-search {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 100px;
}
.header-blog-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: rgba(99,102,241,0.05);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--text);
  font-family: inherit;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-blog-search input::placeholder {
  color: var(--text-muted);
}
.header-blog-search input:hover {
  border-color: rgba(99,102,241,0.30);
}
.header-blog-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(99,102,241,0.10);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.10);
}
.header-blog-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 0.78rem;
  pointer-events: none;
}

/* Category quick pills — glassy */
/* Category pills removed from header per user request */
.header-blog-pills {
  display: none !important;
  max-width: 280px;
}
.header-blog-pills::-webkit-scrollbar { display: none; }
.header-blog-pills a {
  padding: 6px 12px;
  background: rgba(99,102,241,0.05);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-blog-pills a:hover {
  color: var(--primary);
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.10);
  transform: translateY(-1px);
}
.header-blog-pills a.active {
  color: white;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

/* ===== RESPONSIVE HEADER — gradually reduce content =====
   Now that desktop-nav is hidden on blog pages, the blog-bar has
   the full header width (minus brand + actions). We can show the
   search box at wider viewports.
   */
@media (max-width: 1200px) {
  /* Hide the blog search box on smaller screens */
  .header-blog-search { display: none; }
}
@media (max-width: 900px) {
  /* Hide the category quick pills on smaller screens */
  .header-blog-pills { display: none; }
  .header-blog-bar { gap: 8px; }
  .header-blog-title .hbt-sub { display: none; }
}
@media (max-width: 600px) {
  .header-blog-title { padding: 6px 10px; font-size: 0.72rem; }
}

/* ===== BLOG MAIN LAYOUT ===== */
.blog-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 24px 64px;
  scroll-padding-top: 16px;
}
.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   HERO — 2026 MODERN DESIGN
   Glassmorphism card with animated gradient mesh background,
   floating stat tiles with 3D depth, gradient text title.
   ============================================================ */
.blog-hero {
  background:
    linear-gradient(135deg, rgba(99,102,241,0.06) 0%, rgba(14,165,233,0.04) 50%, rgba(139,92,246,0.06) 100%);
  border: 1px solid rgba(99,102,241,0.10);
  border-radius: 24px;
  padding: 32px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
/* Animated gradient mesh orbs */
.blog-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(99,102,241,0.20), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: hero-orb-1 8s ease-in-out infinite;
}
.blog-hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 20%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(14,165,233,0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: hero-orb-2 10s ease-in-out infinite;
}
@keyframes hero-orb-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 20px) scale(1.1); }
}
@keyframes hero-orb-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -15px) scale(1.15); }
}

.blog-hero h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  font-weight: 900;
  margin: 0 0 14px;
  letter-spacing: -0.8px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.blog-hero h1 i {
  background: linear-gradient(135deg, #0ea5e9, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 0.85em;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.2));
}
.blog-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 680px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}
.blog-hero-stats {
  display: flex;
  gap: 16px;
  margin-top: 28px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.blog-hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(99,102,241,0.10);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 100px;
}
[data-theme="dark"] .blog-hero-stat {
  background: rgba(26,32,44,0.4);
}
.blog-hero-stat:hover {
  transform: translateY(-3px);
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 6px 20px rgba(99,102,241,0.10);
}
.blog-hero-stat .bhs-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -1px;
  line-height: 1;
}
.blog-hero-stat .bhs-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 700;
}

/* ===== ARTICLE GRID ===== */
.blog-grid {
  display: grid;
  /* minmax(300px) — 2 cards per row at desktop with sidebar */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.article-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.25s, border-color 0.25s;
  position: relative;
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99,102,241,0.35);
}
.article-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(167,139,250,0.10));
  display: block;
}
.article-card-cover-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #0ea5e9, #6366f1, #8b5cf6);
  background-size: 200% 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 3rem;
  letter-spacing: -1px;
  position: relative;
  overflow: hidden;
}
.article-card-cover-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 50%, rgba(255,255,255,0.10));
  pointer-events: none;
}
.article-card-cover-placeholder::after {
  content: '';
  position: absolute;
  bottom: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,255,255,0.20), transparent 70%);
  pointer-events: none;
}
.article-card:hover .article-card-cover-placeholder {
  background-position: 100% 100%;
  transition: background-position 1.2s ease;
}
.article-card-cover-placeholder > * { position: relative; z-index: 1; }
.article-card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.article-card-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--primary);
  background: rgba(99,102,241,0.10);
  padding: 3px 9px;
  border-radius: 50px;
  align-self: flex-start;
}
.article-card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-excerpt {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.article-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.article-card-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.article-card-author .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}
.article-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.article-card-readtime {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-page);
  border-radius: 50px;
}

/* Empty state */
.blog-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.blog-empty i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.blog-empty h3 {
  font-family: 'Montserrat', sans-serif;
  margin: 0 0 8px;
  color: var(--text);
}

/* ===== PAGINATION ===== */
.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.blog-pagination button,
.blog-pagination a {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}
.blog-pagination button:hover:not(:disabled),
.blog-pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.blog-pagination button.active,
.blog-pagination a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.blog-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== ARTICLE DETAIL VIEW ===== */
.article-view {
  max-width: 820px;
  margin: 0 auto;
}
.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.article-breadcrumb a {
  color: var(--primary);
  font-weight: 600;
}
.article-breadcrumb a:hover { text-decoration: underline; }
.article-breadcrumb .bc-sep { opacity: 0.5; }

.article-header {
  margin-bottom: 28px;
}
.article-header .ac-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--primary);
  background: rgba(99,102,241,0.10);
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 16px;
}
.article-title {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 900;
  margin: 0 0 16px;
  line-height: 1.2;
  letter-spacing: -1px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.article-author {
  display: flex;
  align-items: center;
  gap: 10px;
}
.article-author .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
}
.article-author-info {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  line-height: 1.3;
}
.article-author-info strong { color: var(--text); }
.article-author-info span { color: var(--text-muted); font-size: 0.78rem; }
.article-meta-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.article-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

/* Article content — render the rich text HTML */
.article-content {
  font-size: 1.05rem;
  line-height: 1.78;
  color: var(--text);
}
.article-content > *:first-child { margin-top: 0; }
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 32px 0 14px;
  line-height: 1.25;
}
.article-content h1 { font-size: 1.9rem; }
.article-content h2 {
  font-size: 1.5rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.article-content h3 { font-size: 1.25rem; }
.article-content h4 { font-size: 1.05rem; color: var(--primary); }
.article-content p { margin: 0 0 16px; }
.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.article-content a:hover { color: var(--primary-hover); }
.article-content ul, .article-content ol { margin: 0 0 16px; padding-left: 28px; }
.article-content li { margin-bottom: 6px; }
.article-content ul li::marker { color: var(--primary); }
.article-content ol li::marker { color: var(--primary); font-weight: 700; }
.article-content blockquote {
  margin: 24px 0;
  padding: 16px 22px;
  border-left: 4px solid var(--primary);
  background: rgba(99,102,241,0.06);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--text);
}
.article-content blockquote p { margin: 0; }
.article-content pre {
  background: #0D1117;
  color: #E2E8F0;
  padding: 18px 20px;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 20px 0;
  border: 1px solid #334155;
}
.article-content code {
  background: var(--bg-page);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'Courier New', monospace;
}
.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.88rem;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 16px 0;
}
.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92rem;
}
.article-content th, .article-content td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.article-content th { background: var(--bg-page); font-weight: 700; }

/* Tags */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.article-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s;
}
.article-tag:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99,102,241,0.08);
}

/* Share buttons */
.article-share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  flex-wrap: wrap;
}
.article-share-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-right: 4px;
}
/* Share buttons — brand-colored by default */
.share-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1rem;
  text-decoration: none;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.share-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.share-btn.tw { background: #000; }
.share-btn.fb { background: #1877F2; }
.share-btn.ln { background: #0A66C2; }
.share-btn.rd { background: #FF4500; }
.share-btn.cp { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.share-btn.cp:hover { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.share-btn.copied { background: #10b981 !important; }

/* Author bio block */
.article-author-box {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-top: 32px;
}
.article-author-box .avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.article-author-box .aab-info h4 {
  margin: 0 0 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.05rem;
  color: var(--text);
}
.article-author-box .aab-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Related articles */
.related-articles {
  margin-top: 48px;
}
.related-articles h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 20px;
  letter-spacing: -0.3px;
}

/* ===== CATEGORY PAGE ===== */
.category-header {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(167,139,250,0.08));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.category-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.category-info h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}
.category-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ===== SEARCH PAGE ===== */
.search-box-large {
  position: relative;
  margin-bottom: 28px;
}
.search-box-large input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s;
}
.search-box-large input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}
.search-box-large i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--text-muted);
}
.search-results-info {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.search-results-info strong { color: var(--text); }

/* Highlight matched text in search results */
mark {
  background: rgba(245, 158, 11, 0.25);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

/* ===== SIDEBAR ===== */
.blog-layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 84px;
}
.sidebar-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.sidebar-card h4 {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-card h4 i { color: var(--primary); }

.sidebar-cat-list { list-style: none; padding: 0; margin: 0; }
.sidebar-cat-list li {
  margin-bottom: 4px;
}
.sidebar-cat-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar-cat-list a:hover {
  background: rgba(99,102,241,0.08);
  color: var(--primary);
}
.sidebar-cat-list .cat-count {
  font-size: 0.72rem;
  background: var(--bg-page);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 50px;
  font-weight: 600;
}

.sidebar-popular { list-style: none; padding: 0; margin: 0; }
.sidebar-popular li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-popular li:last-child { border-bottom: none; }
.sidebar-popular a {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-popular .sp-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-popular .sp-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.sidebar-popular a:hover .sp-title { color: var(--primary); }

.sidebar-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sidebar-tag-cloud a {
  padding: 4px 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar-tag-cloud a:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99,102,241,0.08);
}

@media (max-width: 900px) {
  .blog-layout-with-sidebar {
    grid-template-columns: 1fr;
  }
  .blog-sidebar { position: static; }
}

/* ===== LOADING / ERROR ===== */
.blog-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.blog-loading .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: blogspin 0.8s linear infinite;
}
@keyframes blogspin { to { transform: rotate(360deg); } }

.blog-error {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.blog-error i {
  font-size: 3rem;
  color: #ef4444;
  margin-bottom: 16px;
}
.blog-error h3 {
  font-family: 'Montserrat', sans-serif;
  margin: 0 0 8px;
  color: var(--text);
}

/* ===== RTL ADJUSTMENT ===== */
[dir="rtl"] .article-card-meta,
[dir="rtl"] .article-meta {
  flex-direction: row-reverse;
}
[dir="rtl"] .article-card-date {
  margin-left: 0;
  margin-right: auto;
}
[dir="rtl"] .article-content ul,
[dir="rtl"] .article-content ol {
  padding-left: 0;
  padding-right: 28px;
}
[dir="rtl"] .article-content blockquote {
  border-left: none;
  border-right: 4px solid var(--primary);
  border-radius: 12px 0 0 12px;
}
[dir="rtl"] .header-blog-search i {
  left: auto;
  right: 12px;
}
[dir="rtl"] .header-blog-search input {
  padding: 8px 36px 8px 14px;
}

/* ===== READING PROGRESS BAR ===== */
#blog-reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
}
#brp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #6366f1, #8b5cf6);
  box-shadow: 0 0 8px rgba(99,102,241,0.4);
  transition: width 0.1s ease-out;
}

/* Print friendly */
@media print {
  .app-header, .page-footer, .sidebar, .header-blog-bar,
  .article-share, .article-tags, .related-articles, .article-author-box {
    display: none !important;
  }
  .article-content { font-size: 11pt; }
}

/* ============================================================
   UX ENHANCEMENTS — 2026
   Scroll-to-top button, smooth scrolling, focus states,
   loading skeleton, table of contents (auto-generated)
   ============================================================ */

/* === SMOOTH SCROLLING === */
html { scroll-behavior: smooth; }

/* === FOCUS STATES (accessibility) === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.lang-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* === SCROLL TO TOP BUTTON === */
#scroll-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 500;
}
#scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#scroll-to-top:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* === LOADING SKELETON === */
.blog-loading .spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(99,102,241,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: blogspin 0.8s linear infinite;
}
@keyframes blogspin { to { transform: rotate(360deg); } }

/* === ARTICLE CARD LAZY FADE-IN === */
.article-card {
  opacity: 0;
  animation: card-fade-in 0.4s ease-out forwards;
}
.article-card:nth-child(1) { animation-delay: 0.05s; }
.article-card:nth-child(2) { animation-delay: 0.1s; }
.article-card:nth-child(3) { animation-delay: 0.15s; }
.article-card:nth-child(4) { animation-delay: 0.2s; }
.article-card:nth-child(5) { animation-delay: 0.25s; }
.article-card:nth-child(6) { animation-delay: 0.3s; }
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === SIDEBAR CARD STICKY ON SCROLL === */
.blog-sidebar {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - var(--header-h, 70px) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.blog-sidebar::-webkit-scrollbar { width: 4px; }
.blog-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* === ARTICLE CONTENT ENHANCEMENTS === */
/* Add scroll-margin for heading anchors */
.article-content h2,
.article-content h3,
.article-content h4 {
  scroll-margin-top: 16px;
}

/* Code blocks: add copy button hint */
.article-content pre {
  position: relative;
}
.article-content pre:hover::after {
  content: 'Click to copy';
  position: absolute;
  top: 8px; right: 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  font-family: 'Poppins', sans-serif;
  pointer-events: none;
}

/* Images: subtle zoom on hover */
.article-content figure img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.article-content figure:hover img {
  transform: scale(1.02);
}

/* Blockquote: add quotation mark */
.article-content blockquote {
  position: relative;
}
.article-content blockquote::before {
  content: '\201C';
  position: absolute;
  top: -8px; left: 10px;
  font-size: 2.5rem;
  color: var(--primary);
  opacity: 0.2;
  font-family: Georgia, serif;
  line-height: 1;
}

/* === PAGINATION ENHANCEMENT === */
.blog-pagination a,
.blog-pagination button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-pagination a:hover:not(.active),
.blog-pagination button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
}

/* === ARTICLE BREADCRUMB ENHANCEMENT === */
.article-breadcrumb {
  padding: 8px 14px;
  background: rgba(99,102,241,0.04);
  border: 1px solid rgba(99,102,241,0.08);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

/* === SEARCH BOX ENHANCEMENT === */
.search-box-large input {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.search-box-large input:focus {
  transform: translateY(-1px);
}

/* === EMPTY STATE ENHANCEMENT === */
.blog-empty {
  padding: 80px 24px;
  text-align: center;
}
.blog-empty i {
  font-size: 3.5rem;
  opacity: 0.3;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ============================================================
   NATURAL PAGE SCROLL FIX (blog pages)
   The shared template locks the body to 100vh with overflow:hidden
   and scrolls an inner .blog-main container, which made the blog
   look squeezed into a small scrollable box. Blog pages scroll the
   document itself instead, with a sticky header.
   ============================================================ */
body.blog-page {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
body.blog-page .app-header {
  position: sticky;
  top: 0;
}
body.blog-page .blog-main {
  flex: 1 0 auto;
  overflow: visible;
  scroll-padding-top: calc(var(--header-h, 70px) + 16px);
}
body.blog-page .blog-sidebar {
  top: calc(var(--header-h, 70px) + 20px);
  max-height: calc(100vh - var(--header-h, 70px) - 40px);
}
html:has(body.blog-page) {
  height: auto;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h, 70px) + 16px);
}

/* ------------------------------------------------------------
   SCROLLBAR / VIEWPORT FIX (blog pages) — restructured
   The shared template's `html { overflow-x: hidden }` turns <html>
   into its own scroll container, which paints a blank strip beside
   the sticky header. Pairing `clip` with an explicit `overflow-y`
   re-creates that same scroll box (clip degrades to hidden when the
   other axis scrolls), so here ONLY the horizontal axis is set and
   the vertical axis stays `visible` — the scroll then propagates to
   the viewport: one scrollbar, full height, flush to the edge, and
   the header runs all the way up to it.
   ------------------------------------------------------------ */
html:has(body.blog-page) {
  overflow-x: clip;
  background: var(--bg-page);
}
body.blog-page {
  overflow-x: clip;
  overflow-y: visible;
  background: var(--bg-page);
}
/* Native scrollbar follows the active theme instead of painting a
   pale strip over the dark UI. */
html:has(body.blog-page) { color-scheme: light; }
html[data-theme="dark"]:has(body.blog-page) { color-scheme: dark; }

