/* ============================================================
 *  手作纸质感 · CSS3D 翻页书
 * ============================================================ */

:root {
  --pw: 460px;          /* 单页宽 */
  --ph: 630px;          /* 单页高 */
  --paper: #f3e7d0;     /* 纸面暖色 */
  --paper-2: #ece0c6;   /* 纸面暗部 */
  --ink: #463a2c;       /* 正文墨色 */
  --ink-soft: #7a6a52;  /* 次要文字 */
  --accent: #9a6a32;    /* 点缀（暖棕） */
  --skin: #4a3526;      /* 书皮深棕 */
  --skin-2: #3a281b;    /* 书皮暗部 */
  --gold: #d8bd86;      /* 烫金 */
  --shadow: rgba(40, 28, 16, 0.35);
}

* { box-sizing: border-box; }

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

body {
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  color: var(--ink);
  background:
    radial-gradient(120% 120% at 50% 0%, #5b4a39 0%, #423425 45%, #2c2016 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  color: #e9dcc4;
  flex: 0 0 auto;
}
.brand {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  letter-spacing: 0.18em;
  font-size: 18px;
  opacity: 0.85;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toolbar button {
  font-family: inherit;
  font-size: 14px;
  color: #f0e6d2;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 214, 176, 0.35);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.toolbar button:hover { background: rgba(255, 255, 255, 0.14); }
.toolbar button:active { transform: translateY(1px); }
#indicator {
  min-width: 96px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2600px;
  padding: 24px;
}

/* ---------- 书 ---------- */
.book {
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  transform-style: preserve-3d;
  transform: translateZ(0);
  transition: transform 0.45s ease;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.45));
}
/* 合上时整本书左移半页，让封面居中 */
.book.closed {
  transform: translateX(-25%) translateZ(0);
}

/* ---------- 纸张 ---------- */
.sheet {
  position: absolute;
  top: 0;
  left: 50%;                 /* 书脊在书的中线 */
  width: var(--pw);
  height: var(--ph);
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background-color: var(--paper);
  /* 纸张纹理：细腻噪点叠加暖色 */
  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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  box-shadow:
    inset 0 0 38px rgba(120, 90, 50, 0.10),
    inset 7px 0 16px rgba(80, 55, 25, 0.10);
}
.face.front {
  border-radius: 2px 7px 7px 2px;
  /* 左侧（书脊）压暗 */
  background-image:
    linear-gradient(90deg, rgba(80, 55, 25, 0.16) 0%, rgba(80, 55, 25, 0) 9%),
    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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
.face.back {
  transform: rotateY(180deg);
  border-radius: 7px 2px 2px 7px;
  background-image:
    linear-gradient(270deg, rgba(80, 55, 25, 0.16) 0%, rgba(80, 55, 25, 0) 9%),
    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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* 翻页时的弯曲阴影层 */
.shade {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.face.front .shade {
  background: linear-gradient(90deg, rgba(35, 22, 10, 0.55) 0%, rgba(35, 22, 10, 0) 52%);
}
.face.back .shade {
  background: linear-gradient(270deg, rgba(35, 22, 10, 0.55) 0%, rgba(35, 22, 10, 0) 52%);
}

/* ---------- 页内容通用 ---------- */
.page {
  position: absolute;
  inset: 0;
  padding: 46px 40px;
  display: flex;
  flex-direction: column;
}
.folio {
  font-family: "Cormorant Garamond", serif;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
/* 页码角标：左页偶数页在左下，右页奇数页在右下 */
.pagenum {
  position: absolute;
  bottom: 14px;
  font-family: "Cormorant Garamond", serif;
  font-size: 12.5px;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
  opacity: 0.7;
  pointer-events: none;
}
.pagenum--left { left: 40px; }
.pagenum--right { right: 40px; }
/* 右页图集：缩略图条占底部，页码上移到大图右下角避免遮挡 */
.image-page .pagenum--right { bottom: 86px; right: 18px; }
.page-h {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--ink);
}
.meta {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 22px;
}
.desc { font-size: 15.5px; line-height: 1.95; color: var(--ink); }
.desc p { margin: 0 0 12px; }
.tags {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 18px;
}
.tags span {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  border: 1px solid rgba(120, 95, 60, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
}
.lead {
  font-size: 16px;
  line-height: 2;
  color: var(--ink);
  margin: 0;
}

/* 作品左页正文（来自后台「文字」框） */
.work-text {
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--ink);
}
.work-text p { margin: 0 0 12px; }
.empty-note {
  color: var(--ink-soft);
  font-style: italic;
}

/* 目录 */
.toc {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.toc li {
  border-bottom: 1px dashed rgba(120, 95, 60, 0.3);
}
.toc li:last-child { border-bottom: none; }
/* 可点击的目录条目：整行高亮，悬停显示「›」提示可跳转 */
.toc-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.1s ease;
}
.toc-link:hover { background: rgba(154, 106, 50, 0.12); }
.toc-link:active { transform: translateX(2px); }
.toc-no {
  font-family: "Cormorant Garamond", serif;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.1em;
  min-width: 46px;
  flex: 0 0 auto;
}
.toc-t {
  flex: 1 1 auto;
  font-size: 16px;
  line-height: 1.4;
}
.toc-go {
  color: var(--accent);
  font-size: 18px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  flex: 0 0 auto;
}
.toc-link:hover .toc-go { opacity: 1; transform: translateX(0); }

/* 图片页 */
.image-page {
  padding: 0;
  background: var(--paper-2);
}
/* 右页图集：大图 + 底部缩略图条切换 */
.gallery {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
}
.gallery-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 20px; /* 图片左右各留 20px 纯纸色留白 */
}
.gallery-main .work-img {
  width: 100%;
  height: 100%;
  /* contain：整张图完整显示、不变形；顶部保留约 20px 天头，空白集中在下方 */
  object-fit: contain;
  object-position: center 20px;
  display: block;
}
.gallery-thumbs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  background: rgba(80, 55, 25, 0.14);
}
.gallery-thumbs .thumb {
  height: 54px;
  width: auto;
  flex: 0 0 auto;
  border-radius: 4px;
  cursor: pointer;
  object-fit: cover;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s;
}
.gallery-thumbs .thumb:hover { opacity: 1; }
.gallery-thumbs .thumb.active {
  opacity: 1;
  border-color: var(--accent);
}
/* 视频铺满右页，contain 避免变形，黑底更聚焦 */
.work-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #15110b;
  display: block;
}
.placeholder {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 0.05em;
  border: 2px dashed rgba(120, 95, 60, 0.4);
  border-radius: 4px;
}
.placeholder small { font-size: 12px; opacity: 0.8; }

/* 联系 / 后记 */
.contact {
  margin-top: auto;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

/* ---------- 书皮（封面 / 封底） ---------- */
.cover-skin {
  background-color: var(--skin);
  background-image:
    radial-gradient(140% 120% at 30% 10%, rgba(255, 220, 170, 0.10) 0%, rgba(0, 0, 0, 0) 55%),
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
  color: var(--gold);
}
.cover-skin .cover-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  gap: 16px;
}
.cover-rule {
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.8;
}
.cover-rule.slim { width: 40px; }
.cover-title {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 600;
  font-size: 46px;
  line-height: 1.15;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.cover-title.small { font-size: 34px; }
.cover-sub {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.42em;
  font-size: 14px;
  text-transform: uppercase;
  opacity: 0.85;
}
.cover-author {
  font-size: 16px;
  letter-spacing: 0.22em;
  opacity: 0.9;
}
.cover-year {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.3em;
  font-size: 13px;
  opacity: 0.7;
}

/* ---------- 封面 / 封底：SVG 黏土插画容器 ---------- */
.cover-art {
  padding: 0;
  background: transparent;
}
.cover-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
/* 叠一层细微颗粒，增强手作质感 */
.cover-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* ---------- 简历页（融进书开头，延续纸质感）---------- */
.resume-page {
  font-size: 14px;
  color: var(--ink);
  gap: 4px;
}
/* 个人抬头：照片右上角 + 姓名信息 */
.resume-head { align-items: stretch; }
.resume-photo-wrap {
  align-self: flex-end;   /* 照片靠右上角 */
  margin-bottom: 10px;
}
.resume-photo {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(80, 55, 25, 0.28);
  background: #e7d9bd;
  display: block;
}
.resume-photo--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.12em;
  border: 2px dashed rgba(120, 95, 60, 0.45);
}
.resume-name {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 4px;
  color: var(--ink);
}
.resume-intention {
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 16px;
}
.resume-basic {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.resume-row {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.6;
}
.resume-k {
  color: var(--ink-soft);
  min-width: 50px;
  flex: 0 0 auto;
}
.resume-v {
  color: var(--ink);
  word-break: break-all;
}

/* 分区：标题 + 条目列表 */
.resume-block { margin-bottom: 18px; }
.resume-block-h {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
  border-bottom: 1px solid rgba(120, 95, 60, 0.35);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.resume-summary {
  font-size: 13.5px;
  line-height: 1.85;
  margin: 0;
  color: var(--ink);
}
.resume-skill {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ink-soft);
  border: 1px solid rgba(120, 95, 60, 0.4);
  border-radius: 999px;
  padding: 3px 11px;
  margin: 0 6px 8px 0;
}
.resume-item { margin-bottom: 12px; }
.resume-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.resume-item-t {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.resume-item-time {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  flex: 0 0 auto;
}
.resume-item-sub {
  font-size: 13px;
  color: var(--accent);
  margin: 2px 0;
}
.resume-item-d {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  margin-top: 2px;
}

/* 小屏进一步收紧简历字号，避免溢出 */
@media (max-width: 660px) {
  .resume-name { font-size: 22px; }
  .resume-page { font-size: 12.5px; }
  .resume-photo { width: 70px; height: 70px; }
  .resume-block-h { font-size: 13px; }
  .resume-item-t { font-size: 13px; }
}

/* ---------- 底部提示 ---------- */
.hint {
  flex: 0 0 auto;
  text-align: center;
  padding: 14px;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: rgba(233, 220, 196, 0.6);
}

/* ---------- 角落「返回目录」按钮 ---------- */
.toc-home {
  position: fixed;
  left: 22px;
  bottom: 18px;
  z-index: 50;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #f0e6d2;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 214, 176, 0.3);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, background 0.2s ease, transform 0.1s ease;
}
.toc-home.show { opacity: 0.85; pointer-events: auto; }
.toc-home:hover { background: rgba(255, 255, 255, 0.14); }
.toc-home:active { transform: translateY(1px); }

/* ---------- 响应式：整体缩小双开视图 ---------- */
@media (max-width: 880px) {
  :root { --pw: 300px; --ph: 412px; }
  .page { padding: 34px 30px; }
  .page-h { font-size: 25px; }
}
@media (max-width: 660px) {
  :root { --pw: 224px; --ph: 308px; }
  .page { padding: 24px 22px; }
  .page-h { font-size: 21px; }
  .desc { font-size: 13px; line-height: 1.8; }
  .lead { font-size: 13.5px; }
  .cover-title { font-size: 34px; }
  .cover-title.small { font-size: 26px; }
  .brand { display: none; }
}
