/* ===== 设计变量 ===== */
:root {
  --bg-1: #0f172a;
  --bg-2: #1e293b;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #ec4899;
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-hover: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --ring-color: rgba(99, 102, 241, 0.6);
  --toast-bg: #1e293b;
  --toast-text: #f8fafc;
}

[data-theme="light"] {
  --bg-1: #eef2ff;
  --bg-2: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --chip-bg: rgba(15, 23, 42, 0.05);
  --chip-hover: rgba(99, 102, 241, 0.12);
  --shadow: 0 24px 70px rgba(99, 102, 241, 0.15);
  --ring-color: rgba(99, 102, 241, 0.4);
  --toast-bg: #0f172a;
  --toast-text: #f8fafc;
}

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.4s ease;
}

/* ===== 背景光斑 ===== */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  z-index: -1;
  animation: drift 18s ease-in-out infinite;
}

.bg-blob--1 {
  width: 420px; height: 420px;
  background: var(--accent-1);
  top: -80px; left: -80px;
}

.bg-blob--2 {
  width: 380px; height: 380px;
  background: var(--accent-2);
  bottom: -100px; right: -90px;
  animation-delay: -6s;
}

.bg-blob--3 {
  width: 220px; height: 220px;
  background: var(--accent-3);
  top: 45%; left: 60%;
  animation-delay: -12s;
  opacity: 0.3;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ===== 容器 ===== */
.container {
  width: 100%;
  max-width: 430px;
  position: relative;
}

/* ===== 卡片 ===== */
.card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  overflow: hidden;
  animation: cardIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部渐变光带 */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-3));
}

/* ===== 顶部操作区 ===== */
.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.06); }
}

.theme-toggle {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--chip-bg);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, background 0.3s, border-color 0.3s;
}

.theme-toggle:hover {
  transform: rotate(20deg) scale(1.08);
  background: var(--chip-hover);
  border-color: var(--accent-1);
}

.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ===== 头像 ===== */
.avatar-wrap {
  position: relative;
  width: 104px; height: 104px;
  margin: 8px auto 18px;
}

.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  border: 3px solid var(--card-bg);
}

.avatar-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-1), var(--accent-2), var(--accent-3), var(--accent-1));
  animation: spin 6s linear infinite;
  z-index: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 基本信息 ===== */
.card__body {
  text-align: center;
}

.name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.role {
  margin-top: 6px;
  font-size: 15px;
  color: var(--accent-2);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.bio {
  margin: 16px auto 22px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 320px;
}

/* ===== 联系方式 ===== */
.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
}

.chip:hover {
  background: var(--chip-hover);
  transform: translateY(-2px);
  border-color: var(--accent-1);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.chip__icon { font-size: 16px; }

/* ===== 技能标签 ===== */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.skill {
  padding: 6px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: transform 0.25s;
}

.skill:hover {
  transform: scale(1.06);
}

/* ===== 底部 ===== */
.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.footer-note {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-primary {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 响应式 ===== */
@media (max-width: 460px) {
  body { padding: 16px; }
  .card { padding: 24px 20px 20px; }
  .card__footer { flex-direction: column; gap: 14px; }
}

/* 尊重系统减弱动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 照片画廊 ===== */
.gallery {
  margin-top: 26px;
  text-align: left;
}

.gallery__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gallery__item {
  position: relative;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  background: transparent;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gallery__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(99, 102, 241, 0.35);
}

.gallery__item:hover img {
  transform: scale(1.06);
}

/* ===== 灯箱（点击放大）===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox__img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.3s;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  line-height: 1;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 16px;
  border-radius: 999px;
}

/* 移动端导航按钮调整 */
@media (max-width: 460px) {
  .lightbox { padding: 24px; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__nav { width: 40px; height: 40px; }
  .gallery__grid { gap: 8px; }
}
