/* Blog listing */
.blog-listing {
  margin-top: 8px;
}

/* Filter bar */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.blog-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #ffffff;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.blog-filter-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.blog-filter-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.blog-filter-btn--cat {
  border-style: dashed;
}

.blog-filter-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  margin-left: 1px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.blog-filter-btn.active .blog-filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

html[data-theme="dark"] .blog-filter-btn {
  background: #1a1c24;
  border-color: #374151;
  color: #d1d5db;
}

html[data-theme="dark"] .blog-filter-btn:hover {
  border-color: #60a5fa;
  color: #60a5fa;
}

html[data-theme="dark"] .blog-filter-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

html[data-theme="dark"] .blog-filter-count {
  background: #232734;
  color: #e3e6ed;
}

/* Pinned section */
.blog-pinned {
  margin-bottom: 24px;
}

.blog-pinned__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.blog-pinned__label {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.blog-pinned__label i {
  color: #f97316;
  margin-right: 4px;
}

html[data-theme="dark"] .blog-pinned__label {
  color: #9ca3af;
}

/* Blog cards */
.blog-card {
  display: block;
  padding: 16px 20px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.blog-card--with-cover {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.blog-card__cover {
  width: 150px;
  min-height: 104px;
  flex: 0 0 150px;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f4f6;
}

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

.blog-card__body {
  flex: 1;
  min-width: 0;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
}

.blog-card--pinned {
  border-left: 3px solid #f97316;
}

.blog-card--pinned {
  display: block;
  padding: 12px 14px;
  margin-bottom: 0;
}

.blog-card--pinned .blog-card__header {
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
}

.blog-card--pinned .blog-card__heading {
  width: 100%;
}

.blog-card--pinned .blog-card__title {
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card--pinned .blog-card__meta {
  width: 100%;
  margin-left: 0;
  gap: 6px;
  font-size: 11px;
}

.blog-card--pinned .blog-card__desc {
  font-size: 13px;
  line-height: 1.4;
  -webkit-line-clamp: 1;
}

html[data-theme="dark"] .blog-card {
  background: #13151c;
  border-color: rgba(148, 163, 184, 0.15);
}

html[data-theme="dark"] .blog-card__cover {
  background: #1f2937;
}

html[data-theme="dark"] .blog-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(96, 165, 250, 0.4);
}

html[data-theme="dark"] .blog-card--pinned {
  border-left-color: #f97316;
}

@media (max-width: 640px) {
  .blog-pinned__grid {
    grid-template-columns: 1fr;
  }

  .blog-card--with-cover {
    flex-direction: column;
  }

  .blog-card__cover {
    width: 100%;
    min-height: 180px;
    flex-basis: auto;
  }
}

.blog-card__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.blog-card__heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.blog-card__pin {
  color: #f97316;
  font-size: 13px;
  flex-shrink: 0;
}

.blog-card__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: #1f2937;
  line-height: 1.4;
}

html[data-theme="dark"] .blog-card__title {
  color: #f1f5f9;
}

.blog-card__desc {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html[data-theme="dark"] .blog-card__desc {
  color: #9ca3af;
}

.blog-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #9ca3af;
}

html[data-theme="dark"] .blog-card__meta {
  color: #6b7280;
}

.blog-card__date i {
  margin-right: 4px;
}

.blog-card__tags,
.blog-card__cats {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.blog-card__tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
}

html[data-theme="dark"] .blog-card__tag {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
}

.blog-card__cat {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: #fef3c7;
  color: #d97706;
  font-size: 11px;
  font-weight: 600;
}

html[data-theme="dark"] .blog-card__cat {
  background: rgba(217, 119, 6, 0.15);
  color: #fcd34d;
}

/* Pagination */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  padding: 12px 0;
}

.blog-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.blog-page-btn:hover:not(:disabled) {
  border-color: #2563eb;
  color: #2563eb;
}

.blog-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

html[data-theme="dark"] .blog-page-btn {
  background: #1a1c24;
  border-color: #374151;
  color: #d1d5db;
}

html[data-theme="dark"] .blog-page-btn:hover:not(:disabled) {
  border-color: #60a5fa;
  color: #60a5fa;
}

.blog-page-info {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}

html[data-theme="dark"] .blog-page-info {
  color: #9ca3af;
}

/* Blog post page */
.blog-post {
  padding: 32px;
  margin-bottom: 24px;
}

.blog-post__header {
  float: none;
  position: relative;
  width: auto;
  padding: 0 0 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.blog-post__title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 14px;
  color: #111827;
}

html[data-theme="dark"] .blog-post__title {
  color: #f1f5f9;
}

.blog-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
}

html[data-theme="dark"] .blog-post__meta {
  color: #9ca3af;
}

.blog-post__date i {
  margin-right: 4px;
}

.blog-post__tags,
.blog-post__cats {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.blog-post__content {
  font-size: 15px;
  line-height: 1.75;
  color: #374151;
}

html[data-theme="dark"] .blog-post__content {
  color: #d1d5db;
}

.blog-post__content h1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin: 36px 0 14px;
  color: #111827;
}

.blog-post__content h1::before {
  content: "✦";
  color: #2563eb;
  font-size: 20px;
  line-height: 1;
}

html[data-theme="dark"] .blog-post__content h1 {
  color: #f1f5f9;
}

html[data-theme="dark"] .blog-post__content h1::before,
html[data-theme="dark"] .blog-post__content h2::before {
  color: #60a5fa;
}

.blog-post__content h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: #111827;
}

.blog-post__content h2::before {
  content: "#";
  color: #2563eb;
  font-size: 16px;
  font-weight: 800;
}

.blog-post__content h2::after {
  content: "";
  height: 2px;
  width: 46px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, rgba(37, 99, 235, 0.15));
}

html[data-theme="dark"] .blog-post__content h2 {
  color: #f1f5f9;
}

.blog-post__content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: #1f2937;
}

html[data-theme="dark"] .blog-post__content h3 {
  color: #e5e7eb;
}

.blog-post__content p {
  margin: 0 0 16px;
}

.blog-post__content a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

html[data-theme="dark"] .blog-post__content a {
  color: #93c5fd;
}

.blog-post__content blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid #2563eb;
  background: #f8fafc;
  border-radius: 0 8px 8px 0;
  color: #475569;
}

html[data-theme="dark"] .blog-post__content blockquote {
  background: #1a1c24;
  border-left-color: #60a5fa;
  color: #94a3b8;
}

.blog-post__content pre {
  margin: 16px 0;
  padding: 16px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #334155;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

html[data-theme="dark"] .blog-post__content pre {
  background: #1a1c24;
  border-color: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.blog-post__content code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  font-size: 0.9em;
}

.blog-post__content p code,
.blog-post__content li code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #c026d3;
  font-size: 0.88em;
}

html[data-theme="dark"] .blog-post__content p code,
html[data-theme="dark"] .blog-post__content li code {
  background: #1e2030;
  color: #e879f9;
}

.blog-post__content ul,
.blog-post__content ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.blog-post__content li {
  margin-bottom: 6px;
}

.blog-post__content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

.blog-post__zoomable-img {
  cursor: zoom-in;
}

.blog-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
}

.blog-image-lightbox.is-open {
  display: flex;
}

.blog-image-lightbox__img {
  max-width: min(96vw, 1280px);
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  cursor: zoom-out;
}

.blog-image-lightbox__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.blog-lightbox-open {
  overflow: hidden;
}

/* Post navigation */
.blog-post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.blog-post-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  max-width: 45%;
  transition: all 0.15s ease;
}

.blog-post-nav__link:hover {
  border-color: #2563eb;
  color: #2563eb;
}

html[data-theme="dark"] .blog-post-nav__link {
  background: #13151c;
  border-color: rgba(148, 163, 184, 0.15);
  color: #d1d5db;
}

html[data-theme="dark"] .blog-post-nav__link:hover {
  border-color: #60a5fa;
  color: #60a5fa;
}

.blog-post-nav__link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-post-nav__next {
  margin-left: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .blog-post {
    padding: 20px 16px;
  }

  .blog-post__title {
    font-size: 22px;
  }

  .blog-post-page {
    padding: 12px 0;
  }

  .blog-post-nav {
    flex-direction: column;
  }

  .blog-post-nav__link {
    max-width: 100%;
  }

  .blog-card {
    padding: 14px 16px;
  }
}
