/* ============================================================
   SY · 个人项目主页
   风格：深色底 + 极光渐变 + Bento 网格 + 玻璃拟态 + 噪点纹理
   ============================================================ */

:root {
  --bg: #05070d;
  --bg-alt: rgba(255, 255, 255, 0.02);
  --text: #e9edf5;
  --muted: #97a1b4;
  --teal: #2dd4bf;
  --teal-soft: #5eead4;
  --blue: #38bdf8;
  --violet: #a78bfa;
  --border: rgba(255, 255, 255, 0.09);
  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  --accent-soft: rgba(45, 212, 191, 0.12);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --radius: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px; /* 锚点定位避开浮动胶囊导航 */
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--teal); color: #04211c; }

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

/* 深色滚动条 */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(45, 212, 191, 0.4); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ 极光背景 ============ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  /* 基底：左上一抹冷蓝，落在深夜色上 */
  background:
    radial-gradient(1100px 700px at 75% -10%, rgba(56, 189, 248, 0.09), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(139, 92, 246, 0.06), transparent 60%),
    var(--bg);
}

.aurora i {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.aurora .a1 {
  width: 55vw; height: 55vw;
  min-width: 480px; min-height: 480px;
  left: -12vw; top: -18vw;
  background: radial-gradient(circle at 35% 35%, rgba(45, 212, 191, 0.22), transparent 62%);
  animation: drift1 26s ease-in-out infinite alternate;
}

.aurora .a2 {
  width: 48vw; height: 48vw;
  min-width: 420px; min-height: 420px;
  right: -14vw; top: -8vw;
  background: radial-gradient(circle at 60% 40%, rgba(139, 92, 246, 0.16), transparent 62%);
  animation: drift2 32s ease-in-out infinite alternate;
}

.aurora .a3 {
  width: 46vw; height: 46vw;
  min-width: 400px; min-height: 400px;
  left: 22vw; bottom: -26vw;
  background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.13), transparent 62%);
  animation: drift3 38s ease-in-out infinite alternate;
}

.aurora .a4 {
  width: 30vw; height: 30vw;
  min-width: 300px; min-height: 300px;
  right: 4vw; bottom: -6vw;
  background: radial-gradient(circle at 50% 50%, rgba(45, 212, 191, 0.10), transparent 62%);
  animation: drift1 30s ease-in-out infinite alternate-reverse;
}

@keyframes drift1 { to { transform: translate(9vw, 7vh) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-7vw, 9vh) scale(0.92); } }
@keyframes drift3 { to { transform: translate(6vw, -7vh) scale(1.12); } }

/* ============ 噪点纹理 ============ */
.noise {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ 胶囊导航 ============ */
.nav-pill {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 10px 16px 10px 26px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: background 0.3s ease, border-color 0.3s ease;
  max-width: calc(100vw - 32px);
}

.nav-pill.scrolled {
  background: rgba(8, 11, 18, 0.78);
  border-color: rgba(45, 212, 191, 0.22);
}

.logo {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.logo-dot { color: var(--teal); }

.nav-links { display: flex; gap: 28px; }

.nav-links a {
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--teal-soft); }

/* ============ 渐变文字 ============ */
.grad-text {
  background: linear-gradient(120deg, var(--teal-soft), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 流动渐变字（kinetic typography） */
.grad-anim {
  background: linear-gradient(90deg, var(--teal-soft), var(--blue), var(--violet), var(--teal-soft));
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 7s linear infinite;
}

@keyframes shine { to { background-position: 220% center; } }

/* ============ Hero ============ */
.hero {
  position: relative;
  padding: 200px 0 140px;
  text-align: center;
  overflow: hidden;
}

/* 网格底纹，向下渐隐 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 80%);
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--teal-soft);
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  background: rgba(45, 212, 191, 0.07);
}

.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.hero h1 {
  margin-top: 30px;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.h1-line2 {
  display: inline-block;
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0;
}

.hero-sub {
  margin: 26px auto 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  width: 26px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  transition: border-color 0.25s ease;
}

.scroll-cue:hover { border-color: rgba(45, 212, 191, 0.55); }

.scroll-cue span {
  width: 4px; height: 9px;
  border-radius: 4px;
  background: var(--teal-soft);
  animation: cue 1.8s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(12px); opacity: 0.15; }
}

/* ============ 按钮 ============ */
.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-grad {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #04211c;
  box-shadow: 0 10px 32px rgba(45, 212, 191, 0.28);
}

.btn-grad:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 42px rgba(45, 212, 191, 0.42);
}

.btn-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-glass:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 212, 191, 0.5);
}

.btn-muted {
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  cursor: default;
}

/* ============ 跑马灯 ============ */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  padding: 18px 0;
  animation: marquee 36s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-group {
  display: flex;
  align-items: center;
  gap: 40px;
  padding-right: 40px;
}

.marquee-group span {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.marquee-group i {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--teal);
  opacity: 0.75;
}

@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ 区块通用 ============ */
.section { padding: 110px 0; }

.section-alt {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.section-head { margin-bottom: 48px; }

.kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  color: var(--teal-soft);
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 750;
}

.section-desc {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.93rem;
}

.section-desc code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  color: var(--teal-soft);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ============ 玻璃拟态基础 ============ */
.glass,
.cell,
.card,
.skill-group,
.contact-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 34px rgba(0, 0, 0, 0.28);
}

/* ============ 关于我：Bento ============ */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  grid-auto-rows: minmax(148px, auto);
}

.cell {
  position: relative;
  padding: 26px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.cell:hover {
  transform: translateY(-4px);
  border-color: rgba(45, 212, 191, 0.38);
}

.cell h3 {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--teal-soft);
  margin-bottom: 10px;
}

.cell p { color: var(--muted); font-size: 0.93rem; }

.cell-ico {
  position: absolute;
  top: 22px; right: 22px;
  font-size: 1.35rem;
  opacity: 0.9;
}

.cell-intro {
  grid-column: span 2;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.cell-intro::after {
  /* 角落光晕 */
  content: "";
  position: absolute;
  right: -60px; bottom: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.14), transparent 65%);
  pointer-events: none;
}

.cell-intro p { font-size: 0.98rem; }

.span-2c { grid-column: span 2; }
.span-3c { grid-column: span 3; }
.span-2r { grid-row: span 2; }

.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.stat-num {
  font-family: var(--mono);
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ============ 项目卡片 ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(45, 212, 191, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 18px 44px rgba(0, 0, 0, 0.42);
}

/* 光标跟随的聚光效果（--mx/--my 由 JS 写入） */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 50%), rgba(45, 212, 191, 0.11), transparent 46%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.card:hover::before { opacity: 1; }

.card-head {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 12px;
}

.card-ico {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  font-size: 1.3rem;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.16), rgba(56, 189, 248, 0.14));
  border: 1px solid rgba(45, 212, 191, 0.25);
  flex-shrink: 0;
}

.card h3 { font-size: 1.12rem; font-weight: 700; }

.card-featured { grid-column: span 2; }

.card-desc {
  color: var(--muted);
  font-size: 0.93rem;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 3px 11px;
  border-radius: 999px;
  color: var(--teal-soft);
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.22);
}

.card-links {
  display: flex;
  gap: 18px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-links a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease;
}

.card-links a:hover { color: var(--teal-soft); }

.noscript-tip { color: var(--muted); }

/* ============ 技能 ============ */
.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 18px;
}

.skill-group {
  padding: 24px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.skill-group:hover {
  transform: translateY(-4px);
  border-color: rgba(45, 212, 191, 0.38);
}

.skill-group h3 {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--teal-soft);
  margin-bottom: 16px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 5px 12px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chips span::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.7;
}

.chips span:hover {
  color: var(--text);
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.07);
}

/* ============ 联系：渐变描边玻璃面板 ============ */
.contact-panel {
  position: relative;
  text-align: center;
  padding: 70px 32px;
  overflow: hidden;
}

/* 渐变描边（mask 镂空边框） */
.contact-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.55), rgba(56, 189, 248, 0.3) 40%, rgba(167, 139, 250, 0.45) 75%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* 面板内顶部光晕 */
.contact-panel::after {
  content: "";
  position: absolute;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 480px; height: 240px;
  background: radial-gradient(ellipse at center, rgba(45, 212, 191, 0.16), transparent 65%);
  pointer-events: none;
}

.contact-panel h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 750;
  margin-top: 8px;
}

.contact-sub {
  color: var(--muted);
  margin: 14px auto 0;
  max-width: 460px;
}

.contact-actions {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ 页脚 ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ============ 滚动淡入 ============ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .span-3c { grid-column: span 2; }
  .cell-intro { grid-column: span 2; grid-row: span 1; }
}

@media (max-width: 720px) {
  .section { padding: 78px 0; }
  .hero { padding: 150px 0 110px; }
  .nav-pill {
    left: 16px; right: 16px;
    transform: none;
    justify-content: space-between;
  }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.84rem; }
  .bento { grid-template-columns: 1fr; }
  .span-2c, .span-3c, .card-featured { grid-column: span 1; }
  .cell-intro { grid-column: span 1; }
  .grid { grid-template-columns: 1fr; }
  .footer-inner { justify-content: center; text-align: center; }
  .scroll-cue { display: none; }
}

/* ============ 动效偏好 ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora i, .grad-anim, .marquee-track, .pulse, .scroll-cue span { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .card, .cell, .skill-group, .contact-panel { transition: none; }
}
