/* ===========================================================
   小园几许 · 样式
   风格：宣纸底色 + 墨色文字 + 细线留白，点缀桃红/菜黄/草木青
   =========================================================== */

:root {
  /* 色板 */
  --paper: #faf7f0;        /* 宣纸底 */
  --paper-deep: #f3eee3;   /* 稍深一层的纸 */
  --ink: #2c2823;          /* 墨色 */
  --ink-soft: #6d6357;     /* 淡墨 */
  --ink-faint: #9a9086;    /* 更淡 */
  --line: #e3dbcd;         /* 细线 */
  --peach: #c9756a;        /* 桃花红 */
  --apricot: #c9973a;      /* 菜花黄 */
  --leaf: #6f8560;         /* 草木青 */
  --seal: #b0473c;         /* 印章红 */

  /* 字体：全部使用系统字体，零外部依赖 */
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC",
    "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    -apple-system, "Segoe UI", Roboto, sans-serif;

  /* 版心与间距 */
  --content: 760px;
  --gap-section: 128px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--ink);
  background-color: var(--paper);
  /* 极淡的纸面层次，避免大片纯色显得死板 */
  background-image:
    radial-gradient(1200px 600px at 15% -10%, rgba(201, 151, 58, 0.055), transparent 60%),
    radial-gradient(900px 500px at 95% 8%, rgba(201, 117, 106, 0.045), transparent 62%),
    radial-gradient(1000px 700px at 50% 108%, rgba(111, 133, 96, 0.05), transparent 65%);
  background-attachment: fixed;
  line-height: 1.9;
  font-size: 17px;
  letter-spacing: 0.02em;
}

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

/* ---------------- 顶部导航 ---------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 56px);
  transition: background-color 0.35s ease, border-color 0.35s ease,
    backdrop-filter 0.35s ease, padding 0.35s ease;
  border-bottom: 1px solid transparent;
}

.topbar.is-stuck {
  padding-top: 12px;
  padding-bottom: 12px;
  background-color: rgba(250, 247, 240, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--line);
}

.brand {
  font-size: 18px;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.nav {
  display: flex;
  gap: clamp(14px, 3vw, 30px);
  font-size: 14.5px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.nav a {
  position: relative;
  padding-bottom: 2px;
  transition: color 0.25s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background-color: var(--peach);
  transition: width 0.28s ease;
}

.nav a:hover {
  color: var(--ink);
}

.nav a:hover::after {
  width: 100%;
}

/* ---------------- 首屏 ---------------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 100px;
}

.hero-kicker {
  margin: 0 0 26px;
  font-size: 13.5px;
  letter-spacing: 0.42em;
  color: var(--ink-faint);
  text-indent: 0.42em;
}

.hero-title {
  margin: 0;
  font-size: clamp(46px, 9vw, 84px);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  line-height: 1.25;
}

.hero-sub {
  margin: 22px 0 0;
  font-size: clamp(17px, 2.4vw, 21px);
  letter-spacing: 0.44em;
  text-indent: 0.44em;
  color: var(--leaf);
}

.hero-desc {
  margin: 30px 0 0;
  font-size: 15.5px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}

/* 印章 */
.seal {
  margin-top: 64px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: var(--seal);
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0.86;
  transform: rotate(-3deg);
  user-select: none;
}

/* ---------------- 通用区块 ---------------- */
.section {
  width: min(100% - 48px, var(--content));
  margin: 0 auto var(--gap-section);
}

.section--last {
  margin-bottom: 96px;
}

.section-title {
  margin: 0 0 36px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--ink-soft);
}

.section-title span {
  position: relative;
  padding-left: 40px;
}

.section-title span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 26px;
  height: 1px;
  background-color: var(--peach);
}

.section-desc {
  margin: -18px 0 34px;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------------- 关于 ---------------- */
.about-grid {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 36px;
  align-items: start;
}

.about-avatar {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  font-size: 40px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  background-color: var(--paper-deep);
  user-select: none;
}

.about-text p {
  margin: 0 0 18px;
  color: var(--ink);
}

.about-text p:last-of-type {
  margin-bottom: 26px;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-tags li {
  padding: 4px 14px;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.5);
}

/* ---------------- 小筑（作品卡片） ---------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.46);
  transition: transform 0.32s ease, box-shadow 0.32s ease,
    border-color 0.32s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #d6cbb8;
  box-shadow: 0 10px 30px -18px rgba(44, 40, 35, 0.35);
}

.card-title {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.card-desc {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.card-tags {
  margin: 0 0 18px;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.card-link {
  margin-top: auto;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--peach);
  transition: opacity 0.25s ease;
}

.card-link:hover {
  opacity: 0.72;
}

/* ---------------- 随笔 ---------------- */
.notes {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.note {
  display: flex;
  align-items: baseline;
  gap: 22px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.3s ease;
}

.note:hover {
  padding-left: 12px;
}

.note time {
  flex: none;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.note a {
  font-size: 16.5px;
  transition: color 0.25s ease;
}

.note a:hover {
  color: var(--peach);
}

/* ---------------- 往来 ---------------- */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.contact-links a {
  padding: 9px 20px;
  font-size: 14.5px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.5);
  transition: border-color 0.28s ease, color 0.28s ease,
    background-color 0.28s ease;
}

.contact-links a:hover {
  color: var(--peach);
  border-color: var(--peach);
  background-color: rgba(201, 117, 106, 0.06);
}

/* ---------------- 页脚 ---------------- */
.footer {
  padding: 54px 24px 64px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.footer-seal {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--ink-faint);
}

.footer-copy {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

/* ---------------- 滚动淡入 ---------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* 尊重「减少动态效果」的系统偏好 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .card:hover,
  .note:hover {
    transform: none;
  }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
  :root {
    --gap-section: 92px;
  }

  body {
    font-size: 16px;
  }

  .topbar {
    padding: 14px 20px;
  }

  .brand {
    font-size: 16.5px;
    letter-spacing: 0.1em;
  }

  .nav {
    gap: 14px;
    font-size: 13.5px;
    letter-spacing: 0.06em;
  }

  .hero {
    min-height: 86vh;
    padding: 120px 20px 80px;
  }

  .hero-title {
    letter-spacing: 0.14em;
    text-indent: 0.14em;
  }

  .seal {
    margin-top: 46px;
    width: 54px;
    height: 54px;
    font-size: 26px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .about-avatar {
    width: 84px;
    height: 84px;
    font-size: 30px;
  }

  .note {
    flex-direction: column;
    gap: 6px;
  }
}

/* ===========================================================
   创意层
   ① 季节：按真实日期换色（春桃 / 夏荫 / 秋桂 / 冬雪）
   ② 时辰：按真实时刻换光线（晨 / 昼 / 暮 / 夜）
   ③ 花枝：进入页面时逐段生长
   ④ 花瓣：缓缓飘落，可被鼠标扰动
   ⑤ 点击：随处可生一朵小花
   =========================================================== */

/* ---------- ① 季节色板 ---------- */
body[data-season="spring"] {
  --accent: #c9756a;   /* 桃花红 */
  --leaf-now: #6f8560;
  --tint-a: rgba(201, 117, 106, 0.075);
  --tint-b: rgba(201, 151, 58, 0.055);
  --tint-c: rgba(111, 133, 96, 0.05);
}

body[data-season="summer"] {
  --accent: #5c8a68;   /* 荷荫绿 */
  --leaf-now: #4e7a5a;
  --tint-a: rgba(92, 138, 104, 0.08);
  --tint-b: rgba(126, 168, 138, 0.055);
  --tint-c: rgba(80, 120, 100, 0.05);
}

body[data-season="autumn"] {
  --accent: #c08a34;   /* 桂子黄 */
  --leaf-now: #a8763a;
  --tint-a: rgba(201, 151, 58, 0.09);
  --tint-b: rgba(190, 122, 66, 0.06);
  --tint-c: rgba(150, 130, 80, 0.05);
}

body[data-season="winter"] {
  --accent: #7d8a96;   /* 雪后青 */
  --leaf-now: #6c7884;
  --tint-a: rgba(125, 138, 150, 0.09);
  --tint-b: rgba(160, 172, 182, 0.06);
  --tint-c: rgba(120, 132, 148, 0.05);
}

/* 组件里原本写死的桃红 / 草木青，改为跟随季节 */
body {
  --peach: var(--accent, #c9756a);
  --leaf: var(--leaf-now, #6f8560);
}

/* ---------- ② 时辰光线 ---------- */
body[data-daypart="dawn"] {
  --paper: #fbf6ec;
  --day-tint: rgba(255, 202, 142, 0.11);
}

body[data-daypart="day"] {
  --paper: #faf7f0;
  --day-tint: rgba(255, 252, 244, 0);
}

body[data-daypart="dusk"] {
  --paper: #faf3ea;
  --day-tint: rgba(236, 156, 116, 0.11);
}

body[data-daypart="night"] {
  --paper: #f5f3ef;
  --day-tint: rgba(94, 110, 148, 0.13);
}

/* 重写背景：季节色 + 时辰光感叠加 */
body {
  background-color: var(--paper, #faf7f0);
  background-image:
    linear-gradient(var(--day-tint, transparent), var(--day-tint, transparent)),
    radial-gradient(1200px 620px at 16% -10%, var(--tint-a, rgba(201, 151, 58, 0.055)), transparent 62%),
    radial-gradient(900px 520px at 94% 6%, var(--tint-b, rgba(201, 117, 106, 0.045)), transparent 64%),
    radial-gradient(1000px 720px at 50% 106%, var(--tint-c, rgba(111, 133, 96, 0.05)), transparent 66%);
  transition: background-color 1.2s ease;
}

/* ---------- ③ 花枝生长 ---------- */
.branch-wrap {
  position: absolute;
  right: clamp(-70px, 1vw, 40px);
  bottom: -2%;
  width: clamp(240px, 32vw, 400px);
  pointer-events: none;
  opacity: 0.46;
  z-index: 0;
}

.branch {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.bk {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: branchGrow 2.6s cubic-bezier(0.42, 0, 0.24, 1) forwards;
}

.bk--main { stroke-width: 2.5; animation-delay: 0.1s; }
.bk--l1   { animation-delay: 0.85s; }
.bk--l2   { animation-delay: 1.15s; }
.bk--r1   { animation-delay: 1s; }
.bk--r2   { animation-delay: 1.35s; }
.bk--t    { animation-delay: 1.6s; }

@keyframes branchGrow {
  to { stroke-dashoffset: 0; }
}

.lf {
  fill: var(--leaf-now, #6f8560);
  opacity: 0;
  animation: leafIn 1.2s ease forwards;
}

.lf:nth-child(1) { animation-delay: 1.5s; }
.lf:nth-child(2) { animation-delay: 1.65s; }
.lf:nth-child(3) { animation-delay: 1.85s; }
.lf:nth-child(4) { animation-delay: 2.05s; }
.lf:nth-child(5) { animation-delay: 1.7s; }
.lf:nth-child(6) { animation-delay: 1.9s; }
.lf:nth-child(7) { animation-delay: 2.15s; }
.lf:nth-child(8) { animation-delay: 2.3s; }

@keyframes leafIn {
  to { opacity: 0.6; }
}

.bm {
  opacity: 0;
  animation: blossomIn 1.4s ease forwards;
}

.bm:nth-child(1) { animation-delay: 2.1s; }
.bm:nth-child(2) { animation-delay: 2.3s; }
.bm:nth-child(3) { animation-delay: 2.45s; }
.bm:nth-child(4) { animation-delay: 2.6s; }
.bm:nth-child(5) { animation-delay: 2.75s; }
.bm:nth-child(6) { animation-delay: 2.9s; }

.bm circle {
  fill: var(--accent, #c9756a);
}

.bm .bm-core {
  fill: var(--seal, #b0473c);
}

@keyframes blossomIn {
  to { opacity: 0.92; }
}

/* ---------- 逐字题名 ---------- */
.hero-title .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: charIn 1.15s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.hero-title .ch:nth-child(1) { animation-delay: 0.3s; }
.hero-title .ch:nth-child(2) { animation-delay: 0.46s; }
.hero-title .ch:nth-child(3) { animation-delay: 0.62s; }
.hero-title .ch:nth-child(4) { animation-delay: 0.78s; }

@keyframes charIn {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 时辰落款 ---------- */
.hero-time {
  margin: 28px 0 0;
  font-size: 14.5px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--leaf-now, #6f8560);
  transition: color 0.6s ease;
}

/* ---------- 时令标签 ---------- */
.almanac {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--ink-faint);
  white-space: nowrap;
  opacity: 0;
  animation: fadeUp 1.2s ease 3.1s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 0.85; transform: translate(-50%, 0); }
}

/* ---------- ④ 花瓣层 ---------- */
.petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ---------- ⑤ 点击生花 ---------- */
.bloom {
  position: fixed;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  pointer-events: none;
  z-index: 60;
  animation: bloomPop 1.8s ease forwards;
}

.bloom svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes bloomPop {
  0%   { opacity: 0; transform: scale(0.15) rotate(-30deg); }
  30%  { opacity: 1; transform: scale(1) rotate(0deg); }
  68%  { opacity: 0.92; transform: scale(1.05) rotate(7deg); }
  100% { opacity: 0; transform: scale(1.12) rotate(14deg) translateY(-16px); }
}

/* ---------- 首屏层级 ---------- */
.hero > *:not(.branch-wrap):not(.almanac) {
  position: relative;
  z-index: 1;
}

/* ---------- 创意层的响应式与无障碍 ---------- */
@media (max-width: 900px) {
  .branch-wrap {
    right: -90px;
    width: clamp(200px, 46vw, 300px);
    opacity: 0.32;
  }
}

@media (max-width: 720px) {
  .almanac {
    bottom: 26px;
    font-size: 11.5px;
  }

  .hero-time {
    font-size: 13.5px;
  }

  .bloom {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
  }
}

/* 尊重「减少动态效果」：关闭生长/飘落/绽放动画，静态呈现 */
@media (prefers-reduced-motion: reduce) {
  .bk {
    stroke-dashoffset: 0;
    animation: none;
  }

  .lf,
  .bm {
    opacity: 0.7;
    animation: none;
  }

  .hero-title .ch {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .almanac {
    opacity: 0.85;
    animation: none;
  }

  .petals {
    display: none;
  }

  .bloom {
    display: none;
  }
}
