/* ---------------------------------------------------------------
   作品集 · 样式表
   零依赖、零构建。浅色为默认，跟随系统自动切换深色。
   每张卡片通过 inline style 传 --h（HSL 色相）来区分项目类型。
--------------------------------------------------------------- */

:root {
  --bg: #f7f7f5;
  --bg-2: #f0f0ed;
  --panel: #ffffff;
  --panel-2: #fafaf8;
  --text: #131519;
  --text-2: #3a4048;
  --muted: #767b84;
  --faint: #9aa0a8;
  --line: #e6e6e1;
  --line-strong: #d8d8d2;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --ink: #14161a;
  --shadow-sm: 0 1px 2px rgba(19, 21, 25, .04);
  --shadow: 0 1px 2px rgba(19, 21, 25, .04), 0 10px 30px -14px rgba(19, 21, 25, .14);
  --shadow-hover: 0 2px 6px rgba(19, 21, 25, .06), 0 24px 50px -22px rgba(19, 21, 25, .26);
  --radius: 16px;
  --wrap: 1120px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e11;
    --bg-2: #121317;
    --panel: #16181d;
    --panel-2: #1b1e24;
    --text: #eceded;
    --text-2: #bcc2cb;
    --muted: #8b929c;
    --faint: #6d7480;
    --line: #24272e;
    --line-strong: #32363f;
    --accent: #82a8ff;
    --accent-soft: #16203a;
    --ink: #eceded;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-hover: 0 24px 50px -22px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  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", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 84px 0 52px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% 40% 55% -20%;
  background:
    radial-gradient(closest-side, rgba(37, 99, 235, .10), transparent 78%),
    radial-gradient(closest-side, rgba(16, 185, 129, .08), transparent 78%);
  filter: blur(6px);
  pointer-events: none;
}

.hero .wrap { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-2);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 700;
}

.lead {
  margin: 0;
  max-width: 660px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.72;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 30px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              border-color .18s var(--ease), background .18s var(--ease);
}

.btn:hover {
  border-color: var(--muted);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  border-color: var(--ink);
  opacity: .92;
}

/* 简历按钮略微强调，招聘者在页面上最容易找它 */
#linkResume {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

#linkResume:hover { background: var(--ink); color: var(--bg); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 46px;
  margin: 46px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
}

.stats div { min-width: 92px; }

.stats dt {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .06em;
}

.stats dd {
  margin: 4px 0 0;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -.012em;
  white-space: nowrap;
}

/* ---------- Section ---------- */

main { padding: 52px 0 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -.015em;
}

.section-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 18px;
  padding-bottom: 8px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              border-color .22s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.card:focus-within { border-color: var(--accent); }

/* 封面：用项目色相做渐变，不依赖截图 */
.card-cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  background:
    radial-gradient(120% 140% at 20% 0%,
      hsl(var(--h) 72% 94% / .95), hsl(var(--h) 62% 88% / .55) 62%, transparent 100%),
    var(--panel-2);
  border-bottom: 1px solid hsl(var(--h) 40% 88% / .55);
  overflow: hidden;
}

.card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(hsl(var(--h) 45% 60% / .10) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--h) 45% 60% / .10) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(120% 120% at 30% 20%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 120% at 30% 20%, #000 20%, transparent 78%);
}

.card-cover svg {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  color: hsl(var(--h) 58% 38% / .9);
  stroke-width: 1.5;
  transition: transform .3s var(--ease);
}

.card:hover .card-cover svg { transform: scale(1.08) translateY(-1px); }

.card-cover .cover-en {
  position: absolute;
  right: 14px;
  bottom: 8px;
  z-index: 1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: hsl(var(--h) 45% 40% / .42);
  white-space: nowrap;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px 18px 16px;
}

.card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 660;
  letter-spacing: -.012em;
  line-height: 1.42;
}

.card h3 a {
  color: inherit;
  text-decoration: none;
}

/* 整卡可点，同时保留标题链接的焦点语义 */
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card h3 a:focus-visible { outline: none; }

.card p.desc {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.62;
}

.card .note {
  margin: 10px 0 0;
  padding-left: 9px;
  border-left: 2px solid hsl(var(--h) 40% 72% / .55);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.58;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}

.tag {
  padding: 2px 9px;
  border: 1px solid hsl(var(--h) 40% 86% / .75);
  border-radius: 999px;
  background: hsl(var(--h) 60% 97% / .7);
  font-size: 11.5px;
  color: hsl(var(--h) 40% 34% / .95);
  white-space: nowrap;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.state.live { color: #15803d; }
.state.live::before { background: #16a34a; opacity: 1; }
.state.code { color: #a16207; }
.state.code::before { background: #ca8a04; opacity: 1; }

.go {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: gap .18s var(--ease);
}

.go:hover { gap: 7px; }

/* ---------- 重点卡片：前两个项目占两列 ---------- */

@media (min-width: 720px) {
  .card--feat { grid-column: span 2; }
  .card--feat .card-cover { height: 132px; }
  .card--feat .card-cover svg { width: 44px; height: 44px; }
  .card--feat h3 { font-size: 19px; letter-spacing: -.02em; }
  .card--feat p.desc { font-size: 14.5px; max-width: 56ch; }
}

/* ---------- Footer ---------- */

footer {
  margin-top: 64px;
  padding: 26px 0 56px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

footer p { margin: 0; max-width: 680px; line-height: 1.7; }

.noscript {
  padding: 24px 0;
  color: var(--muted);
}

/* ---------- 深色模式微调 ---------- */

@media (prefers-color-scheme: dark) {
  .hero::before {
    background:
      radial-gradient(closest-side, rgba(59, 130, 246, .16), transparent 78%),
      radial-gradient(closest-side, rgba(16, 185, 129, .10), transparent 78%);
  }

  .card-cover {
    background:
      radial-gradient(120% 140% at 20% 0%,
        hsl(var(--h) 42% 26% / .85), hsl(var(--h) 38% 20% / .45) 62%, transparent 100%),
      var(--panel-2);
    border-bottom-color: hsl(var(--h) 30% 30% / .7);
  }

  .card-cover svg { color: hsl(var(--h) 68% 72% / .92); }
  .card-cover .cover-en { color: hsl(var(--h) 50% 78% / .40); }

  .tag {
    border-color: hsl(var(--h) 30% 32% / .9);
    background: hsl(var(--h) 34% 18% / .8);
    color: hsl(var(--h) 55% 78% / .95);
  }

  .card .note { border-left-color: hsl(var(--h) 35% 45% / .6); }

  .state.live { color: #4ade80; }
  .state.code { color: #facc15; }

  #linkResume { border-color: var(--line-strong); color: var(--text); }
  #linkResume:hover { background: var(--panel-2); color: var(--text); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 719px) {
  .card--feat { grid-column: span 1; }
  .card--feat .card-cover { height: 110px; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { padding: 56px 0 36px; }
  .wrap { padding: 0 18px; }
  .stats { gap: 26px; margin-top: 34px; }
  .lead { font-size: 15px; }
  .card-cover { height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover, .btn:hover { transform: none; }
}
