/* 一树 shu.bio · 基础样式(设计令牌 + 公共组件) */

:root {
  --ink: #1a1a1a;
  --ink-2: #4b5563;
  --muted: #8a8f98;
  --line: #e7e5e0;
  --line-2: #efeee9;
  --bg: #fafaf8;
  --card: #ffffff;

  --brand: #0f5132;
  --brand-ink: #0b3d26;
  --brand-soft: #e8f3ec;
  --brand-2: #22c55e;
  --warm: #f97316;
  --danger: #dc2626;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .07);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
p { margin: 0; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.011em;
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 22px; }

/* ---------- 顶栏 ---------- */
.site-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 250, 248, .82);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; }
.logo-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #0f5132, #22c55e);
  color: #fff; font-size: 15px; font-weight: 800; line-height: 1;
}
.logo-text { font-size: 18px; letter-spacing: .02em; }

.site-nav { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.site-nav > a { padding: 7px 12px; border-radius: 10px; color: var(--ink-2); }
.site-nav > a:not(.btn) { color: var(--ink-2); }
.site-nav > a:hover { color: var(--ink); background: #f1f0eb; }
.site-nav > a.btn { padding: 8px 14px; border-radius: 10px; }  /* 按钮走自己的颜色,不被上面覆盖 */
.site-nav > a.btn-dark { background: #1a1a1a; color: #fff; }
.site-nav > a.btn-dark:hover { background: #000; color: #fff; }

/* ---------- 语言切换(纯 CSS 下拉,不依赖 JS) ---------- */
.lang-sw { position: relative; display: inline-flex; align-items: center; }
.lang-sw-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.lang-sw-btn:hover { border-color: #cfcec8; color: var(--ink); }
.lang-sw-globe { width: 15px; height: 15px; flex: none; }
.lang-sw-caret { width: 11px; height: 11px; flex: none; opacity: .5; }
.lang-sw-short { letter-spacing: .02em; }
/* 默认只显示「简 / 繁 / EN」短名,公开页顶栏(宽屏)换成完整语言名 */
.lang-sw-cur { display: none; letter-spacing: .02em; }
.site-nav .lang-sw-cur { display: inline; }
.site-nav .lang-sw-short { display: none; }
@media (max-width: 719px) {
  .site-nav .lang-sw-cur { display: none; }
  .site-nav .lang-sw-short { display: inline; }
}

.lang-sw-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 152px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(20, 24, 20, .13);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
/* 按钮 → 菜单之间 8px 空隙的隐形桥,鼠标滑过去菜单不会闪没 */
.lang-sw-menu::before {
  content: ''; position: absolute; top: -10px; right: 0;
  width: 100%; height: 10px;
}
.lang-sw:hover .lang-sw-menu,
.lang-sw:focus-within .lang-sw-menu { opacity: 1; visibility: visible; transform: none; }

.lang-sw-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 11px; border-radius: 8px;
  font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.lang-sw-menu a:hover { background: #f2f1ec; color: var(--ink); }
.lang-sw-menu a.is-active { color: var(--brand); font-weight: 700; }
.lang-sw-menu a.is-active::after { content: '✓'; font-size: 13px; }

/* 页脚里的变体:菜单向上弹,避免超出视口 */
.lang-sw--foot .lang-sw-menu { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; transform: translateY(6px); }
.lang-sw--foot:hover .lang-sw-menu,
.lang-sw--foot:focus-within .lang-sw-menu { transform: none; }
.lang-sw--foot .lang-sw-menu::before { top: auto; bottom: -10px; }

/* 后台顶栏:和头像/退出并排,去掉描边,融进一行,不再多出一个方框 */
.dash-user .lang-sw-btn {
  border-color: transparent; background: transparent; color: var(--ink-2);
}
.dash-user .lang-sw-btn:hover { background: #f1f0eb; border-color: transparent; color: var(--ink); }

/* 窄屏:顶栏放不下地球图标,保留「简 / 繁 / EN」即可,并收紧间距 */
@media (max-width: 560px) {
  .lang-sw-globe { display: none; }
  .lang-sw-btn { padding: 7px 10px; }
  .lang-sw-menu { min-width: 136px; }
  .site-nav { gap: 4px; }
  .site-nav > a { padding: 7px 9px; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-dark { background: #1a1a1a; color: #fff; }
.btn-dark:hover { background: #000; }
.btn-primary {
  background: linear-gradient(135deg, #0f5132, #14804d 60%, #22c55e);
  color: #fff;
  box-shadow: 0 8px 22px rgba(15, 81, 50, .28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0b3d26, #0f6138 60%, #1aa84b);
  box-shadow: 0 10px 26px rgba(15, 81, 50, .32);
}
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #cfcec8; background: #fafaf8; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: #dcEFe4; }

/* ---------- 通用:平台 SVG 图标小容器 ----------
 * dashboard 与 admin 都用 .item-ic 渲染社交项,
 * 把 <span class="pf-soc-svg"><svg ...></svg></span> 放进去,
 * SVG 自动继承父级 color(#fff),不写 fill="currentColor" 也行,这里再兜一遍。
 */
.pf-soc-svg { width: 16px; height: 16px; display: block; line-height: 0; flex: none; }
.pf-soc-svg svg { width: 100%; height: 100%; fill: currentColor; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 15px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 81, 50, .1);
}
.field .hint { margin-top: 6px; font-size: 13px; color: var(--muted); }
.field .error { margin-top: 6px; font-size: 13px; color: var(--danger); }
.field.has-error input, .field.has-error textarea { border-color: #f0b4b4; }

.input-affix {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
}
.input-affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 81, 50, .1); }
.input-affix .affix {
  display: flex; align-items: center; padding: 0 11px;
  background: #f6f5f1; color: var(--muted); font-size: 14px; border-right: 1px solid var(--line);
}
.input-affix input { border: none; border-radius: 0; flex: 1; }
.input-affix input:focus { box-shadow: none; }

/* ---------- 提示条 ---------- */
.alert { padding: 11px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: var(--brand-soft); color: var(--brand); border: 1px solid #cfe6da; }
.alert-ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ---------- 页脚 ---------- */
.site-foot { border-top: 1px solid var(--line-2); background: #fff; margin-top: 80px; padding: 48px 0 32px; }
.foot-cols { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; margin-bottom: 30px; }
.foot-brand p { margin-top: 10px; color: var(--muted); font-size: 14px; max-width: 300px; }
.foot-links { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--ink-2); }
.foot-links a:hover { color: var(--brand); }
.foot-base {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line-2); padding-top: 20px; font-size: 13px; color: var(--muted);
}
.foot-icp a { color: var(--muted); }
.foot-icp a:hover { color: var(--ink-2); }

/* ---------- 通用 ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
