/* ==================== Works Page (work.html) ==================== */
.works-page {
  min-height: 100vh;
  background: #000;
  padding: 6% 4% 0 0;
}

.page-title {
  display: none;
}

#filters {
  display: flex;
  gap: clamp(10px,2vw,20px);
  margin-top: 3vw;
  margin-bottom: 2vh;
  flex-wrap: wrap;
}

#filters button {
  padding: 1vh 1.5vw;
  border-radius: 10%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: var(--body-size);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: var(--body-weight);
  letter-spacing: var(--body-ls);
}

#filters button:hover,
#filters button.active {
  border-color: #fff;
  background: #fff;
  color: #000;
}

/* Project Grid */
#project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 100%;
  margin: 0 auto;
  margin-left: 0;
}

.project-card {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  display: block;
}

.project-card img {
  width: 100%;
  height: auto;
  transition: transform 0.3s ease;
}

.project-card:hover img {
  transform: scale(1.05);
}

.project-card .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  background: rgba(255, 255, 255);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: #000;
  height: auto;
  min-height: 4vh;
  overflow: hidden;
}

.project-card .overlay.overlay-scrolling {
  justify-content: flex-start;
}

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

.project-card .overlay p {
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-lh);
  letter-spacing: var(--body-ls);
  white-space: nowrap;
  overflow: visible;
  display: inline-block;
  margin: 0;
  flex-shrink: 0;
}

.project-card .overlay p.long-text {
  display: inline-block;
  width: max-content;
  max-width: none;
}

.project-card .overlay p.marquee {
  animation: marquee 10s linear infinite;
}

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ==================== Work Modal ==================== */
.work-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.work-modal.active {
  display: block;
}

.work-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  animation: modalFadeIn 0.25s ease;
}

.work-modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-47%, -50%);
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  width: 90vw;
  max-height: 90vh;
  z-index: 2001;
  animation: modalFadeIn 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  overflow: visible;
}

.work-modal-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: var(--body-size);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.work-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.work-modal-left {
  width: 29vw;
  margin-right: 2vw;
}

.work-modal-title {
  font-size: 2.3vw;
  font-weight: 900;
  line-height: var(--heading-lh);
  letter-spacing: var(--heading-ls);
  margin-left: 1vw;
}

.work-modal-description {
  display: block;
  font-size: 1.2vw;
  font-weight: 600;
  line-height: var(--body-lh);
  letter-spacing: var(--body-ls);
  margin-top: 2vw;
}

.work-modal-right {
  flex: 1 1 auto;
  width: 40vw;
  height: 60vh;
  background: rgb(255, 255, 255, 0);
}

.work-modal-right img,
.work-modal-right video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ===== 轮播容器 ===== */
.work-modal-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;          /* 隐藏滚动条（但保留滚动功能） */
}

/* ===== 滚动轨道：水平弹性布局 + 滚动捕捉 ===== */
.carousel-track {
  display: flex;
  flex-wrap: nowrap;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;   /* 浏览器平滑滚动（配合 scrollTo） */
  /* 隐藏滚动条（所有浏览器） */
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar {
  display: none;
}

/* ===== 每个幻灯片：占满视口宽度，不能收缩，吸附起点 ===== */
.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;          /* 占位背景，可自定义 */
}

/* 内部媒体填满 */
.carousel-slide img,
.carousel-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;       /* 或 cover，根据设计 */
  display: block;
}

/* Hide video download button */
.work-modal-right video::-webkit-media-controls-download-button,
.work-modal-right video::-webkit-media-controls-overlay-download-button {
  display: none !important;
}

/* ===== 箭头按钮（定位在容器两侧） ===== */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(30px, 3vw, 50px);
  height: clamp(30px, 3vw, 50px);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease;
}
.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.7);
}
.carousel-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
.carousel-arrow-left {
  left: 10px;
}
.carousel-arrow-right {
  right: 10px;
}

/* ===== 底部小圆点（位置可根据设计调整） ===== */
.work-modal-carousel-dots {
  position: absolute;
  bottom: -10vh;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 3vw;
  z-index: 10;
}
.carousel-dot {
  width: clamp(10px, 1vw, 14px);
  height: clamp(10px, 1vw, 14px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
  pointer-events: auto;
}
.carousel-dot.active {
  background: #60c0b7;
  transform: scale(1.5);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==================== 404 Page ==================== */
.error-page {
  min-height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
}

.error-page h1 {
  font-size: 20vw;
  font-weight: 900;
  margin-bottom: 24px;
  opacity: 1;
  line-height: var(--heading-lh);
  letter-spacing: var(--heading-ls);
}

.error-page p {
  font-size: 5vw;
  margin-bottom: 10vh;
  opacity: 0.6;
  line-height: var(--body-lh);
  letter-spacing: var(--body-ls);
}

.error-page a {
  padding: 1vw 1vh;
  border:  solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: var(--body-size);
  transition: all 0.3s;
}

.error-page a:hover {
  background: #fff;
  color: #000;
}
