/**
 * 墨引阁 · base.css —— 全站公共组件基线（2026-10-10 样式收敛第一期）
 * 设计原则：
 *   1. 全部选择器使用 :where() 零特异性 —— 页面私有样式永远优先，绝无视觉回归；
 *   2. 不含全局 reset（design-tokens.css 已含；未引 design-tokens 的页面保持各自布局）；
 *   3. 仅提供公共组件兜底基线与可访问性改进，31 页内联样式收敛的过渡底座。
 * 配套：/css/design-tokens.css（单一令牌源）
 */

/* ===== 链接 ===== */
:where(a) { color: inherit; text-decoration: none; }
:where(a:hover) { opacity: 0.85; }

/* ===== 按钮（兜底基线；页面自定义 .btn 样式优先级更高） ===== */
:where(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.4;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
  -webkit-user-select: none;
  user-select: none;
}
:where(.btn:disabled) { opacity: 0.55; cursor: not-allowed; }

/* ===== 表单 ===== */
:where(input, select, textarea) {
  font-family: inherit;
  font-size: inherit;
}
:where(input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible) {
  outline: 2px solid #a97d25;
  outline-offset: 2px;
}

/* ===== 卡片 ===== */
:where(.card) {
  background: #fffdf8;
  border: 1px solid #e7dec9;
  border-radius: 12px;
}

/* ===== 导航（顶部导航 .nav 兜底） ===== */
:where(.nav) {
  position: sticky;
  top: 0;
  z-index: 200;
}

/* ===== 页脚 ===== */
:where(.footer) { font-size: 13px; }

/* ===== Toast ===== */
:where(#toast-wrap) {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
:where(.toast) {
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(34, 29, 21, 0.9);
  color: #fffdf8;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(80, 66, 38, 0.2);
}
:where(.toast.err) { background: rgba(192, 57, 43, 0.92); }

/* ===== 可访问性：跟随系统减少动效 ===== */
@media (prefers-reduced-motion: reduce) {
  :where(*), :where(*::before), :where(*::after) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
