/* ============ 主题变量 ============ */
:root {
  --bg: #f7f6f2;
  --bg-elev: rgba(255, 255, 255, 0.6);
  --fg: #16161a;
  --fg-2: #3b3b44;
  --muted: #6c6c75;
  --faint: #a2a2aa;
  --line: rgba(22, 22, 26, 0.09);
  --line-strong: rgba(22, 22, 26, 0.18);
  --accent: #ff5b38;
  --accent-2: #7a5cff;
  --accent-3: #18b7a0;
  --blob: 0.5;
  --grain: 0.05;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.18);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0e;
    --bg-elev: rgba(255, 255, 255, 0.035);
    --fg: #ececf0;
    --fg-2: #c8c8d0;
    --muted: #9c9ca6;
    --faint: #63636d;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #ff7a5c;
    --accent-2: #9a85ff;
    --accent-3: #2fd1b7;
    --blob: 0.32;
    --grain: 0.07;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0e;
  --bg-elev: rgba(255, 255, 255, 0.035);
  --fg: #ececf0;
  --fg-2: #c8c8d0;
  --muted: #9c9ca6;
  --faint: #63636d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #ff7a5c;
  --accent-2: #9a85ff;
  --accent-3: #2fd1b7;
  --blob: 0.32;
  --grain: 0.07;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.wrap {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: clamp(16px, 5vw, 28px);
}

/* ============ 背景氛围 ============ */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  opacity: var(--blob);
  will-change: transform;
  animation: drift 26s var(--ease) infinite alternate;
}
.b1 { top: -32vmax; left: -22vmax; background: radial-gradient(circle, var(--accent) 0%, transparent 62%); }
.b2 { top: -26vmax; right: -28vmax; background: radial-gradient(circle, var(--accent-2) 0%, transparent 62%); animation-duration: 32s; animation-delay: -8s; }
.b3 { bottom: -40vmax; left: 10vmax; background: radial-gradient(circle, var(--accent-3) 0%, transparent 60%); opacity: calc(var(--blob) * 0.45); animation-duration: 38s; animation-delay: -16s; }
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); }
  100% { transform: translate3d(-4vmax, 7vmax, 0) scale(0.96); }
}
.grain {
  position: fixed; inset: -50%; z-index: -1; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.4s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-family: var(--mono); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.02em; }
.logo span { color: var(--faint); }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  font-size: 0.9rem; color: var(--muted);
  padding: 6px 10px; border-radius: 8px;
  transition: color 0.2s, background-color 0.2s;
}
.nav a:hover { color: var(--fg); background: var(--bg-elev); }
.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-elev); color: var(--fg); cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--line-strong); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ============ 首屏 ============ */
.hero { padding: clamp(64px, 14vh, 140px) 0 clamp(48px, 8vh, 88px); }
.avatar {
  position: relative;
  width: 76px; height: 76px; border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.avatar > span, .avatar > img {
  display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg); object-fit: cover;
  font-size: 30px; font-weight: 700;
}
.hello { color: var(--muted); font-size: 1.05rem; margin-bottom: 0.2em; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.6s ease-in-out 1s infinite; }
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}
.name {
  font-size: clamp(2.9rem, 10vw, 4.9rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 0.32em;
}
.accent-dot { color: var(--accent); }
.role { font-family: var(--mono); font-size: 0.88rem; color: var(--muted); margin-bottom: 1.4em; }
.role i { font-style: normal; color: var(--faint); margin: 0 0.6em; }
.intro { font-size: clamp(1.08rem, 2.4vw, 1.22rem); color: var(--fg-2); max-width: 34em; line-height: 1.8; }

.status {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0.6em 0 2em;
  padding: 7px 16px 7px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-elev);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 0.9rem; color: var(--fg-2);
  transition: border-color 0.2s;
}
.status:hover { border-color: var(--line-strong); }
.status .arrow { color: var(--faint); transition: transform 0.25s var(--ease), color 0.2s; }
.status:hover .arrow { transform: translateX(3px); color: var(--fg); }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #22c55e; animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

/* 按钮 */
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-elev);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--fg); font: inherit; font-size: 0.92rem; font-weight: 500; line-height: 1.4;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.btn svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-solid:hover { border-color: var(--fg); }
.btn-lg { padding: 12px 20px; font-size: 1rem; border-radius: 14px; }

/* ============ 区块 ============ */
.section { padding: clamp(56px, 10vw, 100px) 0 0; }
.label {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}
.label span { color: var(--accent); }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 关于 */
.lead {
  font-size: clamp(1.3rem, 3.4vw, 1.6rem);
  font-weight: 600; line-height: 1.5; letter-spacing: -0.015em;
  margin-bottom: 0.8em;
}
#about > p:not(.lead) { color: var(--fg-2); }
.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; margin: 28px 0 0;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: var(--line);
}
.facts > div { padding: 14px 18px; background: var(--bg); }
.facts dt { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--faint); }
.facts dd { margin: 2px 0 0; font-size: 0.96rem; }

/* 项目卡片 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 22px 20px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg-elev);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  overflow: hidden; isolation: isolate;
  transition: transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 55%);
  opacity: 0; transition: opacity 0.35s;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.glyph {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  color: #fff; font-size: 15px;
  box-shadow: 0 6px 16px -6px var(--g1);
}
.go {
  width: 20px; height: 20px; fill: none; stroke: var(--faint); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.3s var(--ease), stroke 0.2s;
}
.card:hover .go { transform: translate(2px, -2px); stroke: var(--fg); }
.card h3 { font-size: 1.08rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 6px; }
.card p { color: var(--muted); font-size: 0.93rem; line-height: 1.65; margin-bottom: 16px; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-family: var(--mono); font-size: 0.72rem;
  padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted);
}

/* 时间线 */
.timeline li {
  display: grid; grid-template-columns: 92px 1fr; gap: 16px;
  padding: 20px 0; border-top: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.when { font-family: var(--mono); font-size: 0.85rem; color: var(--faint); padding-top: 2px; }
.timeline .now .when { color: var(--accent); }
.timeline .now .when::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 8px; vertical-align: 2px;
}
.timeline h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 2px; }
.timeline p { color: var(--muted); font-size: 0.93rem; margin: 0; }

/* 联系 */
.contact {
  position: relative; overflow: hidden;
  padding: clamp(28px, 6vw, 48px);
  border: 1px solid var(--line); border-radius: 24px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    radial-gradient(100% 120% at 0% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 55%),
    var(--bg-elev);
}
.contact-title {
  font-size: clamp(2rem, 7vw, 3.1rem); font-weight: 800;
  line-height: 1.1; letter-spacing: -0.035em;
  margin-bottom: 0.45em;
}
.contact > p { color: var(--muted); max-width: 30em; margin-bottom: 1.6em; }
.contact-row { display: flex; flex-wrap: wrap; gap: 10px; }
.copy.done { color: var(--accent-3); border-color: color-mix(in srgb, var(--accent-3) 50%, transparent); }

/* 页脚 */
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: clamp(56px, 10vw, 100px);
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.8rem; color: var(--faint);
}
.totop:hover { color: var(--fg); }

/* ============ 入场动画 ============ */
.js .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ============ 移动端 ============ */
@media (max-width: 600px) {
  .nav a { display: none; }
  .grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .facts { grid-template-columns: 1fr; }
  .contact-row .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
