/* ============================================================
   wulin5050 · home
   零依赖：只有 system-ui 字体 + 手写 SVG，没有外部请求
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #08090a;
  --bg-soft: #0c0e10;
  --panel: #101214;
  --panel-2: #15181b;
  --text: #f2f3f4;
  --text-soft: #a6acb5;
  --text-dim: #747b85;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #e9b872;
  --accent-soft: rgba(233, 184, 114, 0.14);
  --contour: rgba(255, 255, 255, 0.42);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75);
  --radius: 18px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti SC", "SimSun", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --wrap: 1080px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
  --bg: #fbfaf8;
  --bg-soft: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #f7f5f1;
  --text: #141517;
  --text-soft: #4d5157;
  --text-dim: #83888f;
  --line: rgba(18, 18, 20, 0.11);
  --line-strong: rgba(18, 18, 20, 0.22);
  --accent: #a86716;
  --accent-soft: rgba(168, 103, 22, 0.12);
  --contour: rgba(24, 22, 18, 0.24);
  --shadow: 0 24px 60px -28px rgba(30, 26, 20, 0.28);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

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;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* 背景：一层极淡的暖光 + 一层网格，收在视口上部 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(720px 420px at 78% -8%, var(--accent-soft), transparent 68%),
    radial-gradient(620px 380px at 4% 2%, rgba(120, 150, 200, 0.07), transparent 70%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(760px 460px at 50% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(760px 460px at 50% 0%, #000 0%, transparent 78%);
  opacity: 0.24;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
}

p { margin: 0; }

ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

::selection {
  background: var(--accent);
  color: #14110c;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* 等高线 symbol 的容器，不占布局 */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-mark {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex: none;
}

.brand:hover .brand-mark { transform: translateY(-1px); }
.brand-mark { transition: transform 0.25s var(--ease); }

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  position: relative;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-soft);
}

.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.is-active { color: var(--text); }

.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel);
}
.icon-btn svg { width: 17px; height: 17px; }

/* 深色显示太阳、浅色显示月亮 */
html[data-theme="dark"] .i-sun,
html[data-theme="light"] .i-moon { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(64px, 11vw, 132px) clamp(56px, 9vw, 104px);
}

/* 右侧一层很淡的等高线，让首屏不至于只有左边一块内容 */
.hero-deco {
  position: absolute;
  top: -14%;
  right: -8%;
  width: min(660px, 46vw);
  height: 128%;
  color: var(--contour);
  opacity: 0.18;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side at 60% 48%, #000 22%, transparent 74%);
  mask-image: radial-gradient(closest-side at 60% 48%, #000 22%, transparent 74%);
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

@media (max-width: 980px) {
  .hero-deco { display: none; }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16);
  flex: none;
  animation: pulse 2.8s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16); }
  50% { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.06); }
}

.hero h1 {
  margin-top: 22px;
  font-size: clamp(2.3rem, 7.4vw, 4.35rem);
  letter-spacing: -0.035em;
  line-height: 1.04;
  max-width: 20ch;
}

.hero h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
  padding-right: 0.06em;
}

.lead {
  text-wrap: pretty;
  margin-top: 26px;
  max-width: 47ch;
  font-size: clamp(15.5px, 1.6vw, 17px);
  line-height: 1.85;
  color: var(--text-soft);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 19px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 0.22s var(--ease), box-shadow 0.22s ease,
    background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 8px 22px -12px rgba(0, 0, 0, 0.7);
}
.btn-primary:hover { box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.8); }

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { background: var(--panel); border-color: var(--text-dim); }

.now {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 44px;
  padding: 14px 18px 14px 16px;
  max-width: 620px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

.now-label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 3px;
}

.now p {
  text-wrap: pretty;
  font-size: 13.8px;
  line-height: 1.7;
  color: var(--text-soft);
}

.now a {
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
}
.now a:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- 区块通用 ---------- */
.section {
  padding-block: clamp(48px, 7vw, 84px);
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  padding-top: 22px;
  margin-bottom: 34px;
  border-top: 1px solid var(--line);
}

.sec-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: none;
}

.sec-head h2 {
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  letter-spacing: -0.02em;
}

.sec-note {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- 项目卡 ---------- */
.project {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  transition: border-color 0.3s ease, transform 0.4s var(--ease),
    box-shadow 0.4s ease;
}

.project:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cover {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 20% 0%, var(--panel-2), transparent 70%),
    var(--bg-soft);
}

.contours {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--contour);
  opacity: 0.75;
  transition: transform 0.9s var(--ease), opacity 0.5s ease;
}
.project:hover .contours { transform: scale(1.035); opacity: 0.95; }

.cover-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 66%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.cover-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.legend-bar {
  display: block;
  width: 82px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4a8f4e, #b8b34a 42%, #d98636 72%, #c4453c);
}

.project-body {
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 3.4vw, 34px);
}

.project-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.project-body h3 {
  margin-top: 10px;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  letter-spacing: -0.022em;
}

.project-desc {
  text-wrap: pretty;
  margin-top: 14px;
  font-size: 14.2px;
  line-height: 1.85;
  color: var(--text-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.tags li {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}

.metrics > div {
  padding: 11px 13px;
  background: var(--panel);
}

.metrics dt {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.metrics dd {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 22px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--accent);
}

.project-link svg { width: 15px; height: 15px; transition: transform 0.25s var(--ease); }
.project-link:hover svg { transform: translateX(3px); }

.link-host {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
}

/* 多个项目时自动排成两列（只有一个项目时不会生成这层容器） */
.project-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid .project { grid-template-columns: 1fr; }
  .project-grid .cover {
    min-height: 210px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

/* ---------- 关于 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(28px, 5vw, 64px);
}

.about-copy p {
  text-wrap: pretty;
  font-size: 14.6px;
  line-height: 1.95;
  color: var(--text-soft);
}

.about-copy p + p { margin-top: 18px; }

.about-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: 4px;
}

.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.skill-group .tags { margin-top: 11px; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: clamp(40px, 6vw, 72px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  padding-block: clamp(36px, 5vw, 56px) 28px;
}

.footer-title {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 20em;
}

.footer-mail {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  border-bottom: 1px solid transparent;
}
.footer-mail:hover { border-bottom-color: currentColor; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 13px;
  color: var(--text-soft);
}
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding-block: 16px 28px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* ---------- 没开 JS / 内容出错时的提示 ---------- */
.noscript-note {
  padding-block: clamp(72px, 10vw, 120px);
}

.noscript-note h2,
.render-error h2 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.noscript-note p,
.render-error p {
  font-size: 14.2px;
  line-height: 1.85;
  color: var(--text-soft);
}

.noscript-note a,
.render-error a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
}

.render-error {
  max-width: 640px;
  margin: clamp(56px, 8vw, 96px) auto;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-left: 2px solid #c4453c;
  border-radius: 4px 14px 14px 4px;
  background: var(--panel);
}

.render-error pre {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--accent);
}

.render-error code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ---------- 入场动画 ---------- */
.load-in {
  opacity: 0;
  animation: rise 0.9s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* 只有 JS 可用时才隐藏，避免脚本失效导致内容永远不出现 */
html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}

html.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .project { grid-template-columns: 1fr; }
  .cover {
    min-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .about-grid { grid-template-columns: 1fr; }
  .sec-note { margin-left: 0; width: 100%; }
  .footer-inner { align-items: flex-start; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .wrap { padding-inline: 20px; }
  .header-inner { gap: 12px; height: 58px; }
  .brand-text { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .hero h1 { max-width: 100%; }
  .lead { max-width: 100%; }
  .now { flex-direction: column; gap: 6px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .link-host { display: none; }
  .project-link { padding-top: 18px; }
}

/* ---------- 无障碍 / 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .load-in,
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .dot { animation: none; }
  .project:hover { transform: none; }
  .project:hover .contours { transform: none; }
}

@media print {
  body::before, body::after { display: none; }
  .site-header, .cta-row, .now { display: none; }
}
