/* 个人主页美化（profile-revamp）页面级样式
 * 命名空间：.pr- 前缀；复用宿主 CSS 变量（自动适配深浅色）。
 * 称谓 chip（.cw-title-chip）样式由 title-tag 插件全局注入，这里不重复定义。 */

.pr-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ===== Hero 资料卡 ===== */
.pr-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, hsl(var(--primary)) 10%, transparent), transparent 55%),
    hsl(var(--card));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  padding: 1.5rem;
}

.pr-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 96px;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, hsl(var(--primary)) 22%, transparent),
    color-mix(in srgb, hsl(var(--primary)) 6%, transparent) 60%,
    transparent
  );
  pointer-events: none;
}

/* 配置了横幅图时，用图片替换顶部灰色渐变带 */
.pr-hero.pr-has-banner::before {
  display: none;
}

.pr-hero-banner {
  position: absolute;
  inset: 0 0 auto 0;
  height: 120px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.pr-hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    color-mix(in srgb, hsl(var(--card)) 55%, transparent) 80%,
    hsl(var(--card))
  );
}

.pr-hero-top {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.pr-hero-avatar {
  flex-shrink: 0;
  padding: 3px;
  border-radius: 9999px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, hsl(var(--primary)) 60%, transparent),
    color-mix(in srgb, hsl(var(--primary)) 15%, transparent)
  );
}

/* 头像本体改成圆形（覆盖宿主 UserAvatar 的 rounded-xl 方角） */
.pr-hero-avatar > div > div:first-child {
  border-radius: 9999px !important;
}

.pr-hero-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.pr-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pr-name {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}

.pr-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.pr-dot {
  width: 3px;
  height: 3px;
  border-radius: 9999px;
  background: hsl(var(--border));
}

.pr-points {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  color: hsl(38 92% 38%);
  background: hsl(38 92% 50% / 0.14);
}

.pr-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pr-tag {
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
}

.pr-bio {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: hsl(var(--foreground) / 0.85);
}

/* ===== 数据墙 ===== */
.pr-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border) / 0.7);
}

.pr-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.pr-stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.pr-stat-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ===== 个人介绍 ===== */
.pr-intro {
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background: hsl(var(--card));
  padding: 1.25rem 1.5rem;
}

.pr-intro-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.pr-intro-body {
  font-size: 0.875rem;
  line-height: 1.7;
  color: hsl(var(--foreground) / 0.85);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== 动态区 ===== */
.pr-activity {
  margin-top: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background: hsl(var(--card));
  overflow: hidden;
}

.pr-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.pr-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 0.75rem;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.pr-tab:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.pr-tab-active {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.pr-tab-count {
  font-size: 0.6875rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
}

.pr-tab-link {
  text-decoration: none;
  margin-left: auto;
}

.pr-tab-link-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.pr-activity-body {
  padding: 1rem;
}

/* 帖子卡片 */
.pr-pcard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pr-pcard {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid hsl(var(--border) / 0.7);
  border-radius: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}

.pr-pcard:hover {
  border-color: hsl(var(--primary) / 0.5);
  background: hsl(var(--accent) / 0.4);
}

.pr-pcard-cover {
  flex-shrink: 0;
  width: 96px;
  height: 72px;
  border-radius: 0.65rem;
  background-size: cover;
  background-position: center;
  background-color: hsl(var(--secondary));
}

.pr-pcard-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pr-pcard-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: hsl(var(--foreground));
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pr-pcard-summary {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pr-pcard-meta,
.pr-rcard-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: auto;
}

.pr-card-board {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 500;
}

.pr-card-board:hover {
  text-decoration: underline;
}

.pr-card-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.pr-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.pr-card-stat-icon {
  width: 0.85rem;
  height: 0.85rem;
}

/* 回复卡片 */
.pr-rcard-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pr-rcard {
  padding: 0.85rem;
  border: 1px solid hsl(var(--border) / 0.7);
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pr-rcard-post {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--primary));
  text-decoration: none;
}

.pr-rcard-post:hover {
  text-decoration: underline;
}

.pr-rcard-content {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: hsl(var(--foreground) / 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pr-mention {
  font-weight: 500;
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-decoration-color: hsl(var(--foreground) / 0.3);
  text-underline-offset: 3px;
}

.pr-mention:hover {
  color: hsl(var(--foreground) / 0.7);
}

/* 空态 */
.pr-empty {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.pr-empty-box {
  padding: 3rem 1rem;
  text-align: center;
  border: 1px dashed hsl(var(--border));
  border-radius: 1rem;
}

/* ===== 侧栏勋章墙 ===== */
.pr-sidebar-wrap {
  margin-top: 1.5rem;
}

.pr-sidebar {
  position: sticky;
  top: 5rem;
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background: hsl(var(--card));
  padding: 1.25rem;
}

.pr-sidebar-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.pr-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.85rem;
}

.pr-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}

.pr-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  transition: transform 0.15s;
}

.pr-badge:hover .pr-badge-icon {
  transform: scale(1.05);
}

.pr-badge-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pr-badge-svg {
  display: inline-flex;
  width: 32px;
  height: 32px;
}

.pr-badge-svg > svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pr-badge-emoji {
  font-size: 1.75rem;
  line-height: 1;
}

.pr-badge-name {
  font-size: 0.6875rem;
  text-align: center;
  line-height: 1.2;
  color: hsl(var(--muted-foreground));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .pr-hero-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .pr-hero-info {
    align-items: center;
  }
  .pr-name-row,
  .pr-meta-row,
  .pr-tags {
    justify-content: center;
  }
  .pr-pcard-cover {
    width: 76px;
    height: 60px;
  }
}
