.blog-section {
  display: grid;
  align-content: start;
  gap: 1.25rem;
}

.blog-toolbar {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.blog-toolbar-heading {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.blog-toolbar-heading h2 {
  margin-bottom: 0;
  writing-mode: horizontal-tb;
  white-space: nowrap;
}

.blog-toolbar-copy {
  color: #5f5f5f;
  max-width: 44rem;
}

.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  overflow-x: auto;
  padding: 0.1rem 0 0.15rem;
  scrollbar-width: thin;
}

.tag-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fffdf7;
  color: var(--text);
  border-radius: 999px;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(90, 74, 0, 0.08);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
}

.tag-filter-button:hover,
.tag-filter-button.is-active {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(74, 143, 212, 0.24);
}

.blog-status {
  color: #666;
}

.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  justify-content: start;
  align-items: stretch;
  gap: 1.1rem;
}

.blog-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.9rem;
  align-self: stretch;
  height: 100%;
  background: linear-gradient(180deg, #fffdf6, #fff8e8);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(90, 74, 0, 0.08);
}

.blog-card-no-cover::before {
  content: "";
  display: block;
  height: 8px;
  background: linear-gradient(90deg, var(--accent), #8abf5a);
}

.blog-card-cover {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: #f2ead0;
}

.blog-card-body {
  display: grid;
  gap: 0.8rem;
  align-content: start;
  grid-template-rows: auto auto minmax(5.8rem, auto) auto auto;
  height: 100%;
  padding: 1.1rem 1.1rem 1.2rem;
}

.blog-card-date,
.blog-post-date {
  color: #8a6f1d;
  font-size: 0.9rem;
  font-weight: 700;
}

.blog-card-title {
  font-size: 1.2rem;
  color: var(--accent-dark);
}

.blog-summary {
  color: #4a4a4a;
  font-size: 0.95rem;
  line-height: 1.8;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.blog-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blog-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef5ff;
  color: var(--accent-dark);
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.blog-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.blog-card-link:hover {
  text-decoration: underline;
}

.blog-guide {
  display: grid;
  gap: 0.8rem;
}

.blog-guide code,
.blog-article code,
.blog-post-view code {
  font-family: Consolas, "Courier New", monospace;
}

.blog-guide pre,
.blog-article pre {
  overflow-x: auto;
  border-radius: 14px;
  background: #1e2430;
  color: #f7f8fb;
  padding: 1rem 1.1rem;
}

.blog-back-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.blog-back-link:hover {
  text-decoration: underline;
}

.blog-post-view {
  display: grid;
  gap: 1.3rem;
  width: min(100%, 52rem);
  justify-self: center;
}

.blog-post-header {
  display: grid;
  gap: 0.9rem;
}

.blog-post-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--accent-dark);
}

.blog-post-cover {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #f2ead0;
}

.blog-article {
  display: grid;
  gap: 1rem;
}

.blog-article h1,
.blog-article h2,
.blog-article h3,
.blog-article h4 {
  color: #294f81;
  line-height: 1.35;
}

.blog-article h1 {
  font-size: 2rem;
}

.blog-article h2 {
  font-size: 1.5rem;
  border-bottom: 2px solid #dbe8f7;
  padding-bottom: 0.35rem;
}

.blog-article h3 {
  font-size: 1.2rem;
}

.blog-article p,
.blog-article li,
.blog-article blockquote {
  color: #3d3d3d;
  line-height: 1.9;
}

.blog-article ul,
.blog-article ol {
  padding-left: 1.4rem;
}

.blog-article a {
  color: var(--accent-dark);
}

.blog-article blockquote {
  margin: 0;
  padding: 0.9rem 1rem;
  background: #fff9e7;
  border-left: 4px solid #e1bb3d;
  border-radius: 0 12px 12px 0;
}

.blog-article code {
  background: #eef3f8;
  color: #294f81;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
}

.blog-article pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
}

.blog-article hr {
  border: 0;
  border-top: 1px solid #d9d9d9;
}

.blog-related {
  width: 100%;
}

.blog-related-panel {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fffdf6, #fff6dd);
}

.blog-related-heading {
  display: grid;
  gap: 0.55rem;
}

.blog-related-heading h3 {
  color: var(--accent-dark);
}

.blog-related-copy {
  color: #5f5f5f;
}

.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.blog-related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.blog-related-tag-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fffdf7;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(90, 74, 0, 0.08);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-related-tag-link:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(90, 74, 0, 0.16);
}

.markdown-image {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.markdown-image img {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f2ead0;
}

.markdown-image figcaption {
  color: #666;
  font-size: 0.9rem;
  text-align: center;
}

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

  .blog-overview-grid,
  .blog-related-grid {
    grid-template-columns: 1fr;
  }

  .blog-card-body {
    padding: 1rem;
  }

  .blog-post-title {
    font-size: 1.7rem;
  }
}
