/* ==========================================================================
   base.css｜重置、字体、排版原语、导航、分屏骨架
   只引用 tokens.css 的变量；这里不含任何具体区块的内容样式。
   ========================================================================== */

/* ---- 自托管字体（拉丁子集，共 77KB，离线可用）------------------------- */
@font-face {
  font-family: 'Imbue';
  src: url('../fonts/imbue-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Albert Sans';
  src: url('../fonts/albert-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Albert Sans';
  src: url('../fonts/albert-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

/* ---- 重置 ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; background: var(--surface); }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---- 布局原语 -------------------------------------------------------- */
.wrap {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--s8); }
.section--surface { background: var(--surface); }
.section--tight { padding-block: var(--s7); }

/* 少量间距工具，避免在 HTML 里写行内样式 */
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }

/* 阅读列：正文永远不超过 46ch */
.measure { max-width: var(--measure); }
.measure > * + * { margin-top: var(--s3); }

/* ---- 排版原语：全站只用这 5 级 -------------------------------------- */
.t-disp {
  font-size: var(--t-disp);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.02em;
}
.t-head {
  font-size: var(--t-head);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.t-lead {
  font-size: var(--t-lead);
  font-weight: 400;
  line-height: 1.45;
  text-wrap: pretty;
}
.t-body { font-size: var(--t-body); line-height: 1.6; text-wrap: pretty; }
.t-meta {
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--muted);
}
.t-latin {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -.01em;
  text-transform: uppercase;
}

/* ---- 按钮：一种形状，方角实心 --------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding-inline: var(--s3);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--t-body);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { background: var(--field); }
.btn:active { transform: translateY(1px); }
.btn--text {
  min-height: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: .22em;
}
.btn--text:hover { background: none; color: var(--accent); }

/* ---- 跳转链接 -------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: var(--s1) var(--s2);
  background: var(--field);
  color: var(--field-ink);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: var(--s2); }

/* ---- 顶部导航：没有边框、没有阴影、没有吸顶玻璃 ---------------------- */
.nav { padding-block: var(--s3); }
.nav__inner {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: var(--s4);
  flex-wrap: wrap;
}
.nav__mark {
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .01em;
}
.nav__links {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  flex-wrap: wrap;
}
/* 把链接组推到右侧：auto 外边距要加在 flex 子项（<nav>）上 */
.nav__inner > nav { margin-inline-start: auto; }
.nav__links a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.nav__links a:hover,
.nav__links a:focus-visible { color: var(--ink); }
.nav__cta { color: var(--ink); text-decoration: underline; }

@media (max-width: 900px) {
  .nav__inner { gap: var(--s2); }
  .nav__links { gap: var(--s3); }
}
@media (max-width: 640px) {
  /* 手机上：名字与简历同一行，导航链接落到第二行 */
  .nav__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: var(--s1) var(--s3);
  }
  .nav__mark { grid-column: 1; grid-row: 1; }
  .nav__cta { grid-column: 2; grid-row: 1; justify-self: end; }
  .nav__inner > nav { grid-column: 1 / -1; grid-row: 2; margin-inline-start: 0; }
  .nav__links { gap: var(--s3); }
}

/* ---- 分屏骨架：桌面 50/50，手机单列上下堆叠 -------------------------
   用法：
   <section class="split">
     <div class="split__panel">…滚动的内容…</div>
     <div class="split__pin">…固定在视口里的一侧…</div>
   </section>
   -------------------------------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
.split__panel {
  padding-inline: var(--gutter);
}
.split__pin {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  background: var(--surface);
}

/* 平板与手机：拆成单列。固定的那一侧变成 60svh 的图块，不再吸顶 */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split__panel { padding-inline: var(--gutter); }
  .split__pin {
    position: relative;
    top: auto;
    height: 60svh;
    order: -1;          /* 手机上先看画面，再看文字 */
  }
}

/* ---- 首屏 ------------------------------------------------------------ */
.hero { min-height: 100svh; }
.hero__panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s5);
  min-height: 100svh;
  padding-block: var(--s3) var(--s5);
}
.hero__claim { max-width: 12ch; }
.hero__foot {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  align-items: flex-start;
}
.hero__note { max-width: 34ch; color: var(--muted); }
.hero__actions { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero__panel { min-height: 0; padding-block: var(--s3) var(--s6); gap: var(--s4); }
  .hero__claim { max-width: 100%; }
  /* 手机上文字在前、标本墙在后：首屏必须能读到 h1 */
  .hero .split__pin { order: 0; height: 52svh; }
}

/* ---- 标本墙（首屏右半的 7 格）--------------------------------------- */
.mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  height: 100%;
  padding: var(--gutter);      /* 台面铺满，标本不越界：左右边距与正文一致 */
}
.mosaic > :nth-child(1) { grid-area: 1 / 1; }
.mosaic > :nth-child(2) { grid-area: 1 / 2; }
.mosaic > :nth-child(3) { grid-area: 2 / 1; }
.mosaic > :nth-child(4) { grid-area: 2 / 2; }
.mosaic > :nth-child(5) { grid-area: 1 / 3 / 4 / 5; }
.mosaic > :nth-child(6) { grid-area: 3 / 1; }
.mosaic > :nth-child(7) { grid-area: 3 / 2; }
.tile {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--bg);
  overflow: hidden;
}
.tile > img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: var(--surface);
}
.tile > .t-meta { padding: 8px 12px; }
.tile--dark { background: var(--field); color: var(--field-ink); }
.tile--dark .t-meta { color: var(--field-ink); }
.tile--wide { grid-column: 3 / 5; grid-row: 2 / 4; }

@media (max-width: 900px) {
  .mosaic {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
  }
  .mosaic > :nth-child(n) { grid-area: auto; }
  .tile:nth-child(even) { transform: translateY(48px); }  /* 右列整体下沉，错落 */
}

/* ---- 区块标题行 ------------------------------------------------------ */
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s5);
  flex-wrap: wrap;
}

/* ---- 页脚 ------------------------------------------------------------ */
.footer {
  background: var(--field);
  color: var(--field-ink);
  padding-block: var(--s7) var(--s4);
}
.footer__rows {
  display: flex;
  gap: var(--s5);
  flex-wrap: wrap;
  margin-bottom: var(--s6);
}
.footer__name {
  font-family: var(--f-display);
  font-size: var(--t-disp);
  line-height: .88;
  letter-spacing: -.01em;
  text-transform: uppercase;
  border-bottom: 0;
  margin-block: var(--s5) var(--s4);
}
.footer__legal { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.footer a { color: var(--field-ink); }
.footer .t-meta { color: var(--field-ink); }

/* ---- 右侧锚点导航：桌面专属 -----------------------------------------
   一根 2px 的短横线代表一个区块；滚到哪一段，哪一根亮起来。
   ≤768px 整个隐藏——手机上它只会挡内容。
   -------------------------------------------------------------------- */
.rail {
  position: fixed;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: grid;
  gap: 12px;
}
.rail__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 24px;
  height: 12px;
}
.rail__tick {
  width: 12px;
  height: 2px;
  background: var(--muted);
  transition: width 180ms ease-out, background-color 180ms ease-out;
}
.rail__item:hover .rail__tick,
.rail__item:focus-visible .rail__tick {
  width: 18px;
  background: var(--accent);
}
.rail__item[aria-current="true"] .rail__tick {
  width: 24px;
  background: var(--accent);
}
.rail__label { display: none; }
/* 提示文字用伪元素画：视觉上是悬浮标签，无障碍名称来自链接自身的 aria-label */
.rail__item::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  padding: 3px 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--t-xs);
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}
.rail__item:hover::after,
.rail__item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
@media (max-width: 768px) {
  .rail { display: none; }
}

/* 深色带上的锚点：短横线换成浅色，否则整条导航看不见 */
.rail--on-dark .rail__tick { background: color-mix(in srgb, var(--field-ink) 62%, transparent); }
.rail--on-dark .rail__item:hover .rail__tick,
.rail--on-dark .rail__item:focus-visible .rail__tick { background: var(--field-ink); }
.rail--on-dark .rail__item[aria-current="true"] .rail__tick { background: var(--field-ink); }

/* ---- 回到顶部 -------------------------------------------------------- */
.to-top {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 6;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--ease), background-color var(--dur) var(--ease),
              color var(--dur) var(--ease), visibility 220ms;
}
.to-top.is-on { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--field); color: var(--field-ink); }
.to-top svg { width: 16px; height: 16px; }

@media (max-width: 768px) {
  .to-top {
    width: 44px;
    height: 44px;
    right: 24px;
    bottom: 24px;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    backdrop-filter: blur(8px); /* taste-skill-ignore 移动端按钮毛玻璃，避免正文字透出 */
    -webkit-backdrop-filter: blur(8px); /* taste-skill-ignore */
  }
}

/* ---- 关于：人像 + 文字 ------------------------------------------------- */
.about {
  display: grid;
  grid-template-columns: 260px minmax(0, 560px);
  gap: var(--s6);
  justify-content: center;
  align-items: start;
}
.about__col { max-width: 560px; }
.about__portrait img {
  width: 100%;
  height: auto;
  background: none;   /* 抠底后的照片落在页面底色上 */
}
@media (max-width: 900px) {
  .about {
    grid-template-columns: 1fr;
    gap: var(--s4);
    max-width: 560px;
    margin-inline: auto;
  }
  .about__portrait { max-width: 200px; }
}

/* ---- 入场动效：只做位移，不做淡入 ------------------------------------
   为什么不用 opacity：长页面上未进入视口的内容会整块"消失"，
   截图、爬到一半的抓取、以及任何没触发 observer 的场景都会读到空白。
   位移版的入场同样成立，而且任何情况下文字都可读。
   -------------------------------------------------------------------- */
.js [data-reveal] {
  transform: translateY(18px);
}
.js [data-reveal].is-in {
  transform: none;
  transition: transform var(--dur-reveal) var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { transform: none; }
}
