/* ===== 跨页面过渡动画 (View Transitions API) ===== */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-fade-out 0.35s ease-out both;
  pointer-events: none;
}

::view-transition-new(root) {
  animation: vt-fade-in 0.35s ease-in both;
  pointer-events: none;
}

@keyframes vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes vt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== Reset & Variables ===== */
* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.65);
  --text: #1d1d1f;
  --sub: #6e6e73;
  --blue: #0071e3;
  --line: rgba(0, 0, 0, 0.08);
  --shadow: 0 25px 70px rgba(0, 0, 0, 0.12);
}

body.dark {
  --bg: #000;
  --card: rgba(35, 35, 38, 0.72);
  --text: #f5f5f7;
  --sub: #a1a1a6;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 125px;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: color .3s, background .3s;
}

/* ===== Apple Sonoma 动态背景 ===== */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  animation: float 20s infinite alternate ease-in-out;
}

body::before {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -150px;
  background: radial-gradient(
    circle,
    rgba(0, 122, 255, 0.45),
    transparent 70%
  );
}

body::after {
  width: 600px;
  height: 600px;
  right: -200px;
  bottom: -220px;
  background: radial-gradient(
    circle,
    rgba(175, 82, 222, 0.35),
    transparent 70%
  );
  animation-delay: -8s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(80px, 60px) scale(1.15);
  }
  100% {
    transform: translate(-40px, 90px) scale(0.95);
  }
}

/* ===== 主题按钮 ===== */
.theme-toggle {
  position: fixed;
  right: 35px;
  top: 35px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
}

.theme-toggle svg {
  width: 26px;
  height: 26px;
  stroke: var(--text);
}

/* ===== Hero ===== */
.hero {
  max-width: 720px;
  margin: auto;
  padding: 92px 24px 42px;
  text-align: center;
}

.hero h1 {
  margin: 12px 0 14px;
  font-size: clamp(42px, 7vw, 64px);
  letter-spacing: -.06em;
  line-height: 1.08;
}

.hero p {
  max-width: 600px;
  margin: auto;
  color: var(--sub);
  font-size: 17px;
  line-height: 1.8;
}

/* ===== 内容布局 ===== */
.container {
  max-width: 1100px;
  margin: auto;
  padding: 20px;
}

.section-title {
  font-size: 32px;
  margin: 40px 0 25px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

/* ===== 卡片 ===== */
.card {
  height: 330px;
  padding: 35px;
  border-radius: 35px;
  background: var(--card);
  backdrop-filter: blur(35px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: 0.35s;
}

.card:hover {
  transform: translateY(-12px);
}

.icon svg {
  width: 60px;
  height: 60px;
  stroke: var(--text);
  stroke-width: 1.8;
}

.card h2 {
  font-size: 32px;
  margin: 20px 0 10px;
}

.card p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--sub);
}

.link {
  color: var(--blue);
  font-size: 18px;
  text-decoration: none;
}

/* ===== Dock ===== */
.dock {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line, rgba(128, 128, 128, 0.12));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transition: background 0.3s, border-color 0.3s;
}

body.dark .dock {
  border-color: rgba(255, 255, 255, 0.06);
}

.dock-item {
  position: relative;
  color: var(--sub);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  transition: transform 0.25s;
}

.github-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.dock-item span {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

.dock-item:hover {
  color: var(--text);
  background: rgba(128, 128, 128, 0.08);
}

.dock-item:hover svg {
  transform: translateY(-6px) scale(1.1);
}

.dock-item:hover span {
  opacity: 1;
}

.dock-item.active {
  color: var(--blue);
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
}

.dock-item.active:hover::after {
  display: none;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 640px) {
  body::before, body::after {
    width: 320px;
    height: 320px;
    filter: blur(60px);
  }
  body::before { top: -100px; left: -100px; }
  body::after { right: -100px; bottom: -120px; }

  .theme-toggle {
    right: 20px;
    top: 20px;
    width: 44px;
    height: 44px;
  }
  .theme-toggle svg { width: 20px; height: 20px; }

  .hero {
    padding: 72px 20px 30px;
  }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 15px; }

  .container { padding: 12px; }

  .section-title {
    font-size: 24px;
    margin: 28px 0 18px;
  }

  .grid { gap: 18px; }

  .card {
    height: auto;
    min-height: 260px;
    padding: 24px;
    border-radius: 24px;
  }
  .icon svg { width: 44px; height: 44px; }
  .card h2 { font-size: 24px; }
  .card p { font-size: 15px; }
  .link { font-size: 16px; }

  .dock {
    gap: 1px;
    padding: 4px;
    bottom: 20px;
  }

  .dock-item {
    width: 40px;
    height: 40px;
  }

  .dock-item svg {
    width: 18px;
    height: 18px;
  }

  .dock-item span {
    display: none;
  }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
  .card { min-height: 220px; padding: 20px; border-radius: 20px; }
  .hero { padding: 60px 16px 24px; }
  .hero h1 { font-size: 28px; }
}
