/* ========== 全局基础样式 ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --z-index-nav: 100;
  --z-index-modal: 200;
  --z-index-expanded-card: 150;
  --primary-color: #9ca3af;
  --text-color: #fff;
  --bg-color: #000;
  --overlay-bg: rgba(0, 0, 0, 0.55);
  --accent-color: #6b7280;
  --light-accent: #d1d5db;
  --nebula-color1: #1a33b8;
  --nebula-color2: #d13be7;
  --nebula-color3: #2ed6d6;
}

html {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  height: 100%;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow-y: auto;
}

::-webkit-scrollbar {
  display: none;
}

::selection {
  background: rgba(99, 102, 241, 0.6);
}

/* ========== 布局容器 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: clamp(1.5rem, 6vw, 5rem);
  padding-right: 1.5rem;
}

@media (min-width: 640px) {
  .container {
    padding-right: 3rem;
  }
}

/* ========== 导航栏 ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-index-nav);
  padding: 1rem 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

.nav-inner {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  justify-content: center;
  margin-left: auto;
}

.nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.nav a:hover {
  color: #d1d5db;
}

.brand {
  font-family: "Savate", serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--text-color);
}

.brand:hover {
  color: #d1d5db;
}

/* ========== 页面通用样式 ========== */
.page-title {
  font-family: "Open Sans", sans-serif;
  font-weight: 600;
  font-size: 3rem;
  margin-bottom: 4rem;
  text-align: left;
}

.page-dark {
  background: var(--bg-color);
  color: var(--text-color);
  min-height: 100%;
  padding-top: 6rem;
}

.page-dark::after {
  content: '';
  display: block;
  height: 4rem;
}

/* ========== Works 页面特定样式 ========== */
.works-page {
  padding-top: 6rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 5rem 4rem;
}

.work-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 1.25rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(60px) scale(0.94);
  transition: opacity 0.8s ease, box-shadow 0.6s ease, transform 0.8s ease;
  will-change: transform;
}

.work-card.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 增强的悬停效果 */
.work-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.work-card:hover .work-cover {
  transform: scale(1.05);
}

.work-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  line-height: 1.45;
  font-size: 1.25rem;
  background: var(--overlay-bg);
  color: var(--text-color);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  flex-direction: column;
}

.work-card:hover .overlay {
  opacity: 1;
}

.overlay small {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  margin-top: 0.25rem;
  opacity: 0.85;
}

/* ========== 卡片展开样式 ========== */
.work-card.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: var(--z-index-expanded-card);
  transform: translate(-50%, -50%) scale(1) !important;
  width: 92vw;
  height: 92vh;
  border-radius: 1.5rem;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: cardExpand 0.3s ease-out forwards;
}

.work-card.expanded-left {
  left: 0;
  top: 50%;
  transform: translate(0, -50%) scale(1) !important;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  animation: slideInFromLeft 0.5s ease-out forwards;
}

.work-card.expanded-right {
  right: 0;
  left: auto;
  top: 50%;
  transform: translate(0, -50%) scale(1) !important;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  animation: slideInFromRight 0.5s ease-out forwards;
}

.work-card.expanded .overlay {
  background: rgba(0, 0, 0, 0.38);
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  opacity: 1 !important;
}

.close-btn {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  z-index: 5;
  width: 2.6rem;
  height: 2.6rem;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.65);
  color: var(--text-color);
  font-size: 1.45rem;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s;
}

.work-card.expanded .close-btn {
  opacity: 1;
  transform: none;
  position: sticky;
  top: 1.2rem;
}

/* ========== 动画定义 ========== */
@keyframes slideInFromLeft {
  from {
    transform: translate(-100%, -50%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translate(0, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translate(100%, -50%) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translate(0, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes cardExpand {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ========== Modal 样式 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-index-modal);
}

.hidden {
  display: none;
}

.modal {
  width: 96%;
  max-width: 1100px;
  max-height: 93vh;
  overflow-y: auto;
  background: #111;
  color: #eee;
  padding: 36px 36px 48px;
  border-radius: 20px;
  position: relative;
}

.modal .close {
  position: absolute;
  top: 22px;
  right: 26px;
  font-size: 34px;
  line-height: 1;
  background: none;
  border: none;
  color: #ddd;
  cursor: pointer;
  z-index: 10;
}

.modal .close:hover {
  color: #fff;
}

.videoWrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 比例 */
  margin-bottom: 2rem;
}

.videoWrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.intro {
  margin: 30px 0;
  line-height: 1.65;
  font-size: 1rem;
}

.photos {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(47%, 1fr));
}

.photos img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  border-radius: 10px;
  transition: transform 0.3s ease;
}

.photos img:hover {
  transform: scale(1.02);
}

/* ========== 首页 Hero 样式 ========== */
.hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hero-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 60%, #000 100%);
  z-index: 2;
}

.hero-content {
  position: absolute;
  z-index: 3;
  left: 3vw;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  text-align: left;
  max-width: 600px;
  padding-left: 0;
}

.hero-title {
  font-size: 7rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

.hero-sub {
  font-size: 2rem;
  color: #e5e7eb;
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 2.5rem;
  }
  .nav-inner {
    flex-wrap: wrap;      /* 允许换行，但方向仍是 row */
  }
  .brand {                /* SHUYU ZHANG */
    flex: 0 0 100%;       /* 占满整行，自动把后面链接推到下一行 */
    margin-bottom: 0.25rem; 
    text-align: center;   /* 可按需微调上下间距 */
  }

  .hero-sub {
  font-size: 1.25 rem;
  color: #e5e7eb;
}
  .hero-content {
    max-width: 95vw;
    padding: 0 1rem;
  }
  
  .work-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .work-card {
    transform: translateY(30px) scale(0.94);
  }
}

/* ========== 移动端优化 ========== */
/* 手机 ≤600px */
@media (max-width: 600px) {
  .hero-title { font-size: 2.5rem; }

  .nav-inner { flex-wrap: wrap; }

  .brand {
    flex: 0 0 100%;
    margin-bottom: 0.25rem;
    text-align: center;
  }

  /* === 新增：让导航菜单水平居中 & 取消右偏 === */
  .nav-list {
    margin-left: 0;        /* 覆盖桌面端的 auto */
    width: 100%;           /* 占满整行 */
    justify-content: center;
  }

  /* 修正拼写：去掉空格 */
  .hero-sub {
    font-size: 1.25rem;
    color: #e5e7eb;
  }

  /* 其余保持原样… */
  .hero-content { max-width: 95vw; padding: 0 1rem; }
  .work-grid    { grid-template-columns: 1fr; gap: 3rem; }
  .work-card    { transform: translateY(30px) scale(0.94); }
  .hero { width: 100%; } 
}

/* 手机 / 小平板 ≤768px */
@media (max-width: 768px) {
  .page-title { font-size: 2.25rem; margin-bottom: 2rem; }

  .nav-inner { flex-wrap: wrap; }

  .brand {
    flex: 0 0 100%;
    margin-bottom: 0.25rem;
    text-align: center;
  }

  /* === 同样让导航菜单居中 === */
  .nav-list {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    gap: 1rem;             /* 这一行你原本就有 */
  }

  .hero-sub { font-size: 1.5rem; }
  .hero { width: 100%; } 

  .modal { padding: 24px; width: 95%; }
}

/* ========== Modal 样式 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

.modal {
  width: 90%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  background: #111;
  color: #eee;
  padding: 36px;
  border-radius: 20px;
  position: relative;
}

.hidden {
  display: none;
}

/* ========== 图片画廊样式 ========== */
.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.gallery-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  transition: transform 0.3s ease;
  object-fit: cover;
}

.gallery-img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.works-page .work-card{transform:translateY(calc(var(--parallax,60px))) scale(.94);
transition: transform 0.6s ease-out;
  will-change: transform;}

.works-page .work-card.in-view:not(.expanded){transform:translateY(calc(var(--parallax,0px))) scale(1)}

/* === Cursor particle effect === */
.particle{
  position:fixed;
  left:0;top:0;
  width:6px;height:6px;
  border-radius:50%;
  pointer-events:none;
  animation:particle 800ms ease-out forwards;
  z-index: 99999; /* 确保粒子显示在所有元素最上层，包括视频 */
  will-change: transform, opacity; /* 优化动画性能 */
}

@keyframes particle{
  to{
    transform:translate(var(--dx),var(--dy)) scale(0);
    opacity:0;
  }
}

/* 通用悬停字体渐变色 - 更淡雅的颜色 */
a:hover, .work-title:hover, .page-title:hover, .subsection-title:hover, .nav-list a:hover {
  background: linear-gradient(90deg, #d1d5db, #9ca3af, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  transition: background 0.4s, color 0.4s;
}