/* ============================================================
   FileHash 官网 · 文章页样式（叠加在 style.css 之上）
   复用同一套 token / 导航 / 主题；零外部依赖
   ============================================================ */

/* ---------- 文章页基础 ---------- */
.article-page {
  background: var(--bg-0);
}

.article-main {
  padding-top: calc(var(--header-h) + 24px);
}

.article-main .container {
  max-width: 1180px;
}

/* ---------- 文章头部 ---------- */
.article-hero {
  max-width: 860px;
  padding: clamp(20px, 4vw, 48px) 0 clamp(24px, 4vw, 40px);
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--text-3);
  font-size: 13px;
}

.article-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.article-breadcrumb a:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.article-breadcrumb .ico {
  width: 14px;
  height: 14px;
}

.article-title {
  margin: 0 0 14px;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.14;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #1c2430 6%, #003a78 38%, #0066cc 66%, #0090e0 98%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="dark"] .article-title {
  background: linear-gradient(100deg, #f5f8fa 6%, #a8d8fa 40%, #4fb3f0 66%, #a8d8fa 98%);
  -webkit-background-clip: text;
  background-clip: text;
}

.article-subtitle {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-bottom: 24px;
  color: var(--text-3);
  font-size: 13px;
  font-family: var(--font-mono);
}

.article-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-meta-item + .article-meta-item::before {
  content: "·";
  margin-right: 12px;
  color: var(--border-strong);
}

.article-lead {
  margin: 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 78%);
  color: var(--text-2);
  font-size: clamp(15.5px, 1.5vw, 17px);
  line-height: 1.85;
}

/* ---------- 布局：正文 + TOC ---------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  padding-bottom: clamp(48px, 6vw, 88px);
}

.article-body {
  min-width: 0;
  max-width: 44em;
  font-size: 17px;
}

/* ---------- 正文排版 ---------- */
.article-section {
  padding-top: 4px;
}

.article-section + .article-section {
  margin-top: clamp(28px, 4vw, 44px);
  padding-top: clamp(24px, 3.4vw, 36px);
  border-top: 1px dashed var(--border);
}

.article-body h2 {
  margin: 0 0 18px;
  font-size: clamp(23px, 2.5vw, 30px);
  line-height: 1.32;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.article-body h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.9;
}

.article-body h3 {
  margin: 28px 0 10px;
  font-size: 18.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.article-body p {
  margin: 0 0 1.05em;
  color: var(--text-2);
  line-height: 1.95;
}

.article-body p strong,
.article-body li strong {
  color: var(--text);
  font-weight: 700;
}

.article-body a {
  color: var(--accent);
  border-bottom: 1px solid rgba(0, 102, 204, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.article-body a:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.article-body code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.article-body ul {
  margin: 0 0 1.2em;
  padding: 0;
  list-style: none;
}

.article-body ul li {
  position: relative;
  margin: 0.42em 0;
  padding-left: 1.4em;
  color: var(--text-2);
  line-height: 1.9;
}

.article-body ul li::before {
  content: "";
  position: absolute;
  left: 0.25em;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: rotate(45deg);
  opacity: 0.9;
}

/* 首字下沉：只作用于正文第一段，中文单字也能有不错的视觉重量 */
.article-body .article-section:first-of-type > p:first-of-type::first-letter {
  float: left;
  margin: 8px 12px 0 0;
  font-size: 3.4em;
  line-height: 0.9;
  font-weight: 800;
  color: var(--accent);
}

.article-body blockquote {
  margin: 1.6em 0;
  padding: 16px 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: linear-gradient(100deg, var(--accent-soft), transparent 80%);
}

.article-body blockquote p {
  margin: 0;
  color: var(--text-2);
  font-size: 1.02em;
  font-weight: 600;
}

/* ---------- 正文中的统计 / 基准图 ---------- */
.article-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 1.5em 0;
  padding: 0;
  list-style: none;
}

.article-stats li {
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: center;
}

.article-stats li::before {
  display: none;
}

.article-stat-value {
  display: block;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #f5f8fa, #a8d8fa 58%, #4fb3f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="light"] .article-stat-value {
  background: linear-gradient(120deg, #0066cc, #0066cc 58%, #0066cc);
  -webkit-background-clip: text;
  background-clip: text;
}

.article-stat-value .suffix {
  font-size: 0.56em;
  font-weight: 700;
  -webkit-text-fill-color: var(--text-2);
}

.article-stat-label {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
}

.article-figure {
  margin: 1.6em 0;
  padding: clamp(16px, 2.4vw, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface), transparent 70%);
}

.article-figure-cap {
  margin: 0 0 16px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.article-bench {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-bench li {
  display: grid;
  grid-template-columns: minmax(96px, 132px) minmax(0, 1fr) minmax(84px, 104px);
  align-items: center;
  gap: 12px;
  padding: 0;
  margin: 0;
}

.article-bench li::before {
  display: none;
}

.article-bench-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-bench-track {
  position: relative;
  height: 9px;
  border-radius: var(--radius-pill);
  background: #eaf1f5;
  overflow: hidden;
}

.article-bench-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0066cc, #4fb3f0);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.article-bench li[data-type="legacy"] .article-bench-fill {
  background: linear-gradient(90deg, #94a3b8, #c4b5a5);
}

.article-bench li[data-type="blake3"] .article-bench-fill {
  background: linear-gradient(90deg, #0284c7, #4fb3f0);
}

.article-bench li[data-type="xxh3"] .article-bench-fill {
  background: linear-gradient(90deg, #0077c8, #f59e0b 55%, #4fb3f0);
  box-shadow: 0 0 14px rgba(0, 144, 224, 0.3);
}

.article-figure.is-in .article-bench-fill {
  transform: scaleX(var(--pct, 0));
}

.article-bench-value {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  white-space: nowrap;
}

.article-bench li[data-type="xxh3"] .article-bench-value {
  color: var(--warn);
}

.article-figure-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.7;
}

/* ---------- 正文内 CTA ---------- */
.article-inline-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1.6em 0 0.4em;
}

/* ---------- 文末大 CTA ---------- */
.article-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  margin-top: clamp(36px, 5vw, 56px);
  padding: clamp(24px, 3.4vw, 38px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 180px at 8% 0%, rgba(0, 102, 204, 0.14), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow-soft);
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.article-cta .eyebrow {
  margin-bottom: 10px;
}

.article-cta h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  line-height: 1.3;
}

.article-cta h2::after {
  display: none;
}

.article-cta-text > p:last-child {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.article-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.article-cta-actions .btn-primary {
  flex: 0 1 auto;
}

/* ---------- TOC ---------- */
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 16px;
}

.toc-title {
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.toc-title::-webkit-details-marker {
  display: none;
}

.toc-title::after {
  content: "";
  display: block;
  margin-top: 10px;
  height: 1px;
  background: var(--border);
}

.toc nav {
  margin-top: 10px;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.toc a {
  display: block;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-left-color: var(--border-strong);
}

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

.toc .toc-sub a {
  padding-left: 22px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-toc {
    position: static;
    order: -1;
    max-width: 44em;
  }

  .toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 10px;
  }

  .article-body {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .article-main {
    padding-top: calc(var(--header-h) + 16px);
  }

  .article-cta {
    grid-template-columns: 1fr;
  }

  .article-cta-actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 720px) {
  .article-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-body {
    font-size: 16.5px;
  }

  .article-body .article-section:first-of-type > p:first-of-type::first-letter {
    font-size: 3em;
    margin-right: 10px;
  }

  .article-bench li {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name value"
      "track track";
    row-gap: 7px;
  }

  .article-bench-name {
    grid-area: name;
  }

  .article-bench-track {
    grid-area: track;
  }

  .article-bench-value {
    grid-area: value;
  }

  .toc ol {
    grid-template-columns: 1fr;
  }

  .article-inline-cta .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .article-title {
    font-size: clamp(29px, 8.4vw, 36px);
  }

  .article-meta {
    font-size: 12px;
  }

  .article-meta-item + .article-meta-item::before {
    display: none;
  }

  .article-lead {
    padding: 14px 16px;
  }
}

/* ---------- 尊重减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  .article-bench-fill {
    transition: none;
  }
}
