/* =========================================================
   基础层：重置、排版、页面骨架、工具栏、首屏
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点跳转时给工具栏留出空间 */
  scroll-padding-top: calc(var(--topbar-h) + 18px);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  letter-spacing: var(--type-body-track);
  /* 系统字体已自带光学尺寸与字距表，交给它自己调 */
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* 主题切换不做突兀的亮度跳变 */
  transition: background-color 420ms cubic-bezier(0.32, 0.08, 0.24, 1),
              color 320ms cubic-bezier(0.32, 0.08, 0.24, 1);
}

h1, h2, h3, p, dl, dd, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* 类选择器里的 display 会盖过 UA 的 [hidden]{display:none}，
   而 hidden 是这些面板"彻底离开"的唯一手段，所以必须锁死 */
[hidden] { display: none !important; }

img, svg { display: block; max-width: 100%; }

a { color: var(--c-brand); text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  /* 触摸交互里即时反馈的前提：不要等 300ms */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.12em 0.34em;
  border-radius: var(--radius-xs);
  background: var(--fill-2);
  color: var(--ink);
}

strong { font-weight: 650; color: var(--ink); }

:focus-visible {
  outline: 2.5px solid var(--c-brand);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--c-brand-tint-strong); color: var(--ink); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: var(--sp-2);
  left: 50%;
  translate: -50% -160%;
  z-index: 200;
  padding: 10px 20px;
  font-size: var(--type-subhead-size);
  font-weight: 600;
  color: var(--bg-elevated);
  background: var(--ink);
  border-radius: var(--radius-full);
  transition: translate 260ms cubic-bezier(0.32, 0.08, 0.24, 1);
}
.skip-link:focus-visible { translate: -50% 0; }

/* =========================================================
   工具栏：浮动的半透明材质层，内容从下面滚过
   ========================================================= */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-inline: var(--gutter);
}

.topbar__material {
  position: absolute;
  inset: 0;
  background: var(--mat-regular);
  backdrop-filter: blur(var(--blur-regular)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur-regular)) saturate(var(--sat));
  /* 材质上缘的一道亮边 = 光打在材料上 */
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--mat-edge), transparent) 1;
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.32, 0.08, 0.24, 1);
  will-change: opacity;
}
.topbar.is-stuck .topbar__material { opacity: 1; }

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding: 6px 8px 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--type-headline-size);
  font-weight: 700;
  letter-spacing: var(--type-headline-track);
}
.brand__mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  object-fit: cover;
  transition: transform 320ms var(--ease-spring);
}
.brand:active .brand__mark { transform: scale(0.9); }

/* 导航：滑动选择器。
   选中块用伪元素实现，这样 <ul> 里只放 <li>，结构保持合法 */
.nav { margin-left: auto; }

.nav__list {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-full);
  background: var(--fill-1);
}

/* 位置与宽度由 JS 用弹簧写入自定义属性，这里只负责渲染 */
.nav__list::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: var(--pill-w, 0px);
  height: calc(100% - 6px);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  transform: translate3d(var(--pill-x, 0px), 0, 0);
  opacity: 0;
  transition: opacity 240ms ease;
  will-change: transform, width;
  pointer-events: none;
}
.nav__list.is-ready::before { opacity: 1; }

.nav__link {
  position: relative;
  z-index: 1;
  display: block;
  padding: 6px 15px;
  border-radius: var(--radius-full);
  color: var(--ink-2);
  font-size: var(--type-subhead-size);
  font-weight: 560;
  letter-spacing: var(--type-subhead-track);
  white-space: nowrap;
  transition: color 220ms ease;
}
.nav__link[aria-current="true"] { color: var(--ink); font-weight: 640; }
.nav__link:hover { color: var(--ink); }

/* 外观切换：开关本体，拖动 + 点击都能用 */
.switch { flex: 0 0 auto; margin-left: var(--sp-2); }
.switch__track {
  position: relative;
  display: block;
  width: 52px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--fill-3);
  box-shadow: inset 0 0 0 1px var(--sep);
  transition: background 320ms cubic-bezier(0.32, 0.08, 0.24, 1);
}
.switch[aria-checked="true"] .switch__track { background: var(--c-brand); }

.switch__icon {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  font-size: 11px;
  line-height: 1;
  transition: opacity 260ms ease;
}
.switch__icon--sun { left: 8px; opacity: 0.85; }
.switch__icon--moon { right: 8px; opacity: 0.5; }
.switch[aria-checked="true"] .switch__icon--sun { opacity: 0.5; }
.switch[aria-checked="true"] .switch__icon--moon { opacity: 1; }

.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24), 0 3px 8px rgba(0, 0, 0, 0.16);
  will-change: transform;
}

/* 内容滚到工具栏下沿时的渐进模糊：不用 1px 硬分隔线 */
.scroll-edge {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  height: 22px;
  z-index: 55;
  pointer-events: none;
  opacity: 0;
  transition: opacity 380ms cubic-bezier(0.32, 0.08, 0.24, 1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
.scroll-edge.is-stuck { opacity: 1; }

/* =========================================================
   首屏
   ========================================================= */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(34px, 5.4vh, 64px);
  min-height: 100svh;
  padding: calc(var(--topbar-h) + clamp(30px, 6vh, 62px)) var(--gutter) clamp(40px, 6vh, 62px);
}

/* 背景光晕：静止的，不做全屏移动背景 */
.hero__field {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-field);
  pointer-events: none;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(200px, 288px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(26px, 5vw, 64px);
  width: min(var(--content), 100%);
  margin-inline: auto;
}

/* --- 头像卡 --- */
.avatar-card__inner {
  position: relative;
  border-radius: var(--radius-xl);
  background: var(--mat-thin);
  border: 1px solid var(--mat-edge);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(var(--blur-thin)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur-thin)) saturate(var(--sat));
  overflow: hidden;
  /* 头像照片本身是方的，裁成圆角方形更贴合整体语言 */
  aspect-ratio: 1;
}
.avatar {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-card__caption {
  margin-top: var(--sp-3);
  text-align: center;
}
.avatar-card__name {
  display: block;
  font-size: var(--type-headline-size);
  font-weight: 660;
  letter-spacing: var(--type-headline-track);
}
.avatar-card__note {
  display: block;
  margin-top: 2px;
  font-size: var(--type-footnote-size);
  letter-spacing: var(--type-footnote-track);
  color: var(--ink-3);
}

/* --- 首屏文字 --- */
.hero__eyebrow {
  font-size: var(--type-subhead-size);
  font-weight: 620;
  letter-spacing: 0.14em;
  color: var(--c-brand);
  text-transform: uppercase;
}

.hero__title {
  margin-top: var(--sp-2);
  font-size: var(--type-largeTitle-size);
  line-height: var(--type-largeTitle-line);
  letter-spacing: var(--type-largeTitle-track);
  font-weight: 750;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-3);
}
.hero__title-sub {
  font-size: clamp(0.72rem, 1.4vw, 0.84rem);
  font-weight: 560;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* 循环短语：与打字机不同，整句淡入替换，不做逐字抖动 */
.hero__phrase {
  margin-top: var(--sp-3);
  min-height: 1.6em;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.phrase.is-swapping { opacity: 0; }

.hero__lead {
  margin-top: var(--sp-4);
  max-width: 46ch;
  color: var(--ink-2);
  font-size: var(--type-body-size);
}

.hero__quote {
  margin-top: var(--sp-5);
  padding-left: var(--sp-4);
  border-left: 3px solid var(--c-brand);
  font-size: var(--type-body-size);
  font-weight: 600;
  color: var(--ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.tag {
  padding: 5px 13px;
  font-size: var(--type-footnote-size);
  font-weight: 560;
  letter-spacing: var(--type-footnote-track);
  color: var(--ink-2);
  background: var(--fill-1);
  border-radius: var(--radius-full);
  transition: transform 260ms var(--ease-spring), background 220ms ease,
              color 220ms ease;
}
@media (hover: hover) {
  .tag:hover { transform: translateY(-2px); background: var(--fill-2); color: var(--ink); }
}

/* --- 数据条 --- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  width: min(var(--content), 100%);
  margin-inline: auto;
  padding: var(--sp-5) var(--sp-2) 0;
  border-top: 1px solid var(--sep);
  text-align: center;
}
.stat__value {
  font-family: var(--font-rounded);
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--c-brand);
}
.stat__label {
  margin-top: 2px;
  font-size: var(--type-footnote-size);
  letter-spacing: var(--type-footnote-track);
  color: var(--ink-3);
}

/* =========================================================
   入场：脚本可用时才隐藏，禁用脚本仍完整可读
   ========================================================= */
.js .load-in {
  opacity: 0;
  transform: translateY(14px);
}
.js .load-in.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 520ms cubic-bezier(0.32, 0.08, 0.24, 1),
              transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 62ms);
}

.js .reveal { opacity: 0; }
.js .reveal.is-shown {
  opacity: 1;
  transition: opacity 560ms cubic-bezier(0.32, 0.08, 0.24, 1),
              transform 680ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal:not(.is-shown) { transform: translateY(20px); }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: var(--sp-6); }
  .hero__art { width: min(240px, 58vw); margin-inline: auto; }
  .hero__title { justify-content: center; }
  .hero__lead { margin-inline: auto; }
  .hero__quote { text-align: left; }
  .hero__actions, .tag-row { justify-content: center; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 52px; }
  .brand__text { display: none; }

  /* 手机上导航收进底部材质条，符合拇指可达范围 */
  .nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    margin: 0;
    padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom, 0px));
    background: var(--mat-regular);
    backdrop-filter: blur(var(--blur-regular)) saturate(var(--sat));
    -webkit-backdrop-filter: blur(var(--blur-regular)) saturate(var(--sat));
    border-top: 1px solid var(--sep);
  }
  .nav__list { justify-content: space-between; background: none; padding: 0; }
  .nav__pill { display: none; }
  .nav__link {
    padding: 8px 10px;
    font-size: var(--type-footnote-size);
    background: none !important;
  }
  .nav__link[aria-current="true"] {
    background: var(--c-brand-tint) !important;
    color: var(--c-brand);
  }
  .footer { padding-bottom: calc(var(--sp-8) + 52px); }
}

@media (max-width: 460px) {
  :root { --type-body-size: 0.97rem; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4) var(--sp-2); }
  .hero { min-height: auto; padding-top: calc(var(--topbar-h) + 48px); }
}
