/* 一树 shu.bio · 公开主页(自包含,不依赖 base.css) */

:root {
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }

/* ---------- 主题变量 ---------- */
.pf {
  --accent: #0f5132; --bg: #f4f4f1; --card: #ffffff; --text: #1a1a1a;
  --muted: #8a8f98; --line: #eae8e3; --chip: #f6f6f2;
  min-height: 100vh; background: var(--bg); color: var(--text);
}
.pf.theme-ink     { --accent:#eaeaea; --bg:#0e0e0e; --card:#191919; --text:#f2f2f2; --muted:#9b9b9b; --line:#2b2b2b; --chip:#232323; }
.pf.theme-jade    { --accent:#0f9d6e; --bg:#eff7f3; --card:#fff;    --text:#12261d; --muted:#6f8b80; --line:#dcece4; --chip:#f0faf5; }
.pf.theme-sunset  { --accent:#c7500f; --bg:#fff7f0; --card:#fff;    --text:#3a2416; --muted:#a8846b; --line:#f3e2d4; --chip:#fdf3ea; }
.pf.theme-night   { --accent:#6ca7ff; --bg:#0b1526; --card:#132036; --text:#eef4ff; --muted:#8ea3c4; --line:#22304a; --chip:#182741; }
.pf.theme-forest  { --accent:#4ade80; --bg:#0d1a12; --card:#14261b; --text:#eaf7ef; --muted:#8fb39d; --line:#1f3628; --chip:#16291d; }
.pf.theme-cloud   { --accent:#2563eb; --bg:#f2f6fb; --card:#fff;    --text:#16233a; --muted:#7488a8; --line:#e0e8f4; --chip:#f2f7ff; }
.pf.theme-blossom { --accent:#e0447a; --bg:#fff5f7; --card:#fff;    --text:#3a1f2a; --muted:#a87b8b; --line:#f6dfe7; --chip:#fdf1f4; }

/* ---------- 背景层 ---------- */
.pf-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center;
  opacity: .32; filter: blur(2px);
}

/* ---------- 布局 ---------- */
.pf-main {
  position: relative; z-index: 1;
  min-height: 100vh; display: flex; justify-content: center;
  padding: 52px 18px 46px;
}
.pf-card {
  width: 100%; max-width: 520px; align-self: flex-start;
  background: var(--card); border-radius: 28px;
  padding: 30px 26px 24px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 24px 60px rgba(16,24,40,.1);
}

/* ---------- 头部 ---------- */
.pf-poster {
  height: 128px; border-radius: 18px; margin-bottom: 18px;
  background-size: cover; background-position: center;
}
.pf-head { text-align: center; }
.pf-avatar {
  display: grid; place-items: center; width: 92px; height: 92px;
  margin: 0 auto 14px; border-radius: 50%;
   color: var(--bg);
  font-size: 34px; font-weight: 800; overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
}
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pf-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.pf-handle { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.pf-bio { font-size: 15px; opacity: .88; margin-top: 12px; white-space: pre-line; }

/* ---------- 社交按钮 ---------- */
.pf-socials {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px; margin-top: 24px;
}
.pf-soc {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 13px;
  background: var(--chip); border: 1px solid var(--line);
  text-align: left; transition: transform .15s ease, border-color .15s ease;
}
.pf-soc:hover { transform: translateY(-2px); border-color: var(--accent); }
.pf-soc-ic {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  color: #fff; font-size: 13px; font-weight: 700;
  overflow: hidden;
}
/* 公开页不通过 site_head() 加载 base.css,这里把 SVG 尺寸兜底一遍,
   否则 <svg> 默认 300×150 会被上面 overflow:hidden 裁到看不见。 */
.pf-soc-svg { width: 16px; height: 16px; display: block; line-height: 0; flex: none; }
.pf-soc-svg svg { width: 100%; height: 100%; fill: currentColor; }
.pf-soc-lb { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 链接列表 ---------- */
.pf-links { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pf-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: 14px;
  background: var(--chip); border: 1px solid var(--line);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pf-link:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(16,24,40,.07); }
.pf-link-ic {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  color: #fff; font-size: 12px; font-weight: 800;
  overflow: hidden;
}
.pf-link-ic[data-fav] { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.pf-link-ic img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.pf-link-t { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-link-a { margin-left: auto; color: var(--muted); font-size: 20px; line-height: 1; }

.pf-empty { text-align: center; color: var(--muted); padding: 28px 0; font-size: 15px; }

/* ---------- 网格布局 ---------- */
.pf.layout-grid .pf-links { display: grid; grid-template-columns: repeat(2, 1fr); }

/* ---------- 页脚 ---------- */
.pf-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }
.pf-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.pf-brand:hover { color: var(--accent); }
.pf-brand-mark {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  background: var(--accent); color: var(--bg); font-size: 12px; font-weight: 800;
}

/* 公开主页不加载 base.css,这里自带一份语言切换器样式(菜单向上弹) */
.pf-foot .lang-sw { margin-top: 14px; display: flex; justify-content: center; }
.pf-foot .lang-sw-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap;
}
.pf-foot .lang-sw-btn:hover { color: var(--text); }
.pf-foot .lang-sw-globe { width: 14px; height: 14px; flex: none; }
.pf-foot .lang-sw-caret { width: 10px; height: 10px; flex: none; opacity: .5; }
.pf-foot .lang-sw-cur { display: none; }
.pf-foot .lang-sw-short { letter-spacing: .02em; }
.pf-foot .lang-sw-menu {
  position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 60;
  min-width: 148px; padding: 6px; transform: translate(-50%, 6px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(16,24,40,.18);
  opacity: 0; visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
/* 菜单与按钮之间空隙的隐形桥,鼠标滑过去不会闪没 */
.pf-foot .lang-sw-menu::before {
  content: ''; position: absolute; bottom: -10px; left: 0;
  width: 100%; height: 10px;
}
.pf-foot .lang-sw:hover .lang-sw-menu,
.pf-foot .lang-sw:focus-within .lang-sw-menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.pf-foot .lang-sw-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 11px; border-radius: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.pf-foot .lang-sw-menu a:hover { background: var(--chip); color: var(--text); }
.pf-foot .lang-sw-menu a.is-active { color: var(--accent); font-weight: 700; }
.pf-foot .lang-sw-menu a.is-active::after { content: '✓'; font-size: 13px; }

/* ---------- 二维码弹窗 ---------- */
.qr-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.qr-modal[hidden] { display: none; }
.qr-backdrop { position: absolute; inset: 0; background: rgba(10,14,12,.62); backdrop-filter: blur(4px); }
.qr-box {
  position: relative; width: 100%; max-width: 320px; text-align: center;
  background: #fff; color: #1a1a1a; border-radius: 22px; padding: 30px 28px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: qrIn .18s ease;
}
@keyframes qrIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.qr-close {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
  border: none; background: transparent; font-size: 22px; line-height: 1;
  color: #9aa0a6; border-radius: 8px;
}
.qr-close:hover { background: #f2f2f2; color: #333; }
.qr-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.qr-img { width: 200px; height: 200px; margin: 0 auto; object-fit: contain; border-radius: 12px; background: #fff; }
.qr-note { margin-top: 12px; font-size: 14px; color: #4b5563; }
.qr-tip { margin-top: 10px; font-size: 12.5px; color: #9aa0a6; }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .pf-main { padding: 26px 14px 40px; }
  .pf-card { padding: 24px 18px 20px; border-radius: 22px; }
  .pf-avatar { width: 80px; height: 80px; font-size: 30px; }
  .pf-name { font-size: 21px; }
  .pf-socials { grid-template-columns: repeat(2, 1fr); }
  .pf.layout-grid .pf-links { grid-template-columns: 1fr; }
}

/* ---------- 桌面端右侧浮窗:主页 URL 二维码 ----------
 * 手机端(<=880)整体隐藏。面板可关闭(用户主动关闭后用 localStorage 记住)。
 */
.qr-side {
  position: fixed;
  top: 50%;
  right: 22px;
  z-index: 60;
  width: 200px;
  padding: 18px 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .04);
  text-align: center;
  transform: translateY(-50%);
  animation: qrSideIn .42s .15s cubic-bezier(.22, .9, .32, 1) both;
}
.qr-side[hidden] { display: none; }
.qr-side-x {
  position: absolute; top: 6px; right: 8px;
  width: 26px; height: 26px;
  border: 0; background: transparent;
  font-size: 18px; line-height: 1; color: var(--muted);
  border-radius: 7px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.qr-side-x:hover { background: var(--line-2); color: var(--ink); }
.qr-side-avatar {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #1aa84b);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.qr-side-avatar img { width: 100%; height: 100%; object-fit: cover; }
.qr-side-ask {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 10px;
}
.qr-side-img {
  display: block;
  width: 168px; height: 168px;
  margin: 0 auto;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.qr-side-name {
  margin-top: 10px;
  font-size: 13.5px; font-weight: 700;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qr-side-url {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

@keyframes qrSideIn {
  from { opacity: 0; transform: translate(40px, -50%); }
  to   { opacity: 1; transform: translate(0, -50%); }
}

/* 平板以下整体隐藏 */
@media (max-width: 880px) {
  .qr-side { display: none !important; }
}
