/* =========================================================
   刘成 · 个人网站
   风格：温柔插画感（暖纸色 / 手绘涂鸦 / 圆润造型）
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- 变量 ---------- */
:root {
  --paper: #fbf6eb;
  --paper-2: #f6efe0;
  --card: #fffdf7;
  --ink: #3a352d;
  --ink-soft: #6f6759;
  --ink-faint: #9c9384;
  --line: #e6dcc6;

  --sage: #8ca47e;
  --sage-deep: #6e8a5e;
  --terra: #c97b5a;
  --mustard: #d9a441;
  --rose: #d9a5a0;
  --lilac: #b3a6c9;

  --serif: "Songti SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --radius: 22px;
  --shadow-soft: 0 10px 30px rgba(90, 76, 55, 0.10), 0 2px 8px rgba(90, 76, 55, 0.06);
  --shadow-lift: 0 18px 44px rgba(90, 76, 55, 0.16), 0 4px 12px rgba(90, 76, 55, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 基础 ---------- */
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  font-size: 16px;
  position: relative;
  overflow-x: hidden;
}

/* 纸张颗粒 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.30;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }

::selection { background: rgba(217, 164, 65, 0.35); }

/* ---------- 通用文字 ---------- */
.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.14em;
  color: var(--terra);
  font-size: 0.92rem;
  margin-bottom: 10px;
}
.h-serif { font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em; line-height: 1.3; }
.muted { color: var(--ink-soft); }

/* 手绘波浪下划线 */
.squiggle {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.squiggle::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.18em;
  height: 0.42em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 12 Q 25 4 47 11 T 95 11 T 145 11 T 197 10' fill='none' stroke='%23c97b5a' stroke-width='5' stroke-linecap='round' opacity='0.75'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

/* 涂鸦圈选 */
.circle-mark {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.circle-mark::before {
  content: "";
  position: absolute;
  inset: -0.32em -0.42em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 90' preserveAspectRatio='none'%3E%3Cpath d='M100 6 C 160 2 196 22 194 45 C 192 72 152 86 98 84 C 44 82 6 68 7 44 C 8 20 48 5 108 7' fill='none' stroke='%238ca47e' stroke-width='4.5' stroke-linecap='round' opacity='0.7'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

/* =========================================================
   导航
   ========================================================= */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(251, 246, 235, 0.82);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid rgba(230, 220, 198, 0.7);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.logo svg { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.98rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: rgba(140, 164, 126, 0.16); }
.nav-links a.active { color: var(--ink); background: rgba(201, 123, 90, 0.14); }
.nav-toggle { display: none; width: 42px; height: 42px; border-radius: 12px; position: relative; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; left: 10px; right: 10px; height: 2px;
  background: var(--ink); border-radius: 2px; transition: 0.3s var(--ease);
}
.nav-toggle span { top: 50%; }
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle span::after { top: 0; transform: rotate(-45deg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding: 150px 0 90px;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  line-height: 1.22;
  letter-spacing: 0.01em;
}
.hero .lede {
  margin-top: 22px;
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 34em;
}
.hero-cta { margin-top: 34px; display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 1rem;
  border: 1.6px solid var(--ink);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), background 0.28s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-soft); }
.btn-primary:hover { transform: translateY(-3px) rotate(-0.6deg); box-shadow: var(--shadow-lift); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(140, 164, 126, 0.18); transform: translateY(-3px); }

.hero-art {
  position: relative;
  padding: 10px;
}
.hero-art .frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(58, 53, 45, 0.14);
  box-shadow: var(--shadow-lift);
  background: var(--card);
}
.hero-art img { width: 100%; aspect-ratio: 1536 / 921; object-fit: cover; }
.hero-art img { transform: scale(1.02); }

/* 漂浮涂鸦 */
.doodle {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}
.doodle svg { display: block; width: 100%; height: 100%; overflow: visible; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-12px) rotate(calc(var(--rot, 0deg) + 3deg)); }
}
.doodle { animation: floaty 6s ease-in-out infinite; animation-delay: var(--delay, 0s); }

/* =========================================================
   区块
   ========================================================= */
.section { padding: 84px 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 44px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
}
.section-head .more { text-decoration: none; color: var(--terra); white-space: nowrap; font-size: 0.98rem; }
.section-head .more:hover { text-decoration: underline wavy var(--terra) 1.5px; text-underline-offset: 5px; }
.section-alt { background: var(--paper-2); border-block: 1px solid var(--line); }

/* =========================================================
   作品卡片
   ========================================================= */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 30px;
}
.work-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid rgba(58, 53, 45, 0.10);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  display: block;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.work-card:hover { transform: translateY(-7px) rotate(-0.4deg); box-shadow: var(--shadow-lift); }
.work-cover { position: relative; overflow: hidden; }
.work-cover svg { display: block; width: 100%; height: auto; }
.work-cover svg .cover-art { transition: transform 0.6s var(--ease); transform-origin: center; }
.work-card:hover .cover-art { transform: scale(1.06) rotate(1deg); }
.work-body { padding: 20px 22px 24px; }
.work-body h3 { font-size: 1.14rem; font-family: var(--serif); }
.work-body p { color: var(--ink-soft); font-size: 0.94rem; margin-top: 6px; line-height: 1.65; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tag {
  font-size: 0.78rem;
  color: var(--sage-deep);
  background: rgba(140, 164, 126, 0.15);
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid rgba(110, 138, 94, 0.22);
}
.work-year { font-family: var(--serif); font-style: italic; color: var(--ink-faint); font-size: 0.86rem; }

/* =========================================================
   博客
   ========================================================= */
.post-list { display: grid; gap: 16px; max-width: 780px; }
.post-item {
  display: flex;
  gap: 22px;
  align-items: baseline;
  padding: 20px 24px;
  background: var(--card);
  border: 1.5px solid rgba(58, 53, 45, 0.09);
  border-radius: 18px;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.post-item:hover { transform: translateX(6px); border-color: rgba(201, 123, 90, 0.45); box-shadow: var(--shadow-soft); }
.post-date {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.88rem;
  white-space: nowrap;
  min-width: 92px;
}
.post-item h3 { font-size: 1.08rem; font-weight: 600; font-family: var(--serif); }
.post-item p { color: var(--ink-soft); font-size: 0.92rem; margin-top: 4px; line-height: 1.6; }

/* =========================================================
   文章页
   ========================================================= */
.article-wrap { max-width: 720px; margin-inline: auto; }
.article-meta { display: flex; gap: 14px; align-items: center; color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 28px; flex-wrap: wrap; }
.prose { font-size: 1.03rem; line-height: 1.95; color: #464037; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-family: var(--serif); font-size: 1.55rem; margin-top: 2.2em; }
.prose h3 { font-family: var(--serif); font-size: 1.25rem; margin-top: 2em; }
.prose h2::before { content: "✦ "; color: var(--mustard); }
.prose h3::before { content: "· "; color: var(--sage); }
.prose a { color: var(--terra); text-decoration: underline wavy rgba(201,123,90,.5) 1.5px; text-underline-offset: 4px; }
.prose blockquote {
  border-left: 3px solid var(--sage);
  background: rgba(140, 164, 126, 0.10);
  padding: 14px 20px;
  border-radius: 0 14px 14px 0;
  color: var(--ink-soft);
}
.prose code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.88em;
  background: rgba(217, 164, 65, 0.16);
  padding: 2px 7px;
  border-radius: 6px;
}
.prose pre {
  background: #332f28;
  color: #f3ede0;
  padding: 20px 22px;
  border-radius: 16px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.7;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose img { border-radius: 16px; margin-block: 1.4em; }
.prose hr { border: none; border-top: 2px dashed var(--line); margin: 2.4em 0; }
.prose ul { list-style: none; }
.prose ul li { padding-left: 1.4em; position: relative; }
.prose ul li::before { content: "❋"; position: absolute; left: 0; color: var(--sage); font-size: 0.8em; top: 0.35em; }
.prose ol { list-style: decimal; padding-left: 1.6em; }
.back-home { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-soft); margin-bottom: 34px; font-size: 0.95rem; }
.back-home:hover { color: var(--terra); }

/* =========================================================
   关于页
   ========================================================= */
.about-grid { display: grid; grid-template-columns: 0.85fr 1fr; gap: 56px; align-items: center; }
.about-art .frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(58, 53, 45, 0.14);
  box-shadow: var(--shadow-lift);
  transform: rotate(-1.4deg);
}
.about-art img { width: 100%; aspect-ratio: 1024/921; object-fit: cover; }
.timeline { margin-top: 34px; display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 86px 1fr; gap: 20px; padding: 16px 0; position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 86px; top: 0; bottom: 0;
  width: 2px;
  background-image: linear-gradient(to bottom, var(--line) 55%, transparent 45%);
  background-size: 2px 12px;
}
.tl-item:last-child::before { bottom: auto; height: 30px; }
.tl-year { font-family: var(--serif); font-style: italic; color: var(--terra); }
.tl-item h4 { font-size: 1.02rem; }
.tl-item p { color: var(--ink-soft); font-size: 0.92rem; }
.tl-dot { position: absolute; left: 81px; top: 24px; width: 12px; height: 12px; border-radius: 50%; background: var(--mustard); border: 2px solid var(--paper); }

/* =========================================================
   页脚
   ========================================================= */
.footer {
  margin-top: 60px;
  background: #3a352d;
  color: #efe7d6;
  padding: 84px 0 40px;
  position: relative;
  overflow: hidden;
}
.footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0; height: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 26' preserveAspectRatio='none'%3E%3Cpath d='M0 26 L0 14 Q 30 2 60 14 T 120 14 T 180 14 T 240 14 T 300 14 T 360 14 T 420 14 T 480 14 T 540 14 T 600 14 T 660 14 T 720 14 T 780 14 T 840 14 T 900 14 T 960 14 T 1020 14 T 1080 14 T 1140 14 T 1200 14 L1200 26 Z' fill='%23fbf6eb'/%3E%3C/svg%3E") repeat-x bottom / 1200px 26px;
}
.footer h2 { font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.3; }
.footer a.big-mail {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3vw, 2rem);
  color: var(--mustard);
  text-decoration: none;
  display: inline-block;
  margin-top: 14px;
}
.footer a.big-mail:hover { text-decoration: underline wavy rgba(217,164,65,.5) 2px; text-underline-offset: 8px; }
.footer-cols {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1px solid rgba(239, 231, 214, 0.18);
  color: rgba(239, 231, 214, 0.62);
  font-size: 0.9rem;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: rgba(239, 231, 214, 0.8); text-decoration: none; }
.footer-links a:hover { color: var(--mustard); }

/* =========================================================
   动效
   ========================================================= */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .doodle { animation: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 900px) {
  .hero { padding: 120px 0 70px; }
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-art { order: -1; max-width: 380px; }
  .section { padding: 64px 0; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 20px 22px;
    background: rgba(251, 246, 235, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s var(--ease);
  }
  .nav-open .nav-links { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 12px 16px; font-size: 1.05rem; }
  .post-item { flex-direction: column; gap: 6px; padding: 18px 20px; }
  .post-item:hover { transform: none; }
  .footer { padding: 70px 0 32px; }
}
