/* =========================================================
   Solin · Personal Site — 极简编辑风（照片首页 / 统一网格作品集）

   目录
   01 Tokens        设计令牌（颜色 / 字体 / 版心与导航边距）
   02 Reset         基础重置
   03 Backdrop      极光夜空背景（非首页）
   04 Cursor        自定义光标（遁光光点）
   05 Header        导航栏（独立组件，三页共用 partials/nav.html）
   06 Reveal        滚动入场
   07 Intro         门页 + 星流穿越
   08 Hero          首页封面轮播
   09 Why           首页「为什么要建立这个网站」
   10 Common        区块与子标题基类
   11 About         关于我（头像 / 简介 / 音乐 / 色谱 / 书单）
   12 Portfolio     照片墙（等高 flex 墙）
   13 Lightbox      灯箱（缩放 / 左右切换 / 参数行）
   14 Footer        页脚 / 回到顶部 / 悬浮滚动条
   15 Transition    页面转场（失焦-模糊-聚焦）
   16 Responsive    响应式与降级

   约定
   - 版心：.wrap 居中限宽 1240（--maxw）；导航栏不参与版心，用 --nav-x。
   - 照片墙的 gallery 区块由 tools/build_wall.py 生成，勿手改。
   ========================================================= */

/* ---------- 01 Tokens ---------- */
:root {
  --bg:        #0d0d0c;
  --ink:       #f2f0e9;
  --ink-2:     #d3d0c7;
  --muted:     #8b877e;
  --line:      rgba(242, 240, 233, .15);
  --line-soft: rgba(242, 240, 233, .07);
  --card:      #131312;
  --shadow:    0 22px 60px -24px rgba(0, 0, 0, .8);

  /* 光标光点 */
  --cur-core:  #fff8e8;
  --cur-glow:  255, 206, 130;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", Georgia,
           "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 版心与边距：--pad 内容内边距，--edge 首页大名字左缘，--maxw 居中版心宽度 */
  --pad: clamp(20px, 5vw, 72px);
  --edge: clamp(20px, 4.5vw, 76px);
  --maxw: 1240px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 02 Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* 滚动条不占布局空间，避免切页时导航栏位移 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 0; height: 0; display: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .5s var(--ease), color .5s var(--ease);
  /* 粘性页脚：内容不足一屏时，底栏也固定在视口底部 */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol, dl, dd, dt { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--ink); color: var(--bg); }

/* 内容版心：居中限宽（原来的版式）——导航栏不参与，它是独立组件 */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.mono { font-family: var(--mono); font-size: .72em; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- 03 Backdrop：夜空极光（除首页外的所有页面；绿色光幕 + 深蓝夜空） ---------- */
body:not(.is-home)::before,
body:not(.is-home)::after {
  content: "";
  position: fixed;
  inset: -30% -20%;
  z-index: -1;
  pointer-events: none;
  transition: opacity .8s var(--ease);
}
/* 第一层：极光余晖——很淡的绿色天光，作为光帘背后的底色 */
body:not(.is-home)::before {
  background:
    radial-gradient(48% 44% at 26% 2%, rgba(88, 226, 164, .3), transparent 70%),
    radial-gradient(42% 38% at 70% 0%, rgba(70, 208, 186, .22), transparent 68%);
  filter: blur(58px) saturate(130%);
  animation: aurora-a 40s ease-in-out infinite alternate;
}
/* 第二层：环境晕染——偏青蓝的夜空底色，低处带一点点紫 */
body:not(.is-home)::after {
  background:
    radial-gradient(50% 44% at 72% 32%, rgba(44, 158, 196, .15), transparent 68%),
    radial-gradient(44% 40% at 20% 74%, rgba(58, 86, 190, .13), transparent 70%);
  filter: blur(64px) saturate(115%);
  animation: aurora-b 42s ease-in-out infinite alternate;
}

/* 极光：WebGL 实时渲染的斜向飘带 + 闪烁星空（由 main.js 注入） */
.aurora-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  filter: saturate(108%);
  transition: opacity .8s var(--ease);
}
/* 夜空兜底色（画布不透明，整屏覆盖） */
body:not(.is-home) {
  background:
    radial-gradient(130% 100% at 50% -12%, #0a1526 0%, #060c18 45%, #03060d 80%),
    #03060d;
}
/* 画布自己就是夜空，底层微光关掉，避免两套极光打架 */
body:not(.is-home)::before,
body:not(.is-home)::after { opacity: 0; }
@keyframes aurora-a {
  0%   { transform: translate3d(-2.4%, -1.2%, 0) scale(1); }
  100% { transform: translate3d(3.2%, 2%, 0) scale(1.1); }
}
@keyframes aurora-b {
  0%   { transform: translate3d(2%, 1%, 0) scale(1.06); }
  100% { transform: translate3d(-3%, -2%, 0) scale(1); }
}

/* 首帧就先隐藏原生箭头，等自定义光点接管（避免切页瞬间闪白色箭头） */
html.cursor-pending,
html.cursor-pending * { cursor: none !important; }

/* ---------- 04 Cursor：遁光光点 ---------- */
html.cursor-on,
html.cursor-on * { cursor: none !important; }

/* 默认隐藏：首次移动鼠标后才出现；离开页面时淡出 */
.cursor {
  position: fixed; top: 0; left: 0; width: 0; height: 0;
  z-index: 700; pointer-events: none;
  opacity: 0;
  transition: opacity .28s;
}
.cursor.is-on { opacity: 1; }
.cursor.is-out { opacity: 0 !important; }
.cursor__core {
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: radial-gradient(circle,
      var(--cur-core) 0 16%,
      rgba(var(--cur-glow), .85) 34%,
      rgba(var(--cur-glow), .26) 54%,
      rgba(var(--cur-glow), 0) 74%);
  box-shadow:
    0 0 7px 1px rgba(var(--cur-glow), .5),
    0 0 18px 5px rgba(var(--cur-glow), .2),
    0 0 42px 12px rgba(var(--cur-glow), .08);
  transition: width .25s var(--ease), height .25s var(--ease),
              margin .25s var(--ease), opacity .3s;
}
.cursor.is-hot .cursor__core {
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
}
.cursor.is-down .cursor__core { transform: scale(.78); }

.cursor__trail {
  position: absolute; border-radius: 50%;
  background: rgba(var(--cur-glow), .5);
  filter: blur(1px);
  pointer-events: none;
}

/* ---------- 05 Header ----------
   导航栏是独立组件：左右边距由 --nav-x 决定，与页面内容版心（--pad / --edge）无关。
   三个页面共用同一份结构（模板 partials/nav.html，改完跑 python tools/sync_nav.py）。
   ------------------------------------------------------------------ */
:root { --nav-x: clamp(20px, 4.5vw, 76px); } /* 导航栏左右边距，两侧相同 */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 18px var(--nav-x);
  border-bottom: 1px solid transparent;
  transition: background-color .4s var(--ease), border-color .4s var(--ease),
              padding .4s var(--ease), backdrop-filter .4s;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--line-soft);
}
/* 关键：backdrop-filter 会让子元素的 position:fixed 相对 header 定位，
   移动端全屏菜单会因此塌缩成 header 那一条——菜单展开时必须移除 */
body.menu-open .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg);
  border-bottom-color: transparent;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  border-radius: 11px;
  font-family: var(--serif); font-size: 22px; line-height: 1;
  transition: transform .5s var(--ease);
}
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.04); }
.brand__text {
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px;
  line-height: 1.1;
  font-family: "Songti SC", "STSong", "SimSun", "NSimSun", serif;
  font-size: 19px;
  letter-spacing: .06em;
}
.brand__text em {
  display: block;
  font-style: normal; font-family: var(--mono); font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  line-height: 1;
}

.nav {
  display: flex; align-items: center;
  gap: clamp(18px, 2.8vw, 38px);
  margin-left: auto; /* 导航靠右，与操作按钮成组 */
}
.nav__link {
  position: relative;
  display: inline-flex; align-items: center;
  font-size: 15px; line-height: 1; letter-spacing: .02em;
  color: var(--ink-2);
  transition: color .3s var(--ease);
}
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav__link:hover, .nav__link.is-active { color: var(--ink); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* 汉堡按钮：桌面隐藏，≤900px 显示 */
.menu-btn { display: none; width: 36px; height: 36px; position: relative; }
.menu-btn span {
  position: absolute; left: 9px; width: 18px; height: 1.5px;
  background: var(--ink); transition: transform .4s var(--ease), opacity .3s;
}
.menu-btn span:nth-child(1) { top: 15px; }
.menu-btn span:nth-child(2) { top: 21px; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

/* ---------- 06 Reveal：滚动入场（opacity + translateY） ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 07 Intro：门页 + 星流穿越 ---------- */
.intro {
  position: fixed; inset: 0; z-index: 600;
  background: #0b0a08;
  transition: opacity .95s cubic-bezier(.4, .1, .2, 1);
}
.intro canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
}
.intro__gate {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 26px;
  cursor: pointer;
  background: radial-gradient(46% 42% at 50% 46%, rgba(214, 172, 100, .1), transparent 75%);
  transition: opacity .55s var(--ease);
}
.intro__gate.is-hidden { opacity: 0; pointer-events: none; }
.intro__title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4.4vw, 3.2rem);
  letter-spacing: .16em; text-indent: .16em;
  color: #f2ecdc;
  text-shadow: 0 0 40px rgba(214, 172, 100, .25);
}
.intro__hint {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .5em; text-indent: .5em;
  color: rgba(242, 236, 220, .55);
  animation: hint-breathe 2.4s ease-in-out infinite;
}
@keyframes hint-breathe {
  0%, 100% { opacity: .45; }
  50% { opacity: .95; }
}
.intro.is-done { opacity: 0; pointer-events: none; }
/* 已播放过的会话：门页在解析阶段就隐藏，避免切回首页时闪现 */
html.intro-played .intro { display: none; }
/* 动画播放期间压住首页 reveal，结束后再统一浮现 */
body.intro-playing .reveal {
  opacity: 0 !important;
  transform: translateY(24px) !important;
}

/* ---------- 08 Hero（首页：日出/桥两张封面每 10 秒淡入淡出轮播 + 左下姓名） ---------- */
body.intro-playing { overflow: hidden; }
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 0 0 clamp(96px, 17vh, 190px);
  overflow: hidden;
}
/* 封面轮播图层：透明度交叉淡入淡出 */
.hero__photo {
  position: absolute; inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 4s var(--ease);
  will-change: opacity;
}
.hero__photo.is-on { opacity: 1; }
.hero__photo--sunrise {
  background-image: url('hero/sunrise.jpg');
  background-position: center 42%;
}
.hero__photo--bridge {
  background-image: url('hero/bridge.jpg');
  background-position: center 58%;
}
/* 左侧压暗护住姓名，右侧尽量透出照片（放在 hero 层，不随轮播淡入淡出，交叉时不会忽明忽暗） */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 7, 3, .78) 0%, rgba(10, 7, 3, .46) 36%, rgba(10, 7, 3, .1) 62%, rgba(10, 7, 3, .04) 100%);
}
.hero__name {
  position: relative; z-index: 2;
  /* 首页文字块：整体更靠左（不再受 1240 版心限制） */
  max-width: none;
  padding-left: var(--edge);
  padding-right: var(--pad);
}
/* 眉标行：粗横线 + 个人网站 Personal website，与姓名左对齐 */
/* 眉标行：细横线 + 个人网站 Personal website，整行与姓名左对齐 */
.hero__eyebrow {
  display: flex; align-items: center; justify-content: flex-start; gap: 14px;
  margin-bottom: clamp(14px, 2vh, 20px);
  color: rgba(245, 239, 223, .88);
  text-shadow: 0 1px 14px rgba(0, 0, 0, .5);
}
.hero__rule {
  width: clamp(36px, 5vw, 58px);
  height: 1px;
  background: currentColor;
  flex: 0 0 auto;
  opacity: .9;
}
.hero__eyebrow-cn {
  font-size: clamp(12.5px, 1.05vw, 14px);
  letter-spacing: .28em;
}
.hero__eyebrow-en {
  /* 与「感受世界」完全一致，不做任何区分 */
  font-size: clamp(12.5px, 1.05vw, 14px);
  letter-spacing: .28em;
}
.hero__title {
  font-family: var(--serif);
  font-size: clamp(3.2rem, 8.6vw, 7rem);
  line-height: 1;
  letter-spacing: .2em;
  font-weight: 400;
  color: #f5efdf;
  text-shadow: 0 2px 26px rgba(0, 0, 0, .55);
}
/* 英文名：黑体，更醒目 */
.hero__en {
  display: block;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: .4em;
  color: rgba(245, 239, 223, .92);
  margin-top: clamp(14px, 2vh, 22px);
  text-shadow: 0 1px 16px rgba(0, 0, 0, .5);
}
.hero__actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 14px;
  margin-top: clamp(28px, 4.4vh, 44px);
}
.hero__btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 28px;
  border-radius: 999px;
  font-size: 14px; letter-spacing: .08em;
  transition: transform .45s var(--ease), background-color .3s,
              border-color .3s, box-shadow .45s var(--ease);
}
.hero__btn svg { width: 14px; height: 14px; }
.hero__btn--solid {
  background: #f5efdf; color: #17150f;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .5);
}
.hero__btn--solid:hover { background: #fffdf4; transform: translateY(-2px); }
.hero__btn--solid:hover svg { transform: translateX(3px); }
.hero__btn--solid svg { transition: transform .3s var(--ease); }
.hero__btn--ghost {
  border: 1px solid rgba(245, 239, 223, .48);
  color: #f5efdf;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .4);
}
.hero__btn--ghost:hover { border-color: rgba(245, 239, 223, .9); background: rgba(245, 239, 223, .1); transform: translateY(-2px); }

/* 向下箭头：居中悬浮在首屏底部，缓慢上下跳动；下滑后淡出 */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 3vh, 30px);
  z-index: 3;
  padding: 10px;
  color: rgba(245, 239, 223, .85);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .55);
  transition: opacity .55s var(--ease);
}
.scroll-hint svg {
  width: 22px; height: 22px;
  animation: scroll-bob 2.2s ease-in-out infinite;
}
.scroll-hint:hover { color: #fff; }
.scroll-hint:hover svg { animation-play-state: paused; }
.scroll-hint.is-hidden { opacity: 0; pointer-events: none; }
@keyframes scroll-bob {
  0%, 100% { transform: translateY(0); opacity: .68; }
  50%      { transform: translateY(10px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-hint svg { animation: none; }
}

/* ---------- 09 Why：首页第二屏「为什么要建立这个网站」 ---------- */
.why {
  position: relative;
  background: var(--bg);
  padding: clamp(96px, 14vh, 160px) 0 clamp(96px, 13vh, 170px);
}
.why__item + .why__item { margin-top: clamp(64px, 9vh, 108px); }
.why__title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  letter-spacing: .05em;
  line-height: 1.3;
}
.why__answer {
  margin-top: clamp(22px, 3.4vh, 36px);
  max-width: 860px;
  font-size: 13.5px;
  line-height: 2.2;
  color: var(--muted);
  text-indent: 2em; /* 首行缩进两字符 */
}
.why__answer p + p { margin-top: 1.15em; }

/* ---------- 10 Common：区块基类与子标题 ---------- */
.section { padding: clamp(72px, 10vw, 132px) 0; position: relative; }
.subpage .section:first-child { padding-top: clamp(112px, 13vw, 160px); }

/* --- 子标题：细线 + 中文标题 + 英文小字 --- */
.subhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  margin: clamp(52px, 7vw, 88px) 0 clamp(22px, 3vw, 32px);
  padding-top: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
}
.subhead h3 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: -.01em;
}
.subhead .mono { color: var(--muted); font-size: 9.5px; letter-spacing: .18em; }

/* ---------- 11 About：头像 + 名字 + 简介 ---------- */
.profile { display: flex; align-items: center; gap: 22px; }
.avatar {
  flex: 0 0 auto;
  width: 78px; height: 78px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
}
.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.profile__cn {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: .08em;
  line-height: 1.1;
}
.profile__en {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  letter-spacing: .34em;
}
.profile__intro {
  margin-top: clamp(24px, 3.4vw, 38px);
  max-width: none;
  font-size: 16.5px;
  line-height: 2.05;
  color: var(--ink-2);
  text-indent: 2em; /* 首行缩进两字符 */
}
/* --- 喜欢的音乐类型 --- */
.music {
  font-size: 16.5px;
  line-height: 2.05;
  color: var(--ink-2);
  text-indent: 2em;
}
/* 关于我页的区块间距：书 / 音乐 / 色谱 等各段拉开且均匀 */
.about .subhead {
  margin-top: clamp(84px, 10vw, 142px);
}

/* 介绍内的链接与悬浮菜单 */
.intro-link {
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  opacity: .92;
  transition: opacity .25s, border-color .25s;
}
.intro-link:hover { opacity: 1; }

/* --- 고윤정 引用：点击展开子菜单 --- */
.gyj-ref { position: relative; display: inline-block; text-indent: 0; }
.gyj-ref__name {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: .92;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent);
  transition: opacity .25s, text-decoration-color .25s;
}
.gyj-ref__name:hover { opacity: 1; text-decoration-color: currentColor; }
.gyj-ref__menu {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-6px);
  z-index: 20;
  width: max-content; /* 贴合最长一项，不再留大片空白 */
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s var(--ease), transform .3s var(--ease), visibility .28s;
}
.gyj-ref.is-open .gyj-ref__menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.gyj-ref__item {
  display: block;
  padding: 9px 14px;
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.gyj-ref__item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }

/* --- 色谱（硬币大小的圆点，每行 10 个） --- */
.palette { display: flex; flex-direction: column; gap: clamp(26px, 3vw, 40px); }
.palette__row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 16px);
}
.swatch {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 9px;
  min-width: 0;
  text-align: center;
}
.swatch__chip {
  position: relative;
  display: block;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.swatch:hover .swatch__chip { transform: translateY(-3px) scale(1.06); box-shadow: var(--shadow); }
/* 复制成功提示（无勾） */
.swatch::after {
  content: "已复制";
  position: absolute;
  top: -26px; left: 50%;
  transform: translate(-50%, 4px);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px; letter-spacing: .08em; line-height: 1.5;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease), transform .32s var(--ease);
}
.swatch.is-copied::after { opacity: 1; transform: translate(-50%, 0); }
.swatch__name { font-family: var(--serif); font-size: 13px; color: var(--ink-2); }
.swatch__hex { color: var(--muted); font-size: 8.5px; letter-spacing: .08em; }

/* --- 看过的书 / 看过的动画（手风琴：书名行不动，下方展开介绍） --- */
.books { border-top: 1px solid var(--line-soft); }
.books li { border-bottom: 1px solid var(--line-soft); }
.books__row {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 2px;
  cursor: pointer;
  transition: padding .45s var(--ease);
}
.books li:hover .books__row { padding-left: 10px; }
.books__no { color: var(--muted); font-size: 8.5px; flex: 0 0 auto; }
.books__title {
  font-family: var(--serif); font-size: 15.5px;
  color: var(--ink-2);
  transition: color .3s;
}
.books li:hover .books__title,
.books li.is-open .books__title { color: var(--ink); }

/* 右侧加号：展开后转成减号 */
.books__sign {
  position: relative;
  margin-left: auto;
  width: 11px; height: 11px;
  flex: 0 0 auto;
  opacity: .42;
  transition: transform .45s var(--ease), opacity .3s;
}
.books__sign::before,
.books__sign::after {
  content: ""; position: absolute; background: currentColor;
}
.books__sign::before { left: 0; right: 0; top: 5px; height: 1px; }
.books__sign::after {
  top: 0; bottom: 0; left: 5px; width: 1px;
  transition: transform .45s var(--ease), opacity .3s;
}
.books li:hover .books__sign { opacity: .75; }
.books li.is-open .books__sign { opacity: .9; }
.books li.is-open .books__sign::after { opacity: 0; }

/* 折叠区：grid 0fr → 1fr，高度平滑展开，后续书名整体往下走 */
.books__detail {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .52s var(--ease), opacity .4s var(--ease);
}
.books li.is-open .books__detail { grid-template-rows: 1fr; opacity: 1; }
.books__inner { overflow: hidden; min-height: 0; }
.books__body { padding: 2px 2px 22px 26px; max-width: 74ch; }
.books__author {
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: .04em;
  color: var(--ink);
}
.books__country {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--muted);
  margin-left: 4px;
}
.books__desc {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--muted);
}

/* ---------- 12 Portfolio：照片墙（等高 flex 墙，由 build_wall.py 生成） ---------- */
.portfolio__intro {
  max-width: 46ch;
  font-size: clamp(14px, 1.1vw, 15.5px);
  line-height: 1.9;
  color: var(--muted);
  margin-bottom: clamp(30px, 4vw, 52px);
}

.gallery-wrap { display: flex; flex-direction: column; }

.year-group {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: clamp(14px, 3vw, 40px);
  padding-top: clamp(24px, 3vw, 34px);
  border-top: 1px solid var(--line-soft);
  margin-bottom: clamp(28px, 4vw, 48px);
}
.year-group:first-child { padding-top: 0; border-top: 0; }

.year-label {
  position: sticky; top: 96px;
  align-self: start;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  letter-spacing: .06em;
  color: var(--ink-2);
  line-height: 1;
}

/* 等高照片墙：缩略图是原图的等比缩小，每行高度一致，宽度随原图比例变化 */
.pf-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1.2vw, 14px);
  --wall-h: clamp(150px, 19vw, 250px);
}
.pf-filler { flex: 999 0 0; height: 0; }

.shot {
  position: relative;
  margin: 0;
  height: var(--wall-h);
  flex: var(--ar, 1.5) 1 calc(var(--wall-h) * var(--ar, 1.5));
  cursor: zoom-in;
  perspective: 900px; /* 3D 倾斜的透视深度 */
  border-radius: 3px;
}
.shot__img {
  position: absolute; inset: 0;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(.95);
  /* 3D 倾斜：随鼠标位移转动（值由 main.js 写入） */
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--ts, 1));
  transition: filter .6s var(--ease), transform .35s ease-out;
  will-change: transform;
}
.shot:hover .shot__img { filter: saturate(1.08); }
.shot:focus-visible { outline: none; }
.shot:focus-visible .shot__img { outline: 1px solid var(--ink); outline-offset: 3px; }

/* 悬浮：底部渐亮 + 编号 */
.shot::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 64px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(to top, rgba(8, 6, 3, .58), rgba(8, 6, 3, 0));
  opacity: 0;
  transition: opacity .45s var(--ease);
  pointer-events: none;
}
.shot::after {
  content: attr(data-num);
  position: absolute; left: 14px; bottom: 12px;
  font-family: var(--mono); font-size: 11.5px;
  letter-spacing: .22em;
  color: #f2ede0;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .65);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
}
.shot:hover::before, .shot:hover::after,
.shot:focus-visible::before, .shot:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 13 Lightbox 基座（遮罩 + 背景模糊层） ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(18px, 4vw, 54px);
  background: #0b0b0a;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity .38s var(--ease), visibility .38s;
}
/* 环境光背景：跟随当前照片（模糊放大 + 压暗提饱和），JS 写入 --lb-bg */
.lightbox::before {
  content: ""; position: absolute; inset: -130px;
  z-index: -1;
  background-image: var(--lb-bg, none);
  background-size: cover; background-position: center;
  filter: blur(44px) brightness(.72) saturate(1.12);
  transform: scale(1.18);
  opacity: 0;
  transition: opacity .55s var(--ease);
}
.lightbox.is-open::before { opacity: 1; }
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__close {
  position: absolute; top: clamp(16px, 3vw, 30px); right: clamp(16px, 3vw, 30px);
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  display: grid; place-items: center;
  color: var(--ink-2);
  z-index: 3;
  transition: border-color .3s, color .3s, transform .4s var(--ease);
}
.lightbox__close:hover { border-color: var(--ink); color: var(--ink); transform: rotate(90deg); }
.lightbox__close svg { width: 16px; height: 16px; }

/* --- 灯箱主体：滚轮/小滚动条缩放 + 左右切换 + 底部参数行 --- */
.lb-stage {
  margin: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(12px, 1.6vw, 18px);
  min-width: 0; max-width: 100%;
  transform: scale(.985);
  transition: transform .5s var(--ease);
}
.lightbox.is-open .lb-stage { transform: none; }

.lb-viewport {
  display: flex;
  width: min(1120px, 88vw);
  height: min(68vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  overflow-anchor: none; /* 关闭浏览器滚动锚定，避免干扰缩放定位 */
  scroll-behavior: auto; /* 缩放锚点需要瞬时滚动，不能被平滑滚动干扰 */
  scrollbar-width: none;
}
.lb-viewport::-webkit-scrollbar { width: 0; height: 0; }
.lb-photo {
  margin: auto;
  flex: 0 0 auto;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 2px;
  box-shadow: 0 26px 70px -32px rgba(0, 0, 0, .55);
  will-change: width, height;
}

.lb-meta {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px;
  text-align: center;
  min-height: 34px;
}
.lb-exif {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--muted);
}
.lb-exif__icon { width: 14px; height: 14px; flex: 0 0 auto; user-select: none; -webkit-user-drag: none; }

.lb-nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 68%, transparent);
  display: grid; place-items: center;
  color: var(--ink-2);
  z-index: 2;
  transition: border-color .3s, color .3s, background-color .3s, opacity .3s;
}
.lb-nav:hover { border-color: var(--ink); color: var(--ink); }
.lb-nav svg { width: 17px; height: 17px; }
.lb-nav--prev { left: clamp(8px, 2vw, 30px); }
.lb-nav--next { right: clamp(8px, 2vw, 30px); }
.lb-nav[disabled] { opacity: .25; pointer-events: none; }

/* 照片下方的小滚动条式缩放条（横向） */
.lb-zoom {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 2px;
}
.lb-zoom__bar {
  position: relative;
  width: clamp(150px, 20vw, 230px);
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  touch-action: none;
}
.lb-zoom__thumb {
  position: absolute;
  top: 50%;
  width: 26px; height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 52%, transparent);
  transform: translate(-50%, -50%);
  transition: background-color .25s;
}
.lb-zoom__bar:hover .lb-zoom__thumb { background: var(--ink); }
.lb-zoom__val {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .1em; color: var(--muted);
  min-width: 34px;
}

/* --- 页底焦距说明小注 --- */
.pf-note {
  margin-top: clamp(28px, 4vw, 48px);
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--muted);
}

/* ---------- 14 Footer：页脚 / 回到顶部 / 悬浮滚动条 ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 24px 0;
  font-size: 12px; color: var(--muted);
}
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* --- 回到顶部按钮：默认隐藏，下滑超过一屏后淡入 --- */
.to-top-fab {
  position: fixed;
  right: clamp(18px, 3vw, 34px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 120;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  display: grid; place-items: center;
  color: var(--ink-2);
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .4s var(--ease), border-color .3s, color .3s, opacity .35s, visibility .35s;
}
.to-top-fab.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }

.to-top-fab svg { width: 16px; height: 16px; }
.to-top-fab:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-3px); }

/* --- 悬浮滚动条（不占页面空间） --- */
.fake-scroll {
  position: fixed;
  top: 0; right: 3px; bottom: 0;
  width: 6px;
  z-index: 140;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.fake-scroll.is-visible { opacity: 1; }
.fake-scroll__thumb {
  position: absolute;
  right: 0;
  width: 5px;
  min-height: 40px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 26%, transparent);
  pointer-events: auto;
  transition: background-color .3s, width .2s;
}
.fake-scroll__thumb:hover,
.fake-scroll.is-dragging .fake-scroll__thumb {
  background: color-mix(in srgb, var(--ink) 48%, transparent);
  width: 6px;
}

/* ---------- 15 Transition：页面转场 失焦 → 模糊 → 聚焦 ----------
   veil 在 header 之下（z 95 < 100）：导航栏始终清晰，不参与过渡 */
.veil {
  position: fixed; inset: 0; z-index: 95;
  pointer-events: none;
  opacity: 0;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  transition:
    opacity .46s var(--ease),
    backdrop-filter .46s var(--ease),
    -webkit-backdrop-filter .46s var(--ease);
  will-change: opacity, backdrop-filter;
}
body.is-entering .veil,
body.is-leaving .veil {
  opacity: 1;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
}
body.is-entering.is-ready .veil {
  opacity: 0;
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
}
body.is-leaving main,
body.is-leaving .site-footer {
  transition: opacity .4s var(--ease), filter .4s var(--ease);
  opacity: .45;
  filter: blur(2px);
}

/* ---------- 16 Responsive：断点与降级 ---------- */
@media (max-width: 900px) {
  html.cursor-on, html.cursor-on * { cursor: auto !important; }
  html.cursor-pending, html.cursor-pending * { cursor: auto !important; }
  .cursor { display: none; }

  .nav {
    position: fixed; inset: 0;
    flex-direction: column; justify-content: center; align-items: flex-start;
    gap: 10px;
    padding: 0 var(--pad);
    background: var(--bg);
    transform: translateY(-100%);
    opacity: 0; visibility: hidden;
    transition: transform .65s var(--ease), opacity .45s var(--ease), visibility .45s;
    z-index: 90;
  }
  .nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav__link {
    font-family: var(--serif); font-size: 1.9rem; line-height: 1.6;
    color: var(--ink);
  }
  .nav__link::after { display: none; }
  .menu-btn { display: block; z-index: 101; }

  .year-group { grid-template-columns: 1fr; gap: 14px; }
  .year-label { position: static; }

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

  .lb-viewport { width: 94vw; height: 58vh; }
  .lb-nav { width: 38px; height: 38px; }
}

@media (max-width: 620px) {
  .hero { padding-bottom: 44px; }
  .hero__title { font-size: clamp(2.7rem, 15vw, 4rem); letter-spacing: .14em; }
  .hero__en { font-size: .9rem; letter-spacing: .4em; }
  .hero__btn { padding: 11px 22px; font-size: 13px; }

  .pf-grid { --wall-h: 112px; gap: 8px; }
  .shot::before { height: 46px; }
  .shot::after { left: 10px; bottom: 8px; font-size: 10px; }

  .profile { gap: 16px; }
  .avatar { width: 64px; height: 64px; }
  .footer__inner { flex-direction: column; }
  .subhead { flex-direction: column; gap: 6px; }
  .palette__row { gap: 4px; }
  .swatch__chip { width: 42px; height: 42px; }
  .swatch__name { font-size: 11.5px; }
  .swatch__hex { font-size: 7.5px; }
  .books__body { padding-left: 18px; }
  .to-top-fab { width: 40px; height: 40px; right: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .veil { transition-duration: .01s; }
  body.is-leaving main,
  body.is-leaving .site-footer { opacity: 1; filter: none; }
  .cursor { display: none; }
  html.cursor-on, html.cursor-on * { cursor: auto !important; }
  html.cursor-pending, html.cursor-pending * { cursor: auto !important; }
  .intro { display: none; }
  body:not(.is-home)::before,
  body:not(.is-home)::after { animation: none; }
}
