/* ==========================================================================
   个人简历网站模板 · 样式表
   零依赖、支持深浅色、移动端优先。所有可调变量集中在 :root。
   ========================================================================== */

:root {
  /* 颜色 */
  --bg:            #f7f6f2;
  --surface:       #ffffff;
  --surface-2:     #fbfaf6;
  --ink:           #1a1917;
  --ink-2:         #55514a;
  --ink-3:         #8b867c;
  --line:          #e7e3da;
  --line-strong:   #d6d1c6;
  --accent:        #c4573b;
  --accent-ink:    #ffffff;
  --accent-soft:   rgba(196, 87, 59, .10);
  --shadow-sm:     0 1px 2px rgba(26,25,23,.05), 0 8px 24px -18px rgba(26,25,23,.35);
  --shadow-md:     0 2px 6px rgba(26,25,23,.06), 0 28px 60px -32px rgba(26,25,23,.4);
  --shadow-lg:     0 40px 90px -40px rgba(26,25,23,.55);

  /* 字体：不依赖外部 CDN，直接吃系统字。想换成 Geist / Outfit 等，改这里即可 */
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
               system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 尺寸 & 节奏 */
  --container: 1200px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 18px;
  --radius-lg: 26px;
  --radius-sm: 10px;
  --section-y: clamp(44px, 6vw, 88px);   /* 板块上下留白（原 64~128，整体收紧约三分之一） */

  --ease: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="dark"] {
  --bg:          #151512;
  --surface:     #1e1e1a;
  --surface-2:   #23231e;
  --ink:         #f2f0e9;
  --ink-2:       #b3aea2;
  --ink-3:       #857f72;
  --line:        #31302a;
  --line-strong: #45443c;
  --accent:      #e07a54;
  --accent-soft: rgba(224, 122, 84, .16);
  --shadow-sm:   0 1px 2px rgba(0,0,0,.4), 0 8px 24px -18px rgba(0,0,0,.8);
  --shadow-md:   0 2px 6px rgba(0,0,0,.4), 0 28px 60px -30px rgba(0,0,0,.9);
  --shadow-lg:   0 40px 90px -40px rgba(0,0,0,.95);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .3s var(--ease), color .3s var(--ease);
}
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .6em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .1em .4em; }
figure { margin: 0; }
:where(a, button, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; transform: translateY(-160%);
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
section[id] { scroll-margin-top: 84px; }

/* ---------- 通用文字 ---------- */
.eyebrow {
  font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 14px;
}
.lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--ink-2); max-width: 52ch; }
.section-head { max-width: 62ch; margin-bottom: clamp(32px, 4vw, 56px); }
.section-head h2 { font-size: clamp(28px, 4.4vw, 46px); }
.section-desc { color: var(--ink-2); margin-bottom: 0; max-width: 52ch; }
.muted { color: var(--ink-3); font-size: 14px; }
.hl { position: relative; white-space: nowrap; }
.hl::after {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: .08em; height: .32em;
  background: var(--accent-soft); border-radius: 4px; z-index: -1;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), opacity .18s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink-3); }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--ink-2);
  transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

/* ---------- 顶栏 ---------- */
.scroll-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%; width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%;
}
.site-header {
  position: sticky; top: 0; z-index: 110;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.site-header.is-scrolled { border-color: var(--line); }
.nav { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 600; font-size: 15px; }
.brand-text em { font-style: normal; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  display: block; padding: 8px 14px; border-radius: 999px; font-size: 15px; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--surface); color: var(--ink); }
.nav-links a.is-active { color: var(--ink); background: var(--accent-soft); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 侧栏目录（默认抽屉，宽屏时变粘性侧栏） ---------- */
.layout { padding-inline: 0; }

.toc-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
  transition: background .2s, color .2s, border-color .2s;
}
.toc-toggle:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

.toc-scrim {
  position: fixed; inset: 0; z-index: 125;
  background: rgba(12, 11, 9, .45); opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.toc-scrim.is-on { opacity: 1; pointer-events: auto; }

.toc {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 130;
  width: min(300px, 84vw); padding: 22px; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(-102%); visibility: hidden;
  transition: transform .34s var(--ease), visibility 0s linear .34s;
}
.toc.is-open { transform: none; visibility: visible; transition: transform .34s var(--ease), visibility 0s; }

.toc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toc-title { margin: 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.toc-close { display: grid; place-items: center; width: 32px; height: 32px; flex: none; }

.toc-list { counter-reset: toc; border-left: 1px solid var(--line); }
.toc-list li { counter-increment: toc; }
.toc-list a {
  position: relative; display: flex; align-items: baseline; gap: 10px;
  padding: 9px 12px; font-size: 14.5px; color: var(--ink-2);
  border-radius: 0 8px 8px 0; transition: color .2s, background .2s, font-weight .2s;
}
.toc-list a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .06em;
}
.toc-list a::after {
  content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleY(0); transform-origin: 50% 50%; transition: transform .28s var(--ease);
}
.toc-list a:hover { background: var(--surface-2); color: var(--ink); }
.toc-list a.is-active { color: var(--accent); font-weight: 600; }
.toc-list a.is-active::after { transform: scaleY(1); }

.toc-foot { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.toc-note { margin: 12px 0 0; text-align: center; }

@media (min-width: 1180px) {
  .layout {
    display: grid; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: auto auto;
    gap: clamp(28px, 3vw, 56px);
    max-width: calc(var(--container) + 224px + 56px);
    margin-inline: auto; padding-inline: var(--gutter);
  }
  .toc {
    grid-column: 1; grid-row: 1 / span 2;
    position: sticky; inset: auto; top: 92px; align-self: start;
    width: auto; max-height: calc(100dvh - 120px); padding: 0 0 24px;
    background: transparent; border: 0; box-shadow: none;
    transform: none; visibility: visible; transition: none;
  }
  .toc-close, .toc-toggle { display: none; }
  #main, .site-footer { grid-column: 2; min-width: 0; }
  #main > .container, .site-footer > .container { max-width: none; padding-inline: 0; }
}

/* ---------- HERO ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 72px);
  align-items: center; padding-block: clamp(48px, 8vw, 104px) clamp(40px, 6vw, 80px);
}
.hero-copy h1 { font-size: clamp(34px, 6.2vw, 68px); letter-spacing: -.035em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 40px; }

.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; border-top: 1px solid var(--line); padding-top: 24px;
  /* 三项数据：整行等分 + 文字居中 */
  text-align: center;
}
.stats dt { font-family: var(--font-display); font-size: clamp(24px, 3vw, 34px); font-weight: 600; letter-spacing: -.02em; }
.stats dt em { font-style: normal; font-size: .5em; margin-left: 2px; color: var(--ink-3); }
.stats dd { font-size: 13px; color: var(--ink-3); }

.hero-media { position: relative; }
.frame-portrait { border-radius: var(--radius-lg); overflow: hidden; }
.frame-portrait img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }
.frame-inset {
  position: absolute; right: -6%; bottom: -12%; width: 46%;
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-md); border: 1px solid var(--line);
}
.frame-inset img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.frame-inset figcaption {
  padding: 10px 14px; font-size: 13px; color: var(--ink-2);
  border-top: 1px solid var(--line); background: var(--surface);
}

/* ---------- 通用图片容器 ---------- */
.frame {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line);
}
.frame img, .frame video { width: 100%; height: 100%; object-fit: cover; }
.frame-16x9  { aspect-ratio: 16 / 9; }
.frame-16x10 { aspect-ratio: 16 / 10; }
.frame-4x3   { aspect-ratio: 4 / 3; }
.frame-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.frame.fill { height: 100%; }

/* 图片加载失败时的占位（模板友好） */
.frame.is-missing {
  display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--bg) 10px, var(--bg) 20px);
}
.frame.is-missing::after {
  content: attr(data-fallback); padding: 12px; white-space: pre-line;
  font-size: 13px; color: var(--ink-3); line-height: 1.6;
}
.frame.is-missing img { display: none; }

/* ---------- 视频播放按钮 ---------- */
.video-card > .vplay, .video-mini .vplay, .vplay {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.vplay:hover { transform: scale(1.08); background: color-mix(in srgb, var(--bg) 94%, transparent); }
.vplay-dot {
  width: 0; height: 0; margin-left: 4px;
  border-left: 15px solid var(--accent);
  border-top: 10px solid transparent; border-bottom: 10px solid transparent;
}
/* 视频缺失时：清空占位比例即可，不再显示提示文字 */
.frame.is-video-missing { background: var(--surface-2); }

/* ---------- SHOWREEL：六格视频墙（标题框 + 视频框，一行 3 个） ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.2vw, 28px);
  align-items: start;
  max-width: 1180px;
  margin-inline: auto;
}

.vcard {
  display: flex; flex-direction: column; gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s var(--ease);
}
.vcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }

/* 指定某张卡片固定在第 2 列（演唱：要紧挨在 02 钢琴正下方，而不是被自动排到第 1 列） */
.vcard.is-col-2 { grid-column: 2; }

/* 一行 3 列后不再需要 04 号卡片的错落上移（该效果是为 2×2 排布做的） */

/* 错落上移：贴齐距离由 main.js 的 alignTailCards() 实测得出（标记 is-tail-align 的卡片），
   这里不再写死 nth-child 兜底值，免得增删卡片后对不上号 */

/* 标题框：每个视频框上方各一个 */
.vc-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.vc-index {
  flex: none; font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: .1em; color: var(--accent); line-height: 1.9;
}
.vc-heading { min-width: 0; }
.vc-heading h3 { font-size: 16px; margin: 0; line-height: 1.35; }
.vc-heading p { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }

/* 视频框：贴合视频真实比例，不留黑边、不做模糊补边 */
.vc-frame {
  aspect-ratio: 16 / 9;      /* JS 读到真实尺寸后会替换成视频自身比例 */
  position: relative;        /* 全屏按钮定位用 */
  border-radius: var(--radius);
  /* 底色用卡片同色系而不是纯黑：任何 1px 缝隙都只是浅灰，不会出现黑边/黑线 */
  background: var(--surface-2);
  max-width: 100%;
  margin-inline: auto;       /* 竖屏视频收窄后居中，比例不变 */
}
.vc-frame.is-video-missing { background: var(--surface-2); }
.vc-video {
  display: block;            /* 消除 inline 元素底部间隙，避免露出底色 */
  width: 100%; height: 100%;
  object-fit: cover;         /* 比例对齐后等价于 contain：铺满且零裁切 */
  background: var(--surface-2);
}

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.about-media { position: relative; padding-bottom: 56px; }
.frame-offset { width: 62%; margin-left: auto; margin-top: -18%; position: relative; box-shadow: var(--shadow-md); }
.about-copy h2 { font-size: clamp(26px, 4vw, 40px); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chip-list li {
  padding: 7px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}

/* ---------- BENTO 作品 ---------- */
.bento {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(14px, 2vw, 22px);
}
.tile {
  grid-column: span 2; position: relative; cursor: pointer;
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.tile > .frame { border: 0; border-radius: 0; }
.tile-wide { grid-column: span 4; }
.tile-tall { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; }
.tile-tall .frame { flex: 1; }
.tile-wide .frame-16x10 { aspect-ratio: 16 / 9; }
.tile-body { padding: 20px 22px 22px; }
.tile-body h3 { font-size: 19px; margin: 10px 0 6px; }
.tile-body p { color: var(--ink-3); font-size: 14.5px; margin: 0; }
.tile-body-on {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.72)); color: #fff;
}
.tile-body-on h3 { margin: 0; }
.tag {
  display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; background: var(--accent-soft); color: var(--accent);
}
.tag-video { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-2); }
[data-theme="dark"] .tag-video { background: rgba(255,255,255,.08); color: var(--ink-2); }
.tile-body-on .tag { background: rgba(255,255,255,.18); color: #fff; }

.tile-quote {
  grid-column: span 2; display: flex; flex-direction: column; justify-content: center;
  padding: 28px 26px; background: var(--ink); color: var(--bg); border-color: transparent; cursor: default;
}
.tile-quote:hover { transform: none; box-shadow: none; }
.tile-quote blockquote { margin: 0; font-family: var(--font-display); font-size: 21px; line-height: 1.45; letter-spacing: -.01em; }
.quote-by { margin: 14px 0 0; font-size: 13px; opacity: .6; }

/* 悬停播放预览 */
.video-hover video { position: relative; z-index: 1; }
.hover-badge {
  position: absolute; right: 12px; top: 12px; z-index: 3;
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--ink-2);
  border: 1px solid var(--line-strong); pointer-events: none;
  transition: opacity .3s var(--ease);
}
.video-hover.is-playing .hover-badge { opacity: 0; }

/* ---------- SKILLS ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 4vw, 56px); }
.skill-group h3 {
  font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.bars li {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  margin-bottom: 20px; font-size: 15px;
}
.bars li em { font-style: normal; font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.bars li i {
  grid-column: 1 / -1; display: block; height: 4px; border-radius: 4px;
  background: var(--line); overflow: hidden; position: relative;
}
.bars li i::before {
  content: ""; position: absolute; inset: 0; background: var(--accent); border-radius: 4px;
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 1.1s var(--ease) .15s;
}
.is-in .bars li i::before { transform: scaleX(var(--v, 0)); }

/* ---------- TIMELINE ---------- */
.timeline { border-top: 1px solid var(--line); }
.timeline li {
  display: grid; grid-template-columns: 160px 1fr; gap: 8px 32px;
  padding: 26px 0; border-bottom: 1px solid var(--line);
  transition: background .3s var(--ease);
}
.timeline li:hover { background: var(--surface-2); }
.t-date { font-family: var(--font-mono); font-size: 13.5px; color: var(--accent); padding-top: 4px; }
.timeline h3 { font-size: 19px; margin: 0 0 6px; }
.timeline p { margin: 0; color: var(--ink-3); font-size: 14.5px; max-width: 60ch; }

/* ---------- GALLERY ---------- */
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(12px, 2vw, 20px); }
.g-item {
  grid-column: span 2; position: relative; overflow: hidden; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2);
}
.g-item img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; display: block; transition: transform .5s var(--ease); }
.g-item:hover img { transform: scale(1.05); }
/* 第一行：大图跨 4 列（16:10）+ 竖图跨 2 列（3:4）—— 两者高度几乎相等，不留空档 */
.g-item-lg { grid-column: span 4; }
.g-item-lg img { aspect-ratio: 16 / 10; }
.g-item-tall { grid-column: span 2; }
.g-item-tall img { aspect-ratio: 3 / 4; }
/* 收尾那张：不再通栏（21:9 会把照片裁掉大半），收窄到中间 4 列并放宽到 16:9 */
.g-item-wide { grid-column: 2 / span 4; }
.g-item-wide img { aspect-ratio: 16 / 9; }
.g-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 14px;
  font-size: 14px; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.65));
}

/* ---------- CONTACT ---------- */
.contact { display: grid; grid-template-columns: 1fr .9fr; gap: clamp(32px, 6vw, 80px); }
.contact h2 { font-size: clamp(28px, 4.4vw, 44px); }
.contact-list { margin-top: 32px; border-top: 1px solid var(--line); }
.contact-list li {
  display: flex; gap: 20px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.contact-list span { min-width: 62px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.contact-list a { font-size: 16px; border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
.contact-list a:hover { color: var(--accent); border-color: var(--accent); }

.contact-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 34px); box-shadow: var(--shadow-sm);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field input, .field textarea {
  width: 100%; padding: 13px 15px; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.has-error input, .field.has-error textarea { border-color: #b4452f; }
.err { margin: 6px 0 0; font-size: 13px; color: #b4452f; min-height: 0; }
.form-status { margin: 14px 0 0; font-size: 14px; color: var(--accent); min-height: 20px; }

/* ---------- FOOTER ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 32px; margin-top: var(--section-y); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-inner p { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ---------- 灯箱 ---------- */
.lightbox {
  border: 0; padding: 0; max-width: 92vw; max-height: 90vh; width: min(1100px, 92vw);
  background: transparent; color: var(--ink); overflow: visible;
}
.lightbox::backdrop { background: rgba(12,11,9,.86); backdrop-filter: blur(6px); }
.lb-body {
  border-radius: var(--radius-lg); overflow: hidden; background: #000;
  display: grid; place-items: center; max-height: 78vh;
}
.lb-body img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; background: #000; }
.lb-body video { width: 100%; max-height: 78vh; background: #000; }
/* 灯箱里图片下方的说明文字：不再显示（保留元素，JS 仍在赋值，避免取不到节点报错） */
.lb-caption { display: none; }
.lb-close, .lb-nav {
  position: absolute; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--ink);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), background .2s;
}
.lb-close:hover, .lb-nav:hover { transform: scale(1.08); }
.lb-close { top: -54px; right: 0; }
.lb-prev { top: 50%; left: -56px; translate: 0 -50%; }
.lb-next { top: 50%; right: -56px; translate: 0 -50%; }
.lb-nav[hidden] { display: none; }

/* ---------- 入场动画 ---------- */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s var(--ease) var(--delay, 0s), transform .7s var(--ease) var(--delay, 0s);
}
.reveal.is-in { opacity: 1; transform: none; }
.tilt { transition: transform .5s var(--ease); will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 响应式 ---------- */
/* 目录（≥1180px 常驻侧栏，以下收进抽屉）与顶部导航二选一出现，避免重复 */
@media (max-width: 1179px) {
  .nav-links { display: none; }
}

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .hero-media { max-width: 520px; }
  .nav-links { display: none; }
  .bento { grid-template-columns: repeat(4, 1fr); }
  .tile-wide { grid-column: span 4; }
  .tile-tall { grid-column: span 2; grid-row: span 1; }
  .tile-tall .frame { aspect-ratio: 3 / 4; }
  .tile-quote { grid-column: span 4; }
  /* 4 列下 6 格排成：大图通栏 / 竖图+横图 / 两张 / 收尾通栏 */
  .gallery { grid-template-columns: repeat(4, 1fr); }
  .g-item-lg { grid-column: span 4; }
  .g-item-tall { grid-column: span 2; }
  .g-item-tall img { aspect-ratio: 1 / 1; }
  .g-item-wide { grid-column: span 4; }
  .g-item-wide img { aspect-ratio: 16 / 9; }
}

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-media { padding-bottom: 0; max-width: 520px; }
  .frame-offset { margin-top: -12%; }
  .skills { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 20px 12px; }
  .hero-media { width: 100%; }
  .frame-inset { position: static; width: 74%; margin: -14% 0 0 auto; }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .tile, .tile-wide, .tile-tall, .tile-quote { grid-column: span 2; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .g-item, .g-item-lg, .g-item-tall, .g-item-wide { grid-column: span 2; }
  .g-item-tall img { aspect-ratio: 4 / 3; }
  .g-item-wide img { aspect-ratio: 4 / 3; }   /* 单列下通栏横幅太扁，收回 4:3 */
  .lb-prev { left: 8px; } .lb-next { right: 8px; } .lb-close { top: -50px; right: 8px; }
  .tile:hover { transform: none; }
}

@media (max-width: 420px) {
  .hero-copy h1 { font-size: 32px; }
  .btn { width: 100%; justify-content: center; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .vcard { padding: 10px; }
  .vc-head { padding: 10px 12px; }
  .vc-heading h3 { font-size: 16px; }
}

/* 强制横板：不论原片是竖屏还是方屏，都按 16:9 横框显示（上下裁切铺满） */
.vc-frame.is-landscape { aspect-ratio: 16 / 9 !important; max-width: none !important; }
.vc-frame.is-landscape .vc-video { object-fit: cover; }
/* 竖屏片裁成横板时，把取景重心上移，避免切掉人物头部（默认 center 会截在腰腹） */
.vc-frame.focus-top .vc-video { object-position: center 30%; }
/* 某一侧有亚像素缝隙时：画面向该方向挪 1px 并加宽 2px 盖住，配合 overflow 不溢出圆角 */
.vc-frame.nudge-right { overflow: hidden; }
.vc-frame.nudge-right .vc-video { width: calc(100% + 2px); transform: translateX(1px); }

/* 网页内全屏层：双击视频触发，原生 requestFullscreen 不可用时兜底（不再使用可见按钮） */
.fs-overlay {
  position: fixed; inset: 0; z-index: 99998; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.fs-overlay video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.fs-close {
  position: absolute; top: 16px; right: 18px; z-index: 2;
  border: 0; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 13px;
}
.fs-close:hover { background: rgba(255, 255, 255, .24); }
/* 原生全屏时取消卡片位移：祖先元素带 transform 会让全屏画面被限制在卡片内 */
.vcard:has(:fullscreen) { transform: none !important; }
.vcard:has(:fullscreen) .vc-frame { aspect-ratio: auto !important; max-width: none !important; }

/* 同一卡片内并排两个视频框（足球：主片 + 加练） */
.vc-duo {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; align-items: start;
}
@media (max-width: 520px) { .vc-duo { grid-template-columns: 1fr; } }

/* ---------- 运动技能：八格视频墙（一行 3 个，沿用才艺板块的卡片结构） ---------- */
.sport-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.2vw, 28px); align-items: start;
  max-width: 1180px; margin-inline: auto;
}
.sport-grid .vcard { padding: 14px; gap: 12px; }
.sport-grid .vc-head { padding: 12px 14px; gap: 12px; }
.sport-grid .vc-heading h3 { font-size: 17px; }
.sport-grid .vc-index { font-size: 12px; line-height: 1.9; }

/* 足球：卡片横跨两列，内部两个视频框同比放大 */
.sport-grid .vcard-wide { grid-column: span 2; }
.sport-grid .vcard-wide .vc-duo { gap: 12px; }
@media (max-width: 900px) { .sport-grid .vcard-wide { grid-column: span 2; } }
@media (max-width: 640px) { .sport-grid .vcard-wide { grid-column: span 1; } }

/* 滑冰（末行卡片）上移贴齐：它上方是横屏的漂移板，比同行另外两张矮，会空出一截；
   实际距离由 main.js 的 alignTailCards() 实测，data-tail-extra 微调 */

@media (max-width: 900px) {
  .video-grid, .sport-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .video-grid, .sport-grid { grid-template-columns: 1fr; max-width: 460px; }
  /* 单列时没有第 2 列可言，回到自动排布 */
  .vcard.is-col-2 { grid-column: auto; }
}
