/* ============================================================
   张天威 · 在线简历
   视觉规范逐项取自 https://hux.pro/ 的真实 CSS 变量与工具类
   （design tokens / 字体 / 卡片 / 列表 / 时间线 / 走马灯）
   ============================================================ */

/* ---------- 自托管字体（源：hux.pro 的 woff2 子集） ---------- */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/inter-latin.woff2) format("woff2");
}
@font-face {
  font-family: Newsreader;
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/newsreader-latin.woff2) format("woff2");
}
@font-face {
  font-family: Newsreader;
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url(../fonts/newsreader-italic-latin.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(../fonts/jetbrainsmono-latin.woff2) format("woff2");
}

/* ---------- 设计令牌（与 hux.pro 完全一致） ---------- */
:root {
  --background: #fff;
  --foreground: #0a0a0a;
  --card: #fff;
  --card-foreground: #0a0a0a;
  --popover: #fff;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --secondary: #f5f5f5;
  --secondary-foreground: #171717;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a1a1a1;
  --radius: 0.625rem;

  /* glass 系列：hux.pro 用 color-mix 由 card 派生 */
  --glass: rgba(255, 255, 255, 0.5);
  --glass-hover: rgba(255, 255, 255, 0.7);
  --glass-overlay: rgba(255, 255, 255, 0.7);
  --glass-strong-hover: rgba(255, 255, 255, 0.8);

  --font-sans: Inter, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Source Han Sans SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-serif: Newsreader, "Songti SC", "Source Han Serif SC", "Noto Serif SC",
    "SimSun", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "PingFang SC", "Microsoft YaHei", monospace;
}

@supports (background: color-mix(in oklab, white, transparent)) {
  :root {
    --glass: color-mix(in oklab, var(--card) 50%, transparent);
    --glass-hover: color-mix(in oklab, var(--card) 70%, transparent);
    --glass-overlay: color-mix(in oklab, var(--card) 70%, transparent);
    --glass-strong-hover: color-mix(in oklab, var(--card) 80%, transparent);
  }
  body.dark {
    --glass: color-mix(in oklab, var(--card) 50%, transparent);
    --glass-hover: color-mix(in oklab, var(--card) 70%, transparent);
    --glass-overlay: color-mix(in oklab, var(--card) 70%, transparent);
    --glass-strong-hover: color-mix(in oklab, var(--card) 80%, transparent);
  }
}

body.dark {
  --background: #1a1a1a;
  --foreground: #e8e8e8;
  --card: #141414;
  --card-foreground: #e8e8e8;
  --popover: #171717;
  --primary: #d4d4d4;
  --primary-foreground: #171717;
  --secondary: #262626;
  --secondary-foreground: #fafafa;
  --muted: #262626;
  --muted-foreground: #a1a1a1;
  --accent: #333;
  --accent-foreground: #fafafa;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.15);
  --ring: #737373;
  --glass: rgba(20, 20, 20, 0.5);
  --glass-hover: rgba(20, 20, 20, 0.7);
  --glass-overlay: rgba(20, 20, 20, 0.7);
  --glass-strong-hover: rgba(20, 20, 20, 0.8);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid;
}

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

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s, color 0.5s;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

/* ---------- 环境背景（对齐 hux.pro 的柔和网格渐变） ----------
   两个底色层做主题交叉淡入，三个光斑负责缓慢漂移。
   只用 transform 动，走合成层，滚动时不掉帧。 */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-base {
  position: absolute;
  inset: 0;
  transition: opacity 0.55s ease;
}
/* 色带用 px 锚定，不用百分比 —— 百分比会随视口高度缩放：
   视口一矮，蓝就整屏铺开、压在卡片下面，白卡片被染成灰蓝。
   px 锚定后，无论视口多高，蓝都只留在顶部 hero 那一条，
   内容区（卡片从 ~230px 开始）已经落到近白。 */
.base-light {
  background:
    radial-gradient(150% 320px at 50% -150px, rgba(120, 162, 220, 0.92) 0%, rgba(120, 162, 220, 0) 100%),
    radial-gradient(70% 400px at -8% 190px, rgba(232, 210, 224, 0.5) 0%, rgba(232, 210, 224, 0) 100%),
    radial-gradient(90% 440px at 2% 100%, rgba(255, 246, 176, 0.72) 0%, rgba(255, 246, 176, 0) 100%),
    linear-gradient(180deg, #d3e1f3 0px, #e8e5eb 215px, #fdfaf4 445px, #fffdf1 100%);
}
.base-dark {
  background:
    radial-gradient(150% 320px at 50% -150px, rgba(62, 96, 146, 0.85) 0%, rgba(62, 96, 146, 0) 100%),
    radial-gradient(70% 400px at -8% 190px, rgba(92, 64, 92, 0.42) 0%, rgba(92, 64, 92, 0) 100%),
    radial-gradient(90% 440px at 2% 100%, rgba(118, 96, 44, 0.36) 0%, rgba(118, 96, 44, 0) 100%),
    linear-gradient(180deg, #16202e 0px, #1b1b1b 215px, #201d19 445px, #221e19 100%);
  opacity: 0;
}
body.dark .base-dark {
  opacity: 1;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  transition: opacity 0.55s ease;
}
body.dark .ambient-orb {
  opacity: 0.5;
}

/* 光斑只做「缓慢漂移」的质感，颜色由上面的底色负责。
   所以这里的透明度压得比较低：再高一点就会把白卡片染成灰蓝。 */
.orb-a {
  width: 150vmax;
  height: 105vmax;
  top: -78vmax;
  left: 50%;
  margin-left: -75vmax;
  background: radial-gradient(closest-side, rgba(120, 160, 216, 0.5), rgba(120, 160, 216, 0));
  animation: orb-drift-a 48s ease-in-out infinite;
}
.orb-b {
  width: 118vmax;
  height: 86vmax;
  bottom: -52vmax;
  left: -34vmax;
  background: radial-gradient(closest-side, rgba(255, 244, 166, 0.5), rgba(255, 244, 166, 0));
  animation: orb-drift-b 63s ease-in-out infinite;
}
.orb-c {
  width: 96vmax;
  height: 76vmax;
  top: 30vmax;
  left: -46vmax;
  background: radial-gradient(closest-side, rgba(235, 205, 220, 0.4), rgba(235, 205, 220, 0));
  animation: orb-drift-c 55s ease-in-out infinite;
}

/* 纯 transform 动画：不触发重排，也不改绘制区域 */
@keyframes orb-drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-3%, 4%, 0) scale(1.07); }
}
@keyframes orb-drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(5%, -3%, 0) scale(1.05); }
}
@keyframes orb-drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4%, 6%, 0) scale(1.08); }
}

/* 指针跟随的柔光（对齐 hux.pro 的 prompt-spotlight）。
   JS 只往 .ambient 上写 --mx/--my 两个变量，光斑位置全交给合成层。 */
.ambient::after {
  content: "";
  position: absolute;
  inset: -12%;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: radial-gradient(
    320px 320px at var(--mx, 50%) var(--my, 42%),
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0) 68%
  );
}
body.dark .ambient::after {
  background: radial-gradient(
    340px 340px at var(--mx, 50%) var(--my, 42%),
    rgba(122, 172, 232, 0.34) 0%,
    rgba(122, 172, 232, 0) 68%
  );
}
.ambient.glow::after {
  opacity: 1;
}

a {
  color: inherit;
  text-decoration: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  cursor: pointer;
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(10, 10, 10, 0.12);
}
body.dark ::selection {
  background: rgba(232, 232, 232, 0.2);
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.font-mono {
  font-family: var(--font-mono);
}
.font-serif {
  font-family: var(--font-serif);
}

.muted {
  color: var(--muted-foreground);
}

/* ---------- 布局骨架 ---------- */
main {
  margin: 0 auto;
  display: flex;
  min-height: 100svh;
  width: 100%;
  flex-direction: column;
  padding: 64px 24px 128px;
}

@media (min-width: 640px) {
  main {
    padding-top: 96px;
    padding-bottom: 160px;
  }
}

.shell {
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
}

.wrap-narrow {
  margin: 0 auto;
  max-width: 680px;
  padding: 0 0;
}

.wrap-wide {
  margin: 0 auto;
  width: 100%;
  max-width: 680px;
}

@media (min-width: 1024px) {
  .wrap-wide {
    max-width: 1024px;
  }
}

@media (min-width: 1536px) {
  .wrap-wide {
    max-width: 1152px;
  }
}

/* ---------- 顶部 Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  height: 11rem;
  position: sticky;
  top: 64px;
  z-index: 10;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .hero {
    height: 12rem;
    top: 96px;
    margin-bottom: 24px;
  }
}

.hero-mark-row {
  height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.hero-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  min-height: 44px;
  cursor: default;
  user-select: none;
}

.hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 24px;
  text-align: center;
}

@media (min-width: 640px) {
  .hero-center {
    padding-bottom: 16px;
  }
}

.hero-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 36px;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 36px;
    line-height: 40px;
  }
}

.hero-sub {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.hero-sub a:hover {
  color: var(--foreground);
}

/* 滚动驱动的 hero 淡出（与 hux.pro 同一实现） */
@keyframes hero-zone-fade {
  0% {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@supports (animation-timeline: scroll()) {
  .hero-zone-fade {
    animation-name: hero-zone-fade;
    animation-duration: 1ms;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(root);
    animation-range: 0 11rem;
  }
  @media (min-width: 768px) {
    .hero-zone-fade {
      animation-range: 0 9rem;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-zone-fade {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ---------- 网格 ----------
   卡片分三列，每一列是一个 .col 容器（结构由 build.py 的 COLUMNS 决定）。
   窄屏三列竖着叠成一列；>=1024px 才并成三列。

   为什么不用 CSS 的 `columns` 瀑布流：它按文档顺序依次灌满一列再灌下一列，
   优化目标是「让最高的那列尽量矮」，不是「三列一样高」。skills 单张 683px，
   第三列每次只到一半就结束，实测三列底边差 265px，右下角一大片空 —— 
   这就是「排版不对称」的来源。
   为什么也不用 grid-row 给卡片逐张定位：grid-row 指的是网格的第几行，
   同一行索引的卡片会被强制对齐到同一个 y，矮卡片下面要空着等高卡片，
   比瀑布流更糟。列容器各堆各的才对。 */
.grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 20;
  padding-top: 8px;
  margin-bottom: 64px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (min-width: 640px) {
  .grid {
    padding-top: 16px;
  }
}

/* 平板区间：前两组左右并排，第三组（技能 / 证书）横跨整行、内部竖排。
   试过把第三组也并成两列 —— 技能 683px、证书 241px，右边会空出 440px 的
   大坑，比单列还难看。横跨整行之后两张卡都吃满宽度，文字换行少、
   也没有空档。
   注意这个区间的容器宽度（.wrap-wide）是 680px，跟 hux.pro 的
   `max-w-[680px] sm:columns-2` 一致，所以两列各约 332px。 */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    align-items: start;
  }
  .grid > .col:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 16px;
    align-items: start;
  }
}

.item {
  user-select: none;
}

/* press-hold 微交互（hux.pro 的按压缩放） */
.press-hold {
  transform-origin: 50%;
  transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1);
}
.press-hold[data-holding] {
  transform: scale(var(--press-hold-scale, 1.03));
  transition-duration: var(--press-hold-duration, 0.4s);
  transition-timing-function: cubic-bezier(0.32, 0, 0.67, 0);
}

.pressable {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pressable:active {
  transition-duration: 0s;
}

/* ---------- 卡片 ---------- */
.widget {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--glass);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  transition: border-color 0.3s, background-color 0.3s;
}

@supports (border-color: color-mix(in oklab, black, transparent)) {
  .widget {
    border-color: color-mix(in oklab, var(--border) 50%, transparent);
  }
}

.widget:hover {
  border-color: var(--border);
  background-color: var(--glass-hover);
}

/* dock 变体：图标角标需要溢出，故不裁剪；容器本身透明，悬停才浮出 */
.widget--dock {
  overflow: visible;
  padding: 0;
  border-color: transparent;
  background-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.widget--dock:hover {
  border-color: color-mix(in oklab, var(--border) 40%, transparent);
  background-color: var(--glass);
}

.widget-surface {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.widget-surface::after {
  content: "";
  border-radius: inherit;
  pointer-events: none;
  background-color: var(--foreground);
  opacity: 0;
  transition: opacity 0.3s;
  position: absolute;
  inset: 0;
}
.widget-surface:active::after {
  opacity: 0.08;
  transition-duration: 75ms;
}

.widget-head {
  padding: 20px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.widget-head.tight {
  padding-bottom: 12px;
}

.widget-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-body {
  padding: 0 20px 20px;
}

.widget-arrow {
  display: flex;
  align-items: center;
  margin: -8px;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted-foreground);
  transition: color 0.2s, background-color 0.2s;
}
.widget-arrow:hover {
  color: var(--foreground);
}
.widget-arrow:active {
  background-color: color-mix(in oklab, var(--muted) 30%, transparent);
}

.widget-arrow svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
}
.widget-arrow[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

/* ---------- 联系方式 dock（对应 hux.pro 的 app 图标方阵） ---------- */
.dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 8px;
  padding: 6px 4px;
}

.dock-tile {
  display: flex;
  justify-content: center;
}

.dock-link {
  position: relative;
  display: block;
  z-index: 0;
}

.dock-link:hover {
  z-index: 10;
}

.dock-stack {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.dock-icon-wrap {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 22.5%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s;
}
body.dark .dock-icon {
  border-color: rgba(255, 255, 255, 0.12);
}
.dock-link:hover .dock-icon,
.dock-link:focus-visible .dock-icon {
  transform: scale(1.05);
}
.dock-icon svg {
  width: 30px;
  height: 30px;
  color: #fff;
}

.dock-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  outline: 2px solid var(--background);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.dock-link:hover .dock-badge,
.dock-link:focus-visible .dock-badge {
  opacity: 1;
  transform: scale(1);
}
.dock-badge svg {
  width: 11px;
  height: 11px;
  color: #fff;
}

.dock-name {
  display: block;
  margin-top: 6px;
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 11px;
  line-height: 16px;
  color: var(--muted-foreground);
}

/* ---------- 列表行（项目 / 技能） ---------- */
.list {
  margin: 0 -8px;
  padding: 0 8px;
}

.list-scroll {
  position: relative;
  margin: 0 -8px;
  padding: 0 8px 8px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  max-height: 256px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.list-scroll.expanded {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.row {
  scroll-snap-align: start;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 -8px;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.15s;
}
.row:hover {
  background-color: color-mix(in oklab, var(--muted) 20%, transparent);
}
.row:active {
  background-color: color-mix(in oklab, var(--muted) 35%, transparent);
}

.row-title {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
}

/* 「精选」行内小标签。以前是一条插在列表中间的分隔横线，正好落在
   .list-scroll 的裁切边缘上，收起来的时候只剩半行飘着，看着像渲染坏了。
   挂到行里之后位置跟着那两条项目走，也不受裁切影响。 */
.row-tag {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: color-mix(in oklab, var(--muted-foreground) 72%, transparent);
  background-color: color-mix(in oklab, var(--muted) 65%, transparent);
}

/* ---------- 项目行（可点开看说明） ---------- */
.prow {
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}
.prow .row {
  margin: 0;
}
.prow:hover > .row {
  background-color: color-mix(in oklab, var(--muted) 20%, transparent);
}
.prow:focus-visible {
  outline: 1px solid color-mix(in oklab, var(--foreground) 20%, transparent);
}

.prow-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.34s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.26s,
    padding 0.26s;
  padding: 0 8px;
}
.prow[data-open="true"] .prow-body {
  max-height: 460px;
  opacity: 1;
  padding: 2px 8px 10px;
}
.prow-body p {
  margin: 0;
  font-size: 12px;
  line-height: 19px;
  color: var(--muted-foreground);
}

.row-chev {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  align-self: flex-start;
  margin-top: 4px;
  color: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
  transition: transform 0.25s;
}
.prow[data-open="true"] .row-chev {
  transform: rotate(180deg);
}

/* ---------- 时间线（工作 / 教育经历） ---------- */
.tl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
}

.tl-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.tl-connector {
  display: none;
}

.tl-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  transition: box-shadow 0.2s;
}
.tl-dot svg {
  width: 12px;
  height: 12px;
  color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
}

.tl-job {
  position: relative;
  margin: 0 -8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.tl-job:hover {
  background-color: color-mix(in oklab, var(--muted) 20%, transparent);
}
.tl-job:active {
  background-color: color-mix(in oklab, var(--muted) 30%, transparent);
}

.tl-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tl-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
}

.tl-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tl-links a {
  display: inline-flex;
  align-items: center;
  color: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
  transition: color 0.2s;
}
.tl-links a:hover {
  color: var(--foreground);
}
.tl-links svg {
  width: 12px;
  height: 12px;
}

.tl-when {
  flex-shrink: 0;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
}

.tl-meta {
  grid-column: 2;
  margin-top: 2px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
}
.tl-meta span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-meta span:last-child {
  flex-shrink: 0;
  color: color-mix(in oklab, var(--muted-foreground) 55%, transparent);
}

/* 可展开的职责明细 */
.tl-body {
  grid-column: 2;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.36s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.28s, margin-top 0.28s;
  margin-top: 0;
}
.tl-job[data-open="true"] .tl-body {
  max-height: 600px;
  opacity: 1;
  margin-top: 8px;
}
.tl-body ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tl-body li {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted-foreground);
}
.tl-body li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 3px;
  height: 3px;
  border-radius: 9999px;
  background-color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
}

.tl-hint {
  grid-column: 2;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: color-mix(in oklab, var(--muted-foreground) 45%, transparent);
  display: flex;
  align-items: center;
  gap: 4px;
}
.tl-hint svg {
  width: 10px;
  height: 10px;
  transition: transform 0.25s;
}
.tl-job[data-open="true"] .tl-hint svg {
  transform: rotate(180deg);
}

/* ---------- 技能卡 ---------- */
.skill-hero {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.skill-emblem {
  display: flex;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background-color: color-mix(in oklab, var(--muted) 30%, transparent);
}
.skill-emblem svg {
  width: 28px;
  height: 28px;
  color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
}

.skill-side {
  display: flex;
  height: 80px;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
}
.skill-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}
.skill-note {
  font-size: 12px;
  line-height: 18px;
  color: color-mix(in oklab, var(--muted-foreground) 80%, transparent);
}

.skill-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.skill-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--muted-foreground);
}
.skill-list svg {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  flex-shrink: 0;
  color: color-mix(in oklab, var(--muted-foreground) 45%, transparent);
}

/* ---------- 证书走马灯 ---------- */
.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 4px;
}
.carousel::-webkit-scrollbar {
  display: none;
}

.rail-pad {
  width: 20px;
  flex-shrink: 0;
}

.cert {
  width: 86%;
  max-width: 200px;
  flex-shrink: 0;
  scroll-snap-align: start;
  text-align: left;
  transition: opacity 0.2s, transform 0.2s;
}
.cert:active {
  transform: scale(0.97);
}

.cert-face {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background-color: color-mix(in oklab, var(--muted) 20%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 40%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}
.cert:hover .cert-face {
  border-color: var(--border);
}
.cert-face svg {
  width: 40px;
  height: 40px;
  color: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
}

.cert-name {
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
}
.cert-issuer {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
}

/* 有扫描件时：图片铺满 4:3 卡片面，悬停轻微放大，点开看大图 */
.cert[data-cert-img] {
  cursor: zoom-in;
}
.cert[data-cert-img] .cert-face {
  background-color: #f7f8fa;
}
.cert-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.dark .cert[data-cert-img] .cert-face {
  background-color: #f1f3f6;
}
.cert[data-cert-img]:hover .cert-face img {
  transform: scale(1.05);
}

/* 没有扫描件时的紧凑列表。
   以前不管有没有图都渲染一个 4:3 的证件面，没图时就是一块 280px 高的
   空灰框，既浪费高度又显得没做完。 */
.cert-list {
  list-style: none;
  margin: 0 -8px;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
}

.cert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.cert-row:hover {
  background-color: color-mix(in oklab, var(--muted) 20%, transparent);
}

.cert-row > svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: color-mix(in oklab, var(--muted-foreground) 55%, transparent);
}

.cert-row-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cert-row-name {
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
}

.cert-row-issuer {
  font-size: 11px;
  line-height: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
}

/* ---------- 证书放大（灯箱） ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.on {
  opacity: 1;
  visibility: visible;
}
/* 作者样式会盖过 UA 的 [hidden]{display:none}，这里显式写一条兜底 */
.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 760px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: scale(0.96);
  transition: transform 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.lightbox.on .lightbox-figure {
  transform: none;
}
.lightbox-figure img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.6);
}
.lightbox-figure figcaption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.82);
}

.lightbox-close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color 0.2s, transform 0.2s;
}
.lightbox-close svg {
  width: 18px;
  height: 18px;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.26);
}
.lightbox-close:active {
  transform: scale(0.94);
}

.dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 12px;
}
.dot {
  height: 6px;
  width: 6px;
  border-radius: 9999px;
  background-color: rgba(10, 10, 10, 0.15);
  transition: all 0.2s;
}
body.dark .dot {
  background-color: rgba(232, 232, 232, 0.15);
}
.dot.on {
  width: 12px;
  background-color: color-mix(in oklab, var(--foreground) 45%, transparent);
}

/* ---------- 亮点金句 ---------- */
.quote {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.625;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.25em;
}
.quote-attr {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}
.quote-attr em {
  font-style: normal;
  color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
}

.quote-panel {
  transition: opacity 0.3s, transform 0.3s;
}
.quote-panel.out {
  opacity: 0;
  transform: translateY(6px);
}

.spin-btn {
  display: inline-flex;
  align-items: center;
  color: var(--muted-foreground);
  font-size: 12px;
  transition: color 0.2s;
  user-select: none;
}
.spin-btn:hover {
  color: var(--foreground);
}
.spin-btn svg {
  width: 12px;
  height: 12px;
  transition: transform 0.5s;
}
.spin-btn.spinning svg {
  transform: rotate(180deg);
}

/* ---------- 小工具卡（跳转到浏览器端压缩站 /compress/） ---------- */
.tools-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in oklab, var(--muted) 45%, transparent);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background-color 0.2s;
}

.tools-card:hover {
  border-color: color-mix(in oklab, var(--foreground) 22%, transparent);
  background: color-mix(in oklab, var(--muted) 80%, transparent);
}

.tools-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--foreground);
  color: var(--background);
}

.tools-icon svg {
  width: 19px;
  height: 19px;
}

.tools-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.tools-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.tools-tag {
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  background: var(--muted);
  color: var(--muted-foreground);
}

.tools-desc {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted-foreground);
}

.tools-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground);
}

.tools-arrow {
  width: 13px;
  height: 13px;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.tools-card:hover .tools-arrow {
  transform: translateX(3px);
}

/* ---------- 固定顶部系统栏 ---------- */
.system-chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  pointer-events: none;
  top: max(env(safe-area-inset-top), 0.5rem);
}

.system-chrome-inner {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin: -12px 0;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chrome-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--muted-foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.05);
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, transform 0.2s,
    box-shadow 0.2s;
}
.chrome-btn:hover {
  color: var(--foreground);
  border-color: var(--ring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.09), 0 10px 26px rgba(0, 0, 0, 0.07);
}
.chrome-btn:active {
  transform: scale(0.94);
}
.chrome-btn svg {
  width: 15px;
  height: 15px;
}
body:not(.dark) .icon-moon {
  display: none;
}
body.dark .icon-sun {
  display: none;
}

/* ---------- 复制气泡 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--glass-hover);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 入场动画 ---------- */
@keyframes widget-lift {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.item {
  animation: widget-lift 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  /* 载入时按文档顺序依次浮起。以前是十条 .item:nth-child(n) 规则，
     换成列容器之后每列都会从 1 重新数，序号就乱了；改成由 build.py
     直接写好的 --i，跟分组无关。 */
  animation-delay: calc(var(--i, 0) * 0.05s + 0.02s);
}

/* ---------- 滚动进场 ----------
   JS 给 [data-reveal] 加上 .reveal（无 JS / 减动效时一律不加，内容默认可见）。
   用 animation 而不是 transition：元素自身的 :hover/:active 过渡不受影响。
   进场播完 JS 会把 .reveal 摘掉，元素回到「无变换」的默认态，和动画终帧一致。 */
.reveal {
  animation: reveal-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 卡片悬停抬升（桌面端） ---------- */
@media (hover: hover) and (pointer: fine) {
  .item {
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .item:hover {
    transform: translateY(-3px);
  }
  .widget {
    transition: border-color 0.3s, background-color 0.3s, box-shadow 0.32s;
  }
  .item:hover .widget {
    box-shadow: 0 18px 40px -22px rgba(15, 23, 42, 0.32);
  }
  body.dark .item:hover .widget {
    box-shadow: 0 18px 44px -20px rgba(0, 0, 0, 0.7);
  }
}

@media (prefers-reduced-motion: reduce) {
  .item {
    animation: none !important;
  }
  .reveal {
    animation: none !important;
  }
  .ambient-orb {
    animation: none !important;
  }
  .item:hover {
    transform: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 打印 ---------- */
@media print {
  .system-chrome,
  .toast,
  .ambient,
  .lightbox {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
