:root {
  --bg: #0a0e17;
  --bg-soft: #0d1421;
  --card: rgba(17, 24, 39, 0.6);
  --card-border: rgba(148, 163, 184, 0.12);
  --primary: #00d9ff;
  --secondary: #a855f7;
  --amber: #fbbf24;
  --text: #e5e7eb;
  --text-dim: #94a3b8;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius: 14px;
  --container: 1100px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

::selection { background: rgba(0, 217, 255, 0.3); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* ---------- background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}

.bg-glow {
  position: fixed;
  z-index: -3;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
}
.bg-glow-1 { width: 480px; height: 480px; background: var(--primary); top: -160px; left: -120px; }
.bg-glow-2 { width: 520px; height: 520px; background: var(--secondary); top: 30%; right: -200px; }

/* ---------- navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--card-border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.logo-bracket { color: var(--primary); }
.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}
.nav-links a {
  font-size: 0.92rem;
  color: var(--text-dim);
  transition: color 0.2s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.25s;
  border-radius: 2px;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* ---------- hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 100px 0 60px;
}
.hero-hello {
  font-family: var(--mono);
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 14px;
  opacity: 0;
  animation: fadeUp 0.6s 0.1s forwards;
}
.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  animation: fadeUp 0.6s 0.25s forwards;
}
.gradient-text {
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  margin-top: 14px;
  font-size: 1.15rem;
  color: var(--text-dim);
  min-height: 1.9em;
  opacity: 0;
  animation: fadeUp 0.6s 0.4s forwards;
}
.tw-text { color: var(--primary); }
.tw-cursor {
  color: var(--primary);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  max-width: 560px;
  margin-top: 18px;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeUp 0.6s 0.55s forwards;
}
.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  opacity: 0;
  animation: fadeUp 0.6s 0.7s forwards;
}
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-primary {
  background: linear-gradient(120deg, var(--primary), #22a3e0);
  color: #04121a;
  font-weight: 700;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 217, 255, 0.35); }
.btn-ghost {
  border: 1px solid var(--card-border);
  color: var(--text);
  background: rgba(148, 163, 184, 0.06);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }

.hero-stats {
  display: flex;
  gap: 48px;
  margin-top: 56px;
  opacity: 0;
  animation: fadeUp 0.6s 0.85s forwards;
}
.stat { display: flex; flex-direction: column; }
.stat strong {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span { font-size: 0.85rem; color: var(--text-dim); }

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 0.8rem;
  animation: float 2s ease-in-out infinite;
}
@keyframes float { 50% { transform: translate(-50%, 8px); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section-head {
  margin-bottom: 44px;
  position: relative;
}
.section-tag {
  color: var(--primary);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.section-title {
  font-size: 2rem;
  font-weight: 700;
}
.section-title::after {
  content: '';
  display: block;
  width: 44px; height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* ---------- skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.skill-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 217, 255, 0.1);
}
.skill-icon {
  font-size: 1.6rem;
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 217, 255, 0.12), rgba(168, 85, 247, 0.12));
  border: 1px solid var(--card-border);
  margin-bottom: 18px;
}
.skill-card h3 { font-size: 1.1rem; margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  transition: 0.2s;
}
.skill-card:hover .tag { color: var(--text); border-color: rgba(148, 163, 184, 0.3); }
.progress {
  margin-top: 20px;
  height: 6px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
.progress-bar.in-view { width: var(--w); }

/* ---------- blog ---------- */
.section-head.with-filter {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.blog-filter { display: flex; gap: 8px; }
.filter-btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: rgba(0, 217, 255, 0.4); }
.filter-btn.active {
  background: linear-gradient(120deg, rgba(0, 217, 255, 0.15), rgba(168, 85, 247, 0.15));
  border-color: var(--primary);
  color: var(--primary);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}
.blog-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.blog-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.blog-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.blog-card time { font-size: 0.75rem; color: var(--text-dim); }
.tag-cyan { color: var(--primary); border-color: rgba(0, 217, 255, 0.35); background: rgba(0, 217, 255, 0.08); }
.tag-purple { color: var(--secondary); border-color: rgba(168, 85, 247, 0.35); background: rgba(168, 85, 247, 0.08); }
.tag-amber { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.blog-card h3 {
  font-size: 1.05rem;
  line-height: 1.5;
  transition: color 0.2s;
}
.blog-card:hover h3 { color: var(--primary); }
.blog-card p {
  font-size: 0.88rem;
  color: var(--text-dim);
  flex: 1;
}
.blog-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.read-more { color: var(--primary); }
.blog-card.hidden { display: none; }
.empty-tip {
  text-align: center;
  padding: 40px 0;
  color: var(--text-dim);
}

/* ---------- thoughts ---------- */
.timeline {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: 0.4;
  border-radius: 2px;
}
.timeline-item { position: relative; padding-bottom: 36px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -32px; top: 8px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--primary);
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.5);
}
.timeline-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 26px;
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s;
}
.timeline-card:hover {
  transform: translateX(6px);
  border-color: rgba(168, 85, 247, 0.45);
}
.timeline-card time { font-size: 0.75rem; color: var(--secondary); }
.timeline-card h3 { font-size: 1.05rem; margin: 6px 0 8px; }
.timeline-card p { font-size: 0.9rem; color: var(--text-dim); }

/* ---------- projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}
.project-cover {
  height: 130px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
}
.project-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(10, 14, 23, 0.5));
}
.cover-1 { background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(10, 14, 23, 0.3)); color: var(--primary); }
.cover-2 { background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(10, 14, 23, 0.3)); color: var(--secondary); }
.cover-3 { background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(10, 14, 23, 0.3)); color: var(--amber); }
.cover-4 { background: linear-gradient(135deg, rgba(52, 211, 153, 0.18), rgba(10, 14, 23, 0.3)); color: #34d399; }
.project-body { padding: 22px 24px 26px; }
.project-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.project-title-row h3 { font-size: 1.08rem; }
.project-links { display: flex; gap: 12px; }
.project-links a {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 3px 10px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  transition: 0.2s;
}
.project-links a:hover { color: var(--primary); border-color: var(--primary); }
.project-body > p {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--card-border);
  background: rgba(13, 20, 33, 0.5);
  margin-top: 40px;
}
.footer-inner {
  padding: 48px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  text-align: center;
}
.footer-brand p { color: var(--text-dim); font-size: 0.88rem; margin-top: 8px; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
  justify-content: center;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--text-dim);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 0.75rem; color: #64748b; }
.heart { color: var(--secondary); }

/* ---------- back to top ---------- */
.back-top {
  position: fixed;
  right: 28px; bottom: 28px;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(13, 20, 33, 0.85);
  backdrop-filter: blur(8px);
  color: var(--primary);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: 0.3s;
  z-index: 90;
}
.back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-top:hover { border-color: var(--primary); box-shadow: 0 0 16px rgba(0, 217, 255, 0.3); }

/* ---------- reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
[data-delay="1"] { transition-delay: 0.12s; }
[data-delay="2"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .progress-bar { width: var(--w); }
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(10, 14, 23, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links li { border-top: 1px solid var(--card-border); }
  .nav-links a {
    display: block;
    padding: 16px 24px;
  }
  .nav-links a::after { display: none; }

  .hero-stats { gap: 28px; }
  .section { padding: 72px 0; }
  .section-head.with-filter { flex-direction: column; align-items: flex-start; }
  .timeline { padding-left: 26px; }
  .timeline-dot { left: -26px; }
}
