/* 科山科技官网 v2 · 水墨山水
   宣纸底、墨色字、一点朱红；衬线用自带的宋体子集（见下），不引外站字体，国内打开不卡 */

/* 自带字体：思源宋体（SIL OFL）里抽出页面用到的字，改名 Keshan Song，协议在 fonts/OFL.txt。各设备显示同一款宋体 */
@font-face { font-family: "Keshan Song"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/keshan-song-400.woff2?v=1") format("woff2"); }
@font-face { font-family: "Keshan Song"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/keshan-song-700.woff2?v=1") format("woff2"); }
@font-face { font-family: "Keshan Song"; font-weight: 900; font-style: normal; font-display: swap; src: url("/assets/fonts/keshan-song-900.woff2?v=1") format("woff2"); }
:root {
  --paper: #f3efe6;
  --ink: #16140f;
  --ink-2: #4a463c;
  --muted: #8c8576;
  --line: rgba(22, 20, 15, 0.16);
  --red: #c8351f;
  --light: #efeadf;
  --light-muted: #9a9486;
  --pad: clamp(20px, 5vw, 76px);
  --ts: clamp(64px, 15.5vh, 196px);            /* 首屏竖排大字的字号 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --serif: "Keshan Song", "Source Han Serif SC", "Noto Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --latin: "Didot", "Bodoni 72", "Bodoni MT", "Times New Roman", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-loading { overflow: hidden; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: var(--red); color: var(--paper); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.defs { position: absolute; }

/* 山水画布：钉在最底层。上面的文字要和它做混合，所以 main 和各 section 都不能建新的层叠上下文
   （不给 z-index、transform、opacity、filter） */
#scene { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; display: block; }

/* ---------- 印章 ---------- */
.seal {
  display: grid; place-items: center;
  width: 2.5em; height: 2.5em; font-size: 16px;
  background: var(--red); color: var(--paper);
  border-radius: 0.2em;
  filter: url(#rough-seal);
}
.seal span {
  writing-mode: vertical-rl; font-family: var(--serif); font-weight: 900;
  font-size: 1em; line-height: 1; letter-spacing: 0.04em;
}

/* ---------- 开场：落一枚印，再飞到左上角 ---------- */
.loader { position: fixed; inset: 0; z-index: 100; background: var(--paper); transition: opacity 1.1s var(--ease-io), visibility 0s 1.1s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader-seal {
  position: fixed; left: 50%; top: 50%; z-index: 101; font-size: 40px;
  margin: -1.25em 0 0 -1.25em; transform-origin: center;
  animation: stamp 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) 0.25s both;
}
.loader-seal.fly { transition: transform 1.1s var(--ease-io); }
@keyframes stamp {
  from { opacity: 0; transform: scale(1.8) rotate(-16deg); }
  to { opacity: 1; transform: scale(1) rotate(-4deg); }
}

/* ---------- 光标（只在有鼠标的设备上） ---------- */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none;
    width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
    background: var(--paper); mix-blend-mode: difference;
    transition: width 0.45s var(--ease), height 0.45s var(--ease), margin 0.45s var(--ease), opacity 0.3s;
  }
  .cursor.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .cursor.is-out { opacity: 0; }
}

/* ---------- 左上印章、右上导航 ---------- */
.brand { position: fixed; left: var(--pad); top: 22px; z-index: 50; opacity: 0; transform: rotate(-4deg); transition: transform 0.6s var(--ease); }
.brand.on { opacity: 1; }
.brand:hover { transform: rotate(4deg) scale(1.08); }
.nav {
  position: fixed; right: var(--pad); top: 30px; z-index: 50;
  display: flex; gap: clamp(18px, 2.6vw, 40px);
  font-family: var(--serif); font-size: 15px; letter-spacing: 0.18em;
  color: var(--paper); mix-blend-mode: difference;       /* 压在纸上是墨色，压在墨山和夜色上自动变浅 */
  transition: transform 0.7s var(--ease), opacity 0.8s 0.9s;
  opacity: 0;
}
.ready .nav { opacity: 1; }
.nav.is-hidden { transform: translateY(-80px); }
.nav a { position: relative; padding: 4px 0; }
.nav i { font-family: var(--latin); font-style: italic; font-size: 11px; letter-spacing: 0.04em; margin-right: 7px; opacity: 0.6; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 0.6s var(--ease); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- 首屏 ---------- */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 540px; }
.hero-title {
  position: absolute; top: 12vh; left: var(--pad);
  writing-mode: vertical-rl;
  font-family: var(--serif); font-weight: 900; font-size: var(--ts); line-height: 1; letter-spacing: 0.04em;
  color: var(--ink);
}
.hero-title .ch { display: inline-block; opacity: 0; filter: blur(18px); transform: translateY(0.18em); transition: opacity 1.5s var(--ease), filter 1.5s var(--ease), transform 1.5s var(--ease); }
.ready .hero-title .ch { opacity: 1; filter: blur(0); transform: none; }
.hero-title .ch:nth-child(1) { transition-delay: 0.25s; }
.hero-title .ch:nth-child(2) { transition-delay: 0.4s; }
.hero-title .ch:nth-child(3) { transition-delay: 0.55s; }
.hero-title .ch:nth-child(4) { transition-delay: 0.7s; }

.hero-side {
  position: absolute; top: calc(12vh + var(--ts) * 0.5); left: calc(var(--pad) + var(--ts) + clamp(14px, 2.2vw, 36px));
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
/* 小字一列：比标题小得多，起笔比「科」字低半个字，不和标题齐头 */
.hero-tag { writing-mode: vertical-rl; font-family: var(--serif); font-size: clamp(13px, 1.8vh, 18px); letter-spacing: 0.5em; color: var(--paper); mix-blend-mode: difference; }
.hero-tag span { display: inline-block; }
.hero-foot span { display: inline-block; }
.hero-tag span, .hero-foot span { opacity: 0; transition: opacity 1.4s 1.2s; }
.ready .hero-tag span, .ready .hero-foot span { opacity: 1; }
.hero-seal { font-size: clamp(11px, 1.5vh, 14px); opacity: 0; transform: rotate(3deg) scale(1.5); transition: opacity 0.25s 1.9s, transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 1.9s; }
.ready .hero-seal { opacity: 1; transform: rotate(3deg) scale(1); }

/* 飞鸟：很小的一行，在主峰左边的天上慢慢飞；每只各自扇翅 */
.hero-birds { position: absolute; left: 44%; top: 23vh; width: clamp(120px, 14.5vw, 260px); overflow: visible; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.hero-birds g { opacity: 0; transition: opacity 2s 1.6s; }
.ready .hero-birds g { opacity: 0.72; }
.hero-birds path { transform-box: fill-box; transform-origin: center bottom; }
@media (prefers-reduced-motion: no-preference) {
  .hero-birds { animation: birds-drift 80s ease-in-out infinite alternate; }
  .hero-birds path { animation: birds-flap 1.5s ease-in-out infinite alternate; }
  .hero-birds path:nth-child(2n) { animation-duration: 1.2s; animation-delay: -0.5s; }
  .hero-birds path:nth-child(3n) { animation-duration: 1.75s; animation-delay: -0.9s; }
  @keyframes birds-drift { from { transform: translate(-5vw, 1.2vh); } to { transform: translate(7vw, -2.4vh); } }
  @keyframes birds-flap { from { transform: scaleY(1); } to { transform: scaleY(0.35); } }
}
.hero-foot {
  position: absolute; right: var(--pad); text-align: right; bottom: 34px;
  font-family: var(--latin); font-size: 13px; letter-spacing: 0.32em; line-height: 2;
  /* 这里压在近处的深色山上，直接用宣纸色加一圈淡墨影：原来用反色混合，碰到中灰的山，反出来还是中灰，字就看不见了 */
  color: var(--paper); text-shadow: 0 0 10px rgba(22, 20, 15, 0.55), 0 0 2px rgba(22, 20, 15, 0.5);
}
.hero-scroll {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 12px; letter-spacing: 0.5em; padding-left: 0.5em;
  color: var(--paper); text-shadow: 0 0 10px rgba(22, 20, 15, 0.55), 0 0 2px rgba(22, 20, 15, 0.5);
}
.hero-scroll i { position: relative; width: 1px; height: 54px; overflow: hidden; }
.hero-scroll i::after { content: ""; position: absolute; inset: 0; background: currentColor; animation: drip 2.4s var(--ease-io) infinite; }
@keyframes drip { 0% { transform: translateY(-100%); } 55% { transform: none; } 100% { transform: translateY(100%); } }

/* ---------- 通用：小节标签、大标题 ---------- */
.sec-label { display: flex; align-items: center; gap: 16px; color: var(--ink-2); }
.sec-label .num { font-family: var(--latin); font-style: italic; font-size: 15px; }
.sec-label i { width: 56px; height: 1px; background: currentColor; opacity: 0.5; }
.sec-label .name { font-family: var(--serif); font-size: 15px; letter-spacing: 0.5em; }

.display { font-family: var(--serif); font-weight: 900; font-size: clamp(42px, 8vw, 132px); line-height: 1.12; letter-spacing: 0.01em; }
.display.xl { font-size: clamp(46px, min(9.6vw, 17vh), 164px); }
.ln { display: block; overflow: hidden; padding: 0.04em 0 0.1em; }
.ln > span { display: inline-block; transform: translateY(112%); transition: transform 1.4s var(--ease); }
.ln:nth-child(2) > span { transition-delay: 0.12s; }
.in .ln > span { transform: none; }

/* ---------- 理念 ---------- */
.idea { padding: 24vh var(--pad) 20vh; }
.idea-text { margin-top: 7vh; font-family: var(--serif); font-weight: 700; font-size: clamp(27px, 4.5vw, 70px); line-height: 1.5; letter-spacing: 0.02em; }
.ph { display: inline-block; opacity: 0; filter: blur(14px); transform: translateY(0.25em); transition: opacity 1.3s var(--ease), filter 1.3s var(--ease), transform 1.3s var(--ease); }
.in .ph { opacity: 1; filter: blur(0); transform: none; }
.ph-red { color: var(--red); }

/* ---------- 诗句 ---------- */
.verse { padding: 6vh 0 12vh; overflow: hidden; }
.verse-row {
  font-family: var(--serif); font-weight: 900; font-size: clamp(76px, 19.5vw, 320px); line-height: 1.12;
  white-space: nowrap; text-align: center; letter-spacing: 0.04em; will-change: transform;
}
.verse-row.is-outline { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.verse-by { margin: 3vh var(--pad) 0; text-align: right; font-family: var(--serif); font-size: 14px; letter-spacing: 0.3em; color: var(--muted); }

/* ---------- 四事 ---------- */
.crafts { padding: 14vh var(--pad) 16vh; }
.craft-list { margin-top: 7vh; border-bottom: 1px solid var(--line); }
.craft {
  position: relative; display: grid; align-items: center; gap: 28px;
  grid-template-columns: 72px minmax(150px, 1fr) minmax(0, 1.25fr) clamp(84px, 9vw, 128px);
  padding: clamp(26px, 4.4vh, 48px) clamp(12px, 2vw, 32px);
  border-top: 1px solid var(--line);
  transition: color 0.5s var(--ease);
}
.craft-no { font-family: var(--serif); font-size: 22px; color: var(--muted); transition: color 0.5s; }
.craft h3 { font-family: var(--serif); font-weight: 900; font-size: clamp(38px, 5.4vw, 88px); line-height: 1.1; letter-spacing: 0.06em; transition: transform 0.7s var(--ease); }
.craft p { color: var(--ink-2); font-size: clamp(14px, 1.2vw, 18px); max-width: 32em; transition: color 0.5s; }
.craft-art { width: 100%; aspect-ratio: 1; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; filter: url(#rough-ink); overflow: visible; }
.craft-art > * { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s var(--ease-io); }
.craft-art > *:nth-child(2) { transition-delay: 0.18s; }
.craft-art > *:nth-child(3) { transition-delay: 0.36s; }
.craft-art > *:nth-child(4) { transition-delay: 0.54s; }
.craft.in .craft-art > * { stroke-dashoffset: 0; }
@media (hover: hover) and (pointer: fine) {
  /* 这几行只是介绍，点不进去，所以悬停不做「按钮式」的反应（整行反白、光标变大都去掉了，2026-11-18）。
     只让右边的墨迹重画一遍，表示正在看这一行 */
  .craft.in:hover .craft-art > * { animation: ink-redraw 1.4s var(--ease-io) both; }
  .craft.in:hover .craft-art > *:nth-child(2) { animation-delay: 0.14s; }
  .craft.in:hover .craft-art > *:nth-child(3) { animation-delay: 0.28s; }
  .craft.in:hover .craft-art > *:nth-child(4) { animation-delay: 0.42s; }
}

@keyframes ink-redraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ---------- 方法：上山的路 ---------- */
.climb { padding: 14vh var(--pad) 22vh; }
.climb .display { margin-top: 5vh; }
/* 图形往上提，和标题错开叠在一起：标题在左上，上山的路从它下面起步、往右上走到标题旁边，中间不留一大块空 */
.climb-stage { position: relative; margin-top: calc(-1 * clamp(70px, 14vw, 230px)); height: clamp(250px, 36vw, 520px); }
.climb-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.climb-base, .climb-line { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.climb-base { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 9; }
.climb-line { stroke: var(--ink); stroke-width: 3.5; }
.climb-dot {
  position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--red); filter: url(#rough-seal); opacity: 0; will-change: transform;
}
.climb-steps li {
  position: absolute; display: flex; flex-direction: column; gap: 2px; white-space: nowrap;
  padding-top: 20px; opacity: 0.28; transform: translateY(10px);
  transition: opacity 0.7s, transform 0.9s var(--ease);
}
.climb-steps li.on { opacity: 1; transform: none; }
.climb-steps li:last-child { transform: translate(-100%, 10px); align-items: flex-end; }
.climb-steps li.on:last-child { transform: translate(-100%, 0); }
.climb-steps b { font-family: var(--serif); font-weight: 900; font-size: clamp(18px, 2vw, 30px); letter-spacing: 0.12em; }
.climb-steps span { font-family: var(--latin); font-style: italic; font-size: 13px; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- 联系：入夜 ---------- */
.contact { padding: 72vh var(--pad) 22vh; }
/* 页尾的字和画布做差值混合：背后是纸显墨色，入夜后显浅色，不依赖画布一定画到了哪一步 */
.contact .sec-label, .contact .display, .mail-text, .mail-btn, .footer { color: var(--light); mix-blend-mode: difference; }
.contact .sec-label { opacity: 0.6; }
.contact .display { margin-top: 5vh; }
.mail { margin-top: 7vh; display: inline-flex; align-items: center; gap: clamp(16px, 2.4vw, 36px); }
.mail-text { position: relative; font-family: var(--latin); font-size: clamp(22px, 3.2vw, 46px); letter-spacing: 0.02em; padding-bottom: 6px; }
.mail-text::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; opacity: 0.5; transform-origin: left; transition: transform 0.7s var(--ease), opacity 0.4s; }
.mail:hover .mail-text::after { opacity: 1; animation: redraw 0.9s var(--ease-io); }
@keyframes redraw { 0% { transform: scaleX(1); transform-origin: right; } 49% { transform: scaleX(0); transform-origin: right; } 50% { transform: scaleX(0); transform-origin: left; } 100% { transform: scaleX(1); transform-origin: left; } }
.mail-btn {
  display: grid; place-items: center; flex: none;
  width: clamp(52px, 5.4vw, 80px); height: clamp(52px, 5.4vw, 80px); border-radius: 50%;
  border: 1px solid rgba(239, 234, 223, 0.5);
  transition: background 0.5s var(--ease), border-color 0.5s, color 0.5s;
}
.mail-btn svg { width: 36%; height: 36%; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform 0.6s var(--ease); }
.mail:hover .mail-btn { background: var(--red); border-color: var(--red); }
.mail:hover .mail-btn svg { transform: rotate(45deg); }

/* ---------- 页脚 ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 28px;
  padding: 26px var(--pad) calc(26px + env(safe-area-inset-bottom));
  font-size: 12px; letter-spacing: 0.08em;
  border-top: 1px solid rgba(239, 234, 223, 0.16);
}
.footer > * { opacity: 0.62; transition: opacity 0.3s; }
.footer a:hover { opacity: 1; }

/* 没有 WebGL 时：首屏只有纸色和文字 */
.no-webgl #scene { display: none; }

/* ---------- 手机 ---------- */
@media (max-width: 760px) {
  :root { --ts: clamp(58px, 12.2vh, 110px); }
  .brand { top: 16px; }
  .nav { top: 24px; }
  .nav a:not(.nav-contact) { display: none; }
  .hero-title { top: 13vh; }
  .hero-side { top: calc(13vh + var(--ts) * 0.5); gap: 16px; }
  .hero-foot { bottom: 26px; font-size: 10px; letter-spacing: 0.26em; }
  .hero-scroll { display: none; }
  .hero-birds { left: 9%; top: 5.5vh; width: 84px; stroke-width: 1.8; }
  .br-wide { display: none; }
  .idea { padding: 18vh var(--pad) 14vh; }
  .idea-text { line-height: 1.62; }
  .verse-row.is-outline { -webkit-text-stroke-width: 1px; }
  .craft { grid-template-columns: 40px 1fr 72px; gap: 6px 14px; padding: 26px 4px; }
  .craft-no { font-size: 17px; align-self: start; padding-top: 0.55em; }
  .craft p { grid-column: 2 / 4; }
  .craft-art { grid-column: 3; grid-row: 1; }
  .climb { padding-bottom: 22vh; }
  .climb-stage { height: 250px; margin-top: -52px; }
  .climb-steps span { display: none; }
  .climb-line { stroke-width: 2.5; }
  .contact { padding: 66vh var(--pad) 30vh; }
  .mail { gap: 14px; }
  .footer { flex-direction: column; }
}

/* 系统开了「减少动态效果」：内容直接显示，不做位移和模糊 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
}
