/* ═══════════════════════════════════════════════
   common.css — 全站公共样式
   ═══════════════════════════════════════════════ */

:root {
  --bg: #FAFAF8;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #F4F4F1;
  --bg-dark: #0A0A0A;
  --surface: #FFFFFF;
  --border: #E8E8E4;
  --border-strong: #D1D1CC;
  --text: #1A1A1A;
  --text-secondary: #6B6B66;
  --text-tertiary: #9B9B96;
  --accent: #1A1A1A;
  --accent-hover: #333333;
  --accent-light: rgba(26,26,26,0.06);
  --highlight: #4A6CF7;
  --highlight-soft: rgba(74,108,247,0.08);
  --success: #2E7D32;
  --error: #C0392B;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.10);
  --shadow-xl: 0 16px 64px rgba(0,0,0,0.14);

  --space-xs: 4px; --space-sm: 8px; --space-md: 16px;
  --space-lg: 24px; --space-xl: 40px; --space-2xl: 64px; --space-3xl: 96px;

  --font-sans: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.15s; --dur-base: 0.3s; --dur-slow: 0.6s;

  --nav-height: 64px;
  --max-width: 1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--nav-height);
  padding-bottom: 100px;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* 粒子背景 canvas — z-index:-1 让它位于 body 背景之上、所有内容之下 */
#bg-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* 导航栏 */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height);
  background: rgba(250,250,248,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(232,232,228,0.6);
  z-index: 1000;
  display: flex; align-items: center;
  padding: 0 var(--space-xl);
  transition: box-shadow var(--dur-base) var(--ease-smooth);
}
.navbar.scrolled { box-shadow: var(--shadow-sm); }
.nav-inner {
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-md);
}
.nav-brand {
  font-size: 0.9rem; font-weight: 800; letter-spacing: -0.3px;
  color: var(--text); padding: 6px 0; margin-right: auto;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw;
}
.nav-brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--highlight);
  animation: navPulse 2s var(--ease-smooth) infinite;
}
@keyframes navPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 14px; border-radius: var(--r-sm);
  transition: color var(--dur-fast), background var(--dur-fast);
  position: relative;
}
.nav-link:hover { color: var(--text); background: var(--accent-light); }
.nav-link.active { color: var(--text); font-weight: 700; }
.nav-link.active::after {
  content: ''; position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%); width: 4px; height: 4px;
  border-radius: 50%; background: var(--text);
}
.nav-toggle {
  display: none; width: 40px; height: 40px;
  align-items: center; justify-content: center; border-radius: var(--r-sm);
}
.nav-toggle:hover { background: var(--accent-light); }
.nav-toggle span {
  width: 18px; height: 2px; background: var(--text);
  position: relative; transition: transform var(--dur-base) var(--ease-smooth);
}
.nav-toggle span::before, .nav-toggle span::after {
  content: ''; position: absolute; left: 0; width: 18px; height: 2px;
  background: var(--text); transition: transform var(--dur-base) var(--ease-smooth);
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

/* 底部悬浮按钮 */
.footer-bar {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 100;
}
.footer-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 18px; border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 0.76rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: all var(--dur-base) var(--ease-out);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.footer-btn:hover {
  border-color: var(--accent); color: var(--text);
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}

/* 弹窗 */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center; justify-content: center;
  flex-direction: column; gap: var(--space-md);
  padding: var(--space-lg); cursor: pointer;
  opacity: 0; transition: opacity var(--dur-base) var(--ease-smooth);
}
.modal-overlay.show { display: flex; opacity: 1; }
.modal-img {
  max-width: 300px; max-height: 75vh;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  cursor: default; object-fit: contain;
}
.modal-row { display: flex; gap: var(--space-lg); align-items: center; cursor: default; }
.modal-label {
  text-align: center; font-size: 0.76rem;
  color: rgba(255,255,255,0.7); font-weight: 600; cursor: default;
}

/* 导航栏响应式 */
@media (max-width: 768px) {
  .navbar { padding: 0 var(--space-md); }
  .nav-links {
    position: fixed; top: var(--nav-height); left: 0; right: 0;
    background: var(--bg-elevated);
    flex-direction: column; padding: var(--space-md); gap: var(--space-xs);
    box-shadow: var(--shadow-md);
    transform: translateY(-100%); opacity: 0; pointer-events: none;
    transition: transform var(--dur-base) var(--ease-smooth), opacity var(--dur-base);
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-toggle { display: flex; }
}
