/* 顾清影 · 雾白与水墨 */

:root {
  --paper: #f4f3ee;
  --paper-2: #ebeae3;
  --card: #fbfaf6;
  --ink: #23272b;
  --ink-2: #4a5057;
  --ink-3: #80868c;
  --line: #d9d8d0;
  --qing: #5c8a82;        /* 青瓷 */
  --qing-soft: #dfe9e5;
  --rouge: #b5605a;       /* 朱砂，只用于印章 */
  --term-bg: #1c2026;
  --term-fg: #d7dbdf;
  --term-dim: #7c848c;
  --shadow: 0 20px 50px -24px rgba(35, 39, 43, .28);

  /* 只用系统自带字体，打开就能显示 */
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace;

  /* 开发模式：跟终端界面一样的深紫蓝 */
  --tui: #1f1f2d;
  --tui-text: #dcd8f2;
  --tui-dim: #8e8aa8;
  --tui-pink: #e6a3c0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14171c;
    --paper-2: #1a1e24;
    --card: #1d2128;
    --ink: #e6e4dc;
    --ink-2: #b4b6b3;
    --ink-3: #82878b;
    --line: #2d3239;
    --qing: #8fbcb2;
    --qing-soft: #223330;
    --rouge: #c9726b;
    --term-bg: #0f1216;
    --shadow: 0 20px 50px -24px rgba(0, 0, 0, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--qing); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

::selection { background: var(--qing-soft); color: var(--ink); }

code {
  font-family: var(--mono);
  font-size: .88em;
  padding: .1em .4em;
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink);
}

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 导航 */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-weight: 600; letter-spacing: .12em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 14px; }
.nav-links a { color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-gh { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; }

/* 开篇：字拼出来的两种样子 */
.hero {
  position: relative;
  height: calc(100svh - 60px);
  min-height: 600px;
  max-height: 1000px;
  overflow: hidden;
  background: #edede8;
  color: #23272b;
  transition: background-color 1.4s ease, color 1.4s ease;
}
.hero[data-scene="dev"] { background: var(--tui); color: var(--tui-text); }

.glyphs { position: absolute; inset: 0; width: 100%; height: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero-copy {
  position: absolute;
  left: max(24px, calc((100% - 1040px) / 2 + 24px));
  top: 50%;
  width: min(40vw, 460px);
  transform: translateY(-50%);
}
.caps { position: relative; height: 230px; }
.cap { position: absolute; inset: auto 0 0 0; visibility: hidden; }
.cap.is-active, .cap.is-leaving { visibility: visible; }

h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; }

.cap-line { margin: 0 0 14px; font-size: 16px; opacity: .65; }
.cap-name {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(56px, 7vw, 96px);
  line-height: 1;
  letter-spacing: .1em;
  white-space: nowrap;
}
.cap-name-dev {
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: .02em;
  color: #d9bfe0;
}
.cap-sub { margin: 0; font-size: 17px; line-height: 1.85; opacity: .8; }

/* 字幕逐字出现，离开时往上散开 */
.cap .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(.4em);
  filter: blur(6px);
  transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .2, 1), filter .5s ease;
  transition-delay: calc(var(--i) * 30ms);
  white-space: pre;
}
.cap.is-active .ch { opacity: 1; transform: none; filter: none; }
.cap.is-leaving .ch { opacity: 0; transform: translateY(-.5em); filter: blur(6px); transition-delay: calc(var(--i) * 8ms); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px;
  transition: transform .2s ease, background-color .6s ease, border-color .6s ease, color .6s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.hero .btn-ink { background: #23272b; color: #edede8; }
.hero[data-scene="dev"] .btn-ink { background: var(--tui-text); color: var(--tui); }
.btn-line { border: 1px solid color-mix(in srgb, currentColor 35%, transparent); color: inherit; }
.btn-line:hover { border-color: currentColor; }

/* 仿终端里「◉ 普通模式 ○ 开发模式」的样子，只显示，不能点 */
.mode-bar {
  position: absolute;
  left: 50%;
  bottom: 28px;
  display: flex;
  gap: 28px;
  margin: 0;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .15em;
  white-space: nowrap;
}
.mode-bar span { opacity: .45; transition: opacity .6s ease; }
.mode-bar span::before { content: "○ "; letter-spacing: 0; }
.mode-bar span.is-current { opacity: 1; }
.mode-bar span.is-current::before { content: "◉ "; }
.hero[data-scene="dev"] .mode-bar span.is-current { color: var(--tui-pink); }

html:not(.js) .hero { height: auto; max-height: none; padding: 96px 0; }
html:not(.js) .glyphs, html:not(.js) .mode-bar { display: none; }
html:not(.js) .hero-copy { position: static; transform: none; width: auto; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
html:not(.js) .caps { height: auto; }
html:not(.js) .cap { position: static; visibility: visible; margin-bottom: 40px; }

/* 章节 */
.section { padding-top: 96px; padding-bottom: 8px; }
.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 28px;
  font-size: clamp(24px, 3.2vw, 30px);
  letter-spacing: .06em;
}
.section-title .num {
  font-size: .6em;
  color: var(--qing);
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.section-note { margin: -12px 0 24px; color: var(--ink-3); font-size: 15px; }

/* 关于我 */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: center;
}
.portrait { margin: 0; position: relative; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: 200px 200px 12px 12px;
  box-shadow: var(--shadow);
}
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--ink); font-weight: 500; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 32px 0 0;
  border-top: 1px solid var(--line);
}
.facts div { padding: 14px 16px 0 0; }
.facts dt { font-size: 12px; letter-spacing: .15em; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; color: var(--ink); font-size: 15px; }

/* 二：我的日记，自己翻页 */
.diary { padding-bottom: 8px; }

.book {
  --paper-page: #f6f1e4;
  --paper-ink: #2b2a2e;
  --paper-line: rgba(181, 96, 90, .16);
  position: relative;
  width: min(1000px, calc(100% - 48px));
  aspect-ratio: 1000 / 640;
  margin: 8px auto 0;
  padding: 14px;
  background: linear-gradient(135deg, #2b3350, #1d2238);
  border-radius: 10px 16px 16px 10px;
  box-shadow: 0 40px 80px -40px rgba(20, 24, 40, .7), inset 0 0 0 1px rgba(255, 255, 255, .05);
  perspective: 2400px;
}
/* 线装的书脊 */
.book::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 50%;
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  background: repeating-linear-gradient(#b5605a 0 10px, transparent 10px 42px);
  opacity: .55;
  pointer-events: none;
}
.book-slot, .book-leaf {
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: calc(50% - 14px);
}
.book-left { left: 14px; }
.book-right, .book-leaf { left: 50%; }
.book-leaf {
  z-index: 2;
  transform-origin: left center;
  transform-style: preserve-3d;
  visibility: hidden;
}
.book-leaf.turning {
  visibility: visible;
  animation: turn 1.15s cubic-bezier(.55, .05, .3, 1) forwards;
}
@keyframes turn { to { transform: rotateY(-180deg); } }
.leaf-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.leaf-back { transform: rotateY(180deg); }
/* 翻页时纸面上的光影 */
.leaf-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .18), transparent 30%);
  opacity: 0;
}
.book-leaf.turning .leaf-face::after { animation: shade 1.15s ease forwards; }
@keyframes shade { 50% { opacity: 1; } }

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 7% 8%;
  color: var(--paper-ink);
  font-family: var(--serif);
  background: var(--paper-page);
}
.book-left .page, .leaf-back .page { box-shadow: inset -24px 0 30px -24px rgba(0, 0, 0, .28); border-radius: 4px 0 0 4px; }
.book-right .page, .leaf-front .page { box-shadow: inset 24px 0 30px -24px rgba(0, 0, 0, .28); border-radius: 0 4px 4px 0; }

/* 扉页 */
.page-title { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.page-title h3 { margin: 0 0 14px; font-size: clamp(28px, 3.6vw, 46px); letter-spacing: .3em; color: var(--paper-ink); }
.page-title p { margin: 0; color: #6b6760; letter-spacing: .15em; }
.seal-lg {
  display: inline-block;
  margin-top: 28px;
  padding: 8px 6px;
  writing-mode: vertical-rl;
  border: 2px solid #b5605a;
  border-radius: 4px;
  color: #b5605a;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: .1em;
  transform: rotate(-5deg);
}
.page-note { display: flex; flex-direction: column; justify-content: center; font-size: clamp(14px, 1.5vw, 17px); line-height: 2; }
.page-note p { margin: 0 0 1em; }
.page-sign { text-align: right; letter-spacing: .3em; color: #6b6760; }

/* 竖排的日记 */
.page-diary {
  writing-mode: vertical-rl;
  font-size: clamp(14px, 1.65vw, 19px);
  line-height: 2.3;
  letter-spacing: .12em;
  background:
    repeating-linear-gradient(to left, transparent 0 calc(2.3em - 1px), var(--paper-line) calc(2.3em - 1px) 2.3em),
    var(--paper-page);
  background-position: calc(100% - 8%) 0;
}
.page-diary p { margin: 0 0 0 .9em; }
.page-date { color: #b5605a; font-weight: 600; letter-spacing: .2em; }
.page-mode {
  position: absolute;
  left: 7%;
  bottom: 7%;
  writing-mode: horizontal-tb;
  margin: 0 !important;
  padding: 3px 10px;
  font-size: 12px;
  letter-spacing: .15em;
  color: #5c8a82;
  border: 1px solid currentColor;
  border-radius: 999px;
}

/* 夹在日记里的东西 */
.page-sticky { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8%; }
.sticky {
  width: 62%;
  padding: 18px 20px 22px;
  background: #fbe6a2;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, .45);
  transform: rotate(-3deg);
  font-size: clamp(14px, 1.5vw, 18px);
}
.sticky b { display: block; font-family: var(--mono); font-size: .9em; color: #7a5a14; margin-bottom: 4px; }
.sticky-2 { background: #d9ecdf; transform: rotate(2.5deg) translateX(12%); }
.sticky-2 b { color: #3f6b5d; }
.tui-line {
  margin: 0;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: #cfcbe6;
  background: #1f1f2d;
  border-radius: 6px;
  white-space: nowrap;
}
.tui-line b { color: #e6a3c0; font-weight: 500; }

.page-code { display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.page-code pre {
  margin: 0;
  padding: 18px 20px;
  background: #1f1f2d;
  color: #dcd8f2;
  border-radius: 8px;
  font: clamp(11px, 1.25vw, 14px)/1.9 var(--mono);
  transform: rotate(-1.5deg);
  box-shadow: 0 12px 22px -14px rgba(0, 0, 0, .6);
  white-space: pre-wrap;
}
.page-code .dim { color: #7d7998; }
/* 朱笔圈出报错那一行 */
.page-code .err { position: relative; display: inline-block; }
.page-code .err::after {
  content: "";
  position: absolute;
  inset: -6px -14px;
  border: 2px solid #e2584e;
  border-radius: 50%;
  transform: rotate(-3deg);
}
.ink-note { margin: 0; font-size: clamp(14px, 1.5vw, 18px); line-height: 1.8; color: #b5605a; transform: rotate(-2deg); }
.page-code .tui-line { align-self: flex-start; }

.page-wave { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 28px; }
.house {
  position: relative;
  width: 70%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 2px dashed #5c8a82;
  border-radius: 14px;
}
.house-label { position: absolute; top: -12px; left: 16px; padding: 0 8px; background: var(--paper-page); color: #5c8a82; font-size: 13px; letter-spacing: .2em; }
.wave { display: flex; align-items: center; gap: 5px; height: 45%; }
.wave i { width: 5px; height: 30%; border-radius: 3px; background: #5c8a82; animation: wave 1.2s ease-in-out infinite; }
.wave i:nth-child(odd) { animation-duration: .9s; }
.wave i:nth-child(3n) { animation-duration: 1.5s; background: #b5605a; }
.wave i:nth-child(1) { animation-delay: -.2s; } .wave i:nth-child(2) { animation-delay: -.5s; }
.wave i:nth-child(4) { animation-delay: -.7s; } .wave i:nth-child(5) { animation-delay: -.1s; }
.wave i:nth-child(7) { animation-delay: -.9s; } .wave i:nth-child(8) { animation-delay: -.3s; }
.wave i:nth-child(10) { animation-delay: -.6s; } .wave i:nth-child(11) { animation-delay: -1s; }
.wave i:nth-child(13) { animation-delay: -.4s; } .wave i:nth-child(14) { animation-delay: -.8s; }
@keyframes wave { 50% { height: 100%; } }
.page-wave .ink-note { transform: rotate(-2deg); }

.page-phone { display: grid; place-items: center; }
.phone {
  width: min(62%, 240px);
  aspect-ratio: 9 / 17;
  padding: 34px 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  background: #edede8;
  border: 8px solid #23242c;
  border-radius: 30px;
  box-shadow: 0 16px 28px -16px rgba(0, 0, 0, .6);
  transform: rotate(3deg);
}
.bubble { margin: 0; max-width: 85%; padding: 7px 10px; font-size: clamp(11px, 1.1vw, 13px); line-height: 1.6; border-radius: 10px; }
.bubble.you { align-self: flex-end; background: #2b3350; color: #eef; }
.bubble.qy { align-self: flex-start; background: #fff; color: #2b2a2e; }

.page-steps { display: flex; flex-direction: column; justify-content: center; gap: 6px; font-size: clamp(14px, 1.5vw, 17px); }
.page-steps p { margin: 10px 0 0; }
.page-steps p b { margin-right: .8em; color: #b5605a; }
.page-steps code { display: block; padding: 6px 10px; font-size: clamp(10px, 1.05vw, 12.5px); color: #2b2a2e; background: rgba(92, 138, 130, .12); border-radius: 4px; overflow-wrap: anywhere; }
.page-steps .seal-lg { align-self: flex-end; margin-top: 18px; }

/* 书里用的是脚本复制出来的页，原来的页只给读屏和没有脚本时用 */
.js .diary-pages { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html:not(.js) .book { display: none; }
html:not(.js) .diary-pages { display: grid; gap: 20px; max-width: 520px; margin: 0 auto; padding: 0 24px; }
html:not(.js) .page { position: relative; min-height: 360px; }

/* 真要装时，可以直接复制的命令 */
.meet { margin-top: 64px; max-width: 760px; }
.meet-title { margin: 0 0 6px; font-family: var(--serif); font-size: 22px; color: var(--ink); letter-spacing: .2em; }
.meet-lede { margin: 0 0 12px; color: var(--ink-2); }
.oneline-box {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  background: #1f1f2d;
  box-shadow: var(--shadow);
}
.oneline-box code {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font: 13.5px/1.6 var(--mono);
  color: #e6c2dc;
  background: transparent;
  border-radius: 0;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.copy-btn {
  flex: none;
  padding: 0 20px;
  font: 600 15px var(--serif);
  letter-spacing: .1em;
  color: #fff;
  background: var(--qing);
  border: 0;
  cursor: pointer;
  transition: background-color .2s ease;
}
.copy-btn:hover { background: color-mix(in srgb, var(--qing) 85%, #000); }
.copy-btn.done { background: var(--rouge); }
.meet-notes { margin: 18px 0 0; padding-left: 1.2em; color: var(--ink-2); font-size: 14.5px; line-height: 1.9; }
.meet-notes code { font-size: .88em; }

/* 页脚 */
.foot { margin-top: 120px; padding: 40px 0 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.foot-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px; }
.foot p { margin: 0; }
.foot-sign { font-family: var(--serif); font-size: 22px; color: var(--ink); letter-spacing: .2em; }
.foot a { color: var(--ink-2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 20px; }

/* 窄屏 */
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; gap: 40px; }
  .portrait { max-width: 360px; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links a:not(.nav-gh):not([href="#meet"]) { display: none; }
  .nav-links { gap: 16px; }
  .hero { height: calc(100svh - 56px); min-height: 640px; }
  .hero-copy { left: 16px; right: 16px; top: auto; bottom: 64px; width: auto; transform: none; }
  .caps { height: 180px; }
  .cap-name { font-size: 15vw; margin-bottom: 10px; }
  .cap-sub { font-size: 15px; }
  .actions { margin-top: 20px; }
  .btn { padding: 9px 18px; font-size: 14px; }
  .mode-bar { bottom: 22px; font-size: 13px; gap: 20px; }
  .section { padding-top: 72px; }
  .facts { grid-template-columns: 1fr; }
  .facts div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .facts dd { margin: 0; }
  .book { width: calc(100% - 32px); aspect-ratio: 5 / 7; padding: 10px; }
  .book::before { display: none; }
  .book-slot, .book-leaf { top: 10px; bottom: 10px; width: calc(100% - 20px); }
  .book-left { display: none; }
  .book-right, .book-leaf { left: 10px; }
  .page { padding: 9% 9%; }
  .page-diary { font-size: 17px; }
  .foot { margin-top: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .hero, .mode-bar span { transition: none; }
  .cap .ch { transition: none; filter: none; }
  .book-leaf.turning, .book-leaf.turning .leaf-face::after, .wave i { animation: none; }
}
