/* =========================================================
   m0nesy — 单页个人主页
   原生 CSS，无依赖。色彩、间距、字号全部走 token。
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #f8f7f3;
  --bg-soft: #f2f1eb;
  --surface: #fffefb;
  --ink: #191813;
  --ink-2: #4a4740;
  --muted: #7d786c;
  --line: #e2ded2;
  --line-strong: #cfc9b9;
  --accent: #b8452c;
  --accent-soft: #f6e7e2;
  --shadow: 0 1px 2px rgba(25, 24, 19, 0.04), 0 12px 32px -22px rgba(25, 24, 19, 0.5);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --wrap: 712px;
  --gutter: clamp(20px, 5.5vw, 40px);
  --radius: 16px;
  --ease: cubic-bezier(0.22, 0.68, 0.35, 1);
}

[data-theme="dark"] {
  --bg: #111110;
  --bg-soft: #171714;
  --surface: #1a1a17;
  --ink: #ece9de;
  --ink-2: #c3bfb1;
  --muted: #8f8a7c;
  --line: #2a2925;
  --line-strong: #3b3931;
  --accent: #e07a54;
  --accent-soft: #2a1c16;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -24px rgba(0, 0, 0, 0.9);
}

/* ---------- Reset ---------- */
*,
*::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(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
em { font-style: normal; color: var(--ink); box-shadow: inset 0 -0.5em 0 var(--accent-soft); }
::selection { background: var(--accent); color: #fff; }

/* 背景：极淡的网点，暗色下几乎不可见 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0);
  background-size: 26px 26px;
  opacity: 0.5;
  pointer-events: none;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  z-index: 100;
}
.skip:focus { left: 16px; }

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

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 16px var(--gutter);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.nav.is-stuck { border-bottom-color: var(--line); }

.mark {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 26px);
  font-size: 14.5px;
  color: var(--muted);
}

.nav-links a {
  position: relative;
  transition: color 0.22s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.22s, color 0.22s;
}
.theme-btn:hover {
  transform: rotate(-18deg);
  border-color: var(--line-strong);
  color: var(--ink);
}
.theme-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
.theme-btn .ico-sun { display: none; }
[data-theme="dark"] .theme-btn .ico-sun { display: block; }
[data-theme="dark"] .theme-btn .ico-moon { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(56px, 13vh, 132px) var(--gutter) clamp(48px, 9vh, 96px);
}

.hero::after {
  content: "";
  position: absolute;
  top: -10%;
  left: 50%;
  width: min(720px, 120%);
  height: 520px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
  opacity: 0.85;
  z-index: -1;
  pointer-events: none;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .line {
  width: 40px;
  height: 1px;
  background: var(--line-strong);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(64px, 16vw, 148px);
  line-height: 0.92;
  letter-spacing: -0.045em;
  font-weight: 600;
  margin-bottom: 26px;
}
.hero h1 .glow {
  background: linear-gradient(178deg, var(--ink) 55%, var(--ink-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 30ch;
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.7;
  color: var(--ink-2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 38px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  transition: transform 0.25s var(--ease), background 0.22s, border-color 0.22s,
    color 0.22s, box-shadow 0.25s;
}
.btn:hover { transform: translateY(-2px); }
.btn.solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn.solid:hover { box-shadow: 0 12px 26px -14px var(--ink); }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Sections ---------- */
.sec {
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(44px, 8vh, 76px) var(--gutter);
  border-top: 1px solid var(--line);
}

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
}

.sec-head h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.prose {
  max-width: 58ch;
  color: var(--ink-2);
  font-size: 16.5px;
}
.prose p + p { margin-top: 1.1em; }
.prose.tight { max-width: 46ch; margin-bottom: 24px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.chips li {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), border-color 0.25s, box-shadow 0.3s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.year {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.card h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.card p {
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.card-link {
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  transition: gap 0.25s var(--ease), color 0.22s;
}
.card-link span { transition: transform 0.25s var(--ease); display: inline-block; }
.card-link:hover span { transform: translateX(4px); }
.card-link.muted { color: var(--muted); font-weight: 400; }

/* ---------- Contact links ---------- */
.links { border-top: 1px solid var(--line); }

.links li { border-bottom: 1px solid var(--line); }

.links a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 2px;
  transition: padding 0.28s var(--ease), color 0.22s;
}
.links a:hover { padding-left: 10px; color: var(--accent); }

.link-label {
  width: 68px;
  flex: none;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-value {
  flex: 1;
  font-size: 15.5px;
  letter-spacing: -0.005em;
}

.arrow {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.28s var(--ease), color 0.22s;
}
.links a:hover .arrow { transform: translate(2px, -2px); color: var(--accent); }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 30px var(--gutter) 44px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- 入场 ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: rise 0.75s var(--ease) both;
  }
  .hero > *:nth-child(1) { animation-delay: 0.02s; }
  .hero > *:nth-child(2) { animation-delay: 0.09s; }
  .hero > *:nth-child(3) { animation-delay: 0.16s; }
  .hero > *:nth-child(4) { animation-delay: 0.23s; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .nav-links { gap: 14px; font-size: 13.5px; }
  .nav-links a[href="#about"] { display: none; }
  .lede { font-size: 16.5px; }
  .card { padding: 18px 18px 20px; }
  .link-label { width: 56px; }
  .link-value { font-size: 14.5px; word-break: break-all; }
}
