/* ============================================================
 * base.css — 设计变量 / 重置 / 通用组件
 * 智学 AI · 视觉原则：单主色、细边框、小编号、少装饰
 * ============================================================ */
:root {
  /* 主色：墨青，只用于关键动作与少量强调 */
  --brand: #0f5f5c;
  --brand-deep: #0a4745;
  --brand-soft: #eef4f3;
  --brand-line: #cfe0dd;

  /* 中性 */
  --paper: #ffffff;
  --paper-2: #f7f8f8;
  --paper-3: #f1f3f3;
  --ink: #181b20;
  --ink-2: #3a4048;
  --muted: #6a727c;
  --faint: #9aa2ab;
  --line: #e6e8ea;
  --line-2: #d5d9dc;

  /* 语义色（仅小面积） */
  --ok: #1c7a4d;
  --ok-soft: #eef5f0;
  --err: #b3352c;
  --err-soft: #faf0ee;
  --warn: #92580f;
  --warn-soft: #faf5ec;
  --info: #2b5d8a;
  --info-soft: #eef3f8;

  /* 分类色（低饱和，仅用于色点 / 图表，不做大面积填充） */
  --c-basics: #0f5f5c;
  --c-ml: #3a6b75;
  --c-dl: #5a5470;
  --c-llm: #7a5a60;
  --c-prompt: #7a6340;
  --c-app: #4d6b50;

  /* 圆角：克制 */
  --r-xs: 3px;
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 10px;

  /* 阴影：仅浮层使用 */
  --shadow-pop: 0 8px 30px rgba(24, 27, 32, .10), 0 1px 3px rgba(24, 27, 32, .06);

  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --max-w: 1160px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }
::selection { background: #d6e6e3; }

/* 键盘可达性：统一焦点样式 */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d8db; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bcc2c6; background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  white-space: nowrap; line-height: 1.3; border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-soft { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-line); }
.btn-soft:hover { background: #e2edeb; }
.btn-outline { background: var(--paper); color: var(--ink-2); border-color: var(--line-2); }
.btn-outline:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .4; pointer-events: none; }

/* 文字链接 */
.link {
  color: var(--brand); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  border-bottom: 1px solid transparent; transition: border-color .15s;
}
.link:hover { border-bottom-color: var(--brand); }

/* ---------------- 标签 ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-xs); font-size: 12px; font-weight: 600;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink-2);
  transition: all .15s; cursor: pointer;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.chip.active .dot { background: #fff !important; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
  padding: 2px 7px; border-radius: var(--r-xs);
  background: var(--paper-3); color: var(--muted);
}

/* 等宽编号：全站统一的识别元素 */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.code-no {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .5px; color: var(--faint);
}

.meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 5px; }

/* 分类色点 */
.cdot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* ---------------- 卡片 ---------------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.card-hover { transition: border-color .16s ease, background .16s ease; }
.card-hover:hover { border-color: var(--line-2); background: #fdfdfd; }

.icon-box {
  width: 36px; height: 36px; border-radius: var(--r-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ---------------- 进度 ---------------- */
.progress { height: 4px; background: var(--paper-3); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 2px; background: var(--brand); transition: width .5s ease; }
.progress.thin { height: 3px; }

/* ---------------- 工具 ---------------- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-muted { color: var(--muted); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* ---------------- 动画 ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- 页脚 ---------------- */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--faint); font-size: 12px; }
.site-footer .between { flex-wrap: wrap; gap: 10px; }
.site-footer a:hover { color: var(--brand); }

/* ---------------- 移动端细节 ---------------- */
@media (max-width: 640px) {
  /* 避免 iOS 聚焦输入框时自动放大页面 */
  .search-inline input, .search-field input, .notes-area { font-size: 16px; }
}

/* ---------------- 降低动效偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
