@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fade .25s ease reverse; }
::view-transition-new(root) { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } }

* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #f4f6fa; --card: rgba(255,255,255,.78); --text: #111827;
  --sub: #667085; --line: rgba(17,24,39,.08); --blue: #0969da;
  --soft: #eef4ff; --accent: #7c3aed; --glow: rgba(9,105,218,.08);
  --shadow: 0 18px 50px rgba(30,41,59,.07);
  --radius-sm: 14px; --radius-md: 20px; --radius-lg: 26px;
}
body.dark {
  color-scheme: dark; --bg: #080b14; --card: rgba(18,24,38,.82); --text: #f0f4fe;
  --sub: #8892a8; --line: rgba(255,255,255,.08); --blue: #60a5fa;
  --soft: rgba(56,139,253,.12); --accent: #a78bfa; --glow: rgba(96,165,250,.07);
  --shadow: 0 22px 60px rgba(0,0,0,.4);
}
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; padding-bottom: 120px; overflow-x: hidden;
  color: var(--text); background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: color .3s, background .3s;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 15% 8%, rgba(9,105,218,.10), transparent 35%),
    radial-gradient(circle at 85% 20%, rgba(124,58,237,.07), transparent 30%),
    radial-gradient(circle at 50% 75%, rgba(9,105,218,.04), transparent 40%);
}
a { color: inherit; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--line); }
::-webkit-scrollbar-thumb:hover { background: var(--sub); }

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: fixed; top: 28px; right: 30px; z-index: 10; display: grid; width: 46px; height: 46px;
  place-items: center; color: var(--text); border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); backdrop-filter: blur(20px); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .25s, box-shadow .25s;
}
.theme-toggle:hover { transform: scale(1.06); box-shadow: 0 0 0 4px var(--glow), var(--shadow); }
.theme-toggle svg { width: 20px; }

/* ─── Hero ─── */
.hero { width: min(1180px, calc(100% - 40px)); margin: auto; padding: 92px 0 48px; text-align: center; }
.eyebrow, .section-kicker { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 {
  margin: 14px 0 12px; font-size: clamp(44px, 7vw, 74px); letter-spacing: -.065em; line-height: 1;
  background: linear-gradient(135deg, var(--text) 40%, var(--blue)); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p { margin: 0 auto; max-width: 520px; color: var(--sub); font-size: 17px; line-height: 1.6; }
.container { width: min(1180px, calc(100% - 40px)); margin: auto; }

/* ─── Loading ─── */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 280px; color: var(--sub); }
.loading svg { width: 28px; height: 28px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Profile Card ─── */
.profile-card {
  display: grid; grid-template-columns: auto minmax(180px,1fr) auto auto; align-items: center; gap: 24px;
  padding: 28px 32px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card);
  backdrop-filter: blur(24px); box-shadow: var(--shadow); transition: box-shadow .3s;
}
.profile-card:hover { box-shadow: 0 0 0 1px var(--glow), var(--shadow); }
.profile-avatar {
  width: 78px; height: 78px; border-radius: 22px; object-fit: cover;
  transition: transform .3s; box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.profile-card:hover .profile-avatar { transform: scale(1.03); }
.profile-main h2 { margin: 6px 0 3px; font-size: 25px; letter-spacing: -.035em; }
.profile-main p { margin: 0; color: var(--sub); font-size: 13px; }
.profile-main a { color: var(--blue); text-decoration: none; font-weight: 500; }
.profile-main a:hover { text-decoration: underline; }
.profile-stats { display: flex; gap: 28px; padding: 0 8px; }
.profile-stats div { display: flex; flex-direction: column; align-items: center; }
.profile-stats strong { font-size: 22px; letter-spacing: -.04em; line-height: 1.3; }
.profile-stats span { color: var(--sub); font-size: 11px; }
.profile-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px;
  color: #fff; background: #24292f; font-size: 13px; font-weight: 700; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
body.dark .profile-link { color: #111; background: #e8ecf2; }
.profile-link:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.profile-link svg { width: 16px; }

/* ─── Sections ─── */
.section-block { margin-top: 72px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-head h2 { margin: 6px 0 0; font-size: 30px; letter-spacing: -.045em; }
.section-head p { margin: 0; color: var(--sub); font-size: 13px; }

/* ─── Featured Grid ─── */
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ─── Repo Card ─── */
.repo-card {
  display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--card); text-decoration: none;
  box-shadow: 0 4px 20px rgba(30,41,59,.04);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), border-color .25s, box-shadow .3s;
  position: relative; overflow: hidden;
}
.repo-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0;
  background: linear-gradient(135deg, transparent 60%, var(--glow)); transition: opacity .35s; pointer-events: none;
}
.repo-card:hover {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--blue) 55%, transparent);
  box-shadow: 0 12px 40px rgba(30,41,59,.1);
}
.repo-card:hover::before { opacity: 1; }
.featured-card {
  min-height: 260px; padding: 26px; border-radius: 22px;
  background: linear-gradient(145deg, var(--card), var(--soft));
  border-color: color-mix(in srgb, var(--blue) 20%, transparent);
}
.featured-card:hover { border-color: color-mix(in srgb, var(--blue) 60%, transparent); }
.repo-card-top { display: flex; align-items: flex-start; gap: 12px; }
.repo-icon {
  display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center;
  border-radius: 12px; color: var(--blue); background: var(--soft);
  transition: transform .25s, background .25s;
}
.repo-card:hover .repo-icon { transform: scale(1.06) rotate(-2deg); }
.repo-icon svg { width: 18px; }
.repo-heading { min-width: 0; flex: 1; }
.repo-heading h3 { margin: 3px 0 0; overflow: hidden; color: var(--text); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.featured-card .repo-heading h3 { font-size: 17px; }
.pin-label { color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.arrow {
  flex: 0 0 auto; width: 17px; color: var(--sub); transition: transform .25s, color .25s;
}
.repo-card:hover .arrow { transform: translate(2px,-2px); color: var(--blue); }
.repo-card > p { flex: 1; margin: 16px 0 22px; color: var(--sub); font-size: 13px; line-height: 1.7; }
.repo-meta { display: flex; align-items: center; gap: 16px; color: var(--sub); font-size: 11px; }
.repo-meta span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta svg { width: 13px; height: 13px; }
.repo-meta .lang-dot { width: 8px; height: 8px; border-radius: 50%; }
.repo-meta .license { margin-left: auto; }

/* ─── All Projects ─── */
.all-projects { margin-top: 78px; }
.repo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.repo-grid .repo-card { min-height: 190px; }

/* ─── Dock ─── */
.dock {
  position: fixed; bottom: 28px; left: 50%; z-index: 999; display: flex; align-items: center; gap: 3px;
  padding: 6px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); backdrop-filter: blur(30px); box-shadow: 0 8px 32px rgba(0,0,0,.1);
}
.dock-item {
  position: relative; display: flex; width: 48px; height: 48px; align-items: center; justify-content: center;
  color: var(--sub); border-radius: 50%; text-decoration: none; transition: all .2s;
}
.dock-item svg { width: 22px; height: 22px; transition: transform .2s; }
.dock-item span {
  position: absolute; bottom: 4px; left: 50%; opacity: 0; transform: translateX(-50%);
  font-size: 10px; white-space: nowrap; transition: opacity .2s;
}
.dock-item:hover { color: var(--text); background: rgba(128,128,128,.09); }
.dock-item:hover svg { transform: translateY(-5px); }
.dock-item:hover span { opacity: 1; }
.dock-item.active { color: var(--blue); }
.dock-item.active::after {
  content: ""; position: absolute; bottom: 5px; width: 16px; height: 3px;
  border-radius: 2px; background: var(--blue);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .profile-card { grid-template-columns: auto 1fr auto; gap: 20px; }
  .profile-stats { grid-column: 1 / 3; grid-row: 2; padding: 0; }
  .profile-link { grid-column: 3; grid-row: 1 / 3; }
  .featured-grid { grid-template-columns: 1fr; }
  .featured-card { min-height: 220px; }
}
@media (max-width: 640px) {
  .hero, .container { width: calc(100% - 24px); }
  .hero { padding: 70px 2px 32px; }
  .hero h1 { font-size: 40px; }
  .theme-toggle { top: 18px; right: 18px; width: 42px; height: 42px; }
  .profile-card { grid-template-columns: auto 1fr; gap: 15px; padding: 18px; border-radius: var(--radius-md); }
  .profile-avatar { width: 58px; height: 58px; border-radius: 17px; }
  .profile-main h2 { font-size: 20px; }
  .profile-stats { grid-column: 1 / 3; justify-content: space-around; gap: 8px; }
  .profile-link { grid-column: 1 / 3; grid-row: auto; justify-content: center; }
  .section-block { margin-top: 52px; }
  .section-head h2 { font-size: 25px; }
  .section-head > p { display: none; }
  .repo-grid { grid-template-columns: 1fr; }
  .repo-grid .repo-card { min-height: 175px; }
  .dock { bottom: 18px; padding: 4px; }
  .dock-item { width: 40px; height: 40px; }
  .dock-item svg { width: 18px; height: 18px; }
  .dock-item span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
