/* ============================================================
   Limit Stage — 个人网站样式
   纯静态站点，无需构建。修改 :root 里的颜色即可全局换肤。
   ============================================================ */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --text: #1b1a17;
  --muted: #6d6a63;
  --line: #e6e2da;
  --accent: #0f766e;
  --accent-soft: #e6f2ef;
  --accent-text: #0b5d57;
  --shadow: 0 1px 2px rgba(20, 20, 15, .04), 0 12px 32px -18px rgba(20, 20, 15, .25);
  --radius: 14px;
  --max: 960px;
  --serif: Georgia, "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg: #12141a;
  --surface: #191c23;
  --surface-2: #1f232b;
  --text: #e9e7e2;
  --muted: #9a978f;
  --line: #2b2f38;
  --accent: #5eead4;
  --accent-soft: #17322f;
  --accent-text: #7ff0dd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -24px rgba(0, 0, 0, .8);
}

* { 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(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.container {
  width: min(var(--max), calc(100% - 2.5rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand .dot { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: auto;
}

.nav-links a {
  padding: .42rem .72rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: .94rem;
  transition: background-color .18s ease, color .18s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] {
  color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: 600;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { color: var(--accent-text); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: none; }

.menu-btn { display: none; }

/* ---------------- Hero ---------------- */
.hero { padding: 4.5rem 0 3rem; }

.eyebrow {
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-text);
  font-weight: 700;
  margin: 0 0 .9rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5.2vw, 3.35rem);
  line-height: 1.18;
  letter-spacing: -.01em;
  margin: 0 0 1.1rem;
  max-width: 22em;
}

.hero .lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 46rem;
  margin: 0 0 2rem;
}

.hero .lead strong { color: var(--text); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .68rem 1.15rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform .16s ease, background-color .18s, border-color .18s, color .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #ffffff; }
:root[data-theme="dark"] .btn-primary { color: #062521; }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .9rem;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}
.social a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.social a:hover { color: var(--accent-text); }
.social svg { width: 15px; height: 15px; }

/* ---------------- Sections ---------------- */
section { padding: 2.6rem 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -.01em;
}
.section-head .more {
  margin-left: auto;
  font-size: .88rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.section-head .more:hover { color: var(--accent-text); }

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

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.card h3 {
  font-size: 1.02rem;
  margin: .1rem 0 .55rem;
  line-height: 1.5;
}
.card p { margin: 0; color: var(--muted); font-size: .93rem; }

.card .kicker {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: .55rem;
}

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

/* 列表式条目（科研 / 项目） */
.entry {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.2rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}
.entry:first-of-type { border-top: 1px solid var(--line); }
.entry .meta {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.9;
  padding-top: .15rem;
}
.entry h3 { margin: 0 0 .4rem; font-size: 1.08rem; line-height: 1.5; }
.entry p { margin: 0 0 .7rem; color: var(--muted); font-size: .94rem; }
.entry ul { margin: .5rem 0 .7rem; padding-left: 1.1rem; color: var(--muted); font-size: .93rem; }
.entry li { margin: .2rem 0; }

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-size: .76rem;
  line-height: 1.6;
  padding: .12rem .55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.plain { background: var(--surface-2); color: var(--muted); }

/* 文章列表 */
.post-list { display: grid; gap: .2rem; }
.post-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 1.15rem .9rem;
  margin-inline: -.9rem;
  border-radius: 10px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background-color .18s;
}
.post-item:hover { background: var(--surface); }
.post-item time {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  padding-top: .35rem;
}
.post-item h3 { margin: 0 0 .3rem; font-size: 1.03rem; line-height: 1.55; }
.post-item p { margin: 0 0 .5rem; color: var(--muted); font-size: .9rem; }

/* ---------------- Article ---------------- */
.article { padding: 3rem 0 4rem; }
.article .container { max-width: 720px; }

.article header { margin-bottom: 2.2rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.article h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.2vw, 2.45rem);
  line-height: 1.3;
  margin: .2rem 0 .9rem;
}
.article .post-meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }

.prose { font-size: 1.02rem; }
.prose h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 2.6rem 0 .9rem;
  line-height: 1.4;
}
.prose h3 { font-size: 1.12rem; margin: 1.9rem 0 .6rem; }
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.15rem; }
.prose li { margin: .4rem 0; }
.prose a { color: var(--accent-text); text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.6rem 0;
  padding: .3rem 0 .3rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.06rem;
}
.prose code {
  font-family: var(--mono);
  font-size: .87em;
  background: var(--surface-2);
  padding: .12em .4em;
  border-radius: 5px;
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: .86rem;
  line-height: 1.65;
  margin: 0 0 1.3rem;
}
.prose pre code { background: none; padding: 0; font-size: 1em; }
.prose img { border-radius: 10px; border: 1px solid var(--line); margin: 1.5rem 0; }
.prose hr { margin: 2.4rem 0; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}
.post-nav a { text-decoration: none; color: var(--muted); }
.post-nav a:hover { color: var(--accent-text); }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.4rem 0;
  margin-top: 3rem;
  color: var(--muted);
  font-size: .87rem;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--accent-text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ---------------- 404 ---------------- */
.center-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4rem 0;
}
.center-page .code { font-family: var(--serif); font-size: 4rem; color: var(--accent); line-height: 1; }

/* ---------------- Responsive ---------------- */
@media (max-width: 720px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .1rem;
    padding: .7rem 1rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .65rem .8rem; border-radius: 8px; }
  .theme-toggle { margin-left: .5rem; }

  .hero { padding-top: 3rem; }
  .entry { grid-template-columns: 1fr; gap: .4rem; }
  .entry .meta { padding-top: 0; }
  .post-item { grid-template-columns: 1fr; gap: .2rem; }
  .post-item time { padding-top: 0; }
  .section-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .post-nav, .actions, .social { display: none; }
  body { background: #fff; color: #000; }
}
