:root {
  --paper: #e8e4d9;
  --paper-deep: #ddd6c6;
  --ink: #1c1914;
  --muted: #5c564c;
  --line: rgba(28, 25, 20, 0.14);
  --accent: #2f5d4a;
  --num: #8a7f6b;
  --card: rgba(255, 253, 248, 0.55);
  --card-hover: rgba(255, 253, 248, 0.8);
  --glow: rgba(47, 93, 74, 0.1);
  --glow-warm: rgba(180, 150, 90, 0.1);
  --shadow-soft: rgba(28, 25, 20, 0.1);
  --shadow-lift: rgba(28, 25, 20, 0.18);
  --font-sans: 'Noto Sans SC', system-ui, sans-serif;
  --font-serif: 'Noto Serif SC', 'Songti SC', serif;
  --font-display: 'Instrument Serif', 'Noto Serif SC', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

/* —— 流动光晕背景 —— */
.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
  will-change: transform;
}

.blob-a {
  width: 46vmax;
  height: 46vmax;
  left: -8vmax;
  top: -10vmax;
  background: radial-gradient(circle at 50% 50%, var(--glow) 0%, transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.blob-b {
  width: 40vmax;
  height: 40vmax;
  right: -10vmax;
  top: 20vmax;
  background: radial-gradient(circle at 50% 50%, var(--glow-warm) 0%, transparent 65%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.blob-c {
  width: 34vmax;
  height: 34vmax;
  left: 20vmax;
  bottom: -14vmax;
  background: radial-gradient(circle at 50% 50%, var(--glow) 0%, transparent 60%);
  animation: drift-c 38s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(6vmax, 4vmax, 0) scale(1.12);
  }
}

@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.05);
  }
  to {
    transform: translate3d(-5vmax, -3vmax, 0) scale(0.95);
  }
}

@keyframes drift-c {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(4vmax, -5vmax, 0) scale(1.1);
  }
}

/* —— 光标聚光 —— */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 40%),
    var(--glow-warm) 0%,
    transparent 60%
  );
}

.js .spotlight {
  opacity: 1;
}

.paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 28%),
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(47, 93, 74, 0.07), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(28, 25, 20, 0.025) 27px,
      rgba(28, 25, 20, 0.025) 28px
    );
  animation: paper-breathe 14s ease-in-out infinite alternate;
}

.rule-v {
  position: fixed;
  top: 0;
  bottom: 0;
  left: max(1.25rem, calc(50% - 28rem));
  width: 1px;
  background: var(--line);
  pointer-events: none;
  animation: rule-in 1s ease-out both;
}

@keyframes paper-breathe {
  from {
    opacity: 0.85;
  }
  to {
    opacity: 1;
  }
}

@keyframes rule-in {
  from {
    opacity: 0;
    transform: scaleY(0.4);
    transform-origin: top;
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* —— 分层渐显 ——
   仅写 from 关键帧 + backwards 填充：动画结束后回归自然样式，
   不会用填充值钉住 transform（否则 JS 倾斜会失效）。 */
.reveal {
  animation: reveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.hub {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 12vh, 6.5rem) 1.5rem 3.5rem;
  padding-left: max(1.75rem, calc(1.5rem + 0.5vw));
}

.masthead {
  margin-bottom: clamp(2.5rem, 8vh, 4rem);
}

.name {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 11vw, 5.25rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}

.lede {
  margin: 0;
  max-width: 22rem;
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 400;
}

/* —— 卡片入口 —— */
.toc {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  perspective: 900px;
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  gap: 0.85rem 1.1rem;
  align-items: center;
  padding: 1.25rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  transform-style: preserve-3d;
  box-shadow: 0 1px 2px var(--shadow-soft);
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.25s ease;
}

.entry::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(
    180px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 255, 255, 0.28),
    transparent 55%
  );
}

.js .entry:hover::before {
  opacity: 1;
}

.entry:hover,
.entry:focus-visible {
  background: var(--card-hover);
  box-shadow:
    0 10px 30px -12px var(--shadow-lift),
    0 2px 6px -2px var(--shadow-soft);
}

.entry:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.entry:hover .title,
.entry:focus-visible .title {
  color: var(--accent);
}

.entry:hover .go,
.entry:focus-visible .go {
  transform: translateX(4px) translateZ(22px);
  opacity: 1;
}

.num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--num);
  letter-spacing: 0.02em;
  transform: translateZ(18px);
}

.body {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  transform: translateZ(12px);
}

.title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
  transition: color 0.18s ease;
}

.desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.go {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent);
  opacity: 0.45;
  transform: translateZ(22px);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.colophon {
  margin-top: 2.75rem;
  padding-top: 0;
}

.colophon p {
  margin: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.domain {
  letter-spacing: 0.04em;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .rule-v {
    left: 1rem;
  }

  .hub {
    padding-left: 1.75rem;
  }

  .entry {
    grid-template-columns: 2.2rem 1fr auto;
    gap: 0.6rem 0.75rem;
    padding: 1.1rem 0.95rem;
  }

  .blob {
    filter: blur(48px);
  }

  .spotlight {
    display: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .spotlight {
    display: none;
  }

  .entry::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .paper,
  .rule-v,
  .aura,
  .blob,
  .spotlight,
  .hub,
  .masthead,
  .toc,
  .colophon,
  .colophon p,
  .name,
  .lede,
  .reveal,
  .entry,
  .go,
  .title {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .spotlight {
    opacity: 0 !important;
  }

  .entry,
  .entry .num,
  .entry .body,
  .entry .go {
    transform: none !important;
  }
}
