/* ==========================================================================
   林墨作品集 · 样式表
   结构：1. 设计令牌  2. 基础重置  3. 布局容器  4. 组件  5. 区块  6. 响应式
   移动优先：默认样式为小屏，断点 640 / 768 / 1024 / 1280 逐级增强
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 渐变强调色 */
  --accent-1: #6366f1;
  --accent-2: #a855f7;
  --accent-3: #ec4899;
  --gradient: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 50%, var(--accent-3) 100%);

  /* 间距与圆角 */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --section-y: clamp(4rem, 10vw, 7.5rem);

  /* 字体 */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.28s;

  --header-h: 64px;
}

/* 深色主题（默认） */
[data-theme="dark"] {
  --bg: #08080c;
  --bg-alt: #0d0d14;
  --surface: #12121c;
  --surface-2: #171724;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceef5;
  --text-muted: #9aa2b4;
  --text-faint: #6b7280;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --glass: rgba(10, 10, 16, 0.72);
  color-scheme: dark;
}

/* 浅色主题覆盖 */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --border: rgba(15, 17, 26, 0.1);
  --border-strong: rgba(15, 17, 26, 0.18);
  --text: #12141c;
  --text-muted: #5b6478;
  --text-faint: #8a93a6;
  --shadow: 0 18px 44px rgba(20, 24, 40, 0.1);
  --glass: rgba(255, 255, 255, 0.8);
  color-scheme: light;
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* 焦点可见：键盘导航必须保留明显的焦点环 */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: var(--accent-2);
  color: #fff;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--accent-1);
  color: #fff;
  border-radius: 0 0 10px 10px;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 0; }

/* ---------- 3. 布局容器 ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

.section { padding-block: var(--section-y); }
.section-alt { background: var(--bg-alt); }

/* 锚点跳转时补偿 sticky 头部高度，避免标题被遮住 */
.section[id],
.hero[id] { scroll-margin-top: calc(var(--header-h) + 8px); }

/* 移动端抽屉打开时锁定背景滚动 */
body.menu-open { overflow: hidden; }

.section-head {
  max-width: 640px;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.section-desc { color: var(--text-muted); font-size: clamp(0.95rem, 2.4vw, 1.05rem); }

/* ---------- 4. 组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { box-shadow: 0 16px 36px rgba(168, 85, 247, 0.45); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-2); background: rgba(168, 85, 247, 0.08); }

.btn-block { width: 100%; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }

/* 头部 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    backdrop-filter var(--dur) var(--ease);
}
.site-header.is-scrolled {
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; }
.brand-text { letter-spacing: -0.01em; }
.brand-dot { color: var(--accent-3); }

.header-actions { display: flex; align-items: center; gap: 0.6rem; }

/* 导航（移动端抽屉） */
.nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 99;
  height: calc(100dvh - var(--header-h));
  padding: 1.5rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
}
.nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-list { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-link {
  display: block;
  padding: 0.9rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-active { color: var(--text); background: var(--surface-2); }

/* 汉堡按钮 */
.menu-btn {
  display: grid;
  place-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.menu-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.menu-btn[aria-expanded="true"] .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-bar:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 5. 区块 ---------- */
/* Hero */
.hero {
  position: relative;
  padding-block: clamp(3.5rem, 12vw, 7rem) clamp(3.5rem, 10vw, 6rem);
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -30%;
  left: 50%;
  width: min(900px, 120vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(168, 85, 247, 0.14) 40%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.9rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-title {
  font-size: clamp(2.1rem, 8vw, 4rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin-bottom: 1.2rem;
}
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-desc {
  max-width: 34em;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.6vw, 1.12rem);
  margin-bottom: 2rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 2.75rem; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.stat dt { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 0.25rem; }
.stat dd {
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Hero 视觉区 */
.hero-visual { position: relative; display: grid; place-items: center; }
.avatar-card {
  position: relative;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.avatar { width: min(260px, 70vw); height: auto; border-radius: 24px; }
.avatar-badge {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  font-size: 0.8rem;
  white-space: nowrap;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-3);
}
.floating-card {
  position: absolute;
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
.floating-card.card-a { top: 8%; right: 0; }
.floating-card.card-b { bottom: 12%; left: 0; animation-delay: -3s; }
.fc-label { font-size: 0.7rem; color: var(--text-faint); }
.fc-value { font-size: 0.85rem; font-weight: 600; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 关于卡片 */
.about-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
.about-card {
  position: relative;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.about-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.card-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-2);
  margin-bottom: 0.75rem;
}
.about-card h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.about-card p { color: var(--text-muted); font-size: 0.95rem; }

/* 技能 */
.skills-grid { display: grid; gap: 1.5rem; }
.skill-group {
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.group-title { font-size: 1.05rem; margin-bottom: 1.25rem; }
.skill-list { display: grid; gap: 1.15rem; }
.skill-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}
.skill-val { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.skill-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.skill-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--gradient);
  transition: width 1.1s var(--ease);
}

/* 作品集 */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}
.filter-btn {
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.filter-btn:hover { color: var(--text); border-color: var(--border-strong); }
.filter-btn.is-active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}

.work-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
.work-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.work-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.work-card.is-hidden { display: none; }
.work-thumb { position: relative; overflow: hidden; background: var(--surface-2); }
.work-thumb svg { width: 100%; height: auto; transition: transform 0.5s var(--ease); }
.work-card:hover .work-thumb svg { transform: scale(1.05); }
.work-body { padding: 1.4rem; display: grid; gap: 0.6rem; }
.work-tag {
  justify-self: start;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.14);
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 600;
}
.work-title { font-size: 1.15rem; }
.work-desc { color: var(--text-muted); font-size: 0.93rem; }
.work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.work-meta li { position: relative; }
.work-meta li + li::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 50%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  transform: translateY(-50%);
}
.work-empty { text-align: center; color: var(--text-muted); padding: 2rem 0; }

/* 联系 */
.contact-grid { display: grid; gap: 2rem; }
.contact-info { display: grid; gap: 0.75rem; align-content: start; }
.info-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
a.info-item:hover { transform: translateX(4px); border-color: var(--accent-2); }
.info-icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  font-size: 1rem;
}
.info-item span strong { display: block; font-size: 0.92rem; }
.info-item span em { font-style: normal; font-size: 0.85rem; color: var(--text-muted); }

.contact-form {
  display: grid;
  gap: 1.1rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.field { display: grid; gap: 0.45rem; }
.field label { font-size: 0.86rem; font-weight: 600; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.22);
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: #ef4444; }
.field-err { font-size: 0.8rem; color: #f87171; }
.form-note { font-size: 0.78rem; color: var(--text-faint); text-align: center; }

/* 页脚 */
.site-footer {
  padding-block: 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.footer-inner {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}
.footer-copy { font-size: 0.85rem; color: var(--text-muted); }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.footer-nav a { font-size: 0.88rem; color: var(--text-muted); transition: color var(--dur) var(--ease); }
.footer-nav a:hover { color: var(--text); }

/* 回到顶部 */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all var(--dur) var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* Toast 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 150;
  transform: translate(-50%, 20px);
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  opacity: 0;
  transition: all var(--dur) var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* 滚动入场动画 */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* ---------- 6. 响应式断点 ---------- */
@media (min-width: 640px) {
  .about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr auto; justify-items: start; text-align: left; }
}

@media (min-width: 768px) {
  .hero-inner { grid-template-columns: 1.05fr 0.95fr; align-items: center; }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: 0.9fr 1.1fr; align-items: start; }
}

@media (min-width: 1024px) {
  /* 桌面端导航回归横向，隐藏汉堡按钮 */
  .menu-btn { display: none; }
  .nav {
    position: static;
    height: auto;
    padding: 0;
    background: transparent;
    border-top: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav-list { flex-direction: row; gap: 0.25rem; }
  .nav-link { padding: 0.5rem 0.9rem; font-size: 0.92rem; }
  .nav-link.is-active { background: transparent; color: var(--text); }
  .nav-link.is-active::after {
    content: "";
    display: block;
    height: 2px;
    margin-top: 4px;
    border-radius: 2px;
    background: var(--gradient);
  }
  .about-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .skills-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .hero-title { font-size: 4.2rem; }
}

/* 尊重系统降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* 打印样式 */
@media print {
  .site-header, .to-top, .filters, .hero-glow { display: none; }
  body { background: #fff; color: #000; }
}
