/* ================================================================
   page-blog-article.css — 博客文章页 · Pure Glass（与首页 / 博客列表一致）
   加载顺序：common.css → page-index.css → page-blog-pure.css → 本文件
   ================================================================ */

/* 博客文章页：隐藏顶栏导航 */
html:has(#page-blog-article) #site-nav,
html:has(#page-blog-article) .nav-mobile-backdrop {
  display: none !important;
}

#page-blog-article.blg-article-page {
  position: relative;
  z-index: 1;
  padding-bottom: 0;
}

#page-blog-article a.no-underline {
  text-decoration: none;
}

/* ── 统一文章卡片（标题 + 正文一体，避免分截）──────────────── */

.blg-article-feed {
  max-width: 48rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) 1.5rem 2.5rem;
}

.blg-article-sheet {
  padding: clamp(1.5rem, 3.5vw, 2.25rem);
  border-radius: 1.5rem;
  overflow: hidden;
}

.blg-article-sheet__head {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.blg-article-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #94a3b8;
}

.blg-article-crumb a {
  color: #64748b;
  transition: color 0.2s ease;
}

.blg-article-crumb a:hover {
  color: #2563eb;
}

.blg-article-crumb span {
  opacity: 0.5;
}

.blg-article-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.35rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  background: rgba(239, 246, 255, 0.8);
  border: 1px solid rgba(191, 219, 254, 0.7);
  border-radius: 9999px;
}

.blg-article-badge__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
}

.blog-article-head {
  margin: 0;
  padding: 0;
  border: none;
}

.blog-article-head h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.625rem, 4.2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.blog-article-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.blog-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15em;
  margin: 0;
  font-size: 0.875rem;
  color: #64748b;
}

.blog-article-meta__label {
  color: #94a3b8;
}

.blog-article-meta__sep {
  color: #cbd5e1;
  font-weight: 600;
  user-select: none;
}

.blog-article-date {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #334155;
}

.blog-article-date--modified {
  font-weight: 500;
  color: #64748b;
}

.blog-article-lead {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
}

.blog-article-readtime {
  font-weight: 500;
  opacity: 0.85;
}

/* 旧 masthead / 返回链接（生成器历史结构兼容） */
.blg-article-masthead {
  display: none;
}

.blg-article-back {
  display: none;
}

/* ── Hero / 插图 ──────────────────────────────────────────── */

.article-hero {
  margin: 0 0 1.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  overflow: hidden;
  box-shadow: 0 4px 20px -6px rgba(15, 23, 42, 0.08);
  background: #f1f5f9;
}

.article-hero img {
  width: 100%;
  height: clamp(180px, 32vw, 360px);
  object-fit: cover;
  display: block;
}

.article-fig {
  margin: 1.75em 0;
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  overflow: hidden;
  box-shadow: 0 4px 20px -6px rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.article-fig img {
  width: 100%;
  height: clamp(140px, 24vw, 260px);
  object-fit: cover;
  display: block;
}

.article-fig figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  background: rgba(248, 250, 252, 0.95);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

/* ── 正文排版（§1 Prose 全元素）──────────────────────────── */

.blog-article-body {
  font-size: clamp(1rem, 1.8vw, 1.0625rem);
  line-height: 1.8;
  color: #334155;
}

.blog-article-body h2,
.blog-article-body h3,
.blog-article-body h4,
.blog-article-body h5 {
  scroll-margin-top: 5rem;
}

.blog-article-body h2 {
  margin: 1.75em 0 0.6em;
  padding-left: 0.875rem;
  border-left: 3px solid #3b82f6;
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.blog-article-body h3 {
  margin: 1.5em 0 0.5em;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  font-weight: 700;
  color: #1e293b;
}

.blog-article-body h4 {
  margin: 1.25em 0 0.4em;
  font-size: clamp(1rem, 2vw, 1.1rem);
  font-weight: 650;
  color: #334155;
}

.blog-article-body h5 {
  margin: 1.1em 0 0.35em;
  font-size: 0.9375rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

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

.blog-article-body strong,
.blog-article-body b {
  font-weight: 700;
  color: #0f172a;
}

.blog-article-body em {
  font-style: italic;
  color: #475569;
}

.blog-article-body a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.blog-article-body a:hover {
  color: #1d4ed8;
  text-decoration-color: rgba(29, 78, 216, 0.55);
}

.blog-article-body code {
  font-family: 'SF Mono', ui-monospace, 'Fira Code', Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid rgba(191, 219, 254, 0.8);
}

.blog-article-body kbd {
  font-family: 'SF Mono', ui-monospace, Consolas, monospace;
  font-size: 0.82em;
  padding: 2px 7px;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 0 #cbd5e1;
}

.blog-article-body del {
  color: #94a3b8;
  text-decoration: line-through;
}

.blog-article-body mark {
  background: rgba(254, 240, 138, 0.65);
  color: #713f12;
  border-radius: 3px;
  padding: 0 3px;
}

.blog-article-body ul {
  margin: 0.75em 0 1.1em 1.4em;
  padding: 0;
  list-style: disc;
}

.blog-article-body ol {
  margin: 0.75em 0 1.1em 1.4em;
  padding: 0;
  list-style: decimal;
}

.blog-article-body li {
  margin-bottom: 0.45em;
  line-height: 1.7;
}

.blog-article-body dl {
  margin: 1em 0 1.2em;
}

.blog-article-body dt {
  font-weight: 700;
  color: #1e293b;
  margin-top: 0.75em;
}

.blog-article-body dd {
  margin-left: 1.4em;
  margin-bottom: 0.4em;
  line-height: 1.65;
}

.blog-article-body pre {
  margin: 1.4em 0;
  padding: 1rem 1.125rem;
  border-radius: 0.875rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.35);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.blog-article-body pre code {
  font-family: 'SF Mono', ui-monospace, 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.75;
  color: #e2e8f0;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}

.blog-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  overflow: hidden;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.blog-article-body thead {
  background: #f8fafc;
}

.blog-article-body tbody tr:nth-child(odd) {
  background: #ffffff;
}

.blog-article-body tbody tr:nth-child(even) {
  background: #f8fafc;
}

.blog-article-body tr {
  border-bottom: 1px solid #e2e8f0;
}

.blog-article-body th {
  color: #475569;
  font-weight: 650;
  padding: 0.75rem 0.875rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
}

.blog-article-body td {
  padding: 0.75rem 0.875rem;
  vertical-align: top;
  line-height: 1.55;
}

.blog-article-body blockquote {
  margin: 1.5em 0;
  padding: 0.875rem 1.125rem 0.875rem 1.25rem;
  border-left: 4px solid #93c5fd;
  background: #eff6ff;
  border-radius: 0 0.75rem 0.75rem 0;
  color: #334155;
  font-style: italic;
  line-height: 1.7;
}

.blog-article-body blockquote p {
  margin: 0;
}

.blog-article-body hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 2.2em 0;
}

.blog-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
}

.blog-article-body figure {
  margin: 1.75em 0;
}

.blog-article-body figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #64748b;
  text-align: center;
}

.blog-article-body details {
  margin: 1.25em 0;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.blog-article-body summary {
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  list-style: none;
}

.blog-article-body summary::-webkit-details-marker {
  display: none;
}

.blog-article-body details[open] summary {
  margin-bottom: 0.625rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #e2e8f0;
}

/* ── 数据卡 ──────────────────────────────────────────────── */

.article-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin: 1.65em 0;
}

@media (max-width: 520px) {
  .article-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .article-stats-row .article-stat-card:last-child {
    grid-column: span 2;
  }
}

.article-stat-card {
  text-align: center;
  padding: 1.25rem 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 1rem;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.06);
}

.article-stat-num {
  font-size: clamp(1.375rem, 4.5vw, 1.875rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.375rem;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.article-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.4;
}

/* ── Callout ──────────────────────────────────────────────── */

.article-callout {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  margin: 1.55em 0;
  border-radius: 0.875rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.article-callout--blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.article-callout--green {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.article-callout--pink {
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.article-callout__icon {
  flex-shrink: 0;
  padding-top: 2px;
}

.article-callout__icon .lucide {
  width: 1.125rem;
  height: 1.125rem;
}

.article-callout--blue .article-callout__icon .lucide { color: #2563eb; }
.article-callout--green .article-callout__icon .lucide { color: #059669; }
.article-callout--pink .article-callout__icon .lucide { color: #db2777; }

.article-callout__body {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #334155;
}

.article-callout__title {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
  color: #1e293b;
}

.article-callout__body > p {
  margin: 0 0 0.75em;
}

.article-callout__list {
  margin: 0;
  padding-left: 1.25em;
}

.article-callout__list > li + li {
  margin-top: 0.35em;
}

/* ── 代码块（带标签）──────────────────────────────────────── */

.article-code-wrap {
  margin: 1.45em 0;
}

.article-code-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 0.625rem 0.625rem 0 0;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
  background: linear-gradient(105deg, #2563eb, #4f46e5);
  color: #ffffff;
  border: 1px solid #1d4ed8;
  border-bottom: none;
}

.article-code {
  font-family: 'SF Mono', ui-monospace, 'Fira Code', Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.75;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.125rem;
  border-radius: 0 0.875rem 0.875rem 0.875rem;
  border: 1px solid #1e293b;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.35);
  overflow-x: auto;
  margin: 0;
  white-space: pre;
  display: block;
}

.article-code .code-comment { color: #94a3b8; }
.article-code .code-path { color: #86efac; }

/* ── 正文内列表 / CTA 链接 ───────────────────────────────── */

.article-body-list {
  margin: 0 0 1.2em 1.2em;
  list-style: disc;
}

.article-body-list strong {
  font-weight: 700;
  color: #0f172a;
}

.article-body-list li {
  margin-bottom: 0.55em;
}

.article-cta-link {
  color: #2563eb !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border-bottom: 2px solid rgba(37, 99, 235, 0.4) !important;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.article-cta-link:hover {
  color: #1d4ed8 !important;
  border-bottom-color: rgba(29, 78, 216, 0.7) !important;
}

/* ── 表格（article-table 组件）──────────────────────────── */

.article-table-wrap {
  margin: 1.5em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.06);
}

.article-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 650;
  padding: 0.75rem 0.875rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
}

.article-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  line-height: 1.55;
  background: #ffffff;
  color: #334155;
}

.article-table tr:nth-child(even) td {
  background: #f8fafc;
}

.article-table tr:last-child td {
  border-bottom: none;
}

/* ── Mac 推广块 ──────────────────────────────────────────── */

.article-mac-promo {
  margin: 2.1em 0 0;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border-radius: 1.25rem;
  border: 1px solid rgba(191, 219, 254, 0.9);
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 55%, #ffffff 100%);
  box-shadow: 0 8px 24px -8px rgba(59, 130, 246, 0.15);
}

.article-mac-promo h2 {
  margin-top: 0 !important;
  padding-left: 0 !important;
  border-left: none !important;
  font-size: clamp(1.05rem, 2.7vw, 1.25rem) !important;
  color: #0f172a !important;
}

.article-mac-promo p {
  font-size: clamp(0.9375rem, 1.75vw, 1rem);
  color: #334155;
}

.article-mac-promo p:last-child {
  margin-bottom: 0;
}

/* ── 文章目录 ────────────────────────────────────────────── */

.article-toc {
  margin: 1.5rem 0 2rem;
  padding: 1.125rem 1.25rem;
  border-radius: 0.875rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.article-toc__title {
  margin: 0 0 0.875rem;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}

.article-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: article-toc;
}

.article-toc__list > li {
  counter-increment: article-toc;
  margin: 0;
  padding: 0;
}

.article-toc__list > li + li {
  margin-top: 0.375rem;
}

.article-toc__list > li > a {
  display: flex;
  gap: 0.625rem;
  align-items: baseline;
  padding: 0.375rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  color: #334155;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.article-toc__list > li > a::before {
  content: counter(article-toc) ".";
  flex-shrink: 0;
  min-width: 1.5em;
  font-size: 0.75rem;
  font-weight: 800;
  color: #3b82f6;
}

.article-toc__list > li > a:hover {
  color: #1d4ed8;
  background: #eff6ff;
}

.article-toc__sublist {
  margin: 0.375rem 0 0;
  padding: 0 0 0 2rem;
  list-style: none;
}

.article-toc__sublist a {
  display: block;
  padding: 0.25rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.article-toc__sublist a::before {
  content: "·";
  margin-right: 0.45em;
  color: #94a3b8;
}

.article-toc__sublist a:hover {
  color: #2563eb;
  background: #eff6ff;
}

/* ── 底部 CTA band 间距 ──────────────────────────────────── */

#page-blog-article .blg-band {
  margin-top: 0;
}

/* ── 浮动优惠按钮 ────────────────────────────────────────── */

.blg-article-fab {
  position: fixed;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.125rem;
  border-radius: 9999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 12px 32px -8px rgba(37, 99, 235, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.blg-article-fab .lucide {
  width: 1.125rem;
  height: 1.125rem;
}

.blg-article-fab:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -8px rgba(37, 99, 235, 0.6);
}

.blg-article-fab:active {
  transform: translateY(0);
}

.blg-article-fab:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .blg-article-fab:hover {
    transform: none;
  }
}
