/* ============================================================================
   S14.5 第一部分 · 全站唯一按钮类库（1-3-5 收敛）
   ----------------------------------------------------------------------------
   引入铁律：本文件必须放在各页内联 <style> 之后的 <link>，靠「同特异性后加载胜出」
             覆盖各页历史遗留的 button{} / button.mini / .btn-main 等旧样式。
   语义四档：.btn-primary 主操作 / .btn-secondary 次要 / .btn-danger 危险（须二次确认）/ .btn-ghost 中性
   规格三档：.btn-sm 28 / .btn-md 32（默认，可省略）/ .btn-lg 40；.btn-block 弹窗与移动端全宽
   铁律：每个视觉区域 Primary ≤ 1。
   ========================================================================== */

/* ---------- 1. 基础结构（btn 为容器，规格类负责尺寸） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border-style: solid;
  border-width: 1px;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  transition: background-color .15s, border-color .15s, color .15s, filter .15s, opacity .15s;
}

/* ---------- 2. 规格三档 ---------- */
.btn.btn-xs { padding: 1px 5px; font-size: 12px; border-radius: 6px; min-height: 22px; gap: 0; }
.btn.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; min-height: 28px; }
.btn.btn-md { padding: 8px 14px; font-size: 13px; border-radius: 8px; min-height: 32px; }
.btn.btn-lg { padding: 10px 18px; font-size: 15px; border-radius: 9px; min-height: 40px; }
.btn.btn-block { width: 100%; }

/* ---------- 3. 语义四档（双类写法提高特异性，稳压历史 button.mini / .btn-main） ---------- */
.btn.btn-primary {
  background: var(--accent, #534AB7);
  border-color: var(--accent, #534AB7);
  color: #fff;
}
.btn.btn-primary:hover { filter: brightness(.92); }

.btn.btn-secondary {
  background: #fff;
  border-color: var(--accent, #534AB7);
  color: var(--accent, #534AB7);
}
.btn.btn-secondary:hover { background: var(--accent-soft, #f7f6fd); }

.btn.btn-danger {
  background: #fff;
  border-color: var(--danger, #B3261E);
  color: var(--danger, #B3261E);
}
.btn.btn-danger:hover { background: #fdeceb; }

.btn.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted, #6b6880);
}
.btn.btn-ghost:hover { background: rgba(15, 18, 40, .06); color: var(--text, #2b2840); }

/* 文字链式按钮（U9：跳转=带箭头文字链） */
.btn.btn-link {
  background: none; border-color: transparent; color: var(--accent, #534AB7);
  padding-left: 4px; padding-right: 4px; text-decoration: underline; text-underline-offset: 3px;
}
.btn.btn-link:hover { filter: brightness(.9); }

/* ---------- 4. 交互状态一套 ---------- */
.btn:hover { text-decoration: none; }
.btn:disabled,
.btn.disabled {
  opacity: .4;
  cursor: not-allowed;
  filter: none;
}
.btn:focus-visible {
  outline: 2px solid var(--accent, #534AB7);
  outline-offset: 2px;
}
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::before {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: geo-btn-spin .7s linear infinite;
  flex: none;
}
@keyframes geo-btn-spin { to { transform: rotate(360deg); } }

/* 键盘可见焦点（全站此前缺失）——只对键盘用户生效，鼠标点击不显示描边 */
a.btn:focus-visible,
button.btn:focus-visible { outline: 2px solid var(--accent, #534AB7); outline-offset: 2px; }
