/* ==========================================================================
   Wang Jian's Website - 全局样式
   使用 CSS 变量定义主题，data-theme="dark" 时切换到深色。
   ========================================================================== */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #16181d;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-2: #0ea5e9;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius: 16px;
  --max-width: 1080px;
}

[data-theme='dark'] {
  --bg: #0d0f14;
  --surface: #151821;
  --surface-2: #1b1f2a;
  --text: #eceff5;
  --muted: #98a1b3;
  --border: #262b38;
  --accent: #8b8bff;
  --accent-2: #38bdf8;
  --accent-soft: rgba(139, 139, 255, 0.14);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------ 顶栏 / 导航 ------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg); /* 不支持 color-mix 的浏览器降级方案 */
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

/* -------------------------------- 布局块 -------------------------------- */

main {
  min-height: 60vh;
}

.section {
  padding: 72px 0;
}

.section-head {
  margin-bottom: 32px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.4px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* --------------------------------- Hero --------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 88px 0 72px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.15;
  letter-spacing: -1px;
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  margin: 0 0 28px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.btn-ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.hero-card {
  display: grid;
  place-items: center;
}

.avatar-ring {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 5px;
  box-shadow: var(--shadow);
}

.avatar-ring img,
.avatar-ring .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 68px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}

/* --------------------------------- 卡片 --------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 20px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
}

.card-link {
  display: inline-block;
  margin-top: 18px;
  font-size: 14.5px;
  font-weight: 600;
}

/* --------------------------------- 内容页 -------------------------------- */

.page-header {
  padding: 64px 0 8px;
}

.page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.6px;
}

.page-header p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

.prose p {
  margin: 0 0 16px;
  color: var(--text);
}

.prose h3 {
  margin: 28px 0 12px;
  font-size: 19px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

/* 时间线 */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--border);
}

.timeline li {
  position: relative;
  padding-bottom: 26px;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
}

.timeline .when {
  display: block;
  color: var(--muted);
  font-size: 13.5px;
}

.timeline strong {
  display: block;
  margin-top: 2px;
}

.timeline span.desc {
  color: var(--muted);
  font-size: 14.5px;
}

/* 技能条 */

.skill + .skill {
  margin-top: 18px;
}

.skill-row {
  display: flex;
  justify-content: space-between;
  font-size: 14.5px;
}

.bar {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* --------------------------------- 联系页 -------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.info-list li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.info-list .label {
  min-width: 68px;
  color: var(--muted);
}

form .field {
  margin-bottom: 18px;
}

form label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.form-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

/* --------------------------------- 页脚 --------------------------------- */

.site-footer {
  margin-top: 40px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  gap: 16px;
}

/* 备案信息（单独一行，字号略小） */
.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 12px;
  font-size: 13px;
}

.footer-beian a {
  color: var(--muted);
}

.footer-beian a:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-beian .sep {
  color: var(--border);
}

/* ------------------------------ 入场动画 ------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* -------------------------------- 响应式 -------------------------------- */

@media (max-width: 860px) {
  .hero,
  .two-col,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 56px 0 48px;
    gap: 36px;
  }

  .hero-card {
    order: -1;
  }

  .avatar-ring {
    width: 180px;
    height: 180px;
  }

  .avatar-fallback {
    font-size: 52px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 24px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav .icon-btn {
    align-self: flex-start;
    margin: 8px 0 0;
  }

  .section {
    padding: 52px 0;
  }
}
