/* ==========================================================================
   common.css —— 全站共享样式（导航栏 / 老虎 / 通用卡片 / 响应式）
   设计语言：深海军蓝底、星空粒子、点阵标题、金棕强调
   ========================================================================== */

:root {
  --bg: #0B1120;          /* 深海军蓝底 */
  --panel: #141d33;       /* 面板，比底色稍亮 */
  --panel-2: #1a2540;
  --line: #2a3a55;        /* 细描边 */
  --line-soft: rgba(42, 58, 85, 0.5);
  --accent: #c9a26b;      /* 金棕强调 */
  --accent-soft: rgba(201, 162, 107, 0.14);
  --text: #e9e6e0;
  --muted: #a5acbd;
  --faint: #6b7488;
  --font-dot: Consolas, "Courier New", "PingFang SC", monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --nav-h: 60px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* 点阵风格标题（等宽 + 字距，仅用于标题） */
.dot-title {
  font-family: var(--font-dot);
  letter-spacing: 2px;
  font-weight: 600;
}

/* ==========================================================================
   导航栏
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: transparent;
  transition: background .25s ease, box-shadow .25s ease, border-color .25s ease;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(11, 17, 32, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line-soft);
}

.nav-logo {
  font-family: var(--font-dot);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  cursor: pointer;
  transition: color .15s;
}
.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s;
  white-space: nowrap;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--accent); }

/* 点阵屏刷新式轻微抖动（hover，2~3 帧、幅度小、200ms 内） */
@keyframes nav-jitter {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(1px, -1px); }
  50%  { transform: translate(-1px, 0); }
  75%  { transform: translate(0, 1px); }
  100% { transform: translate(0, 0); }
}
.nav-item:hover { animation: nav-jitter .18s steps(2, end); }

.nav-caret { margin-left: 5px; font-size: 11px; transition: transform .18s; }
.nav-dropdown.open .nav-caret { transform: rotate(180deg); }

/* 下拉菜单面板 */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 180px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.nav-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(4px);
}
.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.dropdown-menu a:hover { color: var(--text); background: var(--panel-2); }

/* GitHub 图标按钮 */
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 8px;
  color: var(--muted);
  transition: color .15s;
}
.nav-icon:hover { color: var(--text); }
.nav-icon svg { width: 20px; height: 20px; fill: currentColor; }

/* 汉堡按钮（移动端） */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}

/* ==========================================================================
   老虎彩蛋
   ========================================================================== */
#tiger {
  position: fixed;
  z-index: 90;              /* 低于导航栏 100 */
  width: 72px;
  height: 72px;
  cursor: pointer;
  pointer-events: auto;     /* 只对自身生效 */
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
#tiger svg { width: 100%; height: 100%; display: block; }

.tiger-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 11px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.tiger-bubble.show { opacity: 1; }

/* 睡觉 zZ 气泡 */
.tiger-zz {
  position: absolute;
  bottom: 85%;
  right: -6px;
  font-family: var(--font-dot);
  font-size: 14px;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}
.tiger-zz.show { opacity: 1; animation: zz-float 2s ease-in-out infinite; }
@keyframes zz-float {
  0%, 100% { transform: translateY(0); opacity: .9; }
  50% { transform: translateY(-8px); opacity: .4; }
}

/* 老虎待机/跑动动画用 JS 控制，这里只定义摆动关键帧 */
@keyframes tiger-idle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-3deg); }
}
#tiger.idle svg { animation: tiger-idle 2.4s ease-in-out infinite; transform-origin: 50% 90%; }

/* ==========================================================================
   通用卡片 / 按钮 / 标签
   ========================================================================== */
.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px 24px 40px;   /* 顶部留出导航栏高度 */
}

.section-title {
  font-family: var(--font-dot);
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--text);
  margin-bottom: 8px;
}
.section-title .en { color: var(--accent); font-size: 15px; letter-spacing: 2px; display: block; margin-bottom: 4px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}
.tag.accent { color: var(--accent); border-color: rgba(201, 162, 107, 0.5); background: var(--accent-soft); }
.tag.open { color: #7fb0ea; border-color: rgba(127, 176, 234, 0.4); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 107, 0.5);
  color: var(--accent);
  transition: all .15s;
}
.btn:hover { background: var(--accent); color: #0a0e14; }

/* 占位图 */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--faint);
  font-size: 14px;
}

/* 触控热区 */
@media (pointer: coarse) {
  .nav-item, .dropdown-menu a, .btn, .nav-icon, .nav-toggle {
    min-height: 44px;
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1024px) {
  .nav-links { display: none; }   /* 平板/手机：收进汉堡 */
  .nav-toggle { display: flex; }
  .navbar { padding: 0 18px; }
}

/* 移动端下拉面板（全宽） */
.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 99;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 18px 18px;
  display: none;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 13px 8px;
  font-size: 16px;
  color: var(--text);
  border-bottom: 1px solid var(--line-soft);
}
.mobile-menu .m-acc {
  position: relative;
  color: var(--text);
}
.mobile-menu .m-sub { display: none; padding-left: 12px; }
.mobile-menu .m-sub.open { display: block; }
.mobile-menu .m-sub a { color: var(--muted); font-size: 15px; }
.mobile-menu .m-caret { float: right; transition: transform .18s; }
.mobile-menu .m-acc.open .m-caret { transform: rotate(180deg); }
