/* ============================================================================
 * extra.css —— 页面结构补充样式
 * 由 Lead 维护。只补充 styles.css 未覆盖的几个辅助 class，
 * 不覆盖任何既有规则，保持与主样式表一致的设计语言。
 * ========================================================================== */

/* ---------- 首页 Hero ---------- */

.hero-lead-text {
  margin: 18px 0 0;
  max-width: 34em;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-muted, #5b6560);
}

/* Hero 右侧的代码卡片 */
.hero-code {
  margin: 20px 0 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface-sunken, #f6f7f5);
  border: 1px solid var(--border, #e5e7e4);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.8125rem;
  line-height: 1.75;
  overflow-x: auto;
  color: var(--text-soft, #47524c);
  tab-size: 2;
}

.hero-code code {
  font: inherit;
}

/* 代码高亮 token 色（markdown.js 与首页静态代码块共用） */
.tok-kw { color: #0f766e; font-weight: 600; }
.tok-str { color: #b45309; }
.tok-num { color: #7c3aed; }
.tok-com { color: #94a3b8; font-style: italic; }
.tok-fn { color: #0369a1; }
.tok-key { color: #0f766e; }

html[data-theme="dark"] .tok-kw { color: #5eead4; }
html[data-theme="dark"] .tok-str { color: #fcd34d; }
html[data-theme="dark"] .tok-num { color: #c4b5fd; }
html[data-theme="dark"] .tok-com { color: #64748b; }
html[data-theme="dark"] .tok-fn { color: #7dd3fc; }
html[data-theme="dark"] .tok-key { color: #5eead4; }

/* ---------- 归档 ---------- */

.archive-section,
.posts-section {
  padding-block: clamp(56px, 7vw, 96px);
}

.archive-year {
  margin: 32px 0 12px;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text, #17201c);
}

.archive-year:first-child {
  margin-top: 0;
}

.archive-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- 阅读进度条（兜底，styles.css 已定义基础样式） ---------- */

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0;
  z-index: 100;
  background: linear-gradient(90deg, var(--brand-500, #14b8a6), var(--brand-700, #0f766e));
  transition: width 80ms linear;
  pointer-events: none;
}

/* ---------- 移动端调整 ---------- */

@media (max-width: 640px) {
  .hero-lead-text {
    font-size: 0.9375rem;
  }
  .hero-code {
    font-size: 0.75rem;
    padding: 14px 16px;
  }
}

/* ---------- 打印 ---------- */

@media print {
  #readingProgress,
  #backToTop,
  #themeToggle,
  #navToggle,
  .site-header,
  .site-footer,
  .hero-actions {
    display: none !important;
  }
}

/* ---------- 文章页辅助 ---------- */

.post-article {
  display: block;
}

.post-date {
  color: var(--text-muted, #5b6560);
  font-variant-numeric: tabular-nums;
}

/* ---------- Toast 容器 ---------- */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}

.toast-container > * {
  pointer-events: auto;
}

@media (max-width: 640px) {
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }
}

/* ---------- Markdown 渲染产物（markdown.js 输出）样式对齐 ---------- */

/* 标题锚点 # ：默认隐藏，悬浮标题时淡入，避免干扰阅读 */
.md-anchor {
  margin-left: 10px;
  font-size: 0.7em;
  font-weight: 400;
  color: var(--brand, #0f766e);
  text-decoration: none;
  opacity: 0;
  transition: opacity 160ms ease;
  vertical-align: middle;
}

.md-h:hover .md-anchor,
.md-anchor:focus {
  opacity: 0.55;
}

.md-anchor:hover {
  opacity: 1 !important;
}

/* 代码块容器（markdown.js 生成 .md-codeblock，CSS 主样式用 .code-block） */
.md-codeblock {
  position: relative;
  margin: 26px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border, #e5e7e4);
  background: var(--code-bg, #1e2422);
}

.md-codeblock-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 12px;
  color: #9fb0aa;
}

.md-dots {
  display: inline-flex;
  gap: 5px;
}

.md-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.md-lang {
  flex: 1 1 auto;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.md-copy {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #cfe0da;
  font-size: 12px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.md-copy:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.md-copy.is-copied {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.5);
}

.md-codeblock pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 13.5px;
  line-height: 1.7;
  color: #e6eeeb;
  background: transparent;
}

.md-codeblock code {
  font: inherit;
  background: none;
  padding: 0;
}

/* 行内代码 */
.md-inline-code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-sunken, #f2f4f1);
  border: 1px solid var(--border, #e5e7e4);
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.9em;
  color: var(--brand-700, #0f766e);
}

/* 表格 */
.md-table-wrap {
  margin: 26px 0;
  overflow-x: auto;
  border: 1px solid var(--border, #e5e7e4);
  border-radius: 10px;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.md-table th,
.md-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e5e7e4);
  text-align: left;
}

.md-table th {
  background: var(--surface-sunken, #f2f4f1);
  font-weight: 600;
}

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

/* 引用 */
.md-quote {
  margin: 24px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--brand, #0f766e);
  background: color-mix(in srgb, var(--brand, #0f766e) 5%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted, #5b6560);
}

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

/* 图片 */
.md-img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 24px auto;
}

/* 分割线 */
.md-hr {
  margin: 40px auto;
  border: none;
  border-top: 1px solid var(--border, #e5e7e4);
}

/* 任务列表 */
.md-task {
  list-style: none;
  margin-left: -1.1em;
}

.md-task.is-done {
  color: var(--text-muted, #5b6560);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* 目录 */
.md-toc {
  margin: 26px 0;
  padding: 18px 22px;
  border-radius: 10px;
  background: var(--surface-sunken, #f2f4f1);
  font-size: 0.9375rem;
}

.md-toc-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.md-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.md-toc-l3 {
  padding-left: 1.2em;
}

.md-toc a {
  color: var(--text-soft, #47524c);
  text-decoration: none;
}

.md-toc a:hover {
  color: var(--brand, #0f766e);
}
