/* ==========================================================================
   会飞的鱼 · FISH · 个人网站
   暖奶油底 / 砖红主色 / 上圆下方的招牌形状
   ========================================================================== */

/* 可变字重的拉丁子集 */
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dmsans.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

/* 中文：站酷快乐体，裁到站上真正用到的字 + 一层常用字缓冲。
   改文案要是用到了缓冲之外的字，那个字会掉回系统字体，得重新裁一次 */
@font-face {
  font-family: "KuaiLe";
  src: url("../fonts/kuaile.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  /* 拉丁字母一律让给 DM Sans，它才有字重轴，首屏那个加粗波浪要用 */
  unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF;
}

/* --------------------------------------------------------------------------
   1. 令牌
   -------------------------------------------------------------------------- */

:root {
  /* 奶油（默认） */
  --c-bg: #F2E3CF;
  --c-bg-hi: #FFF6ED;
  --c-bg-lo: #E7D5BC;
  --c-ink: #171717;
  /* 正文压深一档：手写体笔画比黑体细，原来的 #4A423A 在奶油底上发飘 */
  --c-ink-2: #3B3128;
  --c-ink-3: #6E655A;
  --c-line: rgba(23, 23, 23, 0.13);
  --c-line-2: rgba(23, 23, 23, 0.26);
  --c-red: #E35342;
  --c-red-deep: #C24234;
  --c-red-text: #B14033;
  --c-red-display: #D94F3F;
  --c-green: #83B918;
  --c-yellow: #EDBE24;
  --c-blue: #2754A9;

  /* 夜（深色） */
  --d-bg: #1C1814;
  --d-bg-hi: #26211B;
  --d-bg-lo: #14110D;
  --d-ink: #F6EAD8;
  --d-ink-2: #CDBFAA;
  --d-ink-3: #948877;
  --d-line: rgba(246, 234, 216, 0.16);
  --d-line-2: rgba(246, 234, 216, 0.30);
  --d-red: #F26A54;
  --d-red-deep: #C24234;
  --d-red-text: #F26A54;
  --d-red-display: #F26A54;
  --d-green: #9BCF33;
  --d-yellow: #F2CB44;
  --d-blue: #4472C4;

  --font: "DM Sans", "KuaiLe", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* 参考站的正文很大，是它亲切感的来源之一 */
  --t--1: clamp(0.86rem, 0.81rem + 0.20vw, 1rem);
  /* 长段落专用：原来那三处说明文字只有 14px，手写体又比黑体轻，看着发虚 */
  --t-body: clamp(1rem, 0.94rem + 0.30vw, 1.14rem);
  --t-0: clamp(1.02rem, 0.96rem + 0.30vw, 1.22rem);
  --t-1: clamp(1.18rem, 1.05rem + 0.62vw, 1.62rem);
  --t-2: clamp(1.55rem, 1.25rem + 1.45vw, 2.70rem);
  --t-3: clamp(2.10rem, 1.50rem + 2.90vw, 4.20rem);
  --t-4: clamp(3.40rem, 1.90rem + 7.20vw, 9.50rem);

  --gutter: clamp(1.25rem, 0.7rem + 2.6vw, 4rem);
  --measure: 1180px;

  /* 招牌形状：上圆下方 */
  --r-lg: 60px 60px 8px 8px;
  --r-md: 34px 34px 6px 6px;
  --r-sm: 18px 18px 4px 4px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --soft: cubic-bezier(0.65, 0, 0.35, 1);

  /* 纸纹：一层几乎看不见的噪点，整页底色才不像一块刷出来的色板。
     强弱全在 feColorMatrix 最后一行：三个 0.12 是起伏，-0.15 是门槛。
     嫌太脏就把门槛往负数推，嫌太干净就往 0 推 */
  --grain-cream: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='g' x='0' y='0' width='170' height='170' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 0 0.05 0.12 0.12 0.12 0 -0.15'/%3E%3C/filter%3E%3Crect width='170' height='170' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-dusk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='g' x='0' y='0' width='170' height='170' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.96 0 0 0 0 0.91 0 0 0 0 0.83 0.12 0.12 0.12 0 -0.15'/%3E%3C/filter%3E%3Crect width='170' height='170' filter='url(%23g)'/%3E%3C/svg%3E");

  /* 撕口：给「换一张纸」那一节当上下边缘的遮罩，400px 一个循环。
     只做透明度，不带颜色，所以两套配色共用一份 */
  --tear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='15' viewBox='0 0 400 15'%3E%3Cpath d='M0 6 L13 3 L28 9 L44 2 L61 8 L77 3 L95 9 L111 4 L127 2 L145 8 L161 3 L177 9 L194 4 L210 2 L227 8 L243 3 L259 9 L276 4 L292 2 L309 8 L325 3 L341 9 L358 4 L374 2 L390 7 L400 6 L400 15 L0 15 Z' fill='%23000'/%3E%3C/svg%3E");
}

:root,
:root[data-theme="cream"] {
  --bg: var(--c-bg);
  --bg-hi: var(--c-bg-hi);
  --bg-lo: var(--c-bg-lo);
  --ink: var(--c-ink);
  --ink-2: var(--c-ink-2);
  --ink-3: var(--c-ink-3);
  --line: var(--c-line);
  --line-2: var(--c-line-2);
  --red: var(--c-red);
  --red-deep: var(--c-red-deep);
  --red-text: var(--c-red-text);
  --red-display: var(--c-red-display);
  --green: var(--c-green);
  --yellow: var(--c-yellow);
  --blue: var(--c-blue);
  --grain: var(--grain-cream);
  color-scheme: light;
}

:root[data-theme="dusk"] {
  --bg: var(--d-bg);
  --bg-hi: var(--d-bg-hi);
  --bg-lo: var(--d-bg-lo);
  --ink: var(--d-ink);
  --ink-2: var(--d-ink-2);
  --ink-3: var(--d-ink-3);
  --line: var(--d-line);
  --line-2: var(--d-line-2);
  --red: var(--d-red);
  --red-deep: var(--d-red-deep);
  --red-text: var(--d-red-text);
  --red-display: var(--d-red-display);
  --green: var(--d-green);
  --yellow: var(--d-yellow);
  --blue: var(--d-blue);
  --grain: var(--grain-dusk);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. 基础
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--grain);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-0);
  font-weight: 450;
  line-height: 1.85;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  /* 快乐体只有一个字重。不关合成的话，凡是 700 的地方中文都会被浏览器
     硬涂粗一圈，圆笔画糊成一团；关掉之后拉丁走 DM Sans 的真字重轴，
     中文保持它本来的样子 */
  font-synthesis: none;
  /* 跑马灯歪着放会横向溢出，必须裁掉。但 overflow:hidden 会把 body 变成滚动容器，
     作品区那套 position:sticky 会当场失效；clip 只裁不滚，两件事才能同时成立 */
  overflow-x: hidden;
  transition: background-color 0.6s var(--soft), color 0.6s var(--soft);
}

@supports (overflow: clip) {
  body { overflow-x: clip; }
}

body.is-locked { overflow: hidden; }

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; text-align: inherit; }

/* 安卓点击时的蓝色高亮方块，和这套配色格格不入 */
* { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

/* 红底区域里改用纸色描边，否则红描红等于没有焦点提示 */
.contact :focus-visible { outline-color: #fff; }

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.section { padding-block: clamp(5rem, 3rem + 9vw, 11rem); }

/* --------------------------------------------------------------------------
   3. 导航
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem var(--gutter);
  transition: transform 0.5s var(--ease), background-color 0.5s var(--ease);
  /* 这条通栏只有右端那几个链接是能点的，左边一大片是空的。
     不让它吃掉指针事件，底下的贴纸才不会被一整条不可见的横杠盖住 */
  pointer-events: none;
}

.nav__links { pointer-events: auto; }

.nav.is-hidden { transform: translateY(-108%); }

.nav.is-stuck {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav__links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 0.2rem + 1vw, 1.4rem);
}

.nav__links a {
  position: relative;
  padding: 0.35em 0.75em;
  font-size: var(--t--1);
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 999px;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.nav__links a:hover {
  color: var(--red-text);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

.nav__toggle {
  position: relative;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 14px 14px 4px 4px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.4s var(--pop), background-color 0.3s var(--ease),
    border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.nav__toggle:hover {
  transform: translateY(-2px) rotate(-6deg);
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* 命中区扩到 44px 上下，用伪元素撑，不影响可见大小与图标居中 */
.nav__links a::after { content: ""; position: absolute; inset: -6px 0; }
.nav__toggle::after { content: ""; position: absolute; inset: -3px; }

.nav__toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nav__toggle .i-dusk, :root[data-theme="dusk"] .nav__toggle .i-cream { display: none; }
:root[data-theme="dusk"] .nav__toggle .i-dusk { display: block; }

/* --------------------------------------------------------------------------
   4. 首屏
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: 7rem 4rem;
  overflow: hidden;
}

.hero__inner { position: relative; z-index: 2; }

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--t--1);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  padding: 0.45em 1em 0.45em 0.8em;
  border: 2px solid var(--line-2);
  border-radius: 999px;
  margin-bottom: clamp(1.2rem, 0.8rem + 1.4vw, 2rem);
}

/* 时段决定这颗点的颜色：白天绿，凌晨琥珀，我大概率睡着的时段就不闪了 */
.hero__kicker { --dot: var(--green); }
.hero__kicker[data-awake="late"] { --dot: var(--yellow); }
.hero__kicker[data-awake="no"] { --dot: var(--ink-3); }

.hero__kicker::before {
  content: "";
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 70%, transparent);
  animation: ping 2.4s var(--soft) infinite;
  transition: background-color 0.6s var(--soft);
}

.hero__kicker[data-awake="no"]::before { animation: none; }

@keyframes ping {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 65%, transparent); }
  70%  { box-shadow: 0 0 0 11px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* 分隔点，和 .hero__meta 那行同一套写法 */
.hero__kicker > * + *::before {
  content: "·";
  margin-right: 0.6rem;
  color: var(--ink-3);
}

/* 等宽数字，分钟跳动时这行字不会跟着抖 */
.hero__kicker [data-clock-time] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.hero__title {
  font-size: var(--t-4);
  line-height: 0.88;
  margin-bottom: 0.28em;
}

.hero__title .row { display: block; }
.hero__title .row--red { color: var(--red-display); }

/* 逐字：脚本拆成单字，进场依次弹起，点击可再弹一次，鼠标扫过会依次让路 */
.ch {
  display: inline-block;
  transform: translateY(0.9em) rotate(6deg);
  /* 进场和点击占用 transform，光标波浪只能走独立的 translate 属性，两者才不打架。
     它也不能跟着 --d 一起延迟，否则鼠标扫过去要等一秒字才抬起来 */
  translate: 0 var(--lift, 0px);
  opacity: 0;
  transition:
    transform 0.72s var(--pop) var(--d, 0ms),
    opacity 0.5s var(--ease) var(--d, 0ms),
    translate 0.34s var(--ease);
  cursor: pointer;
}

.ch.is-in { transform: none; opacity: 1; }
.ch.is-hit { animation: hit 0.55s var(--pop); }

/* 光标靠近时字还会变粗。只给拉丁字母开：
   中文走的是系统字体，多半没有字重轴，硬调只会在 700/900 之间硬跳 */
.ch[data-latin] {
  font-weight: var(--wght, 700);
  transition:
    transform 0.72s var(--pop) var(--d, 0ms),
    opacity 0.5s var(--ease) var(--d, 0ms),
    translate 0.34s var(--ease),
    font-weight 0.34s var(--ease);
}

@keyframes hit {
  0%   { transform: translateY(0) scale(1) rotate(0); }
  35%  { transform: translateY(-0.16em) scale(1.14) rotate(-5deg); }
  70%  { transform: translateY(0.03em) scale(0.97) rotate(2deg); }
  100% { transform: none; }
}

.hero__say {
  font-size: var(--t-2);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.03em;
  max-width: 16em;
  margin-bottom: clamp(1.4rem, 1rem + 1.6vw, 2.4rem);
}

/* 高亮词：一块歪着贴上去的色块 */
.mark {
  display: inline-block;
  padding: 0.02em 0.32em;
  border-radius: 12px 12px 3px 3px;
  background: var(--red);
  color: #fff;
  transform: rotate(-1.6deg);
  transition: transform 0.4s var(--pop);
}

.mark:nth-of-type(2) { background: var(--blue); transform: rotate(1.4deg); }
.hero__say:hover .mark { transform: rotate(0) scale(1.04); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  font-size: var(--t--1);
  font-weight: 500;
  color: var(--ink-3);
  /* 收住宽度，右侧才留得出摆贴纸的空档；这行字本来也不该横贯整屏 */
  max-width: 32em;
}

.hero__meta span { display: inline-flex; align-items: center; gap: 0.55rem; }
.hero__meta span + span::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* 招牌拱形：压在正文下面(z-index 1)、贴纸上面的是贴纸(3)。
   锚在右下角并被 .hero 的 overflow 裁掉一角，才像个被取景框切到的实物 */
.hero__mark {
  position: absolute;
  z-index: 1;
  right: clamp(-90px, -3vw, -20px);
  bottom: -16%;
  width: clamp(210px, 27vw, 400px);
  pointer-events: none;
  transform: translateY(var(--py, 0px));
  rotate: var(--pr, 0deg);
  transform-origin: 50% 25%;
}

.hero__mark svg { display: block; width: 100%; height: auto; }

/* 窄屏正文会占满整个宽度，拱形退到边外只留一道弧，当背景纹理用 */
@media (max-width: 900px) {
  .hero__mark {
    right: -20%;
    bottom: -8%;
    width: clamp(170px, 46vw, 300px);
  }
}

/* 纸雁群：位置和角度全由脚本逐帧写，这里只管长相和扇翅膀 */
.geese {
  position: absolute;
  inset: 0;
  z-index: 4;          /* 飞在贴纸(3)之上，它们是唯一会越过所有东西的 */
  /* 点击靠脚本按距离判定，不让雁群挡住底下的字 */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

.geese.is-flying { opacity: 1; }

.goose {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--w, 42px);
  will-change: transform;
}

.goose svg { display: block; width: 100%; height: auto; }

.goose__wings {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  /* 每只的 delay 由脚本按队列顺序错开，扇动就会顺着人字往后传 */
  animation: flap var(--flap, 0.62s) ease-in-out infinite;
  animation-delay: var(--phase, 0s);
}

/* 两片翅膀一起朝身体那条线压下去，就是一次扇动 */
@keyframes flap {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.26); }
}

/* 贴纸：可拖，可甩，会撞墙 */
.sticker {
  position: absolute;
  z-index: 3;
  padding: 0.55em 1.1em;
  font-size: var(--t--1);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--bg-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: 4px 5px 0 0 var(--ink);
  cursor: grab;
  user-select: none;
  /* 只在真的按住时才接管手势，否则会把首屏底部变成划不动的死区 */
  touch-action: pan-y;
  white-space: nowrap;
  rotate: var(--rot, 0deg);
  transition: box-shadow 0.25s var(--ease);
}

.sticker:active { cursor: grabbing; }
.sticker.is-dragging { touch-action: none; box-shadow: 8px 10px 0 0 var(--ink); z-index: 20; }
.sticker.is-hit { animation: wobble 0.6s var(--pop); }
/* 终端里 reset 时才挂上，让贴纸自己飞回原位而不是瞬移 */
.sticker.is-homing { transition: transform 0.6s var(--pop), box-shadow 0.25s var(--ease); }

@keyframes wobble {
  0%, 100% { rotate: var(--rot, 0deg); }
  25%      { rotate: calc(var(--rot, 0deg) - 9deg); }
  60%      { rotate: calc(var(--rot, 0deg) + 7deg); }
}

.sticker--red { background: var(--red-deep); color: #fff; border-color: var(--ink); }
/* 绿与黄在两套主题里都是亮色，文字固定用深色才不会看不清 */
.sticker--green { background: var(--green); color: #17140E; }
.sticker--yellow { background: var(--yellow); color: #17140E; }
.sticker--blue { background: var(--blue); color: #fff; }

/* 定位放在样式表里而不是行内，窄屏才改得动。
   正文靠左，右侧两张用百分比怎么摆都安全；左侧两张只有正文上下两条窄带能站人，
   而那两条带子是贴着首屏上下边缘的，所以用 rem 死钉在边上，不跟着视口高度浮动 */
.s1 { --rot: -7deg; left: 6%;   top: 7rem; }
.s2 { --rot: 6deg;  right: 10%; top: 20%; }
.s3 { --rot: -4deg; right: 6%;  bottom: 28%; }
.s4 { --rot: 8deg;  left: 9%;   bottom: 4.5rem; }
.s5 { --rot: 5deg;  right: 24%; top: 8.5rem; }
.s6 { --rot: -6deg; right: 4%;  top: 46%; }
.s7 { --rot: 7deg;  right: 27%; bottom: 13%; }
.s8 { --rot: -5deg; left: 27%;  bottom: 4.5rem; }

/* 屏幕越大摆得越多：默认四张，宽屏六张，超宽八张。
   多出来的那几张只在四角布局成立时才放得下，所以高度也要够 */
.s5, .s6, .s7, .s8 { display: none; }

@media (min-width: 1280px) and (min-height: 821px) {
  .s5, .s6 { display: block; }
}

@media (min-width: 1600px) and (min-height: 821px) {
  .s7, .s8 { display: block; }
}

.hero__hint {
  position: absolute;
  left: 50%;
  bottom: clamp(1.2rem, 0.8rem + 1.6vw, 2.4rem);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  font-size: var(--t--1);
  font-weight: 500;
  color: var(--ink-3);
  z-index: 2;
}

.hero__hint::after {
  content: "";
  width: 2px; height: 34px;
  border-radius: 2px;
  background: var(--ink-3);
  animation: fall 2.2s var(--soft) infinite;
  transform-origin: top;
}

@keyframes fall {
  0%, 100% { transform: scaleY(0.25); opacity: 0.35; }
  45%      { transform: scaleY(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   5. 跑马灯
   -------------------------------------------------------------------------- */

/* 跑马灯 rotate + scale 后比视口宽，就地裁掉。
   这层只包着跑马灯，不会影响作品区 sticky 的滚动祖先。
   但歪着放同时也会向上下溢出(视口越宽溢出越多，1440 时约 15px)，
   直接 hidden 会把红条两头削平。上下留出余量再用负外边距抵消，
   于是横向照裁、纵向照露，排版位置一点不变 */
.marquee-clip {
  overflow: hidden;
  padding-block: 2.5rem;
  margin-block: -2.5rem;
}

.marquee {
  position: relative;
  padding-block: clamp(0.7rem, 0.5rem + 0.7vw, 1.1rem);
  background: var(--red);
  color: #fff;
  overflow: hidden;
  border-block: 2px solid var(--ink);
  transform: rotate(-1.1deg) scale(1.03);
}

/* 这条匀速动画只是脚本没跑起来时的兜底。
   initMarquee 一接手就把它关掉，改成跟着滚动速度走的逐帧推进 */
.marquee__track {
  display: flex;
  width: max-content;
  animation: slide 34s linear infinite;
}

@keyframes slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.marquee__group {
  display: flex;
  align-items: center;
  gap: 2.4rem;
  padding-right: 2.4rem;
  font-size: var(--t-1);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.marquee__group span { display: inline-flex; align-items: center; gap: 2.4rem; }
.marquee__group span::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* --------------------------------------------------------------------------
   6. 通用章题
   -------------------------------------------------------------------------- */

.head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  margin-bottom: clamp(2rem, 1.2rem + 2.6vw, 3.6rem);
}

.head__title {
  font-size: var(--t-3);
  letter-spacing: -0.04em;
}

.head__note {
  margin-left: auto;
  font-size: var(--t--1);
  font-weight: 500;
  color: var(--ink-3);
  max-width: 24em;
}

/* --------------------------------------------------------------------------
   6.5 章题上的笔迹：像有人拿红笔在标题上圈了一下、划了一道
   -------------------------------------------------------------------------- */

/* 每个章题一种，圈 / 划 / 星，三处不重样。
   笔画在那一节进场时自己画出来，靠的是把虚线的空档从满推到零 */
.scrib { position: relative; display: inline-block; }

.scrib__ink {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--red);
  /* 用 em 跟着标题字号走，再让描边不随 viewBox 缩放，
     大屏小屏笔画粗细才一样顺手 */
  stroke-width: 0.052em;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* 每条 path 上都写了 pathLength="1"，长度一律按「整条」算，
   于是不管笔画本身多长，1 就是没画，0 就是画完 */
.scrib__ink path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.95s var(--ease) var(--pen, 300ms);
}

/* 这一节被点亮之后，笔迹才开始落下 */
.rise.is-in .scrib__ink path { stroke-dashoffset: 0; }

/* 圈：套在两个字外面，收笔时故意画过了头 */
.scrib--ring .scrib__ink {
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 132%;
  height: 186%;
}

/* 划：压在字底下，两道，第二道慢半拍 */
.scrib--line .scrib__ink {
  left: 50%;
  bottom: -0.2em;
  translate: -50% 0;
  width: 114%;
  height: 0.34em;
}

.scrib--line .scrib__ink path:nth-child(2) { --pen: 480ms; }

/* 星：蹲在字的右肩上，三笔向外挑 */
.scrib--star .scrib__ink {
  right: -0.66em;
  top: -0.3em;
  width: 0.6em;
  height: 0.6em;
}

.scrib--star .scrib__ink path:nth-child(2) { --pen: 430ms; }
.scrib--star .scrib__ink path:nth-child(3) { --pen: 520ms; }

/* 红底那块里的笔迹得换成纸色，红划红等于没划 */
.contact .scrib__ink { stroke: #fff; }

/* --------------------------------------------------------------------------
   7. 信念三条
   -------------------------------------------------------------------------- */

.beliefs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: clamp(1rem, 0.6rem + 1.4vw, 1.8rem);
}

.belief {
  position: relative;
  overflow: hidden;    /* 折角要被卡片自己的圆角裁住 */
  padding: clamp(1.5rem, 1.1rem + 1.4vw, 2.4rem);
  background: var(--bg-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 6px 7px 0 0 var(--ink);
  transition: transform 0.4s var(--pop), box-shadow 0.4s var(--pop);
}

.belief:hover {
  transform: translate(-3px, -4px);
  box-shadow: 10px 12px 0 0 var(--ink);
}

.belief__no {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: var(--t--1);
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border-radius: 14px 14px 4px 4px;
}

.belief:nth-child(1) .belief__no { background: var(--red-deep); }
.belief:nth-child(2) .belief__no { background: var(--green); color: #17140E; }
.belief:nth-child(3) .belief__no { background: var(--blue); }

.belief__title {
  font-size: var(--t-1);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

/* 长说明段一律用 --t-body，别跟导航、标签共用那个小号 */
.belief__body {
  font-size: var(--t-body);
  line-height: 1.9;
  color: var(--ink-2);
}

/* 折角：卡片右下角折起一块，掀开底下压着一句话。
   135deg 的分界线正好是从右上到左下那条对角线，也就是折痕本身 */
.fold {
  --size: 2.4rem;
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--size);
  height: var(--size);
  cursor: pointer;
  background:
    linear-gradient(135deg,
      transparent calc(50% - 1.5px),
      var(--ink) calc(50% - 1.5px),
      var(--ink) calc(50% + 1.5px),
      transparent calc(50% + 1.5px)),
    linear-gradient(135deg, transparent 50%, var(--bg-lo) 50%);
  transition: width 0.5s var(--pop), height 0.5s var(--pop);
}

.fold__note {
  position: absolute;
  right: 0.9rem;
  bottom: 0.7rem;
  width: 8.5em;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: right;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.fold.is-open { --size: 11rem; }
.fold.is-open .fold__note { opacity: 1; transition-delay: 0.18s; }

@media (hover: hover) {
  .belief:hover .fold { --size: 11rem; }
  .belief:hover .fold__note { opacity: 1; transition-delay: 0.18s; }
}

/* --------------------------------------------------------------------------
   7.5 书脊：一根随滚动画出来的线，把下半页的四节串成一本书
   -------------------------------------------------------------------------- */

/* 线是绝对定位在 main 里的，起止两头由脚本按首尾两节量出来 */
main { position: relative; }

/* 只在左边真的空得出一条道的屏幕上出现。
   线本身不接指针事件，否则整个下半页都会被这块透明区盖住 */
.thread {
  position: absolute;
  left: calc(50% - var(--measure) / 2 - 30px);
  width: 40px;
  z-index: 1;
  pointer-events: none;
}

@media (max-width: 1339px) {
  .thread { display: none; }
}

.thread svg { display: block; width: 40px; }

/* 底下那根是全程都在的浅色底线，上面那根红的才跟着滚动长出来 */
.thread__track { fill: none; stroke: var(--line-2); stroke-width: 2; }

.thread__ink {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.6;
  stroke-linecap: round;
  /* path 上写了 pathLength="1"，所以这里的 1 就是「整条」，
     偏移多少等于还没画到哪，脚本直接把进度写进来 */
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* 结：线走到这一节就打一个，点它跳过去 */
.thread__knot {
  position: absolute;
  translate: -50% -50%;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.45s var(--ease), border-color 0.45s var(--ease),
    scale 0.35s var(--pop);
}

.thread__knot b {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  translate: 0 -50%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.thread__knot.is-lit { border-color: var(--red); background: var(--red); }
.thread__knot.is-lit b { opacity: 1; }
.thread__knot:hover { scale: 1.4; }
.thread__knot:hover b { color: var(--red-text); }

/* --------------------------------------------------------------------------
   8. 作品
   -------------------------------------------------------------------------- */

/* 这一节换一张纸：颜色深一档，上下两条边是撕开的，
   整个下半页才不是一条到底的同色长条 */
.section--paper {
  position: relative;
  background-color: var(--bg-lo);
  background-image: var(--grain);
}

/* 纸沿着撕口再往外探出一截。遮罩只管透明度不管颜色，
   所以同一张图两套配色通用，翻主题也不用改 */
.section--paper::before,
.section--paper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 15px;
  background: var(--bg-lo);
  -webkit-mask: var(--tear) repeat-x 0 0 / 400px 15px;
  mask: var(--tear) repeat-x 0 0 / 400px 15px;
}

.section--paper::before { bottom: 100%; }
/* 下缘是同一张撕口翻过来用 */
.section--paper::after { top: 100%; transform: scaleY(-1); }

/* 回形针：把这张纸夹在页面上。点一下它就掉了，刷新又回来 */
.clip {
  position: absolute;
  top: -30px;
  left: clamp(1.2rem, 5vw, 6rem);
  z-index: 4;
  width: 26px;
  color: var(--ink-3);
  cursor: pointer;
  rotate: -7deg;
  transition: rotate 0.3s var(--pop), color 0.3s var(--ease);
}

.clip svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.clip:hover { rotate: -13deg; color: var(--ink-2); }

.clip.is-off {
  pointer-events: none;
  animation: clipOff 0.85s var(--ease) forwards;
}

@keyframes clipOff {
  0%   { translate: 0 0; rotate: -7deg; opacity: 1; }
  30%  { translate: -6px -34px; rotate: 40deg; opacity: 1; }
  100% { translate: -46px 90px; rotate: 400deg; opacity: 0; }
}

/* 夹子底下压着的那张纸条 */
.clip__note {
  position: absolute;
  top: -14px;
  left: calc(clamp(1.2rem, 5vw, 6rem) + 40px);
  z-index: 4;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  opacity: 0;
  rotate: -2deg;
  translate: -8px 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease) 0.25s, translate 0.5s var(--ease) 0.25s;
}

.clip.is-off ~ .clip__note { opacity: 1; translate: 0 0; }

/* 窄屏这块纸边上没地方摆，夹子和纸条一起收起来 */
@media (max-width: 680px) {
  .clip, .clip__note { display: none; }
}

.works {
  display: grid;
  gap: clamp(1rem, 0.6rem + 1.4vw, 1.6rem);
  --stick: clamp(4.5rem, 3.4rem + 2.2vw, 6.5rem);
  --stick-step: 16px;
  /* 容器一到底，五张卡会被同时压到同一个位置再一起离场。
     留一段余量，叠满的那一刻才停得住，不然刚叠好就散了 */
  padding-bottom: clamp(2.5rem, 10vh, 8rem);
}

.work {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.9rem, 0.5rem + 1.6vw, 2.2rem);
  padding: clamp(1.4rem, 1rem + 1.6vw, 2.3rem);
  background: var(--bg-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 6px 7px 0 0 var(--ink);
  overflow: hidden;
  transition: transform 0.4s var(--pop), box-shadow 0.4s var(--pop),
    background-color 0.35s var(--ease);
}

.work::before {
  content: "";
  position: absolute;
  inset: 0;
  /* 这块红上要压小号白字，必须比品牌红更深才够对比度 */
  background: var(--red-deep);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease);
  z-index: 0;
}

/* 卡片都是新标签打开，触屏上点开再切回来 hover 会粘在终态，
   整块砖红停住看起来像页面坏了，所以只在真有指针悬停能力时启用 */
@media (hover: hover) {
  .work:hover {
    transform: translate(-4px, -5px);
    box-shadow: 12px 14px 0 0 var(--ink);
  }

  .work:hover::before { transform: translateY(0); }
}

.work.is-pressed { transform: translate(2px, 3px); box-shadow: 3px 3px 0 0 var(--ink); }

/* 滚动堆叠：每张卡停在略低一点的位置，后一张压上来时前一张只露出顶边那道弧。
   必须写在 .work 的 position:relative 之后，同样特异性靠顺序取胜。
   视口不够高时(横屏手机、小窗)最后一张会顶出屏幕，直接退回普通排列 */
@media (min-height: 660px) {
  .work {
    position: sticky;
    top: calc(var(--stick) + var(--i, 0) * var(--stick-step));
  }

  .work:nth-child(2) { --i: 1; }
  .work:nth-child(3) { --i: 2; }
  .work:nth-child(4) { --i: 3; }
  .work:nth-child(n+5) { --i: 4; }
}

.work > * { position: relative; z-index: 1; }

.work__no {
  font-family: var(--font-mono);
  font-size: var(--t--1);
  font-weight: 700;
  color: var(--ink-3);
  transition: color 0.35s var(--ease);
}

.work__name {
  font-size: var(--t-2);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin-bottom: 0.35rem;
  transition: color 0.35s var(--ease);
}

.work__name em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.5em;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 0.7em;
  letter-spacing: 0;
  transition: color 0.35s var(--ease);
}

.work__desc {
  font-size: var(--t-body);
  line-height: 1.9;
  color: var(--ink-2);
  max-width: 44em;
  transition: color 0.35s var(--ease);
}

.work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.work__tags span {
  padding: 0.22em 0.7em;
  font-size: var(--t--1);
  font-weight: 600;
  border: 2px solid var(--line-2);
  border-radius: 999px;
  transition: border-color 0.35s var(--ease), color 0.35s var(--ease);
}

.work__go {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  transition: transform 0.4s var(--pop), background-color 0.35s var(--ease),
    color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.work__go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .work:hover .work__name,
  .work:hover .work__desc,
  .work:hover .work__no,
  .work:hover .work__name em { color: #fff; }

  .work:hover .work__tags span { border-color: rgba(255, 255, 255, 0.55); color: #fff; }

  .work:hover .work__go {
    background: #fff;
    color: var(--red-deep);
    border-color: #fff;
    transform: rotate(45deg) scale(1.08);
  }
}

/* --------------------------------------------------------------------------
   9. 关于
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.6rem, 1rem + 3vw, 4rem);
  align-items: start;
}

.about__text {
  font-size: var(--t-1);
  line-height: 1.85;
  color: var(--ink-2);
}

.about__text p + p { margin-top: 1.2em; }

/* 起手一个大字沉下去，像翻开书的第一页 */
.about__text > p:first-child::first-letter {
  float: left;
  margin: 0.1em 0.12em 0 0;
  font-size: 3.1em;
  line-height: 0.8;
  color: var(--red-text);
}

/* 加粗的词可以点，点一下像有人拿笔在书上划了一道。
   那条线是内联的 SVG，笔画本身是歪的，才不像机器画的下划线 */
.about__text b {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1.5 5.4C18 2.6 33 7.2 51 4.1S82 2.2 98.5 5.2' fill='none' stroke='%23E35342' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0 92%;
  background-size: 0 0.42em;
  transition: background-size 0.55s var(--ease);
}

.about__text b.is-marked { background-size: 100% 0.42em; }

.wants {
  padding: clamp(1.4rem, 1rem + 1.4vw, 2.2rem);
  background: var(--bg-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 6px 7px 0 0 var(--ink);
}

.wants__title {
  font-size: var(--t-1);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.wants li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.8rem 0;
  font-size: var(--t-body);
  line-height: 1.85;
  color: var(--ink-2);
  border-top: 2px solid var(--line);
}

.wants li::before {
  content: "";
  width: 10px; height: 10px;
  margin-top: 0.62em;
  border-radius: 3px;
  background: var(--red);
  transform: rotate(45deg);
}

.wants li:nth-child(2)::before { background: var(--green); }
.wants li:nth-child(3)::before { background: var(--yellow); }

/* --------------------------------------------------------------------------
   10. 联系
   -------------------------------------------------------------------------- */

.contact {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 1.2rem + 3.6vw, 4.5rem);
  /* 这块里全是小号白字，用比品牌红更深的一档才够对比度 */
  background: var(--red-deep);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 10px 12px 0 0 var(--ink);
}

.contact__title {
  font-size: var(--t-3);
  letter-spacing: -0.04em;
  margin-bottom: 0.6rem;
}

.contact__sub {
  font-size: var(--t-1);
  font-weight: 500;
  color: #fff;
  margin-bottom: clamp(1.6rem, 1rem + 2vw, 2.6rem);
  max-width: 30em;
}

/* 邮戳：平时不在，抄走联系方式的那一下才盖下来 */
.stamp {
  position: absolute;
  top: clamp(1.2rem, 0.6rem + 2vw, 2.6rem);
  right: clamp(1rem, 0.4rem + 2.4vw, 3rem);
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.15em;
  width: 6.4rem;
  height: 6.4rem;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  rotate: -16deg;
  scale: 1.9;
}

.stamp b { font-weight: 700; letter-spacing: 0; }

/* 盖下来：快、重、然后就停在那儿 */
.stamp.is-stamped { animation: stampDown 0.42s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }

@keyframes stampDown {
  0%   { opacity: 0; scale: 1.9; }
  55%  { opacity: 1; scale: 0.94; }
  100% { opacity: 1; scale: 1; }
}

@media (max-width: 680px) { .stamp { display: none; } }

.lines { display: grid; gap: 0.6rem; }

.line {
  display: grid;
  grid-template-columns: 5.6em minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.95rem 1.2rem;
  background: rgba(0, 0, 0, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform 0.35s var(--pop), background-color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.line:hover {
  transform: translate(-2px, -3px);
  background: #fff;
  border-color: #fff;
  color: var(--red-deep);
}

.line__key { font-size: var(--t--1); font-weight: 700; }
.line__val { font-family: var(--font-mono); font-size: var(--t--1); word-break: break-all; }
.line__act { font-size: var(--t--1); font-weight: 600; }

/* --------------------------------------------------------------------------
   11. 页脚
   -------------------------------------------------------------------------- */

.foot {
  padding-block: 3rem 4rem;
  border-top: 2px solid var(--line);
  margin-top: clamp(4rem, 2rem + 6vw, 8rem);
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1.6rem;
  font-size: var(--t--1);
  font-weight: 500;
  color: var(--ink-3);
}

.foot__hint { margin-left: auto; }
.foot__hint b { color: var(--red-text); font-weight: 700; }

/* --------------------------------------------------------------------------
   12. 进场
   -------------------------------------------------------------------------- */

/* 隐藏态只在脚本可用时生效，脚本挂了内容也照样看得见 */
:root.js .rise {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.85s var(--soft) var(--delay, 0ms),
    transform 0.85s var(--pop) var(--delay, 0ms);
}

:root.js .rise.is-in { opacity: 1; transform: none; }

/* 点击迸出的小色片 */
.confetti {
  position: fixed;
  z-index: 90;
  width: 9px; height: 9px;
  border-radius: 2px;
  pointer-events: none;
  will-change: transform, opacity;
}

/* --------------------------------------------------------------------------
   13. 终端彩蛋
   -------------------------------------------------------------------------- */

.term {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  padding: clamp(0.8rem, 0.4rem + 2vw, 3rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.term.is-open { display: block; animation: termIn 0.45s var(--pop); }

@keyframes termIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.term__box {
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 10px 12px 0 0 var(--ink);
  overflow: hidden;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 2px solid var(--ink);
  font-size: var(--t--1);
  font-weight: 600;
}

.term__dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); }
.term__dot--live { background: var(--red); }
.term__x { margin-left: auto; border: 0; background: none; cursor: pointer; font-weight: 700; }
.term__x:hover { color: var(--red-text); }

.term__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.4rem;
  font-family: var(--font-mono);
  font-size: var(--t--1);
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.term__body b { color: var(--ink); }
.term__body i { color: var(--red-text); font-style: normal; }
.term__body u { color: var(--ink-3); text-decoration: none; }
.term__line { display: block; }

.term__prompt {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.7rem 1.1rem 1.1rem;
  border-top: 2px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--t--1);
}

.term__sigil { color: var(--red-text); font-weight: 700; }

.term__input {
  flex: 1;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  outline: none;
  caret-color: var(--red);
}

/* --------------------------------------------------------------------------
   14. 透视模式：按 ~ 让页面自己讲自己是怎么做的
   -------------------------------------------------------------------------- */

.xray {
  position: fixed;
  inset: 0;
  z-index: 70;          /* 压住内容，但要让终端(80)盖在它上面 */
  pointer-events: none;
  font-family: var(--font-mono);
}

.xray__box {
  position: absolute;
  border: 2px dashed var(--red);
  border-radius: 5px;
}

.xray__tag {
  position: absolute;
  left: -2px;
  bottom: 100%;
  margin-bottom: 4px;
  padding: 0.35em 0.7em;
  max-width: 88vw;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  /* 标签是浮在页面之上的工具层，两套配色下都用同一身打扮：
     跟着主题翻转的话，暗色下会变成奶油底，黄色数字直接糊掉 */
  color: #F2E3CF;
  background: #171717;
  border-radius: 7px 7px 2px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 贴着视口顶端的元素(比如导航)上方没地方，标签翻到框内 */
.xray__box[data-flip] .xray__tag {
  bottom: auto;
  top: 2px;
  margin: 0;
  border-radius: 2px 7px 7px 2px;
}

.xray__num { color: #EDBE24; font-style: normal; }

.xray__hint {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  padding: 0.5em 1em;
  font-size: 12px;
  font-weight: 700;
  color: #F2E3CF;
  background: #171717;
  border-radius: 12px 12px 3px 3px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   15. 窄屏
   -------------------------------------------------------------------------- */

@media (max-width: 940px) {
  .about { grid-template-columns: minmax(0, 1fr); }
  .head__note { margin-left: 0; }
}

/* 四角摆放要同时满足两件事：左右有空档，上下也有空档。
   矮屏(1366×768 这类笔记本，视口高度往往只剩 660 上下)正文几乎顶满首屏，
   上下那两条带子就没了，所以宽度和高度任一不够，都退回底部一排。 */
@media (max-width: 900px), (max-height: 820px) {
  .hero { padding-bottom: 12rem; }
  .sticker { font-size: 0.8rem; padding: 0.5em 0.95em; }
  /* 左右两侧同时有值会把绝对定位元素拉伸满屏，务必把另一侧复位 */
  .s1 { --rot: -8deg; left: 5%;   right: auto; top: auto; bottom: 5.6rem; }
  .s2 { --rot: 6deg;  right: 6%;  left: auto;  top: auto; bottom: 5.6rem; }
  .s3 { --rot: -3deg; left: 8%;   right: auto; top: auto; bottom: 1.6rem; }
  .s4 { --rot: 7deg;  right: 10%; left: auto;  top: auto; bottom: 1.6rem; }
}

@media (max-width: 680px) {
  .work { grid-template-columns: auto minmax(0, 1fr); }
  .work__go { grid-column: 2; justify-self: start; margin-top: 0.4rem; }
  .line { grid-template-columns: 3.9em minmax(0, 1fr); padding: 0.85rem 0.9rem; }
  .line__val { font-size: 0.8rem; }
  .hero__hint { display: none; }
  .sticker { font-size: 0.78rem; padding: 0.5em 0.9em; }
}

/* --------------------------------------------------------------------------
   15. 降级
   -------------------------------------------------------------------------- */

/* 终端只能靠实体键盘唤起，手机上别给一个做不到的提示 */
@media (hover: none) and (pointer: coarse) {
  .foot__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .rise, .ch { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
  /* 笔迹直接是画完的样子，不去追那条线 */
  .scrib__ink path { stroke-dashoffset: 0; }
}

/* --------------------------------------------------------------------------
   16. 打印：动画状态与装饰全部去掉，只留内容
   -------------------------------------------------------------------------- */

@media print {
  :root.js .rise,
  :root.js .rise.is-in,
  .ch { opacity: 1 !important; transform: none !important; }

  .nav, .marquee, .sticker, .hero__hint, .hero__mark, .term, .work__go,
  .thread, .clip, .clip__note, .scrib__ink { display: none !important; }

  /* 纸上不需要另一张纸的颜色和毛边 */
  .section--paper { background: none !important; }
  .section--paper::before, .section--paper::after { display: none !important; }

  /* 纸上没有滚动，堆叠只会让卡片互相盖住 */
  .work { position: static !important; }

  body { background: #fff; color: #000; }

  .belief, .work, .wants, .contact {
    background: #fff;
    color: #000;
    border: 1px solid #000;
    box-shadow: none;
    break-inside: avoid;
  }

  .contact__title, .contact__sub, .line, .line__key, .line__val { color: #000; }
  .line { background: none; border: 1px solid #000; }

  /* 纸上点不了链接，把地址打出来 */
  .work[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.7em;
    word-break: break-all;
  }

  .section { padding-block: 1.5rem; }
}
