/* ============ 主题变量 ============ */
:root,
[data-theme="light"] {
  --bg: #fafaf7;
  --bg-soft: #f2f1ea;
  --ink: #17150f;
  --muted: #6f6a5c;
  --line: #e4e1d5;
  --accent: #b34a1e;
  --accent-soft: rgba(179, 74, 30, 0.08);
  --card-shadow: 0 1px 2px rgba(23, 21, 15, 0.04), 0 8px 24px rgba(23, 21, 15, 0.06);
  --nav-bg: rgba(250, 250, 247, 0.82);
}

[data-theme="dark"] {
  --bg: #12110e;
  --bg-soft: #1a1915;
  --ink: #f0ede3;
  --muted: #a29a86;
  --line: #2b2820;
  --accent: #e0703a;
  --accent-soft: rgba(224, 112, 58, 0.1);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  --nav-bg: rgba(18, 17, 14, 0.78);
}

/* ============ 基础 ============ */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: 0.01em; }
p { margin: 0 0 1em; }
a { color: inherit; }

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

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

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  z-index: 100;
  transition: top 0.2s ease;
}
.skip:focus { top: 1rem; }

/* ============ 导航 ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 4.25rem;
}

.brand {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

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

.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-soft); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(12deg); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.is-dark .icon-moon { display: block; }
.theme-toggle.is-dark .icon-sun { display: none; }

.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.menu-btn span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ 首屏 ============ */
.hero {
  padding-block: clamp(4.5rem, 11vw, 8.5rem) clamp(3.5rem, 8vw, 6rem);
}

.kicker {
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: clamp(3.5rem, 11vw, 7rem);
  letter-spacing: 0.01em;
  margin-bottom: 1.25rem;
}

.tagline {
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}
.tagline em { font-style: normal; color: var(--accent); }

.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2.25rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-large { font-size: 1.1rem; padding: 1rem 2.5rem; }

/* ============ 章节 ============ */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
section { scroll-margin-top: 5.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-index {
  font-family: Georgia, serif;
  font-size: 0.95rem;
  color: var(--accent);
  font-style: italic;
}
.section-head h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.section-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
  align-self: center;
}
.section-intro { color: var(--muted); max-width: 40rem; margin-bottom: 2.5rem; }

/* ============ 关于 ============ */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.about-text p:last-child { margin-bottom: 0; }
.hint {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}

.facts {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  overflow: hidden;
}
.facts li {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.4rem;
  font-size: 0.98rem;
  border-bottom: 1px solid var(--line);
}
.facts li:last-child { border-bottom: none; }
.facts span {
  flex: 0 0 3.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
}

/* ============ 作品卡片 ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.75rem;
  background: var(--bg);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: var(--card-shadow);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}
.card-index { font-family: Georgia, serif; font-style: italic; color: var(--accent); font-size: 0.95rem; }
.card-year { font-size: 0.85rem; color: var(--muted); }
.card h3 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.card p { color: var(--muted); font-size: 0.98rem; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.25rem; }
.tags span {
  font-size: 0.8rem;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.card-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  align-self: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.card-link:hover { color: var(--accent); border-color: var(--accent); }
.card-link span { display: inline-block; transition: transform 0.2s ease; }
.card-link:hover span { transform: translateX(4px); }

/* ============ 联系 ============ */
.contact-lede {
  color: var(--muted);
  max-width: 36rem;
  margin-bottom: 2rem;
  font-size: 1.08rem;
}
.socials {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2.25rem;
  font-size: 0.98rem;
}
.socials a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.socials .dot { color: var(--line); }

/* ============ 页脚 ============ */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  align-items: center;
}
.footer p { margin: 0; font-size: 0.9rem; color: var(--muted); }

/* ============ 入场动画 ============ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .menu-btn { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 4.25rem;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0.75rem 1.25rem 1.25rem;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.85rem 0.5rem; font-size: 1.05rem; border-radius: 12px; }
  .nav-inner { position: relative; }
  .about-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .card, .theme-toggle { transition: none; }
}
