/* =========================================================
   RPF–01 · 私人档案 —— 学术档案图版
   手写样式：原生 CSS，无框架、无外链、无外部字体
   色板：纸 #EFE7D4 / 案卷底 #D2C7B2 / 墨 #1E1B16
        次墨 #5B5448 / 发丝线 #C3B7A0 / 朱印 #A33B2B
   ========================================================= */

:root {
  --paper: #EFE7D4;
  --backing: #D2C7B2;
  --ink: #1E1B16;
  --ink-2: #5B5448;
  --hair: #C3B7A0;
  --seal: #A33B2B;
  --hover: #E8DFCC;
  --plate: #F8F3E7;
  --serif: Georgia, "Times New Roman", "Songti SC", STSong, SimSun, serif;
  --mono: Consolas, Menlo, "Courier New", monospace;
  --kai: KaiTi, STKaiti, "Kaiti SC", "Songti SC", serif;
  --sheet: 1120px;
  --pad: 56px;
}

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

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

body {
  margin: 0;
  background: var(--backing);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg { max-width: 100%; }

a { color: inherit; }

button,
select { font: inherit; }

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

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

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

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 30;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 14px;
}

.skip:focus { top: 16px; }

.mono {
  font-family: var(--mono);
  letter-spacing: .08em;
}

/* ---------- 纸页与案卷 ---------- */

.file-wrap {
  max-width: calc(var(--sheet) + 48px);
  margin: 40px auto 64px;
  padding: 0 24px;
}

.file-tab {
  position: relative;
  z-index: 1;
  width: max-content;
  margin: 0 0 -1px 28px;
  padding: 7px 16px 8px;
  border: 1px solid var(--ink);
  border-bottom: 0;
  background: var(--paper);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .16em;
  color: var(--ink-2);
}

.sheet-frame {
  border: 1px solid var(--ink);
  padding: 12px;
  background: var(--paper);
}

.sheet {
  position: relative;
  max-width: var(--sheet);
  margin: 0 auto;
  padding: var(--pad) var(--pad) 36px;
  border: 1px solid var(--hair);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(30, 27, 22, .02) 0 1px,
    transparent 1px 6px
  );
}

/* 左外缘竖排书脊 */
.sheet::before {
  content: "私人档案 · 卷一";
  position: absolute;
  left: 14px;
  top: 186px;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1;
  letter-spacing: .35em;
  color: var(--ink-2);
  pointer-events: none;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--hair);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink-2);
}

/* ---------- 首屏 ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 56px;
  align-items: start;
  padding: 62px 0 72px;
}

.kicker {
  margin: 0 0 22px;
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-2);
}

.latin {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: .28em;
  color: var(--ink-2);
}

h1 {
  margin: 0;
  font-weight: 400;
  line-height: .95;
}

.name-first {
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.4;
  letter-spacing: .08em;
}

.name-last {
  display: block;
  font-size: clamp(96px, 11vw, 150px);
  line-height: 1;
  letter-spacing: .02em;
}

.hero-sub {
  max-width: 24em;
  margin: 28px 0 32px;
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink-2);
  text-wrap: balance;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 11px 24px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: .14em;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}

.btn::after {
  content: "→";
  font-family: var(--mono);
  font-size: 15px;
  transition: transform .12s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.btn:hover::after { transform: translateX(4px); }

.hero-hint {
  margin: 18px 0 0;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-2);
}

/* ---------- 图版 ---------- */

.plate {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 4px 0 0 auto;
}

.plate-frame {
  position: relative;
  margin: 0;
  padding: 12px 12px 10px;
  border: 1px solid var(--ink);
  background: var(--plate);
}

.plate-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--hair);
  pointer-events: none;
}

.plate-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-2);
}

.plate-figure {
  display: block;
  width: 100%;
  height: auto;
}

.plate-cap {
  display: block;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--hair);
  font-size: 10px;
  line-height: 1.65;
  color: var(--ink-2);
}

.plate-cap span { display: block; }

.crop {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--ink);
  pointer-events: none;
}

.crop-tl { top: -6px; left: -6px; border-top-width: 1px; border-left-width: 1px; }
.crop-tr { top: -6px; right: -6px; border-top-width: 1px; border-right-width: 1px; }
.crop-bl { bottom: -6px; left: -6px; border-bottom-width: 1px; border-left-width: 1px; }
.crop-br { bottom: -6px; right: -6px; border-bottom-width: 1px; border-right-width: 1px; }

.seal {
  position: absolute;
  left: -22px;
  bottom: 88px;
  width: 52%;
  max-width: 190px;
  height: auto;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
  opacity: .9;
  pointer-events: none;
}

/* 图版自绘：只画一次 */
.plate-figure .draw path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.2s ease-out forwards;
}

.plate-figure .draw path:nth-child(2) { animation-delay: .12s; }
.plate-figure .draw path:nth-child(3) { animation-delay: .24s; }

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

/* ---------- 版心：索引 + 内容 ---------- */

.layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0 44px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
}

.index {
  position: sticky;
  top: 24px;
  padding-top: 46px;
}

.index-title {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--ink-2);
}

.index ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.index li { margin: 0 0 2px; }

.index a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0 7px 20px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  text-decoration: none;
}

.index a .mono {
  font-size: 10px;
  color: var(--ink-2);
}

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

.index a[aria-current="true"] { color: var(--ink); }

.index a[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 2px;
  margin-top: -1px;
  background: var(--seal);
}

.content { min-width: 0; }

.content > .sec:first-child { border-top: 0; }

/* ---------- 分区 ---------- */

section[id] { scroll-margin-top: 28px; }

main section[tabindex="-1"]:focus { outline: none; }

main[tabindex="-1"]:focus { outline: none; }

.sec {
  padding: 46px 0 62px;
  border-top: 1px solid var(--hair);
}

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
}

.sec-no {
  font-size: 11px;
  color: var(--ink-2);
}

.sec-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: .06em;
}

.sec-rule {
  flex: 1;
  height: 1px;
  background: var(--hair);
  transform: translateY(-4px);
}

.sec.is-current .sec-rule {
  background: linear-gradient(90deg, var(--seal) 0 48px, var(--hair) 48px 100%);
}

.sec-count {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-2);
}

.sec-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 36px;
  align-items: start;
}

/* ---------- 正文 ---------- */

.prose { max-width: 34em; }

.prose p {
  margin: 0 0 1.15em;
  text-indent: 2em;
}

.prose p:last-child { margin-bottom: 0; }

.editor-note {
  margin: 0 0 22px;
  padding-left: 14px;
  border-left: 1px solid var(--hair);
  text-indent: 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
}

.margin-notes {
  padding-top: 2px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}

.margin-notes p {
  margin: 0 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
}

.aster {
  margin-right: .3em;
  color: var(--ink-2);
}

/* ---------- 引文 ---------- */

.pullquote {
  margin: 0;
  padding: 38px 0 38px 36px;
  border-top: 1px solid var(--hair);
  border-left: 2px solid var(--seal);
}

.q-en {
  max-width: 40em;
  margin: 0 0 14px;
  font-size: 18px;
  font-style: italic;
  line-height: 1.75;
  color: var(--ink-2);
  text-wrap: balance;
}

.q-zh {
  margin: 0 0 16px;
  font-family: var(--kai);
  font-size: 22px;
  line-height: 1.8;
  letter-spacing: .02em;
}

.q-src {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--ink-2);
}

/* ---------- 作品台账 ---------- */

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hair);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px 6px;
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  border-bottom-color: transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .08em;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}

.chip:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--ink);
  border-bottom-color: var(--seal);
  background: var(--plate);
  color: var(--ink);
}

.sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-2);
}

.sort select {
  padding: 4px 8px 5px;
  border: 1px solid var(--hair);
  background: var(--plate);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--hair);
  background: var(--hair);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 14px;
  background: var(--paper);
  transition: background .12s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: transparent;
  transition: background .12s ease;
}

.card:hover { background: var(--hover); }
.card:hover::before { background: var(--ink); }
.card[hidden] { display: none; }

.card-fig {
  margin: 0;
  padding: 6px;
  border: 1px solid var(--hair);
  background: var(--plate);
}

.card-fig img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: contain;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--ink-2);
}

.card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: .04em;
}

.card-text {
  flex: 1;
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
}

.card-foot {
  display: flex;
  justify-content: flex-end;
}

.note-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .12em;
  cursor: pointer;
}

.note-toggle:hover {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.toggle-mark {
  font-family: var(--mono);
  font-size: 12px;
}

.note {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .18s ease;
}

.note-inner {
  overflow: hidden;
  visibility: hidden;
  transition: visibility 0s .18s;
}

.card.is-open .note { grid-template-rows: 1fr; }

.card.is-open .note-inner {
  visibility: visible;
  transition-delay: 0s;
}

.note-inner p {
  margin: 10px 0 8px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}

.copy {
  padding: 4px 8px 5px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.works-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 28px;
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}

.works-notes p {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
}

/* ---------- 联系方式 ---------- */

.contact-list {
  margin: 0;
  border-top: 1px solid var(--hair);
}

.crow {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}

.crow dt {
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--ink-2);
}

.crow dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.crow a {
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
}

.crow a:hover { border-bottom-color: var(--ink); }

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 0 4px;
  border: 1px solid var(--hair);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--ink-2);
  vertical-align: 2px;
}

.contact-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------- 页脚 ---------- */

.colophon {
  margin-top: 8px;
  padding: 24px 0 0;
  border-top: 1px solid var(--hair);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.colophon p { margin: 0 0 6px; }

.colophon .end {
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: .16em;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  :root { --pad: 44px; }
  .layout { grid-template-columns: 132px minmax(0, 1fr); gap: 0 34px; }
  .hero { gap: 40px; }
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .index {
    position: static;
    padding: 18px 0 0;
    border-bottom: 1px solid var(--hair);
    margin-bottom: 4px;
  }

  .index-title { display: none; }

  .index ol {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 24px;
  }

  .index li { margin: 0; }

  .index a {
    padding: 7px 0 10px;
    font-size: 13.5px;
  }

  .index a[aria-current="true"]::before {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    margin: 0;
  }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .plate {
    max-width: 360px;
    margin: 0;
  }

  .sec-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .margin-notes { padding-top: 0; }
}

@media (max-width: 640px) {
  :root { --pad: 24px; }

  .file-wrap {
    margin: 20px auto 40px;
    padding: 0 12px;
  }

  .file-tab { margin-left: 12px; }

  .sheet-frame { padding: 6px; }

  .sheet::before { display: none; }

  .masthead {
    font-size: 9px;
    letter-spacing: .08em;
  }

  .hero { padding: 40px 0 48px; }

  .name-last { font-size: clamp(84px, 22vw, 120px); }

  .hero-sub { font-size: 16.5px; }

  .sec { padding: 34px 0 44px; }

  .sec-head { margin-bottom: 20px; }

  .sec-head h2 { font-size: 22px; }

  .grid { grid-template-columns: minmax(0, 1fr); }

  .works-notes { grid-template-columns: minmax(0, 1fr); }

  .crow {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
  }

  .seal {
    left: -8px;
    bottom: 96px;
    width: 44%;
    max-width: 150px;
  }

  .seal text:last-of-type { display: none; }

  .plate-head,
  .plate-cap { font-size: 10.5px; }

  .index ol {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 2px 24px;
  }

  .q-zh { font-size: 19px; }

  .pullquote { padding-left: 20px; }
}

@media (max-width: 360px) {
  .masthead {
    flex-direction: column;
    gap: 2px;
  }
}

/* ---------- 减少动态 ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .plate-figure .draw path {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* ---------- 打印 ---------- */

@media print {
  @page { margin: 18mm; }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .file-wrap {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .file-tab,
  .index,
  .tools,
  .note-toggle,
  .copy,
  .skip,
  .hero-hint { display: none; }

  .sheet-frame {
    border: 0;
    padding: 0;
    background: none;
  }

  .sheet {
    max-width: none;
    border: 0;
    padding: 0;
    background: #fff;
  }

  .sheet::before { display: none; }

  .seal {
    mix-blend-mode: normal;
    opacity: 1;
  }

  .plate-figure .draw path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .note { grid-template-rows: 1fr !important; }

  .note-inner { visibility: visible !important; }

  .card {
    break-inside: avoid;
    background: #fff;
  }

  .grid {
    gap: 0;
    border-color: #999;
  }

  .card { border-top: 1px solid #999; }

  a { text-decoration: none; }

  .hero {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
  }

  .layout { display: block; }

  .pullquote { break-inside: avoid; }
}
