/* ==========================================================================
   林一舟 · 个人作品集 样式表
   结构：1. 设计令牌  2. 基础重置  3. 布局工具  4. 组件  5. 响应式  6. 动效与降级
   约定：移动优先，从小到大逐级增强断点。
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 品牌色 */
  --brand-500: #4f46e5;
  --brand-600: #4338ca;
  --brand-100: #e0e7ff;
  --accent-500: #06b6d4;

  /* 中性色（浅色主题） */
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --text: #14161f;
  --text-soft: #4b5266;
  --text-mute: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.12);

  /* 尺寸与节奏 */
  --container: 1160px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --section-y: clamp(3.5rem, 9vw, 6.5rem);
  --header-h: 64px;

  /* 字体：系统字体栈，零网络请求，中文显示更稳 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --transition: 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色主题：所有颜色变量集中覆盖，组件样式无需改动 */
[data-theme="dark"] {
  --brand-500: #818cf8;
  --brand-600: #a5b4fc;
  --brand-100: #312e81;
  --accent-500: #22d3ee;

  --bg: #0b1020;
  --bg-alt: #11172c;
  --surface: #151c33;
  --text: #f2f4f9;
  --text-soft: #c3c9dc;
  --text-mute: #9aa3bd;
  --border: #262f4d;
  --border-strong: #37415f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* 锚点跳转时给 sticky 头部留出空间 */
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  /* 主题切换时颜色平滑过渡，但避免影响布局属性 */
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

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

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

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

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

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

/* 键盘焦点可见：任何主题下都保证对比度，绝不要移除 outline */
:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 跳转到主内容：仅键盘聚焦时显示 */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--brand-500);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 3. 布局工具 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  /* 移动端留 20px，大屏自动放宽（clamp 两侧必须带空格） */
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section {
  padding-block: var(--section-y);
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
  max-width: 62ch;
}

.section-kicker {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-500);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
}

.section-sub {
  margin-top: 0.75rem;
  color: var(--text-mute);
}

.grad {
  background: linear-gradient(120deg, var(--brand-500), var(--accent-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.inline-link {
  color: var(--brand-500);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 4. 组件 ---------- */

/* 4.1 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* 滚动后给头部加分隔线，由 JS 添加 .is-scrolled */
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.0625rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--transition), background-color var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-alt);
}

/* 当前所在区块高亮 */
.nav-link.is-active {
  color: var(--brand-500);
  background: var(--brand-100);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--text-soft);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  color: var(--brand-500);
  border-color: var(--brand-500);
  transform: translateY(-1px);
}

/* 日月图标按主题切换显隐 */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* 汉堡按钮：仅移动端显示 */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 38px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}

/* 展开态：三条线变叉号 */
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 4.2 Hero */
.hero {
  padding-block: clamp(3rem, 10vw, 7rem) clamp(3rem, 8vw, 5.5rem);
  /* 背景光晕：径向渐变，不使用外部图片 */
  background:
    radial-gradient(ellipse 70% 55% at 78% 8%, color-mix(in srgb, var(--brand-500) 14%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 50% at 12% 92%, color-mix(in srgb, var(--accent-500) 12%, transparent), transparent 70%);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.8125rem;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px color-mix(in srgb, #10b981 22%, transparent);
}

.hero-title {
  font-size: clamp(2rem, 1.3rem + 3.6vw, 3.5rem);
  font-weight: 800;
}

.hero-desc {
  margin-top: 1.25rem;
  max-width: 54ch;
  color: var(--text-soft);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition),
              background-color var(--transition), color var(--transition);
}

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--brand-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.stat dt {
  color: var(--text-mute);
  font-size: 0.8125rem;
}

.stat dd {
  margin: 0.15rem 0 0;
  font-size: 1.375rem;
  font-weight: 700;
}

.stat .num {
  color: var(--brand-500);
}

.hero-visual {
  position: relative;
  justify-self: center;
  width: min(320px, 78vw);
}

.avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.avatar-ring {
  position: absolute;
  inset: -14px;
  border-radius: calc(var(--radius-lg) + 14px);
  border: 2px dashed color-mix(in srgb, var(--brand-500) 40%, transparent);
  animation: spin 26s linear infinite;
}

/* 4.3 关于 */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 5vw, 3rem);
  align-items: start;
}

.about-text {
  display: grid;
  gap: 1.1rem;
  max-width: 62ch;
  color: var(--text-soft);
}

.about-text strong {
  color: var(--text);
}

.about-facts {
  display: grid;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.about-facts li {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border);
}

.about-facts li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.fact-label {
  color: var(--text-mute);
  font-size: 0.8125rem;
}

.fact-value {
  font-weight: 600;
}

/* 4.4 技能 */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.skill-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.skill-cat {
  font-size: 1.0625rem;
  margin-bottom: 1.1rem;
}

.skill-bars {
  display: grid;
  gap: 1rem;
}

.skill-bars li {
  display: grid;
  gap: 0.4rem;
}

.skill-name {
  font-size: 0.875rem;
  color: var(--text-soft);
}

.skill-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
}

.skill-fill {
  display: block;
  height: 100%;
  width: 0;
  /* --level 由 HTML 内联传入，进场后再由 JS 触发动画 */
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-card.is-visible .skill-fill {
  width: var(--level);
}

/* 4.5 作品集 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: all var(--transition);
}

.filter-btn:hover {
  color: var(--brand-500);
  border-color: var(--brand-500);
}

.filter-btn.is-active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.project-card {
  display: flex;
}

/* 筛选隐藏：用 display:none 而非 visibility，避免占据布局空间 */
.project-card[hidden] {
  display: none;
}

.project-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.project-link:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--brand-500) 45%, transparent);
  box-shadow: var(--shadow-lg);
}

.project-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg-alt);
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-600);
  font-size: 0.75rem;
  font-weight: 600;
}

.project-title {
  font-size: 1.125rem;
}

.project-desc {
  color: var(--text-mute);
  font-size: 0.9375rem;
  flex: 1;
}

.project-more {
  margin-top: 0.25rem;
  color: var(--brand-500);
  font-size: 0.875rem;
  font-weight: 600;
}

.empty-state {
  padding: 2.5rem;
  text-align: center;
  color: var(--text-mute);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* 4.6 时间线 */
.timeline {
  position: relative;
  display: grid;
  gap: 1.75rem;
  padding-left: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  /* 写成 1px - 1.75rem 而非 -1.75rem + 1px，避免一元负号带来的解析歧义 */
  left: calc(1px - 1.75rem);
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 18%, transparent);
}

.timeline-time {
  color: var(--brand-500);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.timeline-title {
  margin-top: 0.25rem;
  font-size: 1.0625rem;
}

.timeline-org {
  margin-top: 0.15rem;
  color: var(--text-soft);
  font-size: 0.9375rem;
  font-weight: 500;
}

.timeline-desc {
  margin-top: 0.4rem;
  color: var(--text-mute);
  font-size: 0.9375rem;
  max-width: 60ch;
}

/* 4.7 联系 */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 5vw, 3rem);
  align-items: start;
}

.contact-subtitle {
  font-size: 1.0625rem;
  margin-bottom: 0.9rem;
}

.contact-subtitle + * {
  margin-bottom: 1.75rem;
}

.contact-list {
  display: grid;
  gap: 0.9rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-areas: "icon label" ". value";
  align-items: center;
  column-gap: 0.6rem;
}

.contact-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-100);
  color: var(--brand-600);
  font-size: 0.8125rem;
}

.contact-label {
  grid-area: label;
  color: var(--text-mute);
  font-size: 0.8125rem;
}

.contact-value {
  grid-area: value;
  font-weight: 600;
  color: var(--text);
}

a.contact-value:hover {
  color: var(--brand-500);
}

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.social-list a {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.875rem;
  transition: color var(--transition), border-color var(--transition);
}

.social-list a:hover {
  color: var(--brand-500);
  border-color: var(--brand-500);
}

.contact-form {
  display: grid;
  gap: 1rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.req {
  color: #ef4444;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 22%, transparent);
}

/* 校验失败态 */
.field.has-error input,
.field.has-error textarea {
  border-color: #ef4444;
}

.field-error {
  color: #ef4444;
  font-size: 0.8125rem;
}

.form-status {
  min-height: 1.4em;
  font-size: 0.875rem;
  font-weight: 500;
}

.form-status.is-ok {
  color: #10b981;
}

.form-status.is-error {
  color: #ef4444;
}

/* 4.8 页脚与返回顶部 */
.site-footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: center;
}

.footer-copy,
.footer-note {
  color: var(--text-mute);
  font-size: 0.875rem;
}

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: opacity var(--transition), transform var(--transition);
}

.to-top:hover {
  transform: translateY(-3px);
}

.to-top[hidden] {
  display: none;
}

/* ---------- 5. 响应式断点（移动优先，逐级增强） ---------- */

/* 平板竖屏及以上 */
@media (min-width: 640px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-list {
    gap: 0.35rem;
  }
}

/* 桌面端 */
@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1.15fr 0.85fr;
  }

  .hero-visual {
    width: 340px;
  }

  .about-grid {
    grid-template-columns: 1.4fr 1fr;
  }

  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: 1fr 1.15fr;
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

/* 大屏：项目卡片两列（当前仅保留 2 个作品，两列排布不留空位） */
@media (min-width: 1100px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 60%;
  }
}

@media (min-width: 1400px) {
  .project-grid {
    max-width: 52%;
  }
}

/* 移动端导航抽屉（在断点以下生效） */
@media (max-width: 899px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    /* 默认收起：max-height 过渡比 display 更平滑 */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .site-nav.is-open {
    max-height: 360px;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
  }

  .nav-link {
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
  }
}

/* ---------- 6. 动效与降级 ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 进场动画初始态：仅支持 JS 的环境才隐藏，避免无脚本时内容不可见 */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 尊重系统「减少动态效果」设置：关闭所有动画与平滑滚动 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .skill-fill {
    width: var(--level);
  }
}

/* 打印样式：导出 PDF 简历时更干净 */
@media print {
  .site-header,
  .to-top,
  .filter-bar,
  .contact-form,
  .hero-visual {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* ==========================================================
   视频作品 & PPT 画廊 & 灯箱（追加区块）
   ========================================================== */

/* 子区块标题 */
.work-subtitle {
  margin-top: 3.5rem;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.work-sub-hint {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-mute);
}

/* 区块内第一个子标题不需要额外上边距 */
.section-head + .work-subtitle {
  margin-top: 1.75rem;
}

/* ---- 视频卡片 ---- */
.video-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-card video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.video-card figcaption {
  padding: 0.9rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.video-card figcaption strong {
  color: var(--text);
  font-size: 1rem;
}

.video-card figcaption span {
  color: var(--text-mute);
  font-size: 0.85rem;
}

@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .video-grid .video-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1100px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .video-grid .video-card:first-child {
    grid-column: auto;
  }
}

/* ---- PPT 画廊：长条缩略图网格，点击放大 ---- */
.ppt-gallery {
  margin-top: 1.5rem;
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.ppt-item {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: zoom-in;
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ppt-item:hover,
.ppt-item:focus-visible {
  transform: translateY(-3px);
  border-color: var(--brand-500);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-500) 18%, transparent);
}

.ppt-item img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: top;
}

.ppt-name {
  display: block;
  padding: 0.55rem 0.4rem;
  font-size: 0.8rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .ppt-gallery { grid-template-columns: repeat(4, 1fr); }
  .ppt-item img { height: 360px; }
}

/* ---- 灯箱 ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem 1.5rem;
  background: color-mix(in srgb, #000 82%, transparent);
  backdrop-filter: blur(4px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-img {
  max-width: min(92vw, 560px);
  max-height: 82vh;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: #e5e7eb;
  font-size: 0.9rem;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

body.lightbox-open {
  overflow: hidden;
}
