/* ---- Blog Layout ---- */

.blog-header {
  text-align: center;
  padding: 0 0 0.5rem;
  margin-bottom: 1rem;
}

.blog-header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(180deg, #fff 40%, var(--fg-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

.blog-header-desc {
  color: var(--fg-dim);
  font-size: 0.9rem;
  max-width: 480px;
  margin: 0 auto 0.75rem;
}

.blog-header-links {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* ---- Blog List ---- */

.blog-list {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1rem;
}

.blog-entry-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.blog-entry-row:hover {
  background: var(--bg-card);
}

.blog-entry {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--fg);
  min-width: 0;
}

.blog-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--fg-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.blog-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.blog-tags {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

.blog-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--fg-dim);
  background: var(--bg-secondary);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.blog-tag:hover {
  color: var(--fg-accent);
  background: var(--bg-card-hover);
}

.blog-tags-list {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blog-tags-list .blog-tag {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
}

/* ---- Blog Post ---- */

.blog-page-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.blog-page-header a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}

.blog-page-header a:hover {
  color: var(--fg-accent);
}

.blog-page-sep {
  color: var(--fg-dim);
}

.blog-back {
  display: inline-block;
  margin: 0 0 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.blog-back:hover {
  color: var(--fg-accent);
}

.blog-post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 740px;
  margin: 0 auto;
}

.blog-post-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--fg-dim);
}

.blog-post-dots {
  display: flex;
  gap: 5px;
}

.blog-post-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: inline-block;
}

.blog-post:hover .blog-post-dots i:nth-child(1) { background: #ef4444; }
.blog-post:hover .blog-post-dots i:nth-child(2) { background: #f59e0b; }
.blog-post:hover .blog-post-dots i:nth-child(3) { background: #22c55e; }

.blog-post-titlebar-text {
  opacity: 0.7;
}

.blog-post-body {
  padding: 2rem 2.5rem;
}

.blog-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.blog-post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
}

.blog-post-reading-time::before {
  content: '\00b7';
  margin-right: 1rem;
}

.blog-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.blog-post-tags a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--fg-dim);
  background: var(--bg-secondary);
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.blog-post-tags a:hover {
  color: var(--fg-accent);
  background: var(--bg-card-hover);
}

/* ---- Post Content Typography ---- */

.blog-post-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2rem 0 0.75rem;
}

.blog-post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1.5rem 0 0.5rem;
}

.blog-post-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1.25rem 0 0.5rem;
}

.blog-post-content p {
  color: var(--fg-dim);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}

.blog-post-content a {
  color: var(--fg-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-post-content a:hover {
  color: var(--fg);
}

.blog-post-content strong {
  color: var(--fg);
  font-weight: 600;
}

/* Override global terminal list markers for blog content */
.blog-post-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.blog-post-content ol {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.blog-post-content li {
  position: static;
  padding-left: 0.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--fg-dim);
  line-height: 1.75;
}

.blog-post-content li::before {
  content: none;
}

.blog-post-content blockquote {
  border-left: 3px solid var(--fg-accent);
  background: rgba(0, 0, 0, 0.15);
  padding: 0.75rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 6px 6px 0;
}

.blog-post-content blockquote p {
  margin-bottom: 0;
  font-style: italic;
}

.blog-post-content img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1rem 0;
}

.blog-post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fg-accent), transparent);
  margin: 2rem 0;
}

/* Inline code */
.blog-post-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: var(--bg-secondary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--fg-accent);
}

/* Fenced code blocks (Pygments output) */
.blog-post-content .highlight {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}

.blog-post-content .highlight pre {
  margin: 0;
  padding: 0;
  background: none;
}

.blog-post-content .highlight code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--fg);
}

.blog-post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.blog-post-content th,
.blog-post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: var(--fg-dim);
}

.blog-post-content th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--fg);
  font-weight: 600;
}

/* ---- Giscus Comments ---- */

.giscus-wrapper {
  max-width: 740px;
  margin: 2rem auto;
}

/* ---- Post Navigation ---- */

.post-nav {
  display: flex;
  justify-content: space-between;
  max-width: 740px;
  margin: 0 auto 0.5rem;
  padding: 0 0.5rem;
  gap: 2rem;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  max-width: 48%;
  transition: transform 0.2s;
}

.post-nav-link:hover {
  transform: translateX(0);
}

.post-nav-prev:hover {
  transform: translateX(-3px);
}

.post-nav-next:hover {
  transform: translateX(3px);
}

.post-nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--green);
  letter-spacing: 0.03em;
}

.post-nav-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-dim);
  line-height: 1.4;
  transition: color 0.2s;
}

.post-nav-link:hover .post-nav-title {
  color: var(--fg-accent);
}

.post-nav-next {
  margin-left: auto;
  text-align: right;
  align-items: flex-end;
}
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-post-nav a:hover {
  background: var(--bg-card-hover);
  color: var(--fg-accent);
}

/* ---- Pygments Syntax Theme ---- */
/* Mapped to site palette */

.highlight .hll { background-color: var(--bg-card-hover); }
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs,
.highlight .cp { color: var(--fg-dim); font-style: italic; }  /* comments */
.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt { color: var(--blue); }                        /* keywords */
.highlight .s,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .s1,
.highlight .s2,
.highlight .ss,
.highlight .sx { color: var(--green); }                       /* strings */
.highlight .na,
.highlight .nb,
.highlight .nf,
.highlight .nx { color: var(--fg-accent); }                   /* functions/names */
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo,
.highlight .il { color: #e06c75; }                            /* numbers */
.highlight .o,
.highlight .ow { color: var(--fg); }                          /* operators */
.highlight .p { color: var(--fg-dim); }                       /* punctuation */
.highlight .nc,
.highlight .nn,
.highlight .ne { color: #e5c07b; }                            /* classes/namespaces */
.highlight .nd { color: var(--fg-accent); }                   /* decorators */
.highlight .ni { color: var(--fg); font-weight: bold; }       /* entities */
.highlight .err { color: #e06c75; }                           /* errors */
.highlight .gd { color: #e06c75; }                            /* diff deleted */
.highlight .gi { color: var(--green); }                       /* diff inserted */

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .blog-header {
    padding: 0 0 1rem;
  }

  .blog-header h1 {
    font-size: 1.75rem;
  }

  .blog-entry {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .blog-tags {
    margin-left: 0;
    width: 100%;
  }

  .blog-post-body {
    padding: 1.25rem 1rem;
  }

  .blog-post-header h1 {
    font-size: 1.4rem;
  }

  .post-nav {
    flex-direction: column;
    gap: 1.5rem;
  }

  .post-nav-link {
    max-width: 100%;
  }

  .post-nav-next {
    text-align: left;
    align-items: flex-start;
  }
}
