/* ==========================================================================
   RobinQu 个人主页 — 深色主题
   ========================================================================== */

:root {
  --bg: #0b0e14;
  --bg-elev: #11151f;
  --bg-card: #141926;
  --border: #232a3a;
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --text-faint: #667085;
  --accent: #38e0c8;
  --accent-2: #7aa2ff;
  --accent-glow: rgba(56, 224, 200, 0.25);
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --radius: 12px;
  --header-h: 60px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }

.container {
  width: min(1080px, 100% - 2.5rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #06251f;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

::selection { background: var(--accent-glow); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  height: var(--header-h);
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(11, 14, 20, 0.65);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav-logo svg { border-radius: 6px; }
.nav-links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.nav-links a { transition: color 0.2s ease; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-h) + 3rem) 0 4rem;
  overflow: hidden;
}
#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero::after {
  /* 底部淡出，衔接下一节 */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 25%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
}
.hero-inner {
  position: relative;
  z-index: 2;
}

/* 终端 */
.terminal {
  max-width: 620px;
  background: rgba(17, 21, 31, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(122, 162, 255, 0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.terminal-title {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}
.terminal-body {
  padding: 1.1rem 1.25rem 1.35rem;
  font-family: var(--mono);
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  min-height: 13.5em;
}
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line + .term-line { margin-top: 0.35em; }
.term-prompt { color: var(--accent); }
.term-cmd { color: var(--text); }
.term-out { color: var(--text-dim); }
.term-out strong { color: var(--accent-2); font-weight: 600; }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.terminal-fallback {
  margin-top: 1rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

/* 数据快照 */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 6vw, 4rem);
  margin-top: 2.75rem;
}
.stat dt {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.stat-num {
  font-family: var(--mono);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-num::after {
  content: "+";
  color: var(--accent);
  font-size: 0.6em;
  margin-left: 0.1em;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.6rem;
  translate: -50% 0;
  z-index: 2;
  width: 26px;
  height: 42px;
  border: 2px solid var(--text-faint);
  border-radius: 14px;
  opacity: 0.7;
}
.scroll-hint span {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel {
  0%, 100% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(12px); opacity: 0; }
}

/* ---------- Section 通用 ---------- */
.section { padding: 6rem 0 2rem; }
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.section-title .accent { color: var(--accent); font-family: var(--mono); margin-right: 0.35em; }
.section-sub { margin-top: 0.6rem; color: var(--text-dim); }

/* 滚动渐入（由 JS 加 .is-visible） */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 时间线 ---------- */
.timeline {
  position: relative;
  margin-top: 3rem;
  padding-left: 1.75rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-2), var(--accent));
  opacity: 0.5;
}
.timeline-item { position: relative; }
.timeline-item + .timeline-item { margin-top: 2.5rem; }
.timeline-marker {
  position: absolute;
  left: -1.75rem;
  top: 0.55rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.timeline-card:hover {
  border-color: rgba(56, 224, 200, 0.45);
  transform: translateY(-2px);
}
.timeline-era {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.timeline-card h3 { font-size: 1.2rem; margin-bottom: 0.55rem; }
.timeline-card p { color: var(--text-dim); font-size: 0.96rem; }
.timeline-card strong { color: var(--text); font-weight: 600; }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tag-list li {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
}

/* ---------- 项目墙 ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}
.project-card {
  perspective: 800px;
}
.project-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  transform-style: preserve-3d;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
}
.project-card:hover .project-link {
  border-color: rgba(122, 162, 255, 0.5);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}
.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.project-head h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-2);
  word-break: break-all;
}
.stars {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: #ffd76e;
  font-variant-numeric: tabular-nums;
}
.project-desc {
  margin-top: 0.8rem;
  color: var(--text-dim);
  font-size: 0.93rem;
  flex: 1;
}
.project-meta {
  display: flex;
  gap: 1.1rem;
  margin-top: 1.2rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.project-meta .lang { display: inline-flex; align-items: center; gap: 0.4rem; }
.lang-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lang-color, var(--accent));
}

.more-link { margin-top: 2.25rem; }
.more-link a {
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.more-link a:hover, .more-link a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.footer-inner {
  padding: 2.25rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.footer-links a { transition: color 0.2s ease; }
.footer-links a:hover { color: var(--accent); }
.icp { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .nav-links { gap: 1.1rem; font-size: 0.85rem; }
  .section { padding-top: 4rem; }
  .timeline { padding-left: 1.4rem; }
  .timeline-marker { left: -1.4rem; }
  .icp { margin-left: 0; width: 100%; }
  .terminal-body { min-height: 15em; }
}

/* ---------- 降级：减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .caret { animation: none; }
}
