/* ============================================================
   陈默 · 三维设计师作品集  —  暗色高级质感设计系统
   ============================================================ */

:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --text: #f5f5f4;
  --muted: #8e8e93;
  --accent: #c9a96e;
  --accent-dim: rgba(201, 169, 110, 0.14);
  --line: rgba(255, 255, 255, 0.08);
  --font-latin: "Outfit", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "Outfit", system-ui, sans-serif;
  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.6s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #0a0a0b; }

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

.section { padding-block: clamp(80px, 12vw, 160px); }

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.preloader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-logo {
  font-family: var(--font-latin);
  font-size: 40px; font-weight: 600; letter-spacing: 0.1em;
  color: var(--accent);
  display: block; text-align: center; margin-bottom: 18px;
}
.preloader-bar {
  display: block; width: 160px; height: 1px;
  background: var(--line); overflow: hidden;
}
.preloader-bar-fill {
  display: block; height: 100%; width: 40%;
  background: var(--accent);
  animation: load 1.1s var(--ease) infinite;
}
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
.hero .reveal:nth-child(1) { transition-delay: 0.05s; }
.hero .reveal:nth-child(2) { transition-delay: 0.15s; }
.hero .reveal:nth-child(3) { transition-delay: 0.25s; }
.hero .reveal:nth-child(4) { transition-delay: 0.35s; }
.hero .reveal:nth-child(5) { transition-delay: 0.45s; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(10, 10, 11, 0.75);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav-inner {
  max-width: 1280px; margin-inline: auto;
  padding: 18px clamp(20px, 4vw, 48px);
  display: flex; align-items: center; gap: 32px;
}
.nav-logo {
  font-family: var(--font-latin); font-weight: 600;
  font-size: 22px; color: var(--text); text-decoration: none;
  letter-spacing: 0.05em;
}
.nav-logo-dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  transition: color 0.3s;
  position: relative;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; margin-left: auto;
  flex-direction: column; justify-content: center; gap: 7px; align-items: center;
}
.nav-toggle span { width: 22px; height: 1.5px; background: var(--text); transition: transform 0.3s; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 15px; font-weight: 400;
  padding: 14px 32px; border-radius: 999px;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.3s var(--ease), background 0.3s, color 0.3s, border-color 0.3s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-primary { background: var(--accent); color: #0f0e0c; }
.btn-primary:hover { background: #d9bc84; transform: translateY(-2px); }
.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-outline:hover { background: var(--accent-dim); }
.btn-small { padding: 9px 22px; font-size: 13px; }
.btn-full { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-orb {
  position: absolute;
  right: -8vw; top: 50%;
  width: min(58vw, 720px);
  transform: translateY(-50%);
  animation: float 9s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(-53%) rotate(3deg); }
}
.hero-inner { position: relative; z-index: 1; padding-top: 80px; }
.hero-eyebrow {
  color: var(--accent); font-size: 14px; letter-spacing: 0.35em;
  margin-bottom: 24px;
}
.hero-title {
  font-family: var(--font-latin);
  font-size: clamp(44px, 8.5vw, 108px);
  font-weight: 500; line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}
.hero-title span { display: block; }
.hero-title em { font-style: normal; color: var(--accent); }
.hero-sub { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); max-width: 560px; margin-bottom: 40px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 64px; }
.hero-stats { display: flex; gap: clamp(32px, 6vw, 80px); }
.stat { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-latin); font-size: clamp(30px, 4vw, 46px);
  font-weight: 500; color: var(--text); line-height: 1.1;
}
.stat-num::after { content: "+"; color: var(--accent); font-size: 0.7em; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.hero-scroll {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 11px; letter-spacing: 0.3em;
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.hero-scroll-line { width: 1px; height: 44px; background: var(--line); position: relative; overflow: hidden; }
.hero-scroll-line::after {
  content: ""; position: absolute; inset: 0; background: var(--accent);
  animation: scrollHint 1.8s var(--ease) infinite;
}
@keyframes scrollHint {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* ---------- Section head ---------- */
.section-head { margin-bottom: 56px; }
.section-eyebrow {
  color: var(--accent); font-size: 13px; letter-spacing: 0.35em;
  font-family: var(--font-latin); margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-latin); font-weight: 500;
  font-size: clamp(30px, 4.5vw, 52px); letter-spacing: -0.01em; line-height: 1.15;
}
.section-sub { color: var(--muted); margin-top: 14px; max-width: 520px; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 44px; }
.filter-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-family: var(--font-body); font-size: 14px;
  padding: 9px 22px; border-radius: 999px; cursor: pointer;
  transition: all 0.3s var(--ease);
}
.filter-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.filter-btn.is-active { background: var(--accent); border-color: var(--accent); color: #0f0e0c; }

/* ---------- Works grid ---------- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2.5vw, 32px);
}
.work-card {
  grid-column: span 6;
  position: relative; cursor: pointer;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.5s var(--ease), border-color 0.4s, opacity 0.4s, scale 0.4s;
}
.work-card:nth-child(4n + 2), .work-card:nth-child(4n + 3) { grid-column: span 6; }
.work-card:hover { transform: translateY(-6px); border-color: rgba(201, 169, 110, 0.4); }
.work-card.is-hidden { display: none; }
.work-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.work-thumb img {
  width: 100%; height: 100%; display: block;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.work-card:hover .work-thumb img { transform: scale(1.05); }
.work-info {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 20px 24px;
}
.work-name { font-size: 18px; font-weight: 400; }
.work-year { color: var(--muted); font-size: 13px; font-family: var(--font-latin); }
.work-tags { padding: 0 24px 20px; display: flex; gap: 8px; flex-wrap: wrap; }
.work-tag {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px;
}

/* ---------- About ---------- */
.about { background: var(--surface); border-block: 1px solid var(--line); }
.about-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(48px, 7vw, 110px); align-items: start;
}
.about-text { color: var(--muted); margin-top: 20px; max-width: 56ch; }
.timeline { margin-top: 44px; border-top: 1px solid var(--line); }
.timeline-item {
  display: flex; gap: 24px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.timeline-year { font-family: var(--font-latin); color: var(--accent); font-size: 14px; min-width: 120px; }
.timeline-role { color: var(--text); font-size: 15px; }
.skills-title {
  font-family: var(--font-latin); font-weight: 500; font-size: 22px; margin-bottom: 28px;
}
.skills-list { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.skill-name { display: block; font-size: 14px; color: var(--text); margin-bottom: 8px; }
.skill-bar { display: block; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.skill-fill {
  display: block; height: 100%; width: calc(var(--level) * 100%);
  background: linear-gradient(90deg, var(--accent), #e6cf9e);
  transform-origin: left; border-radius: 2px;
}

/* ---------- 视频播放角标 ---------- */
.play-badge {
  position: absolute; top: 50%; left: 50%; z-index: 2;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(10, 10, 11, 0.55);
  border: 1px solid rgba(201, 169, 110, 0.6);
  backdrop-filter: blur(6px);
  transform: translate(-50%, -50%);
  transition: transform 0.4s var(--ease), background 0.3s;
  pointer-events: none;
}
.play-badge::after {
  content: ""; position: absolute; top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid; border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent var(--accent);
}
.work-card:hover .play-badge { transform: translate(-50%, -50%) scale(1.12); background: rgba(201, 169, 110, 0.2); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 32px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.footer-note a { color: var(--muted); text-decoration: none; transition: color 0.3s; }
.footer-note a:hover { color: var(--accent); }

/* ---------- Case modal ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 5, 6, 0.8);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.35s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-panel {
  position: relative; z-index: 1;
  width: min(880px, 100%); max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px;
  animation: panelIn 0.45s var(--ease);
}
@keyframes panelIn { from { opacity: 0; transform: translateY(30px) scale(0.98); } }
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10,10,11,0.6); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; font-size: 14px;
  transition: all 0.3s;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent); }
.modal-hero { aspect-ratio: 21 / 9; overflow: hidden; }
.modal-hero img { width: 100%; height: 100%; display: block; object-fit: cover; }
.modal-hero.is-video { aspect-ratio: 16 / 9; background: #000; }
.modal-hero.is-video video { width: 100%; height: 100%; display: block; }
.modal-body { padding: clamp(28px, 5vw, 56px); }
.modal-category { color: var(--accent); font-size: 13px; letter-spacing: 0.25em; margin-bottom: 10px; }
.modal-title {
  font-family: var(--font-latin); font-weight: 500;
  font-size: clamp(26px, 4vw, 40px); margin-bottom: 28px;
}
.modal-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  border-block: 1px solid var(--line); padding-block: 22px; margin-bottom: 36px;
}
.modal-meta dt { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.modal-meta dd { color: var(--text); font-size: 14px; }
.modal-h3 { font-family: var(--font-latin); font-weight: 500; font-size: 20px; margin: 36px 0 16px; }
.modal-text { color: var(--muted); max-width: 65ch; }
.process-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.process-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 28px 20px 20px;
}
.process-tag {
  display: inline-block; font-size: 12px; color: var(--accent);
  border: 1px solid rgba(201,169,110,0.35); border-radius: 999px;
  padding: 4px 14px; margin-bottom: 12px;
}
.process-card figcaption { color: var(--muted); font-size: 13px; }
.result-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.result-grid img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); }
.modal-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--line);
}

/* ============================================================
   交互与视觉增强层（仅 transform / opacity，GPU 友好）
   ============================================================ */

/* 卡片级联入场（首屏渲染 & 筛选切换） */
.work-card.is-entering {
  animation: cardIn 0.55s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); }
}

/* 卡片悬停：遮罩 + 查看提示 + 金色微光 */
.work-thumb::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(10, 10, 11, 0.55), transparent 55%);
  opacity: 0; transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.work-card:hover .work-thumb::before { opacity: 1; }
.work-thumb::after {
  content: "查看项目 →"; position: absolute; left: 20px; bottom: 16px; z-index: 2;
  font-size: 13px; letter-spacing: 0.08em; color: var(--accent);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
}
.work-card:hover .work-thumb::after { opacity: 1; transform: none; }
.work-card:hover {
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 169, 110, 0.25);
}
.work-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 图片加载淡入（避免突兀闪显） */
.work-thumb img { opacity: 0; transition: transform 0.7s var(--ease), opacity 0.5s ease; }
.work-thumb img.is-loaded { opacity: 1; }

/* 主按钮：微光扫过 + 轻微回弹 */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
  content: ""; position: absolute; top: 0; left: -80%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s var(--ease);
  pointer-events: none;
}
.btn-primary:hover::before { left: 120%; }
.btn-primary:hover { transform: translateY(-2px) scale(1.02); }
.filter-btn:active { transform: scale(0.94); }

/* 技能条：滚动进入时生长 */
.skill-fill { width: 0; transition: width 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.skills-list.is-visible .skill-fill { width: calc(var(--level) * 100%); }

/* 时间线行悬停 */
.timeline-item { transition: background 0.3s, padding-left 0.3s var(--ease); }
.timeline-item:hover { background: rgba(255, 255, 255, 0.02); padding-left: 10px; }

/* 弹窗成果图悬停 */
.result-grid img { transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease); }
.result-grid img:hover { transform: scale(1.015); box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.6); }

/* 顶部滚动进度条 */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 120;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), #e6cf9e);
  transform-origin: left; transform: scaleX(0);
  pointer-events: none;
}

/* 导航滚动态加阴影层次 */
.nav.is-scrolled { box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.5); }

/* Hero orb 视差性能优化（JS 驱动 translate 属性，与 float 动画不冲突） */
.hero-orb { will-change: transform, translate; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .modal-meta { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .work-card, .work-card:nth-child(4n + 2), .work-card:nth-child(4n + 3) { grid-column: span 12; }
  .form-row { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .process-grid { grid-template-columns: 1fr; }
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: flex; }
  .nav.is-open .nav-links {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(10,10,11,0.96); backdrop-filter: blur(14px);
    padding: 24px clamp(20px, 4vw, 48px) 32px; gap: 20px;
    border-bottom: 1px solid var(--line);
  }
  .hero-orb { opacity: 0.45; right: -30vw; width: 110vw; }
  .hero-stats { flex-wrap: wrap; gap: 28px; }
}

/* ---------- Reduced motion ---------- */
@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;
  }
  .reveal { opacity: 1; transform: none; }
}
