/* ==========================================================================
   于昊然阁下 H.E. Shao Yu — 官方网站样式
   深浅色自动适配 · 响应式（手机 / 平板 / PC）
   ========================================================================== */

/* ---------- 设计令牌：浅色（默认） ---------- */
:root {
  color-scheme: light;

  --bg: #f6f4ef;
  --bg-alt: #efece5;
  --surface: #fffdf9;
  --surface-2: #f4f1ea;
  --text: #16181d;
  --text-2: #4a4f58;
  --muted: #7c828c;
  --line: rgba(22, 24, 29, .10);
  --line-strong: rgba(22, 24, 29, .20);

  --accent: #9a763a;
  --accent-strong: #7d5d27;
  --accent-soft: rgba(154, 118, 58, .12);
  --accent-contrast: #fffdf9;

  --ink: #10151c;
  --ink-2: #1b222c;
  --danger: #8b1a1a;

  --btn-bg: #16181d;
  --btn-fg: #ffffff;
  --btn-bg-hover: #000000;

  --header-bg: rgba(246, 244, 239, .82);
  --reader-bg: #e6e3dd;
  --reader-bar: rgba(255, 253, 249, .9);

  --shadow-sm: 0 1px 2px rgba(16, 21, 28, .05), 0 6px 18px -10px rgba(16, 21, 28, .16);
  --shadow-md: 0 2px 4px rgba(16, 21, 28, .05), 0 18px 44px -18px rgba(16, 21, 28, .28);
  --shadow-lg: 0 30px 80px -30px rgba(16, 21, 28, .40);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "SimSun", "Times New Roman", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: "Times New Roman", "Songti SC", Georgia, "SimSun", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;

  --container: 1140px;
  --header-h: 68px;
}

/* ---------- 设计令牌：深色 ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0d11;
  --bg-alt: #101318;
  --surface: #151921;
  --surface-2: #1b2029;
  --text: #ece9e2;
  --text-2: #b7bcc5;
  --muted: #8b919b;
  --line: rgba(236, 233, 226, .11);
  --line-strong: rgba(236, 233, 226, .22);

  --accent: #c9a869;
  --accent-strong: #e3c78f;
  --accent-soft: rgba(201, 168, 105, .15);
  --accent-contrast: #14171d;

  --ink: #05070a;
  --ink-2: #0d1117;
  --danger: #c96a6a;

  --btn-bg: #c9a869;
  --btn-fg: #14171d;
  --btn-bg-hover: #e3c78f;

  --header-bg: rgba(11, 13, 17, .80);
  --reader-bg: #0f1216;
  --reader-bar: rgba(21, 25, 33, .92);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px -10px rgba(0, 0, 0, .55);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .45), 0 20px 48px -20px rgba(0, 0, 0, .75);
  --shadow-lg: 0 34px 90px -32px rgba(0, 0, 0, .85);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: .01em;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, p, dl, dd, blockquote, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, canvas { max-width: 100%; }

a {
  color: inherit;
  text-decoration: none;
  transition: color .2s ease, opacity .2s ease, border-color .2s ease, background-color .2s ease;
}

button { font: inherit; color: inherit; }

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

::selection { background: var(--accent-soft); color: var(--text); }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 999;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: .9rem;
  transition: top .25s ease;
}
.skip-link:focus { top: 12px; }

.container {
  width: min(var(--container), 100% - clamp(32px, 8vw, 96px));
  margin-inline: auto;
}

.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.link-accent { color: var(--accent); border-bottom: 1px solid transparent; }
.link-accent:hover { border-bottom-color: currentColor; }
.dot { color: var(--accent); margin-inline: .35em; }

/* ---------- 背景装饰 ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
}
.bg-glow-1 {
  width: 52vw; height: 52vw;
  top: -18vw; right: -12vw;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
}
.bg-glow-2 {
  width: 44vw; height: 44vw;
  bottom: -16vw; left: -14vw;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 0%, transparent 72%);
  opacity: .5;
}

/* ---------- 页头导航 ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, box-shadow .3s ease, background-color .3s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 12px 32px -24px rgba(0, 0, 0, .5);
}

.scroll-progress {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width .12s linear;
}

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: .1em;
  white-space: nowrap;
}
.brand-text small {
  font-size: .68rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.brand::before {
  content: "";
  width: 3px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.4vw, 18px);
}

.nav-link {
  position: relative;
  padding: 8px 10px;
  font-size: .95rem;
  color: var(--text-2);
  border-radius: 8px;
  white-space: nowrap;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 2px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after,
.nav-link.is-active::after { transform: scaleX(1); }
.nav-link.is-active { color: var(--text); }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, transform .2s ease, background-color .2s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(12deg); }
.theme-icon { display: none; width: 19px; height: 19px; }
.theme-icon svg { display: block; width: 100%; height: 100%; }
html[data-mode="auto"] .icon-auto,
html[data-mode="light"] .icon-light,
html[data-mode="dark"] .icon-dark { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 1.8px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .3s ease, opacity .25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + clamp(40px, 8vh, 96px)) 0 clamp(64px, 10vh, 110px);
}

.hero-inner { text-align: center; }

.eyebrow {
  font-size: clamp(.72rem, 2.2vw, .84rem);
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.hero-title { margin-top: clamp(14px, 3vh, 26px); }
.hero-zh {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 12vw, 7.2rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: .1em;
  text-indent: .1em;
  background: linear-gradient(170deg, var(--text) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-en {
  display: block;
  margin-top: clamp(10px, 2vh, 18px);
  font-family: var(--font-display);
  font-size: clamp(.82rem, 2.6vw, 1.2rem);
  letter-spacing: .5em;
  text-indent: .5em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4vw, 30px);
  margin: clamp(22px, 4vh, 38px) auto;
  max-width: 620px;
}
.hero-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.hero-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.02rem, 3.4vw, 1.42rem);
  letter-spacing: .06em;
  color: var(--text-2);
  max-width: min(100%, 27em);
  margin-inline: auto;
  text-wrap: balance;
}
.hero-sub {
  margin-top: 12px;
  font-size: clamp(.78rem, 2.4vw, .92rem);
  letter-spacing: .24em;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: clamp(26px, 4.5vh, 42px);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(30px, 5vh, 48px);
}
.hero-chips li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.chip-label {
  font-size: .6rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
}
.chip-value { font-size: .86rem; color: var(--text); }
a.chip-value:hover { color: var(--accent); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: 24px; height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.scroll-cue span {
  width: 3px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  animation: cue 1.9s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { transform: translateY(-5px); opacity: .25; }
  50% { transform: translateY(5px); opacity: 1; }
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  padding: .74em 1.4em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .2s ease, background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.btn svg { width: 1.05em; height: 1.05em; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--btn-bg-hover); box-shadow: var(--shadow-md); }

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-small { padding: .6em 1.1em; font-size: .84rem; }

/* ---------- 区块 ---------- */
.section { padding: clamp(72px, 10vw, 132px) 0; }
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line);
}

.section-head { max-width: 720px; margin-bottom: clamp(36px, 6vw, 64px); }
.section-kicker {
  font-size: .72rem;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.section-title {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 5.4vw, 2.9rem);
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.25;
}
.section-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin-top: 18px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.section-lead {
  margin-top: 22px;
  font-size: clamp(.96rem, 2.4vw, 1.05rem);
  color: var(--text-2);
  max-width: 62ch;
}
.section-lead strong { color: var(--text); font-weight: 700; }

/* ---------- 简介 ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.feature-card {
  position: relative;
  padding: 28px 26px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.feature-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
}
.feature-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.feature-card:hover::before { opacity: 1; }
.feature-index {
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1;
  color: var(--accent);
  opacity: .55;
}
.feature-card h3 {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  letter-spacing: .1em;
}
.feature-card p {
  margin-top: 10px;
  font-size: .92rem;
  color: var(--text-2);
}

.pull-quote {
  position: relative;
  margin-top: clamp(30px, 5vw, 52px);
  padding: 26px 30px 26px 34px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.pull-quote p {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.8vw, 1.18rem);
  line-height: 1.9;
  letter-spacing: .04em;
  color: var(--text);
}
.pull-quote cite {
  display: block;
  margin-top: 14px;
  font-style: normal;
  font-size: .82rem;
  letter-spacing: .12em;
  color: var(--muted);
}

/* ---------- 简历 ---------- */
.cv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(16px, 2.4vw, 26px);
  align-items: start;
}
.cv-card {
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.cv-card-title {
  font-family: var(--font-serif);
  font-size: 1.16rem;
  letter-spacing: .14em;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.cv-list { margin-top: 4px; }
.cv-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.cv-row:last-child { border-bottom: 0; }
.cv-row dt {
  font-size: .8rem;
  letter-spacing: .16em;
  color: var(--muted);
  padding-top: 2px;
}
.cv-row dd { font-size: .98rem; color: var(--text); }

.orcid-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}
.orcid-link:hover { color: var(--accent); }
.orcid-icon { width: 20px; height: 20px; color: #a6ce39; flex: none; }

.timeline { margin-top: 10px; }
.timeline li {
  position: relative;
  padding: 4px 0 22px 26px;
  border-left: 1px solid var(--line-strong);
}
.timeline li:last-child { padding-bottom: 4px; }
.timeline-dot {
  position: absolute;
  left: -4.5px; top: 12px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline time {
  display: block;
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--accent);
}
.timeline p {
  margin-top: 6px;
  font-size: .93rem;
  color: var(--text-2);
}

/* ---------- 著作 ---------- */
.work-card {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 46px);
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.work-cover {
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 30px);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--line);
}
.cover-frame {
  position: relative;
  width: min(100%, 272px);
  aspect-ratio: 3 / 4.35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px 22px;
  border-radius: 6px 14px 14px 6px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .06), transparent 40%),
    linear-gradient(200deg, var(--ink-2), var(--ink));
  box-shadow:
    inset 0 0 0 1px rgba(201, 168, 105, .38),
    inset 6px 0 14px -8px rgba(0, 0, 0, .9),
    0 22px 44px -20px rgba(0, 0, 0, .65);
  transform: perspective(1100px) rotateY(-9deg);
  transition: transform .5s ease;
}
.cover-frame:hover { transform: perspective(1100px) rotateY(0deg); }
.cover-frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(201, 168, 105, .3);
  border-radius: 3px 9px 9px 3px;
  pointer-events: none;
}
.cover-title {
  writing-mode: vertical-rl;
  white-space: nowrap;
  max-height: 82%;
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: .2em;
  line-height: 1.9;
  color: #eee0c2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.cover-en {
  position: absolute;
  left: 24px; bottom: 22px;
  max-width: calc(100% - 48px);
  font-family: var(--font-display);
  font-size: .58rem;
  line-height: 1.7;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(238, 224, 194, .5);
  text-align: left;
}

.work-body { display: flex; flex-direction: column; min-width: 0; }
.work-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.work-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.4vw, 2.05rem);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.4;
}
.work-subtitle {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: .78rem;
  letter-spacing: .08em;
  line-height: 1.7;
  color: var(--muted);
}

.work-desc {
  margin-top: 20px;
  font-size: .96rem;
  color: var(--text-2);
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.work-tags li {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .76rem;
  letter-spacing: .08em;
  color: var(--text-2);
}

.work-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 20px;
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.work-meta dt {
  font-size: .68rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}
.work-meta dd { margin-top: 4px; font-size: .92rem; }

.work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.work-note {
  margin-top: 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  font-size: .82rem;
  line-height: 1.85;
  color: var(--text-2);
}
.work-note strong { color: var(--text); }

/* ---------- 联系 ---------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.link-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.link-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.link-card-label {
  font-size: .68rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--accent);
}
.link-card-value {
  font-size: 1rem;
  color: var(--text);
  word-break: break-all;
}
.link-card-hint {
  margin-top: auto;
  font-size: .78rem;
  color: var(--muted);
}
.link-card:hover .link-card-hint { color: var(--text-2); }

/* ---------- 页脚 ---------- */
.site-footer {
  padding: clamp(40px, 6vw, 64px) 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.footer-inner { display: flex; flex-direction: column; gap: 22px; }
.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.footer-name {
  font-family: var(--font-serif);
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding-block: 18px;
  border-block: 1px solid var(--line);
}
.footer-links a {
  font-size: .86rem;
  color: var(--text-2);
  letter-spacing: .06em;
}
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: .78rem; color: var(--muted); }

/* ---------- 阅读器 ---------- */
.reader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: var(--reader-bg);
  opacity: 1;
  transition: opacity .25s ease;
}
.reader[hidden] { display: none; }

.reader-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px clamp(8px, 2vw, 18px);
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--reader-bar);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  transition: transform .3s ease, opacity .3s ease;
}
.reader-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.reader-titles { min-width: 0; }
.reader-title {
  font-family: var(--font-serif);
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-subtitle {
  font-size: .68rem;
  letter-spacing: .18em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-bar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.reader-counter {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-2);
  padding-inline: 8px;
  white-space: nowrap;
}
.reader-sep {
  width: 1px; height: 20px;
  margin-inline: 6px;
  background: var(--line-strong);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn .icon-exit { display: none; }
.reader.is-fullscreen .icon-btn .icon-enter { display: none; }
.reader.is-fullscreen .icon-btn .icon-exit { display: block; }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.reader-progress { height: 2px; background: transparent; position: relative; z-index: 3; }
.reader-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width .15s linear;
}

.reader-stage {
  position: relative;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(14px, 2.4vw, 28px) clamp(8px, 2vw, 24px) clamp(48px, 8vh, 88px);
  -webkit-overflow-scrolling: touch;
}
.reader-stage:focus { outline: none; }

.reader-pages { display: block; }

/* ---------- 全文排版（由 LaTeX 源码渲染） ---------- */
.novel {
  --novel-ink: #1c1c1e;
  --novel-paper: #fffdf8;
  --novel-muted: #6f6a63;
  --novel-line: rgba(28, 28, 30, .16);
  --novel-box: rgba(112, 128, 144, .10);
  --novel-danger: #8b1a1a;
  max-width: 44em;
  margin: 0 auto;
  padding: clamp(30px, 5vw, 64px) clamp(20px, 5vw, 58px);
  background: var(--novel-paper);
  color: var(--novel-ink);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-serif);
  font-size: var(--novel-size, 19px);
  line-height: 2;
  letter-spacing: .02em;
  overflow-wrap: break-word;
}
.reader.is-paper-dark .novel {
  --novel-ink: #e9e5db;
  --novel-paper: #14171d;
  --novel-muted: #9c978b;
  --novel-line: rgba(233, 229, 219, .16);
  --novel-box: rgba(233, 229, 219, .05);
  --novel-danger: #d98a8a;
}
.novel p { margin: 0 0 1.15em; text-indent: 2em; }
.novel p:last-child { margin-bottom: 0; }
.novel strong { font-weight: 700; }
.novel .kai { letter-spacing: .06em; }
.novel .hei { font-family: var(--font-sans); font-weight: 700; }
.novel .big { font-size: 1.08em; }
.novel .deep { color: var(--novel-danger); }
.novel .blk {
  display: inline-block;
  width: 1em;
  height: .86em;
  margin-inline: .05em;
  background: currentColor;
  border-radius: 1px;
  vertical-align: -.1em;
}
.novel .asterisk { letter-spacing: .5em; opacity: .75; }
.novel-rule {
  width: 55%;
  margin: 1.8em auto;
  border: 0;
  border-top: 1px solid var(--novel-line);
}
.novel-cover {
  text-align: center;
  padding: .6em 0 2.4em;
  margin-bottom: 2.2em;
  border-bottom: 1px solid var(--novel-line);
}
.novel-title {
  font-size: 1.8em;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.5;
  margin-bottom: .9em;
}
.novel-cover-line {
  text-indent: 0;
  font-size: .95em;
  color: var(--novel-muted);
  margin-bottom: .3em;
}
.novel-chapter {
  font-size: 1.42em;
  font-weight: 700;
  letter-spacing: .14em;
  text-align: center;
  margin: 2.6em 0 1.6em;
}
.novel-center { text-align: center; margin: 1.7em 0; }
.novel-center p { text-indent: 0; margin-bottom: .35em; }
.novel-right { text-align: right; margin: 1.7em 0; }
.novel-right p { text-indent: 0; margin-bottom: .3em; }
.novel-quote {
  margin: 1.7em 0;
  padding-left: 1.4em;
  border-left: 3px solid var(--novel-line);
}
.novel-quote p { text-indent: 0; }
.novel-inner {
  margin: 1.7em 0;
  padding: 1em 1.35em;
  border-left: 3px solid #708090;
  border-radius: 0 6px 6px 0;
  background: var(--novel-box);
  color: var(--novel-muted);
}
.novel-inner p { text-indent: 0; margin-bottom: .5em; }
.novel-inner .hei { color: var(--novel-ink); }
.novel-review {
  margin: 1.7em 0;
  padding: 1.1em 1.4em;
  border: 1px solid var(--novel-danger);
  border-radius: 8px;
}
.novel-review p { text-indent: 0; margin-bottom: .5em; }
.novel-review .hei { color: var(--novel-ink); }

body.novel-standalone { background: var(--reader-bg); }
.novel-standalone .novel { margin-block: clamp(20px, 5vw, 60px); }

.reader-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--reader-bg);
  text-align: center;
}
.reader-status[hidden] { display: none; }
.reader-status p { color: var(--text-2); font-size: .9rem; letter-spacing: .06em; }
.reader-status .error-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
}
.spinner {
  width: 30px; height: 30px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.reader.is-immersive .reader-bar { transform: translateY(-102%); opacity: 0; pointer-events: none; }
.reader.is-immersive .reader-stage { padding-top: clamp(8px, 1.5vw, 16px); }

.reader-toast {
  position: absolute;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 5;
  transform: translate(-50%, 12px);
  max-width: min(86vw, 420px);
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--reader-bar);
  color: var(--text-2);
  font-size: .82rem;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.reader-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 入场动画 ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
}
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity .7s cubic-bezier(.22, .61, .36, 1), transform .7s cubic-bezier(.22, .61, .36, 1);
}
html.js .feature-grid .reveal:nth-child(2),
html.js .link-grid .reveal:nth-child(2) { transition-delay: .09s; }
html.js .feature-grid .reveal:nth-child(3),
html.js .link-grid .reveal:nth-child(3) { transition-delay: .18s; }

/* ---------- 响应式：平板 ---------- */
@media (max-width: 1024px) {
  .work-card { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
  .cv-layout { grid-template-columns: 1fr; }
}

/* ---------- 响应式：手机 / 小平板 ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    inset: var(--header-h) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px clamp(16px, 5vw, 28px) 22px;
    background: var(--surface);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, transform .28s ease, visibility .28s;
  }
  .nav-menu.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .nav-link {
    padding: 13px 14px;
    border-radius: 12px;
    font-size: 1rem;
  }
  .nav-link::after { display: none; }
  .nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
  .theme-toggle {
    align-self: flex-start;
    margin: 8px 0 0;
    width: auto;
    height: auto;
    padding: 10px 16px;
    border-radius: 999px;
    gap: 10px;
  }
  .theme-toggle::after {
    content: "主题：跟随系统";
    font-size: .85rem;
  }
  html[data-mode="light"] .theme-toggle::after { content: "主题：浅色"; }
  html[data-mode="dark"] .theme-toggle::after { content: "主题：深色"; }

  .hero { min-height: auto; padding-top: calc(var(--header-h) + 56px); }
  .hero-chips li { border-radius: 14px; }
  .scroll-cue { display: none; }

  .work-card { grid-template-columns: 1fr; }
  .work-cover { padding: 24px; }
  .cover-frame { width: min(100%, 230px); transform: none; }
  .cover-frame:hover { transform: none; }

  .feature-card { padding: 24px 22px 26px; }

  .reader-title { max-width: 34vw; }
  .reader-counter { display: none; }
  .reader-sep { display: none; }
  .icon-btn { width: 38px; height: 38px; border-radius: 10px; }
  .reader-stage { padding-inline: 6px; }
}

/* ---------- 响应式：小手机 ---------- */
@media (max-width: 420px) {
  .brand-text small { display: none; }
  .hero-actions .btn { flex: 1 1 44%; }
  .cv-row { grid-template-columns: 96px minmax(0, 1fr); }
  .reader-subtitle { display: none; }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html.js .reveal { opacity: 1; transform: none; }
}

/* ---------- 打印 ---------- */
@media print {
  .site-header, .bg-decor, .scroll-cue, .reader, .site-footer .footer-links { display: none !important; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
