﻿/* ══════════════════════════════════════════════════
   知人志 · 样式
   纸张质感 / 横向滑动 / 肖像册页
   ══════════════════════════════════════════════════ */

:root {
  --paper: #f2f2f0;
  --card: #fbfbfa;
  --ink: #17181a;
  --muted: #6c6e72;
  --line: #dcdcda;
  --accent: #1f2933;
  --gold: #8a6f55;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --paper: #0e0f11;
  --card: #16181b;
  --ink: #e9eaec;
  --muted: #909499;
  --line: #262a2e;
  --accent: #a8c0d6;
  --gold: #c39a72;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background:
    radial-gradient(120% 90% at 8% -12%, #fbfbfa 0%, transparent 56%),
    radial-gradient(90% 70% at 104% 112%, #e4e4e2 0%, transparent 60%),
    var(--paper);
  color: var(--ink);
  font: 15.5px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .25s, color .25s;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(120% 90% at 8% -12%, #1a1c1f 0%, transparent 56%),
    radial-gradient(90% 70% at 104% 112%, #08090a 0%, transparent 60%),
    var(--paper);
}

/* 缓慢流动的两团光：暖的靠肖像，冷的靠文字 */
body::before {
  content: "";
  position: fixed; inset: -12%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 30% at 76% 26%, rgba(205, 158, 106, .16), transparent 62%),
    radial-gradient(34% 30% at 20% 74%, rgba(104, 142, 186, .14), transparent 64%);
  filter: blur(8px);
  animation: drift 54s ease-in-out infinite alternate;
}

html[data-theme="dark"] body::before {
  mix-blend-mode: screen;
  background:
    radial-gradient(26% 26% at 73% 40%, rgba(230, 182, 122, .34), transparent 66%),
    radial-gradient(30% 30% at 18% 70%, rgba(92, 134, 184, .13), transparent 70%),
    radial-gradient(55% 42% at 0% 0%, rgba(255, 255, 255, .045), transparent 72%);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(38% 30% at 76% 26%, rgba(255, 236, 214, .85), transparent 62%),
    radial-gradient(34% 30% at 20% 74%, rgba(226, 233, 242, .75), transparent 64%);
  opacity: .8;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 2%, 0) scale(1.07); }
}

/* 纸面颗粒 */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 6;
  pointer-events: none;
  opacity: .30;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
}
html[data-theme="dark"] body::after { mix-blend-mode: screen; opacity: .10; }

::selection { background: color-mix(in srgb, var(--gold) 24%, transparent); }

svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  padding: 8px 14px; background: var(--accent); color: var(--paper);
  font-size: 13px; text-decoration: none;
}
.skip:focus { left: 12px; top: 12px; }

/* ── 顶栏 ───────────────────────────────────────── */

.bar {
  position: relative; z-index: 10;
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  padding: 0 clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit;
  font-family: var(--serif); font-size: 16px; letter-spacing: 2px;
}
.brand-mark {
  width: 27px; height: 27px;
  display: grid; place-items: center;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 15px; line-height: 1; border-radius: 1px;
}

.bar-right { display: flex; align-items: center; gap: 18px; }

.counter {
  font-family: var(--serif);
  font-size: 13px; letter-spacing: 1px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.counter b { color: var(--ink); font-size: 15px; font-weight: 600; margin-right: 5px; }
.counter i { margin: 0 3px; font-style: normal; opacity: .45; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 1px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── 滑动主体 ───────────────────────────────────── */

main {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  position: relative; z-index: 2;
}

.deck {
  flex: 1; min-height: 0;
  display: flex;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  outline: none;
}
.deck::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  align-items: center;
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(18px, 4vh, 44px) clamp(20px, 6vw, 86px);
  overflow: hidden;
}

/* 册页编号，压在最底层 */
.folio {
  position: absolute;
  right: -1vw;
  top: 50%; transform: translateY(-50%);
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(110px, 15vw, 210px);
  line-height: .8;
  color: color-mix(in srgb, var(--ink) 6%, transparent);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.slide-text { position: relative; z-index: 2; max-width: 34rem; }

.era {
  margin: 0 0 16px;
  font-size: 11.5px; letter-spacing: 3.2px;
  color: var(--gold); text-transform: uppercase;
}

.name {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 3px;
}
.name small {
  display: block; margin-top: 10px;
  font-family: var(--sans);
  font-size: 12px; letter-spacing: 2px;
  color: var(--muted); font-weight: 400;
}

.sum {
  margin: 0 0 26px;
  font-size: 15px; line-height: 1.95;
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
  max-width: 30ch;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.tag {
  padding: 2px 10px;
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  color: var(--gold);
  font-size: 11.5px; letter-spacing: 1px;
  border-radius: 1px;
}

.more {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 0 0 6px;
  border: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  background: none; color: var(--ink);
  font: inherit; font-size: 13.5px; letter-spacing: 1.5px;
  cursor: pointer;
  transition: border-color .2s, color .2s, gap .2s;
}
.more:hover { border-color: var(--accent); color: var(--accent); gap: 16px; }
.more span { font-size: 15px; }

/* 肖像 */
.portrait {
  position: relative; z-index: 1;
  justify-self: center; align-self: center;
  width: min(40vh, 330px);
  aspect-ratio: 3 / 4;
  margin: 0;
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: grayscale(.14) sepia(.05) contrast(1.04);
  border: 1px solid var(--line);
  box-shadow: 16px 16px 0 -8px color-mix(in srgb, var(--ink) 6%, transparent);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.slide.is-active .portrait img { transform: translateY(-4px); }

.portrait.is-empty {
  border: 1px dashed color-mix(in srgb, var(--line) 90%, var(--ink));
  background: var(--paper);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--muted);
}
.portrait.is-empty .silhouette { width: 58%; opacity: .8; }
.portrait.is-empty .silhouette svg { width: 100%; height: auto; stroke-width: .8; stroke: color-mix(in srgb, var(--ink) 26%, transparent); }
.portrait.is-empty .empty-label { font-size: 11px; letter-spacing: 2px; }

.credit {
  position: absolute; left: 0; bottom: -22px;
  font-size: 10.5px; letter-spacing: .6px;
  color: var(--muted);
  max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 入场动画 */
.slide-text > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.slide.is-active .slide-text > * { opacity: 1; transform: none; }
.slide.is-active .slide-text > *:nth-child(2) { transition-delay: .07s; }
.slide.is-active .slide-text > *:nth-child(3) { transition-delay: .14s; }
.slide.is-active .slide-text > *:nth-child(4) { transition-delay: .21s; }
.slide.is-active .slide-text > *:nth-child(5) { transition-delay: .28s; }

.slide .portrait { opacity: 0; transition: opacity .9s var(--ease) .1s; }
.slide.is-active .portrait { opacity: 1; }

/* ── 底部翻页 ───────────────────────────────────── */

.pager {
  flex: none;
  display: flex; align-items: center; gap: 20px;
  height: 66px;
  padding: 0 clamp(20px, 6vw, 86px);
  border-top: 1px solid var(--line);
  position: relative; z-index: 10;
}

.pager-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 1px; cursor: pointer; font-size: 15px;
  transition: border-color .2s, color .2s;
}
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }

.rail {
  flex: 1; height: 1px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  position: relative;
}
.rail span {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 20%;
  background: var(--ink);
  transition: width .3s var(--ease);
}

/* ── 详情抽屉 ───────────────────────────────────── */

.drawer { position: fixed; inset: 0; z-index: 40; }

.drawer-mask {
  position: absolute; inset: 0;
  background: rgba(14, 13, 11, .42);
  backdrop-filter: blur(3px);
  animation: fade .2s ease;
}

.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 34px clamp(22px, 4vw, 46px) 64px;
  animation: slide .26s var(--ease);
  outline: none;
}

.drawer-close, .vault-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 19px; line-height: 1; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.drawer-close:hover, .vault-close:hover { color: var(--ink); border-color: var(--muted); }

.d-top { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.d-seal {
  width: 54px; height: 54px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--serif); font-size: 25px; line-height: 1;
  transition: transform .2s, border-color .2s, color .2s;
}
.d-seal.is-secret { cursor: pointer; }
.d-seal.is-secret:hover { border-color: var(--gold); color: var(--gold); transform: rotate(-4deg); }
.d-seal.is-secret:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.d-name { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: 2px; }
.d-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.d-fields { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0 24px; }

.d-bio {
  margin: 0 0 30px;
  font-size: 14.8px; line-height: 2;
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.d-h3 {
  margin: 0 0 15px;
  font-size: 11px; letter-spacing: 2.6px; text-transform: uppercase;
  color: var(--gold);
}

.tl { list-style: none; margin: 0 0 30px; padding: 0 0 0 14px; border-left: 1px solid var(--line); }
.tl li { position: relative; padding: 0 0 17px 16px; font-size: 13.8px; color: var(--muted); }
.tl li::before {
  content: ""; position: absolute; left: -18.5px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--accent);
}
.tl .year { display: block; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }

.d-works { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; padding: 0; list-style: none; }
.d-works li {
  font-size: 12.5px; padding: 3px 11px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}

.d-quote {
  margin: 0; padding: 18px 20px;
  border-left: 2px solid var(--gold);
  background: var(--card);
  font-family: var(--serif);
  font-size: 15.5px; line-height: 1.9;
}

/* ── 档案室 ─────────────────────────────────────── */

.vault {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(20px, 6vh, 72px) 16px;
  background: rgba(10, 10, 9, .66);
  backdrop-filter: blur(5px);
  overflow-y: auto;
  animation: fade .2s ease;
}

.vault-panel {
  position: relative;
  width: min(1000px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .65);
  animation: rise .28s var(--ease);
  outline: none;
}

.vault-head { display: flex; align-items: flex-start; gap: 20px; }
.vault-kicker { margin: 0 0 8px; font-size: 10.5px; letter-spacing: 3px; color: var(--gold); text-transform: uppercase; }
.vault-head h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 26px; letter-spacing: 3px; font-weight: 600; }
.vault-note { margin: 0; color: var(--muted); font-size: 13px; }
.vault-close { position: static; margin-left: auto; flex: none; }

.vault-actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 26px 0 18px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.vault-hint { color: var(--muted); font-size: 12.5px; }
.vault-stat { margin-left: auto; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }

.v-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  border: 1px solid var(--line); background: var(--card);
}
.v-head { display: flex; align-items: baseline; gap: 8px; }
.v-name { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .4px; }
.v-ver { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.v-desc {
  margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.v-meta { display: flex; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.v-meta span + span::before { content: "·"; margin-right: 9px; color: var(--line); }
.v-btns { display: flex; gap: 7px; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent;
  font: inherit; font-size: 12.5px; font-weight: 550;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.btn.primary { flex: 1; background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.disabled { flex: 1; border: 1px dashed var(--line); color: var(--muted); cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

/* ── 页脚 & 提示 ────────────────────────────────── */

.colophon {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  height: 34px;
  padding: 0 clamp(20px, 6vw, 86px);
  color: var(--muted); font-size: 11px; letter-spacing: .4px;
  border-top: 1px solid var(--line);
  position: relative; z-index: 10;
}
.foot-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--line);
  margin-left: auto; cursor: default;
  transition: background .2s, box-shadow .2s;
}
.foot-dot:hover { background: var(--gold); }
.foot-dot.found { background: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent); }

.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 80;
  transform: translate(-50%, 14px);
  padding: 9px 18px;
  background: #17140f; color: #f3efe6; font-size: 13px;
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

/* ── 响应式 ─────────────────────────────────────── */

@media (max-width: 900px) {
  body { overflow-y: auto; overflow-x: hidden; height: auto; min-height: 100%; }
  .bar { height: 58px; }

  .deck {
    display: block;
    overflow: visible;
    scroll-snap-type: none;
  }

  .slide {
    display: flex; flex-direction: column-reverse;
    align-items: flex-start;
    gap: 22px;
    padding: 30px 20px 34px;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .slide-text { max-width: 100%; }
  .name { font-size: 34px; letter-spacing: 2px; margin-bottom: 16px; }
  .sum { font-size: 14.5px; max-width: 100%; }
  .folio { font-size: 110px; right: 12px; opacity: .8; }

  .portrait { width: min(64vw, 280px); align-self: center; }
  .credit { position: static; display: block; margin-top: 8px; white-space: normal; }

  .slide-text > *, .slide .portrait { opacity: 1; transform: none; }

  /* 竖排时这些控件没有意义，藏起来 */
  .counter, .folio, .pager { display: none; }

  .colophon { height: auto; padding: 14px 20px 20px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .slide-text > *, .slide .portrait { opacity: 1; transform: none; }
}
