/* Post component */

.post-language-switch {
  display: flex;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
}

.post {
  max-width: 1040px;
  margin: 0 auto;
}

.post-hero {
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 2rem 2.25rem 1.8rem;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(219, 234, 254, 0.75), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 16px 48px rgba(15, 47, 85, 0.07);
}

.post-hero-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.55rem;
}

.post-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.post-back-link:hover {
  color: var(--accent);
}

.post-kicker {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-hero h1 {
  max-width: 800px;
  margin: 0;
  color: #102a49;
  font-size: clamp(2rem, 4.5vw, 3.15rem);
  line-height: 1.16;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.post-deck {
  max-width: 760px;
  margin: 1rem 0 0;
  color: #475569;
  font-size: 1.08rem;
  line-height: 1.72;
  text-wrap: pretty;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.post-meta span {
  position: relative;
}

.post-meta span + span::before {
  content: "·";
  position: absolute;
  left: -0.7rem;
  color: #94a3b8;
}

.post-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.9rem;
}

.post-tag {
  display: inline-flex;
  border: 1px solid #cbdced;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  padding: 0.22rem 0.68rem;
  font-size: 0.77rem;
  font-weight: 600;
}

.post-reading-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 760px);
  justify-content: center;
  align-items: start;
  gap: 1.5rem;
}

.post-toc-card {
  position: sticky;
  top: calc(var(--sticky-offset) + 1.1rem);
  max-height: calc(100vh - var(--sticky-offset) - 2.2rem);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 1rem 0.9rem;
  box-shadow: 0 7px 24px rgba(15, 23, 42, 0.045);
  scrollbar-width: thin;
}

.post-toc-label {
  margin: 0 0 0.65rem;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-toc {
  display: grid;
  gap: 0.08rem;
}

.post-toc a {
  display: block;
  border-left: 2px solid #e2e8f0;
  color: #64748b;
  padding: 0.35rem 0.45rem 0.35rem 0.62rem;
  font-size: 0.79rem;
  line-height: 1.42;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.post-toc a:hover,
.post-toc a.is-active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.post-main-column {
  min-width: 0;
}

.post-toc-mobile {
  display: none;
}

.post-content {
  border: 1px solid rgba(219, 226, 234, 0.95);
  border-radius: 16px;
  background: #ffffff;
  padding: clamp(1.35rem, 4vw, 2.75rem);
  box-shadow: 0 10px 36px rgba(15, 23, 42, 0.045);
  color: #243247;
  font-size: 1.01rem;
  line-height: 1.82;
  overflow-wrap: break-word;
}

.post[data-post-lang="zh"] .post-content {
  line-height: 1.95;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content p {
  margin: 1.05rem 0;
}

.post[data-post-lang="zh"] .post-content p {
  text-align: justify;
  text-justify: inter-ideograph;
}

.post-content h2,
.post-content h3 {
  color: #102a49;
  scroll-margin-top: calc(var(--sticky-offset) + 1.25rem);
  text-wrap: balance;
}

.post-content h2 {
  position: relative;
  margin: 3.35rem 0 1.15rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  font-size: clamp(1.45rem, 3vw, 1.82rem);
}

.post-content h2::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 3.2rem;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.post-content h3 {
  margin: 2.15rem 0 0.75rem;
  font-size: 1.2rem;
}

.post-content a {
  color: var(--accent);
  text-decoration-color: #93b4d8;
  text-underline-offset: 0.18em;
}

.post-content a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

.post-content blockquote {
  position: relative;
  margin: 1.45rem 0;
  border: 1px solid #d6e3f0;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: #f5f9fd;
  color: #173f6f;
  padding: 0.85rem 1.05rem;
  font-family: var(--heading-font);
  font-size: 1.05rem;
  line-height: 1.7;
}

.post-content blockquote p {
  margin: 0;
  text-align: left !important;
}

.post-content ul,
.post-content ol {
  padding-left: 1.45rem;
}

.post-content li {
  margin: 0.38rem 0;
  padding-left: 0.12rem;
}

.post-content li::marker {
  color: var(--accent);
  font-weight: 700;
}

.post-content table {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.post-content th,
.post-content td {
  min-width: 120px;
  border-bottom: 1px solid var(--line);
  padding: 0.68rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: #edf3f8;
  color: #173f6f;
  font-weight: 700;
}

.post-content tr:nth-child(even) td {
  background: #fafcff;
}

.post-content code {
  border-radius: 5px;
  background: #eef3f8;
  color: #173f6f;
  padding: 0.12rem 0.32rem;
  font-size: 0.9em;
}

.post-content pre {
  overflow-x: auto;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: #f6f8fb;
  padding: 1rem;
}

.post-content pre code {
  background: transparent;
  padding: 0;
}

.post-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted);
  padding: 0.9rem 1rem;
  font-size: 0.88rem;
}

.post-footer-nav a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.post img,
.img-fluid {
  max-width: 100%;
  height: auto;
}

.post mjx-container[jax="CHTML"][display="true"] {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1.35rem 0 !important;
  border: 1px solid #e0e8f0;
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.85rem 0.7rem;
}

@media (max-width: 900px) {
.post-reading-layout {
    grid-template-columns: minmax(0, 760px);
  }

.post-toc-card {
    display: none;
  }

.post-toc-mobile {
    display: block;
    margin: 0 0 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    padding: 0.75rem 0.85rem;
  }

.post-toc-mobile summary {
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
  }

.post-toc-mobile .post-toc {
    margin-top: 0.65rem;
  }

}

.blog-figure {
  margin: 0.9rem auto 1rem;
}

.blog-figure figcaption {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 640px) {
.post-hero {
    margin-bottom: 1rem;
    padding: 1.15rem 1rem 1.25rem;
    border-radius: 14px;
  }

.post-hero-toolbar {
    margin-bottom: 1.15rem;
  }

.post-hero h1 {
    font-size: clamp(1.72rem, 9vw, 2.25rem);
  }

.post-deck {
    font-size: 0.98rem;
    line-height: 1.65;
  }

.post-meta {
    display: grid;
    gap: 0.2rem;
  }

.post-meta span + span::before {
    display: none;
  }

.post-content {
    border-radius: 12px;
    padding: 1.2rem 1rem;
    font-size: 0.98rem;
  }

.post[data-post-lang="zh"] .post-content p {
    text-align: left;
  }

.post-content h2 {
    margin-top: 2.75rem;
    font-size: 1.42rem;
  }

.post-content h3 {
    font-size: 1.14rem;
  }

.post-footer-nav {
    align-items: flex-start;
    flex-direction: column;
  }

}
