/* ==========================================================
   个人主页
   —— 基础样式 + 移动端堆叠（< 1024px）
   —— PC 布局（≥ 1024px）在文件后半段
   ========================================================== */

:root {
  color-scheme: dark;
  --bg: #0f0d14;
  --surface: #16131c;
  --surface-2: #1d1924;
  --surface-3: #282231;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #efeaf4;
  --text-2: #aca4b8;
  --text-3: #8b8399;
  --accent: #f4a7b9;
  --accent-ink: #2a121c;
  --accent-soft: rgba(244, 167, 185, 0.14);
  --accent-ring: rgba(244, 167, 185, 0.3);
  --avatar-ring: #9fd8b2;
  --shadow-panel: 0 24px 60px -24px rgb(0 0 0 / 0.7);
  --scrim: 10 7 14; /* 卡片上压暗用的底色（rgb 三个通道） */
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 20px;
  --page-pad: 20px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  --font: "ZCOOL KuaiLe", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

/* 亮色模式：<html data-theme="light">（由右上角的开关切换，选择会记在浏览器里）。
   这里只覆盖颜色，尺寸和间距沿用上面的定义 */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf5f6;
  --surface: #ffffff;
  --surface-2: #f7eef1;
  --surface-3: #efe3e8;
  --border: rgba(70, 35, 50, 0.1);
  --border-strong: rgba(70, 35, 50, 0.18);
  --text: #2b1f27;
  --text-2: #5d4f59;
  --text-3: #726273;
  --accent: #b93360;
  --accent-ink: #ffffff;
  --accent-soft: rgba(185, 51, 96, 0.1);
  --accent-ring: rgba(185, 51, 96, 0.3);
  --avatar-ring: #bfe6c8;
  --shadow-panel: 0 18px 44px -20px rgb(80 30 50 / 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(1100px 520px at 15% -10%, var(--accent-soft), transparent 70%) no-repeat, var(--bg);
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: currentColor;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--page-pad);
}

/* 移动端/窄屏：左栏与模块上下堆叠，预览面板暂不显示（移动端布局下一步再做） */
.side {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-bottom: 32px;
}

.preview {
  display: none;
}

/* ---------- 左栏：通用卡片块 ---------- */

.block {
  min-width: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.block__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.block__icon {
  font-size: 17px;
  color: var(--text-2);
}

.block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.block__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  transition: color 0.2s;
}

.block__link:hover {
  color: var(--accent);
}

/* 个人资料 */
.profile {
  position: relative;
}

/* 贴在头像右上角的 🍥 装饰，轻轻地左右摇摆。
   外面叠几层卡片底色的描边，这样压在浅色头像上也看得清 */
.profile__fishcake {
  position: absolute;
  top: 51px; /* 圆形头像框的右上角（translate(-50%,-50%) 居中，所以这里直接是圆框外缘坐标） */
  left: 99px;
  z-index: 1;
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 1px var(--surface)) drop-shadow(0 0 1px var(--surface)) drop-shadow(0 0 1px var(--surface))
    drop-shadow(0 2px 3px rgb(0 0 0 / 0.3));
  transform: translate(-50%, -50%);
  animation: fishcake-float 3.4s ease-in-out infinite;
}

@keyframes fishcake-float {
  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }
  50% {
    transform: translate(-50%, -50%) translateY(-5px);
  }
}

.profile__top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile__avatar {
  width: 84px;
  height: 84px;
  flex: none;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 6px var(--avatar-ring); /* 淡绿色圆圈头像框 */
}

.profile__id {
  min-width: 0;
}

.profile__name {
  display: flex;
  margin-top: 6px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  word-break: keep-all; /* 昵称里夹着中文时不从中间断开 */
  overflow-wrap: anywhere;
}

.profile__handle {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.profile__tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

/* 昵称下面的一行小标签（现在没有内容，位置让给了小窗口猫） */
.tagline-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* 小窗口里的线条小猫：探头、眨眼、摇尾巴（.cat-canvas 是「猫窝」游戏的画布，这个样式只是兜底） */
.cat-window {
  margin-top: 1px;
}

.cat-canvas {
  display: block;
  width: 120px;
  height: 76px;
}

.cat-window svg {
  display: block;
  width: 120px;
  height: auto;
  overflow: visible;
}

.cat-window .cat-head,
.cat-window .cat-ear,
.cat-window .cat-whisker,
.cat-window .cat-tail,
.cat-window ellipse,
.cat-window [d] {
  stroke: var(--text-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cat-window .cat-whisker {
  stroke-width: 1.2;
  opacity: 0.8;
}

.cat-window .cat-head {
  animation: cat-bob 3.2s ease-in-out infinite;
}

.cat-window .cat-eyes {
  animation: cat-blink 4.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.cat-window .cat-tail {
  animation: cat-tail 2.8s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: 0% 100%;
}

@keyframes cat-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2.5px);
  }
}

@keyframes cat-blink {
  0%,
  91%,
  100% {
    transform: scaleY(1);
  }
  94% {
    transform: scaleY(0.08);
  }
}

@keyframes cat-tail {
  from {
    transform: rotate(-7deg);
  }
  to {
    transform: rotate(8deg);
  }
}

.sep {
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: var(--text-3);
}

.profile__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-2);
}

.profile__bio {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
}

/* 左栏不够宽时头像放到上面，名字单独占一行 */
@container (max-width: 300px) {
  .profile__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.profile__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.profile__tags-label {
  flex: none;
  width: 100%;
  margin-bottom: -2px;
  font-size: 12px;
  color: var(--text-3);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tag .icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* 占位标签：还没填内容时显示 */
.tag--ghost {
  color: var(--text-3);
  border-style: dashed;
  background: transparent;
}

/* 精选照片：左栏里的小轮播 */
.carousel {
  position: relative;
  margin-top: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  border-radius: 12px;
}

.carousel__track {
  display: flex;
  height: 100%;
  transition: transform 0.5s var(--ease);
}

.carousel__slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
}

.carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel__slide figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 26px 78px 10px 12px; /* 右边留出圆点的位置 */
  font-size: 12.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(to top, rgb(var(--scrim) / 0.78), rgb(var(--scrim) / 0));
  pointer-events: none;
}

.carousel__btn {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 16px;
  color: #fff;
  background: rgb(var(--scrim) / 0.5);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0; /* 鼠标移到照片上才出现；触屏靠左右滑动 */
  transform: translateY(-50%);
  transition: opacity 0.2s, background-color 0.2s;
}

.carousel__btn:hover {
  background: rgb(var(--scrim) / 0.78);
}

.carousel__btn--prev {
  left: 8px;
}

.carousel__btn--next {
  right: 8px;
}

.carousel:hover .carousel__btn,
.carousel:focus-within .carousel__btn {
  opacity: 1;
}

@media (hover: none) {
  .carousel__btn {
    display: none;
  }
}

.carousel__dots {
  position: absolute;
  right: 10px;
  bottom: 13px;
  z-index: 1;
  display: flex;
  gap: 14px;
}

/* 透明的边框用来扩大可点击的范围，看到的圆点本身只有 6px */
.carousel__dots button {
  width: 6px;
  height: 6px;
  padding: 0;
  background: rgb(255 255 255 / 0.5);
  background-clip: padding-box;
  border: 5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: width 0.25s, background-color 0.25s;
}

.carousel__dots button.is-on {
  width: 16px;
  background-color: #fff;
}

/* 社交索引 */
.socials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

/* 左栏不够宽时社交索引改成单列 */
@container (max-width: 280px) {
  .socials {
    grid-template-columns: 1fr;
  }
}

/* 社交项是单数个时，最后一个占满整行（否则会空一格，长邮箱也显示不全） */
.social:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.social {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px 9px 10px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 0.2s, border-color 0.2s;
}

.social:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.social__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  font-size: 19px;
  color: var(--text);
  background: var(--surface-3);
  border-radius: 10px;
  transition: color 0.2s;
}

.social:hover .social__icon {
  color: var(--accent);
}

.icon--text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.social__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.social__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social__handle {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* GitHub 动态 */
.feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.event {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 12px;
}

.event:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 34px;
  bottom: -18px;
  width: 1px;
  background: var(--border-strong);
}

.event__icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 30px;
  height: 30px;
  font-size: 15px;
  color: var(--accent);
  background: var(--surface-3);
  border-radius: 50%;
}

.event__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.event__repo {
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s;
}

.event__repo:hover {
  color: var(--accent);
}

.event__count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 16px;
  vertical-align: 1px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

.event__time {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}

/* ---------- 右栏：模块 ---------- */

.module + .module {
  margin-top: 48px;
}

.module__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 18px;
}

.module__intro {
  min-width: 0;
}

.module__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.module__index {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s;
}

.module__count {
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--surface-3);
  border-radius: 999px;
  transition: color 0.25s, background-color 0.25s;
}

.module.is-active .module__index,
.module.is-active .module__count {
  color: var(--accent);
}

.module.is-active .module__count {
  background: var(--accent-soft);
}

.module__desc {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text-2);
  transition: color 0.2s;
}

.module__more:hover,
.module.is-active .module__more {
  color: var(--accent);
}

.module__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* ---------- 卡片 ---------- */

.card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius);
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.module[data-ratio="4-3"] .card {
  aspect-ratio: 4 / 3;
}

.card--static {
  cursor: default;
}

/* 封面图：默认铺满；--bg 是虚化背景，--fg 是完整显示在右侧的原图 */
.cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.card.is-selected .cover:not(.cover--fg) {
  transform: scale(1.06);
}

.cover--bg {
  transform: scale(1.3);
  filter: blur(22px) saturate(1.2);
}

.card.is-selected .cover--bg {
  transform: scale(1.36);
}

.cover-box {
  position: absolute;
  top: 12%;
  right: 9%;
  bottom: 5%;
  width: 38%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover--fg {
  position: static;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.45), 0 0 0 1px rgb(255 255 255 / 0.2);
  transition: none;
}

.card--pixel .cover--fg {
  image-rendering: pixelated;
  border-radius: 6px;
}

.card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(var(--scrim) / 0.88) 0%, rgb(var(--scrim) / 0.4) 40%, rgb(var(--scrim) / 0) 68%);
}

.card__body {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__desc {
  font-size: 12px;
  line-height: 1.45;
  color: rgb(255 255 255 / 0.76);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 每行两张的模块卡片更大，描述可以占两行 */
.module[data-cols="2"] .card__desc {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 原图完整显示的卡片：标题占满上方一行，图在右下角，描述在左下角。
   左侧和上方压得比较暗，保证浅色截图做背景时白字仍然清楚 */
.card--contain .card__scrim {
  background:
    linear-gradient(to bottom, rgb(var(--scrim) / 0.78) 0%, rgb(var(--scrim) / 0.1) 50%),
    linear-gradient(100deg, rgb(var(--scrim) / 0.92) 0%, rgb(var(--scrim) / 0.84) 48%, rgb(var(--scrim) / 0.1) 82%);
}

.card--contain .cover-box {
  top: 30%;
  right: 7%;
  bottom: 7%;
  width: 40%;
}

.card--contain .card__body {
  top: 0;
  bottom: auto;
}

.card--contain .card__title {
  display: -webkit-box;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card--contain .card__desc {
  max-width: 54%;
  margin-top: 4px;
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* 窄屏下卡片很小，只留标题 */
@media (max-width: 1023px) {
  .module[data-cols="2"] .card__desc,
  .card--contain .card__desc,
  .module .card__desc {
    display: none;
  }
}

/* 手机上每行两张的模块改成一行一张 */
@media (max-width: 640px) {
  .module[data-cols="2"] .module__grid {
    grid-template-columns: 1fr;
  }
}

.card__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #fff;
  background: rgb(var(--scrim) / 0.62);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.5), inset 0 0 0 5px var(--accent-ring);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.card.is-selected::after {
  opacity: 1;
}

/* ---------- 右栏：模块预览面板 ---------- */

.panel {
  position: relative; /* 给右上角的关闭按钮做定位基准 */
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

/* 预览栏右上角的关闭按钮（点击或 Esc 收起预览） */
.panel__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font: inherit;
  font-size: 16px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.panel__close:hover {
  color: var(--accent);
  border-color: var(--accent-ring);
}

.panel__hero {
  position: relative;
  aspect-ratio: 2.2 / 1; /* 不做太高，条目多的模块在 800px 高的屏幕上也能完整显示 */
  overflow: hidden;
  background: var(--surface-2);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

.panel__hero-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.panel__hero-layer.is-on {
  opacity: 1;
}

.panel__hero-layer .cover-box {
  top: 9%;
  right: 7%;
  bottom: 22%; /* 底部留给大图上的标题条 */
  width: 30%;
}

.panel__hero-layer .cover--fg {
  border-radius: 14px;
}

.panel__hero-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 30px 18px 14px;
  background: linear-gradient(to top, rgb(var(--scrim) / 0.84), rgb(var(--scrim) / 0));
}

.panel__hero-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__hero-count {
  flex: none;
  font-size: 12px;
  color: rgb(255 255 255 / 0.8);
  font-variant-numeric: tabular-nums;
}

.panel__hero-count b {
  font-size: 14px;
  color: #fff;
}

.panel__body {
  padding: 18px 12px 6px;
}

.panel__kicker {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.panel__title {
  margin-top: 2px;
  padding: 0 6px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.panel__desc {
  margin-top: 4px;
  padding: 0 6px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

.panel__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}

.pitem {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 12px;
  transition: background-color 0.2s;
}

.pitem:hover,
.pitem.is-active {
  background: var(--surface-2);
}

.pitem__thumb {
  width: 46px;
  height: 46px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
}

.pitem__thumb--contain {
  object-fit: contain;
  background: var(--bg);
}

.pitem__thumb--pixel {
  image-rendering: pixelated;
}

.pitem__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.pitem__title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.pitem.is-active .pitem__title {
  color: var(--accent);
}

.pitem__desc {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pitem__arrow {
  font-size: 16px;
  color: var(--accent);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 0.2s, transform 0.2s;
}

.pitem:hover .pitem__arrow,
.pitem.is-active .pitem__arrow {
  opacity: 1;
  transform: none;
}

.pitem__lock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  font-size: 11.5px;
  color: var(--text-3);
}

.panel__foot {
  padding: 12px 18px 18px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 12px;
  transition: filter 0.2s;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn__count {
  padding: 0 7px;
  font-size: 12px;
  line-height: 18px;
  background: rgb(0 0 0 / 0.16);
  border-radius: 999px;
}

/* ==========================================================
   PC 布局（≥ 1024px）
   默认：左 3 / 右 7
   悬停模块（.is-preview）：左 3 / 中 4 / 右 3，最右一栏为模块预览
   ========================================================== */

@media (min-width: 1024px) {
  :root {
    --page-pad: 24px;
  }

  .layout {
    display: grid;
    grid-template-columns: 3fr 7fr;
    overflow-anchor: none; /* 布局切换由 FLIP 接管，关掉浏览器的滚动锚定避免跳动 */
  }

  /* 左栏宽度在两种状态下都不变 */
  .side {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    min-width: 0;
    margin-bottom: 0;
    padding-right: var(--gap);
    container-type: inline-size;
  }

  /* 中栏 + 预览栏：7fr + 0fr，展开后变成 4fr + 3fr */
  .zone {
    display: grid;
    grid-template-columns: 7fr 0fr;
    min-width: 0;
  }

  .layout.is-preview .zone {
    grid-template-columns: 4fr 3fr;
  }

  .main {
    min-width: 0;
  }

  .layout.is-preview .main {
    padding-right: var(--gap);
  }

  .preview {
    display: block;
    min-width: 0;
    overflow: clip; /* clip 不会产生滚动容器，内部 sticky 才能相对视口生效 */
  }

  .preview__sticky {
    position: sticky;
    top: calc(var(--topbar-h) + 16px); /* 顶部菜单栏是吸顶的，预览面板要贴在它下面 */
    padding-left: var(--gap);
  }

  .panel {
    max-height: calc(100vh - var(--topbar-h) - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    box-shadow: var(--shadow-panel);
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  }

  .layout.is-preview .panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.3s ease 0.06s, transform 0.42s var(--ease) 0.06s, visibility 0s;
  }

  .layout.is-closing .panel {
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .module__head {
    flex-wrap: nowrap;
    gap: 16px;
    margin-bottom: 20px;
  }

  .module__desc {
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .module__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    container-type: inline-size;
  }

  .layout.is-preview .module__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card__body {
    padding: 14px 16px;
  }

  .card__title {
    font-size: 16px;
  }

  .card__desc {
    font-size: 13px;
  }

  /* 中栏收窄后（展开预览）卡片变小：只留标题，给背景图留出更多面积 */
  @container (max-width: 600px) {
    .card__body {
      padding: 11px 13px;
    }

    .card__title {
      font-size: 14px;
    }

    /* 选择器写得具体一些，是为了盖住上面“每行两张的模块描述可占两行”和 contain 卡片的规则 */
    .module .module__grid .card__desc {
      display: none;
    }

    .card--contain .cover-box {
      top: 32%;
    }
  }
}

@media (min-width: 1200px) {
  :root {
    --gap: 24px;
  }

  .module__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* data.js 里写了 cols: 2 的模块（精选项目、精选照片）在默认状态下每行两张 */
  .module[data-cols="2"] .module__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  :root {
    --page-pad: 32px;
  }
}

/* ---------- 顶部菜单栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1440px;
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__avatar {
  width: 28px;
  height: 28px;
  flex: none;
  object-fit: cover;
  border-radius: 9px;
}

.brand__name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin-left: auto;
}

.nav__link {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text-2);
  transition: color 0.2s, background-color 0.2s;
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav__link.is-current {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

/* 亮色模式开关：深色时显示太阳（点了变亮色），亮色时显示月亮 */
.theme-toggle,
.panel__back {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  font: inherit;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle {
  margin-left: 4px;
}

.theme-toggle:hover,
.panel__back:hover {
  color: var(--accent);
  border-color: var(--border-strong);
}

.theme-toggle:active {
  transform: scale(0.92);
}

.theme-toggle .icon {
  grid-area: 1 / 1;
  font-size: 18px;
}

.theme-toggle__moon,
:root[data-theme="light"] .theme-toggle__sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle__moon {
  display: block;
}

/* 切换主题时颜色平滑过渡 */
@media (prefers-reduced-motion: no-preference) {
  body,
  .topbar,
  .block,
  .tag,
  .event__icon,
  .nav__link {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  }
}

/* 手机上菜单栏放不下站点名，只留头像 */
@media (max-width: 480px) {
  .brand__name {
    display: none;
  }

  .nav__link {
    padding: 6px 9px;
    font-size: 13.5px;
  }
}

/* ---------- 右栏：项目 README 视图 ---------- */
.panel__overview[hidden],
.panel__doc[hidden] {
  display: none;
}

/* 吸顶的工具条：返回按钮、项目名、GitHub 链接 */
.panel__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 48px 10px 12px; /* 右侧留出右上角关闭按钮的位置 */
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.panel__back {
  width: 30px;
  height: 30px;
  font-size: 17px;
  background: none;
}

.panel__doc-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__gh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  flex: none;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  transition: filter 0.2s;
}

.panel__gh:hover {
  filter: brightness(1.08);
}

.panel__gh .icon {
  font-size: 14px;
}

/* README 正文 */
.readme {
  padding: 6px 16px 22px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.readme > :first-child {
  margin-top: 14px;
}

.readme h1,
.readme h2,
.readme h3,
.readme h4,
.readme h5 {
  margin: 24px 0 10px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.readme h1 {
  font-size: 20px;
}

.readme h2 {
  padding-bottom: 6px;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
}

.readme h3 {
  font-size: 15.5px;
}

.readme h4,
.readme h5 {
  font-size: 14.5px;
}

.readme p {
  margin: 0 0 12px;
}

.readme a {
  color: var(--accent);
}

.readme a:hover {
  text-decoration: underline;
}

.readme strong {
  color: var(--text);
}

.readme ul,
.readme ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.readme li {
  margin: 3px 0;
}

.readme li > p {
  margin-bottom: 6px;
}

.readme li.task-list-item {
  margin-left: -20px;
  list-style: none;
}

.readme input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--accent);
}

.readme img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px auto;
  border-radius: 8px;
}

/* 徽章保持行内显示，不要单独占一行 */
.readme img[src*="shields.io"] {
  display: inline-block;
  margin: 0 2px;
  vertical-align: middle;
}

/* 预览栏比较窄，截图里的字看不清：不在链接里的图片可以点开看原图 */
.readme__zoom {
  cursor: zoom-in;
}

.readme code {
  padding: 2px 5px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 5px;
}

.readme pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.readme pre code {
  padding: 0;
  font-size: inherit;
  color: var(--text);
  background: none;
}

.readme blockquote {
  margin: 0 0 12px;
  padding: 4px 14px;
  color: var(--text-3);
  border-left: 3px solid var(--accent-ring);
}

.readme hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.readme table {
  display: block;
  max-width: 100%;
  margin: 0 0 12px;
  overflow-x: auto;
  font-size: 13px;
  border-collapse: collapse;
}

.readme th,
.readme td {
  min-width: 80px; /* 预览栏窄，给每列留够宽度，放不下时表格横向滚动，而不是把字挤成一列一两个字 */
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  text-align: left;
}

.readme th:first-child,
.readme td:first-child {
  min-width: 0;
  width: 1%;
  white-space: nowrap; /* 第一列通常是序号，按内容收窄 */
}

.readme th {
  color: var(--text);
  background: var(--surface-2);
}

.readme details {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.readme summary {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.readme__note {
  padding: 28px 4px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

/* ==========================================================
   页面载入动画
   主页左侧卡片块和右侧模块依次从下方淡入（只播一次）
   ========================================================== */

@keyframes home-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.side > .block {
  animation: home-in 0.5s var(--ease) both;
}

.side > .block:nth-child(2) {
  animation-delay: 0.08s;
}

.side > .block:nth-child(3) {
  animation-delay: 0.16s;
}

.side > .block:nth-child(4) {
  animation-delay: 0.24s;
}

.module {
  animation: home-in 0.55s var(--ease) both;
}

.module:nth-child(2) {
  animation-delay: 0.06s;
}

.module:nth-child(3) {
  animation-delay: 0.12s;
}

.module:nth-child(4) {
  animation-delay: 0.18s;
}

.module:nth-child(5) {
  animation-delay: 0.24s;
}

/* ---------- 左栏：GitHub 提交热力图（数据在 js/contributions.js） ---------- */
:root {
  --contrib-l0: #232833;
  --contrib-l1: #0e4429;
  --contrib-l2: #006d32;
  --contrib-l3: #26a641;
  --contrib-l4: #39d353;
}

:root[data-theme="light"] {
  --contrib-l0: #e9e4ee;
  --contrib-l1: #9be9a8;
  --contrib-l2: #40c463;
  --contrib-l3: #30a14e;
  --contrib-l4: #216e39;
}

.contrib {
  display: block;
  width: 100%;
  height: auto;
}

.contrib-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.contrib rect {
  fill: var(--contrib-l0);
}

.contrib rect[data-level="1"] { fill: var(--contrib-l1); }
.contrib rect[data-level="2"] { fill: var(--contrib-l2); }
.contrib rect[data-level="3"] { fill: var(--contrib-l3); }
.contrib rect[data-level="4"] { fill: var(--contrib-l4); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .profile__fishcake {
    animation: none;
  }
}
