﻿/* ============================================================
   个人网站全局样式
   设计：简洁 / 专业 / 深蓝强调色 / 大量留白 / 卡片式布局
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --text: #1e293b;
  --text-muted: #5b6b7f;
  --accent: #1e40af;
  --accent-hover: #1e3a8a;
  --accent-soft: #eef3ff;
  --border: #e5eaf1;
  --card-bg: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .07);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .09);
  --maxw: 1080px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
main { min-height: 60vh; }
section[id] { scroll-margin-top: 84px; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.brand-dot { color: var(--accent); }
.site-nav ul { display: flex; gap: 6px; }
.nav-link {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 500;
  transition: color .2s, background-color .2s;
}
.nav-link:hover { color: var(--text); background: var(--bg-soft); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .25s; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s, transform .2s;
}
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30, 64, 175, .25); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-sm { padding: 8px 16px; font-size: .875rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero-greeting { color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.hero-name { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.hero-role { font-size: clamp(1.1rem, 2.4vw, 1.4rem); font-weight: 600; color: var(--text); margin-bottom: 12px; }
.hero-desc { max-width: 620px; color: var(--text-muted); font-size: 1.05rem; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 区块 ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-kicker { color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 700; }
.section-sub { color: var(--text-muted); margin-top: 8px; }

.page-head { padding: 72px 0 8px; }
.page-head .section-sub { margin-top: 4px; }

/* ---------- 网格与卡片 ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-cover { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-soft); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-cover img { transform: scale(1.04); }
.card-body { padding: 20px 22px 22px; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.card-desc { color: var(--text-muted); font-size: .92rem; margin-bottom: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.card-links { display: flex; gap: 16px; }
.card-link { font-size: .9rem; font-weight: 600; }
.card-link:hover { text-decoration: underline; }
.card-link.is-muted { color: var(--text-muted); }

/* ---------- 技能亮点 ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.skill-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s, box-shadow .25s;
}
.skill-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.skill-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.skill-icon svg { width: 22px; height: 22px; }
.skill-name { font-weight: 700; margin-bottom: 4px; }
.skill-desc { color: var(--text-muted); font-size: .9rem; }

/* ---------- 状态徽章 ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #dcfce7; color: #166534; font-size: .8rem; font-weight: 600; }

/* ---------- 关于页 ---------- */
.about-layout { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: start; }
.about-avatar { border-radius: var(--radius); box-shadow: var(--shadow-md); }
.info-list { display: grid; gap: 10px; }
.info-item { display: flex; gap: 10px; font-size: .95rem; }
.info-label { color: var(--text-muted); min-width: 76px; }
.info-value a { color: var(--text); }
.info-value a:hover { color: var(--accent); }

.timeline { border-left: 2px solid var(--border); padding-left: 24px; display: grid; gap: 28px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -31px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
}
.timeline-date { color: var(--accent); font-weight: 600; font-size: .85rem; }
.timeline-title { font-weight: 700; }
.timeline-desc { color: var(--text-muted); font-size: .92rem; }

.skill-group { margin-bottom: 28px; }
.skill-group h3 { font-size: 1.05rem; margin-bottom: 14px; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-tag { background: var(--bg-soft); border: 1px solid var(--border); padding: 8px 14px; border-radius: 999px; font-size: .9rem; }

/* ---------- 联系页 ---------- */
.contact-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 40px; align-items: start; }
.contact-info p { color: var(--text-muted); }
.contact-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; }
.contact-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.contact-icon svg { width: 20px; height: 20px; }
.contact-item h3 { font-size: 1rem; margin-bottom: 2px; }
.contact-item p { margin: 0; font-size: .92rem; }
.contact-item a { color: var(--text); }
.contact-item a:hover { color: var(--accent); }

.form-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, .12);
}
.form-group textarea { min-height: 140px; resize: vertical; }
.form-note { font-size: .85rem; color: var(--text-muted); margin-top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 404 ---------- */
.error-page { padding: 120px 0; text-align: center; }
.error-code { font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.error-page p { color: var(--text-muted); margin-bottom: 28px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-inner p { margin: 0; color: var(--text-muted); font-size: .9rem; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--text-muted); font-size: .9rem; }
.footer-links a:hover { color: var(--accent); }

/* ---------- 滚动渐入 ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .about-layout { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .hero { padding: 72px 0 56px; }
  .page-head { padding: 48px 0 8px; }
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: none;
    padding: 8px 16px 16px;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .nav-link { padding: 12px 14px; }
  .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); }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

/* ---------- 表单状态提示 ---------- */
.form-status { margin-top: 12px; }
.form-status.success { color: #166534; font-weight: 600; }
.form-status.error { color: #b91c1c; font-weight: 600; }