/* ---------- 1. CSS 变量：全站统一的设计令牌 ---------- */
:root {
  /* 背景层次（由深到浅） */
  --bg: #0d1017;              /* 页面最底层背景 */
  --bg-card: #161a23;         /* 卡片背景 */
  --bg-elevated: #1d222e;     /* 悬浮/输入框等更亮一层 */
  --border: #272d3b;          /* 边框颜色 */

  /* 文字颜色 */
  --text: #e8ebf1;            /* 主文字 */
  --text-secondary: #98a2b3;  /* 次要文字（摘要、说明） */
  --text-muted: #6b7486;      /* 弱化文字（日期、页脚） */

  /* 品牌主色（紫蓝渐变） */
  --accent: #6c8cff;
  --accent-gradient: linear-gradient(135deg, #6c8cff 0%, #a06cff 100%);

  /* 其它 */
  --success: #4ade80;         /* 在线状态 / 成功提示 */
  --radius: 14px;             /* 卡片圆角 */
  --radius-sm: 8px;           /* 按钮小圆角 */
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);          /* 常规阴影 */
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.5);    /* 悬停加深阴影 */
  --header-h: 68px;           /* 导航栏高度，供锚点偏移使用 */
  --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1); /* 全站统一过渡曲线 */

  /* 主题相关背景（写死色值提取为变量，方便浅色模式覆盖） */
  --header-bg: rgba(13, 16, 23, 0.82);        /* 导航栏毛玻璃背景 */
  --header-bg-solid: rgba(13, 16, 23, 0.97);  /* 手机端展开菜单背景 */
  --footer-bg: #0a0d13;                       /* 页脚背景 */
  --hover-bg: rgba(255, 255, 255, 0.05);      /* 导航链接悬停底色 */
}

/* ---------- 1.2 浅色主题：html.light 时覆盖变量（柔和米白配深灰） ---------- */
html.light {
  --bg: #f6f4ef;              /* 柔和护眼米白 */
  --bg-card: #ffffff;         /* 卡片纯白 */
  --bg-elevated: #efede7;     /* 悬浮/输入框更灰一层 */
  --border: #e3dfd4;          /* 米色系边框 */
  --text: #2a2e35;            /* 深灰主文字 */
  --text-secondary: #5a6270;  /* 次要文字 */
  --text-muted: #8b93a0;      /* 弱化文字 */
  --accent: #4a6cf0;          /* 浅色下加深主色，保证对比度 */
  --accent-gradient: linear-gradient(135deg, #4a6cf0 0%, #8a5cf0 100%);
  --danger: #e5484d;
  --success: #189a54;
  --shadow: 0 4px 20px rgba(30, 35, 45, 0.08);
  --shadow-hover: 0 14px 34px rgba(30, 35, 45, 0.16);
  --header-bg: rgba(246, 244, 239, 0.85);
  --header-bg-solid: rgba(246, 244, 239, 0.97);
  --footer-bg: #edeae2;
  --hover-bg: rgba(0, 0, 0, 0.05);
}

/* ---------- 2. 基础重置与排版 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;     /* 让内边距计入宽度，方便布局 */
}

html {
  scroll-behavior: smooth;    /* 锚点跳转平滑滚动 */
}

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased; /* 字体渲染更细腻 */
}

a {
  color: inherit;
  text-decoration: none;      /* 链接默认去下划线，交互态再补 */
}

img {
  max-width: 100%;
  display: block;
}

ul { list-style: none; }

/* 统一容器：全站内容最大 1200px 居中 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 通用内页标题区（联系页顶部横幅） */
.page-head {
  padding: 96px 0 40px;
  text-align: center;
}

.page-head h1 {
  font-size: clamp(2rem, 4vw, 2.75rem); /* 流式字号，自适应缩放 */
  letter-spacing: -0.02em;
}

.page-head p {
  color: var(--text-secondary);
  margin-top: 12px;
}

.section-title {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

/* 主色渐变文字工具类（用于强调词） */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================================
   3. 顶部导航栏（所有页面共用同一套结构）
   ============================================================ */
.site-header {
  position: sticky;           /* 吸顶导航 */
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);           /* 半透明毛玻璃 */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

/* 页面滚动后由 JS 添加 .scrolled，显示底部分隔线 */
.site-header.scrolled {
  border-bottom-color: var(--border);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo：渐变圆点 + 名字 */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.nav-logo .logo-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;           /* 圆形头像缩略图 */
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(108, 140, 255, 0.35); /* 细光环点缀 */
}

/* 桌面端导航链接 */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  position: relative;
  padding: 8px 14px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--hover-bg);
}

/* 激活态：高亮文字 + 底部渐变下划线 */
.nav-link.active {
  color: var(--text);
  font-weight: 600;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
}

/* 汉堡按钮：默认隐藏，≤768px 显示 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: var(--transition);
}

/* 汉堡展开为 X 的动画（JS 切换 .open） */
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 右侧功能区：导航链接 + 主题切换按钮 + 汉堡按钮 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 深浅色模式切换按钮 */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theme-toggle:active {
  transform: translateY(0);
}

/* ============================================================
   5. 首页 (index.html) 专属
   ============================================================ */

/* 顶部简介：左头像 + 右文字 */
.about-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 44px;
  align-items: center;
  padding: 88px 0 56px;
}

.avatar {
  width: 168px;
  height: 168px;
  border-radius: 50%;               /* 圆形大头像 */
  object-fit: cover;                /* 图片填满圆形，不变形 */
  box-shadow: 0 0 0 6px rgba(108, 140, 255, 0.15); /* 外圈光环 */
}

.about-hero h1 { font-size: 2.1rem; letter-spacing: -0.02em; }

.about-hero .location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 16px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.about-hero .bio {
  color: var(--text-secondary);
  max-width: 640px;
}

/* 职业历程时间轴（垂直） */
.timeline {
  position: relative;
  padding: 8px 0 8px 34px;      /* 左侧留出竖线空间 */
}

/* 竖向主线 */
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(108, 140, 255, 0.05));
}

.tl-item {
  position: relative;
  padding: 0 0 34px 22px;
}

/* 每个节点的小圆点：中心对准竖线（竖线 left:8px，圆点宽 12px → left:2px） */
.tl-item::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 140, 255, 0.18);
}

.tl-item .period {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tl-item h3 {
  font-size: 1.1rem;
  margin: 4px 0 2px;
}

.tl-item .role {
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.tl-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* 技能进度条 */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 44px;
}

.skill .skill-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.94rem;
  margin-bottom: 8px;
}

.skill .skill-head b { font-weight: 600; }
.skill .skill-head span { color: var(--text-muted); }

/* 进度条轨道 */
.skill .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

/* 进度条填充：宽度由内联 style 提供，JS 进页面时做生长动画 */
.skill .bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  width: 0;
  transition: width 1.1s cubic-bezier(0.25, 1, 0.4, 1);
}

/* 他人评价：引号设计 */
.testimonials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.testimonial {
  position: relative;
  padding: 30px 28px 26px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.testimonial:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

/* 大引号装饰 */
.testimonial::before {
  content: "\201C";
  position: absolute;
  top: 6px;
  left: 18px;
  font-size: 3.6rem;
  font-family: Georgia, serif;
  line-height: 1;
  color: var(--accent);
  opacity: 0.45;
}

.testimonial p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 18px 0 18px;
}

.testimonial .who {
  font-size: 0.88rem;
}

.testimonial .who b { display: block; }
.testimonial .who span { color: var(--text-muted); font-size: 0.8rem; }

/* ============================================================
   7. 联系 (contact.html) 专属
   ============================================================ */

/* 联系方式卡片：单卡片居中展示 */
.contact-layout {
  max-width: 560px;           /* 限制卡片宽度，视觉更聚焦 */
  margin: 0 auto;
  padding: 40px 0 88px;
}

/* 联系方式卡片 */
.contact-card {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contact-card h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

/* 在线状态 */
.online-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  margin-bottom: 22px;
}

.online-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite; /* 呼吸点动画 */
}

/* 呼吸点动画（在线状态使用） */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* 联系条目（邮箱等） */
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.contact-item:last-of-type { border-bottom: none; }

.contact-item .icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.05rem;
  background: var(--bg-elevated);
}

/* 图标图片：在 38×38 容器内居中自适应 */
.contact-item .icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.contact-item a:hover { color: var(--accent); }

/* ============================================================
   6. 底部页脚（所有页面共用同一套结构）
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg); /* 比页面更深一层（浅色模式下为米灰） */
  padding: 56px 0 28px;
  margin-top: auto;           /* 配合 body flex，保证内容少时页脚贴底 */
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.footer-grid h4 {
  font-size: 0.98rem;
  margin-bottom: 16px;
}

.footer-grid p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 320px;
}

.footer-links li { margin-bottom: 10px; }

.footer-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.footer-links a:hover { color: var(--accent); }

/* 页脚底部版权行 */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 26px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   7. 滚动淡入动画（JS 添加 .in-view 触发）
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* 尊重用户"减少动态效果"的系统偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   8. 响应式适配
   ============================================================ */

/* —— 平板端 ≤1024px —— */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* —— 手机端 ≤768px —— */
@media (max-width: 768px) {
  /* 导航：隐藏链接列表，显示汉堡按钮 */
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px 24px 24px;
    background: var(--header-bg-solid);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    /* 默认收起：位移 + 透明，配合 .open 展开 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-link { padding: 14px 16px; }
  .nav-link.active::after { left: 14px; width: 32px; right: auto; }

  /* 各页面布局降级为单列 */
  .about-hero      { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .about-hero .bio { margin: 0 auto; }
  .skills-grid     { grid-template-columns: 1fr; }
  .testimonials    { grid-template-columns: 1fr; }
  .footer-grid     { grid-template-columns: 1fr; gap: 28px; }
  .page-head       { padding-top: 64px; }
}

/* ============================================================
   9. Minecraft 页面 (minecraft.html) 专属
   ============================================================ */

/* 结果卡片容器 */
.mc-card {
  max-width: 640px;
  margin: 0 auto 16px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 120px;
}

/* 加载中提示 */
.mc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  color: var(--text-secondary);
}

/* hidden 属性优先：display:flex 会覆盖默认的 display:none，需显式声明 */
.mc-loading[hidden] { display: none; }

/* 旋转加载圈 */
.mc-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mc-spin 0.8s linear infinite;
}

@keyframes mc-spin {
  to { transform: rotate(360deg); }
}

/* 错误提示 */
.mc-error {
  padding: 20px;
  text-align: center;
  color: var(--danger, #ff6b7a);
  background: rgba(255, 107, 122, 0.08);
  border: 1px solid rgba(255, 107, 122, 0.25);
  border-radius: var(--radius-sm);
}

/* 结果展示区 */
.mc-info { animation: mc-fade 0.4s ease; }

@keyframes mc-fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 头部：图标 + 主机名 + 在线状态 */
.mc-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.mc-favicon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;        /* 像素图标清晰显示 */
  border-radius: 8px;
  background: var(--bg-elevated);
}

.mc-host {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.mc-online {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 3px 10px;
  border-radius: 999px;
}

/* MOTD：保留 MC 原生颜色样式 */
.mc-motd {
  padding: 16px;
  margin-bottom: 20px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 详细数据列表 */
.mc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.mc-stats li {
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.mc-stats span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.mc-stats b {
  font-size: 1rem;
  font-weight: 600;
}

/* 独立跳转按钮：居中显示，位于卡片下方 */
.mc-action {
  max-width: 640px;
  margin: 0 auto 88px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* 加入QQ群区域 */
.mc-qq-group {
  max-width: 640px;
  margin: 16px auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.mc-qq-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mc-qq-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.mc-qq-info h3 {
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.mc-qq-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.mc-qq-btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #1ea1f1 0%, #4a9eff 100%);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}

.mc-qq-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 161, 241, 0.4);
}

.mc-join-btn {
  display: inline-block;
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(108, 140, 255, 0.35);
  transition: var(--transition);
}

.mc-join-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(108, 140, 255, 0.5);
}

/* 幽灵按钮样式：描边透明底，与主按钮区分 */
.mc-ghost-btn {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: none;
}

.mc-ghost-btn:hover {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
  box-shadow: none;
}

/* 下拉菜单容器 */
.mc-dropdown {
  position: relative;
  display: inline-block;
}

.mc-dropdown-toggle {
  cursor: pointer;
  white-space: nowrap;
}

/* 下拉菜单：默认隐藏 */
.mc-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 10;
}

/* 展开状态 */
.mc-dropdown.open .mc-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mc-dropdown-menu li {
  list-style: none;
}

.mc-dropdown-menu a {
  display: block;
  padding: 12px 20px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
}

.mc-dropdown-menu a:hover {
  color: var(--text);
  background: var(--hover-bg);
}

/* —— 手机端：数据列表降为单列 —— */
@media (max-width: 768px) {
  .mc-stats { grid-template-columns: 1fr; }
}
