/* ==========================================================================
   VPNWY · 博客样式包(列表页 + 文章页)
   --------------------------------------------------------------------------
   文章页结构约定:
     <main>
       <nav class="article-crumbs">…</nav>
       <header class="article-hero">…</header>
       <article class="prose article-body reading-wrap">…</article>
       <div class="reading-wrap"><div class="promo-block">…</div></div>
       <section id="related-posts"></section>
       <nav id="post-nav"></nav>
     </main>
   面包屑 / hero / 正文 / 文末推广共用同一条阅读列:56rem 正文 + 两侧内衬。
   ========================================================================== */

:root {
  --read-col: 56rem;
  --read-gutter: clamp(1.25rem, 4vw, 1.75rem);
  --read-box: calc(var(--read-col) + 2 * var(--read-gutter));
}

/* ---------- 1. 阅读列容器 ---------- */

.reading-wrap,
.article-body,
.article-hero,
.article-crumbs,
#related-posts,
#post-nav {
  width: 100%;
  max-width: var(--read-box);
  margin-inline: auto;
  padding-inline: var(--read-gutter);
}

.reading-wrap.article-body,
.reading-wrap.prose {
  max-width: var(--read-box);
}

.reading-wrap #related-posts,
.reading-wrap #post-nav {
  max-width: none;
  padding-inline: 0;
}

#related-posts[hidden],
#post-nav[hidden] {
  display: none;
}

/* ---------- 2. 面包屑(与页头留呼吸间距) ---------- */

.article-crumbs {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 0;
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.article-crumbs ol,
.article-crumbs ul {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-crumbs li {
  min-width: 0;
}

.article-crumbs li + li::before {
  content: "/";
  margin-inline: .45rem;
  color: var(--text-muted);
  opacity: .5;
}

.article-crumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.article-crumbs a:hover,
.article-crumbs a:focus-visible {
  color: var(--accent);
}

.article-crumbs [aria-current="page"] {
  color: var(--text);
}

/* ---------- 3. 文章 hero:图章角标卡 ---------- */

.article-hero {
  position: relative;
  margin-top: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
  padding-block: clamp(3.25rem, 6vw, 4rem) clamp(1.75rem, 3vw, 2.25rem);
  background: linear-gradient(180deg, var(--bg-panel) 0%, color-mix(in srgb, var(--accent) 4%, var(--bg-panel)) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.article-hero::after,
.blog-hero::after {
  content: "WY";
  position: absolute;
  top: clamp(1rem, 2.4vw, 1.35rem);
  right: clamp(1rem, 2.4vw, 1.35rem);
  width: clamp(3.25rem, 6vw, 4.5rem);
  height: clamp(3.25rem, 6vw, 4.5rem);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: clamp(.8rem, 1.5vw, 1rem);
  font-weight: 700;
  letter-spacing: .08em;
  text-indent: .08em;
  color: var(--accent);
  background: var(--bg-panel);
  border: 1px solid var(--accent-a18);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 .22rem var(--bg-panel),
    inset 0 0 0 .3rem var(--accent-a18),
    var(--sh-1);
  transform: rotate(-10deg);
  pointer-events: none;
}

.article-hero h1,
.blog-hero h1 {
  font-family: var(--font-display);
  line-height: 1.18;
  letter-spacing: -.018em;
  color: var(--text);
  text-wrap: pretty;
  margin: 0 0 .85rem;
}

.article-hero h1 {
  font-size: clamp(1.6rem, 4.4vw, 2.6rem);
}

.article-hero .hero-meta,
.article-hero .article-meta,
.article-hero .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem .5rem;
  margin: 0 0 .95rem;
  font-size: .8125rem;
  color: var(--text-muted);
}

.article-hero .hero-meta > *,
.article-hero .article-meta > * {
  display: inline-flex;
  align-items: center;
  padding: .22rem .6rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: .75rem;
  line-height: 1.5;
  white-space: nowrap;
}

.article-hero .hero-meta .post-tag,
.article-hero .article-meta .post-tag {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--bg-panel);
  background: var(--accent);
  border-color: var(--accent);
}

.article-hero .article-sum,
.article-hero .hero-sum,
.article-hero > p:last-child {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-muted);
}

/* ---------- 4. 正文排版 ---------- */

.article-body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  counter-reset: article-sec;
  overflow-wrap: break-word;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body p {
  margin: 0 0 1.1rem;
}

.article-body h2 {
  counter-increment: article-sec;
  margin: 2.6rem 0 .95rem;
  padding-bottom: .5rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  line-height: 1.38;
  letter-spacing: -.01em;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  text-wrap: pretty;
}

.article-body h2::before {
  content: counter(article-sec, decimal-leading-zero);
  display: inline-block;
  margin-right: .6em;
  padding: .08em .42em;
  font-family: var(--font-mono);
  font-size: .7em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  background: var(--bg-panel-2);
  border-radius: 6px;
  vertical-align: .1em;
}

.article-body h3 {
  margin: 1.9rem 0 .65rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.45;
  letter-spacing: -.008em;
  color: var(--text);
  text-wrap: pretty;
}

.article-body h4 {
  margin: 1.5rem 0 .5rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.2rem;
  padding-left: 1.35rem;
}

.article-body li {
  margin-bottom: .45rem;
}

.article-body li::marker {
  color: var(--accent);
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.article-body strong {
  font-weight: 700;
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: .9rem 1.25rem;
  background: var(--bg-panel-2-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-muted);
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.article-body hr {
  margin: 2.25rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ---------- 5. 表格(实色表头 + 斑马纹 + 窄屏横滑) ---------- */

.table-scroll {
  max-width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-body table,
.data-table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.65;
}

.article-body thead th,
.data-table thead th {
  padding: .7rem .85rem;
  background: var(--text);
  color: var(--bg-panel);
  font-size: .875rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.article-body tbody td,
.data-table tbody td {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.article-body tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
  background: var(--bg-panel-2-soft);
}

.article-body tbody tr:hover,
.data-table tbody tr:hover {
  background: var(--accent-a05);
}

@media (max-width: 860px) {
  .article-body table,
  .data-table {
    display: block;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- 6. 代码块(终端窗) ---------- */

.article-body pre {
  position: relative;
  margin: 1.5rem 0;
  padding: 2.6rem 1.1rem 1.1rem;
  background: var(--text);
  color: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.7;
}

.article-body pre::before {
  content: "\25CF";
  position: absolute;
  top: .95rem;
  left: 1.1rem;
  font-size: .5rem;
  line-height: 1;
  color: var(--error);
  text-shadow: 1.1em 0 0 var(--warn), 2.2em 0 0 var(--success);
}

.article-body code {
  padding: .12em .38em;
  background: var(--bg-panel-2);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .875em;
  color: var(--accent-dark);
}

.article-body pre code {
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: .875rem;
  color: inherit;
}

/* ---------- 7. callout ---------- */

.callout {
  position: relative;
  margin: 1.5rem 0;
  padding: 1rem 1.15rem 1rem 3.1rem;
  background: var(--accent-a05);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .9375rem;
  line-height: 1.75;
}

.callout::before {
  content: "i";
  position: absolute;
  top: 1.05rem;
  left: 1rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--bg-panel);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout--warn {
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-panel));
  border-left-color: var(--warn);
}

.callout--warn::before {
  content: "!";
  background: var(--warn);
}

.callout--success {
  background: color-mix(in srgb, var(--success) 8%, var(--bg-panel));
  border-left-color: var(--success);
}

.callout--success::before {
  background: var(--success);
}

.callout--plain {
  background: var(--bg-panel-2-soft);
  border-left-color: var(--text-muted);
}

.callout--plain::before {
  background: var(--text-muted);
}

/* ---------- 8. 数据卡 / 勾叉清单 / 结论块 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.stat-card {
  padding: 1.05rem 1.15rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-1);
}

.stat-card:nth-child(2n) {
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-panel));
  border-top-color: var(--accent-2);
}

.stat-card:nth-child(3n) {
  border-top-color: var(--accent-dark);
}

.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: var(--text);
}

.stat-label {
  display: block;
  margin-top: .35rem;
  font-size: .8125rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.check-list {
  display: grid;
  gap: .5rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  margin: 0;
  padding: .7rem 1rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  line-height: 1.75;
}

.check-list li:hover {
  border-color: var(--accent-a18);
}

.verdict {
  margin: 1.75rem 0;
  padding: 1.05rem 1.2rem;
  background: var(--accent-a05);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .9688rem;
  line-height: 1.8;
}

.verdict > strong:first-child,
.verdict > p:first-child > strong:first-child {
  display: block;
  margin-bottom: .35rem;
  color: var(--accent-dark);
  font-weight: 700;
}

/* ---------- 9. 文末推广卡 ---------- */

.promo-block {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  max-width: var(--read-col);
  margin: clamp(2rem, 4vw, 2.75rem) auto;
  padding: 1.75rem 1.9rem;
  background: linear-gradient(118deg, var(--accent-dark) 0%, var(--accent) 52%, var(--accent-2) 100%);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  color: var(--bg-panel);
  overflow: hidden;
}

.promo-block::after {
  content: "";
  position: absolute;
  top: -4rem;
  right: -3rem;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--on-dark-14) 0 38%, transparent 39%);
  pointer-events: none;
}

.promo-block > div {
  position: relative;
  z-index: 1;
}

.promo-block h3 {
  margin: 0 0 .35rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -.01em;
  color: var(--bg-panel);
}

.promo-block p {
  margin: 0;
  max-width: 34rem;
  font-size: .9375rem;
  line-height: 1.7;
  color: var(--on-dark-84);
}

.promo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.promo-block .btn--primary {
  background: var(--bg-panel);
  border-color: var(--bg-panel);
  color: var(--text);
}

.promo-block .btn--primary:hover,
.promo-block .btn--primary:focus-visible {
  background: var(--bg-panel-2);
  border-color: var(--bg-panel-2);
  color: var(--text);
}

.promo-block .btn--ghost {
  background: transparent;
  border-color: var(--white-a42);
  color: var(--bg-panel);
}

.promo-block .btn--ghost:hover,
.promo-block .btn--ghost:focus-visible {
  border-color: var(--bg-panel);
  color: var(--bg-panel);
}

/* ---------- 10. 延伸阅读 / 上下篇 ---------- */

#related-posts {
  padding-block: 2.5rem 0;
}

.related-head,
#related-posts > h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  letter-spacing: -.01em;
  color: var(--text);
  text-wrap: pretty;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 1.15rem;
}

.related-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.1rem 1.15rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-1);
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.related-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .22s ease;
}

.related-card:hover,
.related-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-a18);
  box-shadow: var(--sh-2);
}

.related-card:hover::before,
.related-card:focus-visible::before {
  transform: scaleX(1);
}

.related-tag {
  align-self: flex-start;
  padding: .16rem .55rem;
  background: var(--accent-a10);
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.related-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -.008em;
  color: var(--text);
  text-wrap: pretty;
}

.related-date {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
}

#post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  padding-block: 2.25rem 2.5rem;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1rem 1.15rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.post-nav-card--next {
  align-items: flex-end;
  text-align: right;
}

.post-nav-card:hover,
.post-nav-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--sh-2);
}

.post-nav-label {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.post-nav-title {
  font-size: .9688rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
}

/* ---------- 11. 列表页 ---------- */

.blog-wrap {
  width: 100%;
  max-width: var(--wrap-max, 1240px);
  margin-inline: auto;
}

.blog-hero {
  position: relative;
  margin-top: clamp(1.25rem, 3vw, 2rem);
  padding-block: clamp(3.25rem, 6vw, 4rem) clamp(1.75rem, 3vw, 2.25rem);
  padding-inline: clamp(1.5rem, 4vw, 2.25rem);
  background: linear-gradient(180deg, var(--bg-panel) 0%, color-mix(in srgb, var(--accent) 4%, var(--bg-panel)) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.blog-hero h1 {
  font-size: clamp(1.7rem, 5vw, 3rem);
}

.blog-hero-kicker {
  margin: 0 0 .6rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .16em;
  color: var(--accent);
}

.blog-hero-lead {
  max-width: 46rem;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag-btn {
  min-height: 2.25rem;
  padding: .45rem 1rem;
  font-family: var(--font-body);
  font-size: .875rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.tag-btn:hover {
  color: var(--text);
  border-color: var(--accent-a18);
}

.tag-btn.is-active,
.tag-btn[aria-pressed="true"] {
  color: var(--bg-panel);
  background: var(--text);
  border-color: var(--text);
}

.list-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: var(--text-muted);
}

.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.blog-list .post-card {
  position: relative;
  padding: 1.35rem 1.4rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.blog-list .post-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  border-radius: var(--r-md) var(--r-md) 0 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .22s ease;
}

.blog-list .post-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-a18);
  box-shadow: var(--sh-2);
}

.blog-list .post-card:hover::before {
  transform: scaleX(1);
}

.blog-list .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
  font-size: .8125rem;
  color: var(--text-muted);
}

.blog-list .post-tag {
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  background: var(--accent-a10);
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.blog-list .post-meta time {
  font-family: var(--font-mono);
  font-size: .75rem;
}

.blog-list .post-title {
  margin: 0 0 .55rem;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.42;
  letter-spacing: -.01em;
  text-wrap: pretty;
}

.blog-list .post-title a {
  color: var(--text);
  text-decoration: none;
}

.blog-list .post-title a:hover,
.blog-list .post-title a:focus-visible {
  color: var(--accent);
}

.blog-list .post-sum {
  margin: 0 0 .9rem;
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.blog-list .link-more {
  font-size: .875rem;
  font-weight: 600;
}

.list-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2rem 1.25rem;
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--text-muted);
}

/* ---------- 12. 窄屏与动效降级 ---------- */

@media (max-width: 768px) {
  .article-hero,
  .blog-hero {
    border-radius: var(--r-sm);
  }

  .related-grid,
  #post-nav {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .article-hero .hero-meta > *,
  .article-hero .article-meta > * {
    font-size: .7rem;
  }

  .promo-block {
    padding: 1.4rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .related-card,
  .related-card::before,
  .post-nav-card,
  .blog-list .post-card,
  .blog-list .post-card::before,
  .tag-btn {
    transition: none;
  }

  .related-card:hover,
  .related-card:focus-visible,
  .post-nav-card:hover,
  .post-nav-card:focus-visible,
  .blog-list .post-card:hover {
    transform: none;
  }
}