/* /users/{username}/ 公开主页样式 —— 与 /me/ 同色调,简化版(没有邮箱、没有编辑按钮) */
:root {
  --paper: #fbf6ee;
  --paper-strong: #f5ecdc;
  --paper-deep: #eadbc8;
  --ink: #3d2c1f;
  --ink-soft: #5b4329;
  --muted: #8a6f54;
  --line: rgba(110, 79, 54, 0.14);
  --line-strong: rgba(110, 79, 54, 0.22);
  --shadow: 0 14px 32px rgba(81, 58, 35, 0.1);
  --shadow-hover: 0 18px 36px rgba(81, 58, 35, 0.16);

  --accent: #70543a;
  --accent-hover: #5a4226;
  --accent-soft: #f3e7d2;
  --accent-fg: #ffffff;

  --success-bg: #e6f4ea;
  --success-fg: #1e7a3a;
  --warning-bg: #fef3cd;
  --warning-fg: #856404;
  --error-bg: #fdecea;
  --error-fg: #b3261e;

  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC",
           "Times New Roman", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC",
           "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono:  "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body.user-body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(180deg, #fbf6ee 0%, #f3e7d2 100%);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

.user-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

/* —— topbar —— */
.user-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  height: 30px;
  line-height: 1;
}
.user-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.user-topbar__brand:hover { color: var(--accent); }
.user-topbar__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* —— header —— */
.user-header { margin-bottom: 22px; }
.user-header__eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.user-header__title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.user-header__desc {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* —— card —— */
.user-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  min-height: 220px;
}

/* —— 各种态容器 —— */
[hidden] { display: none !important; }

/* —— 占位态 (/users/ 没传 username 时) —— */
.user-empty {
  text-align: center;
  padding: 36px 8px 24px;
}
.user-empty__title {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}
.user-empty__msg {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.user-empty__msg code {
  font-family: var(--mono);
  background: var(--paper-strong);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.user-empty__msg a { color: inherit; text-decoration: none; }
.user-empty__msg a:hover code { background: var(--accent-soft); }
.user-empty__msg--muted { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* —— 加载中 —— */
.user-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 0;
  color: var(--muted);
  font-size: 14px;
}
.user-loading__spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: user-spin 0.8s linear infinite;
}
@keyframes user-spin { to { transform: rotate(360deg); } }

/* —— 错误态 —— */
.user-error {
  text-align: center;
  padding: 36px 8px 24px;
}
.user-error__title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--error-fg);
}
.user-error__msg {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ink-soft);
}
.user-error__actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* —— profile —— */
.user-profile__hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px dashed var(--line-strong);
}
.user-avatar {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.user-avatar span {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-profile__headline { flex: 1 1 auto; min-width: 0; }
.user-profile__name {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-profile__handle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}
.user-profile__handle code {
  background: transparent;
  padding: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* —— 字段表 —— */
.user-fields {
  margin: 0;
}
.user-field {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.user-field:last-child { border-bottom: 0; }
.user-field dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0;
}
.user-field dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}
.user-field__badge-cell { display: flex; align-items: center; }

/* —— 徽标 —— */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.user-badge[data-state="verified"]  { background: var(--success-bg); color: var(--success-fg); border-color: rgba(30, 122, 58, 0.18); }
.user-badge[data-state="unverified"] { background: var(--warning-bg); color: var(--warning-fg); border-color: rgba(133, 100, 4, 0.22); }
.user-badge[data-state="unknown"]   { background: var(--paper-deep); color: var(--muted); border-color: var(--line); }
.user-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* —— footnote —— */
.user-footnote {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}
.user-footnote a {
  color: var(--accent);
  text-decoration: none;
}
.user-footnote a:hover { text-decoration: underline; }

/* —— button (error 里用到) —— */
.user-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  line-height: 1;
}
.user-btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.user-btn--primary:hover { background: var(--accent-hover); }
.user-btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.user-btn--ghost:hover {
  background: var(--paper-strong);
  color: var(--ink);
}

/* —— 暗色 —— */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2a1f17;
    --paper-strong: #3d2c1f;
    --paper-deep: #4a372a;
    --ink: #f3e7d2;
    --ink-soft: #d6c4ab;
    --muted: #a08a72;
    --line: rgba(243, 231, 210, 0.12);
    --line-strong: rgba(243, 231, 210, 0.22);
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
    --shadow-hover: 0 18px 36px rgba(0, 0, 0, 0.42);
    --accent: #c89866;
    --accent-hover: #d6a578;
    --accent-soft: #4a372a;
    --accent-fg: #1a1108;
    --success-bg: rgba(30, 122, 58, 0.18);
    --success-fg: #6cc285;
    --warning-bg: rgba(133, 100, 4, 0.22);
    --warning-fg: #e0b948;
    --error-bg: rgba(179, 38, 30, 0.18);
    --error-fg: #ee8e85;
  }
  body.user-body {
    background: linear-gradient(180deg, #2a1f17 0%, #1f1610 100%);
  }
  .user-card { background: #322518; }
  .user-avatar { border-color: var(--line-strong); }
  .user-empty__msg code { background: var(--paper-strong); color: var(--accent); }
  .user-empty__msg a:hover code { background: var(--accent-soft); }
  .user-btn--ghost:hover { background: var(--paper-strong); }
}

/* —— 移动端 —— */
@media (max-width: 600px) {
  .user-shell { padding: 20px 16px 40px; }
  .user-card { padding: 22px 18px 18px; }
  .user-header__title { font-size: 24px; }
  .user-profile__hero { gap: 14px; }
  .user-avatar { width: 56px; height: 56px; }
  .user-profile__name { font-size: 19px; white-space: normal; }
  .user-field { grid-template-columns: 1fr; gap: 4px; }
  .user-field dt { font-size: 10px; }
}
