/* ========== Local fonts (Baskerville BQ — 私授权，仓库需 Private) ========== */
@font-face {
  font-family: 'Baskerville';
  src: url('../fonts/BaskervilleNewBQ-Roman.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Baskerville';
  src: url('../fonts/BaskervilleNewBQ-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: optional;
}
@font-face {
  font-family: 'Baskerville';
  src: url('../fonts/BaskervilleNewBQ-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Baskerville';
  src: url('../fonts/BaskervilleNewBQ-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ========== 阿里巴巴普惠体 2.0（免费可商用） ========== */
@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('../fonts/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('../fonts/AlibabaPuHuiTi-2-85-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* 800/900 字重很少用（仅 2 处），font-display: optional 让浏览器 100ms 内未下载就用 fallback，不阻塞首屏 */
@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('../fonts/AlibabaPuHuiTi-2-95-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('../fonts/AlibabaPuHuiTi-2-105-Heavy.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: optional;
}
/* Baskerville Italic 仅 1 处用到（联系页斜体大字），同样 optional 不阻塞 */

/* ========== Tokens ========== */
:root {
  --bg: #131313;
  --bg-2: #181818;
  --panel: rgba(20, 20, 20, 0.65);
  --panel-solid: #141414;
  --accent: #e63946;
  --accent-soft: rgba(230, 57, 70, 0.18);
  --accent-line: rgba(230, 57, 70, 0.45);
  --text: #f3f3f3;
  --text-dim: #9a9a9a;
  --text-faint: #5a5a5a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);

  --font-serif: 'Baskerville', 'Alibaba PuHuiTi', -apple-system, 'PingFang SC', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  --font-sans: 'Inter', 'Alibaba PuHuiTi', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* ========== Type scale（全局字号分层）========== */
  --fs-mono-xs: 11px;   /* 标签 / 角标（10px 在中文下偏小） */
  --fs-mono-sm: 12px;   /* 二级 mono */
  --fs-xs: 12px;        /* 辅助说明 */
  --fs-sm: 13px;        /* 正文小号 */
  --fs-base: 14px;      /* 正文 */
  --fs-md: 16px;        /* 强调正文 */
  --fs-lg: 20px;        /* 小标题 */
  --fs-xl: 28px;        /* 中标题 */
  --fs-2xl: 40px;       /* 大标题 */
  --fs-3xl: 64px;       /* 巨标题 */

  --rail-w: 44px;
  --hud-pad: 28px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; }
img, video { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }

/* ========== Background grain + scanline ========== */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 2px,
      rgba(255,255,255,0.012) 2px,
      rgba(255,255,255,0.012) 3px
    );
  mix-blend-mode: overlay;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 998;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,0.28) 100%);
}

/* ========== Left rail ========== */
.rail {
  position: fixed;
  left: 0; top: 0;
  width: var(--rail-w);
  height: 100vh;
  z-index: 50;
  background: transparent;     /* rail 主体透明，让背景图/底色透出 */
  border-right: none;          /* 去掉白色边框 */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  pointer-events: none;        /* rail 容器透明，仅其内子按钮/链接接收点击 */
}
/* rail 内 logo + 关于/作品 链接显式开启点击（容器是 pointer-events:none） */
.rail__logo,
.rail__logo a,
.rail__honors {
  pointer-events: auto;
}
/* D + 关于：合并到一个加宽加高的半透明黑底色块，固定在屏幕左上角 */
.rail__nav-block {
  position: absolute;
  left: 0;
  top: 20px;
  transform: none;
  width: calc(var(--rail-w) + 8px);   /* 略宽于 rail，覆盖右侧露白 */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.55);    /* 半透明，让背景图/底色透出 */
  border: none;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;                         /* 永远在 spotlight 之上不被暗化 */
}
.rail__logo {
  display: flex;
  align-items: center; justify-content: center;
  width: 100%;
  padding: 18px 0 14px;
  font-family: var(--font-serif);
  font-size: 30px;          /* 加大 */
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: transparent;
  border: none;
}
.rail__logo a { display: block; line-height: 1; }
.rail__honors {
  display: flex;
  align-items: center; justify-content: center;
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #fff;
  background: transparent;
  padding: 22px 0 24px;
  border: none;
  cursor: pointer;
  transition: color .3s;
  text-transform: uppercase;
}
.rail__honors:hover { color: var(--accent); }

/* 项目切换按钮已移出 rail，挂在 body 下，见下方 .page-nav-btn */
.rail__nav { display: none; }

/* ========== 项目切换按钮：固定屏幕左右边缘垂直居中 ========== */
.page-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  z-index: 65;
  transition: background .25s, color .25s, transform .25s, padding .25s;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}
.page-nav-btn--prev { left: 0; }
.page-nav-btn--next { right: 0; }
.page-nav-btn:hover:not([disabled]) {
  background: var(--accent);
  color: #fff;
}
.page-nav-btn--prev:hover:not([disabled]) { transform: translate(-4px, -50%); }
.page-nav-btn--next:hover:not([disabled]) { transform: translate(4px, -50%); }
.page-nav-btn[disabled] { opacity: 0.25; cursor: not-allowed; }
/* (mobile 切换按钮已在 max-width:720 块内统一处理) */

/* ========== HUD (top corners) ========== */
.hud {
  position: fixed;
  top: var(--hud-pad);
  z-index: 60;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
}
.hud--tl { left: calc(var(--rail-w) + 24px); color: var(--text-dim); }
.hud--tl .signal { color: var(--accent); margin-top: 2px; display: block; }
.hud--tr { right: var(--hud-pad); text-align: right; color: var(--text-dim); }
.hud--tr .ts { font-size: 11px; letter-spacing: 0.1em; }
.hud--tr .iso { color: var(--text-faint); }

.lang-toggle {
  position: fixed;
  right: var(--hud-pad);
  top: 70px;
  display: flex; gap: 6px;
  z-index: 60;
  font-family: var(--font-mono);
  font-size: 11px;
}
.lang-toggle button {
  width: 30px; height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  letter-spacing: 0.1em;
  transition: all .25s;
  background: rgba(0, 0, 0, 0.55);
}
.lang-toggle button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.lang-toggle button.is-active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

/* ========== Live feed (bottom-left) ========== */
.live-feed {
  position: fixed;
  left: calc(var(--rail-w) + 18px);
  bottom: 22px;
  z-index: 60;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.live-feed .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: blink 1.6s infinite;
}
@keyframes blink {
  0%, 70% { opacity: 1; }
  85% { opacity: 0.2; }
  100% { opacity: 1; }
}

/* ========== Status (bottom-right) ========== */
.sys-status {
  position: fixed;
  right: var(--hud-pad);
  bottom: 22px;
  z-index: 60;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  text-align: right;
}
.sys-status .stable { color: var(--accent); }

/* ========== Tag / chip ========== */
.tag {
  display: inline-flex; align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.tag--ghost { border-color: var(--border-strong); color: var(--text-dim); }
.tag--solid { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ========== Decorative box ========== */
.deco-box {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  background: rgba(0,0,0,0.4);
  pointer-events: none;
}

/* ========== Crosshair corners ========== */
.crosshair {
  position: relative;
}
.crosshair::before, .crosshair::after,
.crosshair > .ch-tl, .crosshair > .ch-tr,
.crosshair > .ch-bl, .crosshair > .ch-br {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--accent);
  pointer-events: none;
}
.crosshair > .ch-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.crosshair > .ch-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.crosshair > .ch-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.crosshair > .ch-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ========== Buttons ========== */
.btn-decrypt {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
  transition: color .25s, border-color .25s;
  cursor: pointer;
}
.btn-decrypt:hover { color: var(--accent); }

/* ========== Page heading (oversized serif) ========== */
.page-heading {
  font-family: var(--font-serif);
  font-size: clamp(40px, 5.5vw, 80px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 0.95;
  position: relative;
}
.page-heading .slash {
  display: inline-block;
  width: 2px; height: 0.85em;
  background: var(--accent);
  margin: 0 0.5em -0.05em 0.5em;
  transform: rotate(20deg);
  vertical-align: middle;
}

/* ========== Utility ========== */
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }
.label-accent { color: var(--accent); }
.divider { height: 1px; background: var(--border); width: 100%; }
.divider-accent { height: 1px; background: linear-gradient(to right, transparent, var(--accent), transparent); }

/* ========== Page wrapper ========== */
/* rail 是 fixed 浮层，不再用 padding-left 让出位置；内容真正屏幕居中 */
.page {
  min-height: 100vh;
  position: relative;
}

@media (max-width: 720px) {
  :root { --rail-w: 36px; --hud-pad: 14px; }
  /* mobile 关于按钮：横排 + 屏幕左上角，跟 evidence 分割线在水平方向上贴近、在它上方 */
  .rail__nav-block {
    top: 14px;
    left: 14px;
    transform: none;
    flex-direction: row;
    align-items: center;
    width: auto;
    padding: 0;
    gap: 0;
  }
  .rail__logo {
    padding: 6px 10px;
    font-size: 20px;
    border-right: 1px solid rgba(255,255,255,0.18);
  }
  .rail__honors {
    writing-mode: horizontal-tb;
    padding: 7px 12px;
    font-size: 11px;
    letter-spacing: 0.22em;
  }
  /* 切换按钮垂直居中保留默认；尺寸调小以适配窄屏 */
  .page-nav-btn { width: 44px; height: 44px; font-size: 22px; }
  /* 简介/详情页：左上 HUD（项目名）在 navBlock 横条之下，避免视觉重叠 */
  body[data-page="project-intro"] .hud--tl,
  body[data-page="project-detail"] .hud--tl { display: none; }
  .hud--tl { left: calc(var(--rail-w) + 10px); font-size: 9px; letter-spacing: 0.15em; }
  .hud--tr { font-size: 9px; letter-spacing: 0.14em; }
  .hud--tr .ts { font-size: 10px; }
  .lang-toggle { top: 52px; }
  .lang-toggle button { width: 26px; height: 22px; font-size: 10px; }
  .live-feed {
    left: calc(var(--rail-w) + 10px);
    bottom: 14px;
    font-size: 9px;
    letter-spacing: 0.14em;
  }
  .sys-status { display: none; }
  .rail { padding: 12px 0; }
  .rail__logo { font-size: 16px; }
  .rail__honors {
    margin-top: 18px;
    font-size: 9px;
    letter-spacing: 0.22em;
    padding: 10px 6px;
  }
  /* 暗角与扫描线在 mobile 减弱，避免叠加到正文影响可读性 */
  body::after { background: radial-gradient(ellipse at 50% 50%, transparent 65%, rgba(0,0,0,0.18) 100%); }
  body::before { opacity: 0.5; }
  .page-heading { font-size: clamp(36px, 8.5vw, 56px); }
}
@media (max-width: 420px) {
  :root { --rail-w: 32px; --hud-pad: 12px; }
  .hud--tl { font-size: 8.5px; letter-spacing: 0.1em; }
  .live-feed { display: none; }
  .rail__honors { writing-mode: vertical-rl; padding: 8px 4px; font-size: 8.5px; letter-spacing: 0.18em; }
}

/* ===== 四角 HUD 淡出（配合 js/chrome.js 的 body.is-past-hero） =====
   .live-feed 从 left:62px 起、.sys-status 距右 28px，而 .section 内容左右
   各留 60px —— 两者在几何上就是叠的，滚到任何满宽 section 都会压在内容上。
   移动端原本已经把它们隐藏（≤720 隐藏 .sys-status，≤420 隐藏 .live-feed），
   桌面端漏了，这里补上。 */
.hud--tl,
.hud--tr,
.live-feed,
.sys-status {
  transition: opacity .45s ease, visibility .45s;
}
body.is-past-hero .hud--tl,
body.is-past-hero .hud--tr,
body.is-past-hero .live-feed,
body.is-past-hero .sys-status {
  opacity: 0;
  visibility: hidden;      /* 光标是自绘的，纯 opacity:0 仍会挡住下面的文本选择 */
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .hud--tl, .hud--tr, .live-feed, .sys-status { transition: none; }
}
