/* ============ 顶栏图标按钮（统计 / 主题）============ */
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-action {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, transform .15s ease;
}
.header-action:hover {
  color: var(--blue-light);
  transform: scale(1.1);
}
.header-action:focus { outline: none; }
.header-action:focus-visible {
  color: var(--blue-light);
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.header-action svg { display: block; }

.writer-toggle {
  width: auto;
  min-width: 34px;
  gap: 6px;
  padding: 0 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.writer-toggle svg {
  flex: 0 0 auto;
}

.language-toggle {
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.language-toggle span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 主题图标显隐：手动暗色显月亮 / 手动浅色显太阳 / 跟随系统显屏幕 */
.theme-toggle .theme-icon { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
html[data-theme-mode="system"] .theme-toggle .theme-icon { display: none; }
html[data-theme-mode="system"] .theme-toggle .icon-system { display: block; }

/* 浅色主题适配 */
html[data-theme="light"] .header-action { color: #6b7280; }
html[data-theme="light"] .header-action:hover { color: var(--blue-2); }

/* ============ Hero arrow light theme ============ */
html[data-theme="light"] .hero-arrow {
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  border-color: var(--border);
}

html[data-theme="light"] .hero-arrow:hover {
  background: #ffffff;
  color: var(--blue-2);
  border-color: var(--blue-2);
}

html[data-theme="light"] .hero-dot { background: var(--border); }
html[data-theme="light"] .hero-dot.is-active { background: var(--blue-2); }

/* ============ Back-to-top button ============ */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  z-index: 50;
  box-shadow: var(--shadow);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--blue-light);
  border-color: var(--blue);
  transform: translateY(-2px);
}

html[data-theme="light"] .back-to-top:hover { color: var(--blue-2); }

@media (max-width: 600px) {
  .back-to-top { right: 16px; bottom: 16px; width: 40px; height: 40px; }
}

/* ============ Code window (hero decoration) light theme ============ */
html[data-theme="light"] .code-window {
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  border-color: #d1d9e0;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .code-window-top {
  background: #f6f8fa;
  border-bottom-color: #d1d9e0;
}

html[data-theme="light"] .code-window pre { color: #24292f; }
html[data-theme="light"] .cw-kw { color: #cf222e; }
html[data-theme="light"] .cw-str { color: #8a3f1a; }
html[data-theme="light"] .cw-fn { color: #8250df; }
html[data-theme="light"] .cw-cm { color: #6e7781; }

/* ============ Side terminal stats card light theme ============ */
html[data-theme="light"] .side-terminal {
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  border-color: #d1d9e0;
}

html[data-theme="light"] .side-terminal .terminal-bar {
  border-bottom-color: #d1d9e0;
  background: #f6f8fa;
}

html[data-theme="light"] .side-terminal .terminal-title { color: #6e7781; }
html[data-theme="light"] .side-terminal .terminal-body { color: #24292f; }
html[data-theme="light"] .side-terminal .t-prompt { color: #116329; }
html[data-theme="light"] .side-terminal .t-cmd { color: #24292f; }
html[data-theme="light"] .side-terminal .t-tree { color: #6e7781; }
html[data-theme="light"] .side-terminal .t-key { color: #57606a; }
html[data-theme="light"] .side-terminal .t-val { color: #b6531d; }

/* ============ Profile card light theme ============ */
html[data-theme="light"] .profile-banner {
  background: linear-gradient(135deg, #f8ede3 0%, #f3ddca 55%, #f3b680 100%);
}

html[data-theme="light"] .profile-avatar {
  border-color: var(--card);
}

html[data-theme="light"] .profile-name { color: var(--heading); }
html[data-theme="light"] .profile-bio  { color: var(--muted); }

html[data-theme="light"] .profile-stats { border-top-color: var(--border); }
html[data-theme="light"] .profile-stat + .profile-stat { border-left-color: var(--border); }
html[data-theme="light"] .profile-stat strong { color: var(--heading); }
html[data-theme="light"] .profile-stat span   { color: var(--muted-2); }

/* ============ Comments light theme ============ */
html[data-theme="light"] .comment-list .comment-body {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

html[data-theme="light"] .comment-list .comment-body:hover {
  border-color: rgba(224, 111, 42, 0.5);
}

html[data-theme="light"] .comment-list .comment-author > span[itemprop="image"] {
  background: linear-gradient(135deg, #f7d8bf, #fff4eb);
  border-color: rgba(224, 111, 42, 0.24);
  color: #b6531d;
}

html[data-theme="light"] .comment-list .comment-reply a:hover,
html[data-theme="light"] .comment-list .comment-meta a:hover,
html[data-theme="light"] .comment-list .comment-author cite a:hover {
  color: var(--blue-2);
}
