/* ==================== 项目区小云朵装饰 ==================== */
.project-clouds {
  position: absolute;
  inset: 0;
  z-index: 0;          /* 天空之上，草坪/图标之下 */
  pointer-events: none;
  overflow: visible;
  /* 软边过渡：避免页间滚动时出现云朵底部“硬裁切线” */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
}

.pcloud {
  position: absolute;
  object-fit: contain;
  opacity: 0;          /* 初始隐藏，GSAP 入场控制 */
  will-change: transform, opacity;
}

/* ── 四朵云散布布局（降低重叠，增强层次）── */
.pcloud-1 {
  width: clamp(520px, 58vw, 860px);
  left: -6%;
  top: 9%;
  opacity: 0;        /* GSAP 会覆盖 */
  filter: brightness(1.05);
}

.pcloud-2 {
  width: clamp(460px, 50vw, 760px);
  right: -3%;
  top: 16%;
  left: auto;
  filter: brightness(1.08);
}

.pcloud-3 {
  width: clamp(380px, 42vw, 640px);
  left: 20%;
  top: 42%;
  filter: brightness(1.02);
}

.pcloud-4 {
  width: clamp(420px, 46vw, 700px);
  right: 12%;
  top: 56%;
  left: auto;
  filter: brightness(1.1);
}

/* ── 移动端布局：延续桌面层次，减少堆叠 ── */
@media (max-width: 768px) {
  .pcloud-1 { width: clamp(300px, 76vw, 520px); left: -8%; top: 10%; }
  .pcloud-2 { width: clamp(270px, 68vw, 460px); right: -8%; top: 18%; }
  .pcloud-3 { width: clamp(230px, 58vw, 380px); left: 8%; top: 46%; }
  .pcloud-4 { width: clamp(250px, 62vw, 420px); right: 4%; top: 62%; }
}

/* ==================== 项目区（Slide 2）==================== */
#projects {
  position: relative;
  overflow: visible;  /* 覆盖 .slide 的默认裁切 */
}

/* ── 区块标题 ── */
.projects-header {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.projects-title {
  font-family: var(--font-serif);
  font-size: var(--type-title);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.12em;
  margin: 0 0 10px;
  text-shadow: 0 2px 16px rgba(0, 20, 80, 0.3);
}

.projects-sub {
  font-family: var(--font-serif);
  font-size: var(--type-subtitle);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.18em;
  margin: 0;
}

/* “可以拖拽 / 点击”下方的轻量项目映射 */
.projects-legend {
  margin: 10px 0 0;
  text-align: center;
  font-size: clamp(0.62rem, 0.86vw, 0.78rem);
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.62);
  text-wrap: balance;
}

.projects-legend-sep {
  opacity: 0.45;
}

/* ── 拖拽桌面 ── */
.project-desktop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transition: filter 0.4s ease;
}

/* 面板打开时桌面模糊 */
.project-desktop.blurred {
  filter: blur(6px) brightness(0.7);
  pointer-events: none;
}

/* 面板打开时锁定页面滚动 */
.scroll-container.scroll-locked {
  overflow-y: hidden;
}

/* ── 可拖拽项目对象 ── */
.desk-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: none;
  will-change: transform;
}

/* 项目图标左上角轻量序号 */
.desk-item-index {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  pointer-events: none;
  font-size: clamp(0.62rem, 0.78vw, 0.8rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 6px rgba(0, 28, 80, 0.35);
}

.desk-item:active,
.desk-item.dragging {
  cursor: grabbing;
  z-index: 50 !important;
}

.desk-item.dragging .desk-gif-wrap {
  filter: drop-shadow(0 24px 48px rgba(0, 60, 160, 0.5)) !important;
  -webkit-transform: scale(1.04) translateZ(0);
  transform: scale(1.04) translateZ(0);
}

.desk-gif-wrap {
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(0 12px 28px rgba(0, 40, 120, 0.22));
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.desk-item:hover .desk-gif-wrap {
  -webkit-transform: scale(1.06) translateY(-4px) translateZ(0);
  transform: scale(1.06) translateY(-4px) translateZ(0);
  filter: drop-shadow(0 20px 40px rgba(0, 60, 180, 0.35));
}

.desk-gif {
  display: block;
  width: clamp(150px, 12vw, 220px);
  height: auto;
  object-fit: contain;
}

/* 单独控制每个项目图标大小 */
.desk-item[data-id="ai-tutor"] .desk-gif {
  width: clamp(220px, 24vw, 440px);
}

.desk-item[data-id="charm"] .desk-gif {
  width: clamp(150px, 15vw, 280px);
}

.desk-item[data-id="shoe"] .desk-gif {
  width: clamp(300px, 32vw, 600px);
}

.desk-item[data-id="traveler"] .desk-gif {
  width: clamp(150px, 15vw, 280px);
}

.desk-label {
  font-size: clamp(0.6rem, 0.72vw, 0.76rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.04em;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 30, 80, 0.5);
}

/* ── 点击面板外关闭遮罩 ── */
.panel-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 59;
  background: transparent;
  cursor: pointer;
}

.panel-backdrop.open {
  display: block;
}

/* ── 项目详情面板 ── */
.project-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 72%;
  display: flex;
  flex-direction: row;
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(10, 25, 60, 0.15);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 60;
  overflow: hidden;
}

.project-panel.open {
  transform: translateX(0);
}

/* 关闭按钮（位于 project-panel 内绝对定位）*/
.panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  position: absolute;
  top: clamp(24px, 3.5vh, 48px);
  left: clamp(14px, 1.8vw, 28px);
  z-index: 61;
}

.panel-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 面板内滚动内容包裹层（桌面：横排；移动端：纵向可滚动）*/
.panel-scroll-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  height: 100%;
}

/* 左栏：固定文字区（sticky），1:3 宽度比 */
.panel-left {
  width: 25%;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100%;
  padding: clamp(24px, 3.5vh, 48px) clamp(14px, 1.8vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.panel-index {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.panel-title {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
}

.panel-role {
  font-size: clamp(0.72rem, 0.9vw, 0.82rem);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.05em;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.panel-divider {
  width: 32px;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  margin-bottom: 20px;
}

.panel-desc {
  font-size: clamp(0.78rem, 0.95vw, 0.9rem);
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.75;
  letter-spacing: 0.01em;
  margin-bottom: 28px;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  position: relative;
  transition: color 0.25s ease;
}

.panel-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.25s ease;
}

.panel-link:hover {
  color: rgba(255, 255, 255, 0.95);
}

.panel-link:hover::after {
  background: rgba(255, 255, 255, 0.85);
}

.panel-link-arrow {
  font-size: 1em;
  transition: transform 0.25s ease;
}

.panel-link:hover .panel-link-arrow {
  transform: translateX(3px);
}

/* 右栏：循环滚动媒体区，无间距全出血 */
.panel-right {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: none;
}

.panel-right::-webkit-scrollbar {
  display: none;
}

/* 媒体内容：无间距全出血堆叠 */
.panel-media {
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.03);
  position: relative;
  min-height: 200px; /* 骨架屏基础高度 */
}

/* iOS 风格丝滑光泽流动 (Shimmer) */
.panel-media.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.0) 20%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.0) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: ios-shimmer 2s infinite linear;
  z-index: 1;
}

@keyframes ios-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.panel-media img,
.panel-media video {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

/* 加载完成后移除背景并显示内容 */
.panel-media.is-loaded {
  background-color: transparent;
  min-height: 0;
}

.panel-media.is-loaded img,
.panel-media.is-loaded video {
  opacity: 1;
}


/* 媒体占位（素材未提供时） */
.panel-media-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* ── 移动端：保持散落图标布局 ── */
@media (max-width: 768px) {
  .projects-legend {
    margin-top: 8px;
    padding: 0 14px;
    font-size: clamp(0.54rem, 2.8vw, 0.68rem);
  }

  .desk-item-index {
    top: 4px;
    left: 6px;
    font-size: clamp(0.56rem, 2.2vw, 0.7rem);
  }

  .desk-gif {
    width: clamp(80px, 20vw, 130px);
  }

  .desk-item[data-id="ai-tutor"] .desk-gif {
    width: clamp(140px, 36vw, 280px);
  }

  .desk-item[data-id="charm"] .desk-gif,
  .desk-item[data-id="traveler"] .desk-gif {
    width: clamp(90px, 24vw, 150px);
  }

  .desk-item[data-id="shoe"] .desk-gif {
    width: clamp(180px, 44vw, 340px);
  }

  .desk-gif-wrap {
    filter: drop-shadow(0 8px 20px rgba(0, 40, 120, 0.3));
  }

  .project-panel {
    position: fixed;
    width: 100%;
    top: 0;
    bottom: auto;
    height: 100%;
    transform: translateY(100%);
    flex-direction: column;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .project-panel.open {
    transform: translateY(0);
    pointer-events: auto;
  }

  .panel-scroll-content {
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .panel-scroll-content::-webkit-scrollbar {
    display: none;
  }

  .panel-close {
    top: 16px;
    right: 16px;
    left: auto;
    z-index: 91;
  }

  .panel-left {
    width: 100%;
    height: auto;
    position: relative;
    padding: 24px 20px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: flex-start;
  }

  .panel-right {
    flex: none;
    min-height: auto;
    overflow-y: visible;
    padding: 0 16px max(25vh, 140px);
    gap: 12px;
  }

  .panel-media {
    border-radius: 12px;
    overflow: hidden;
  }
}

/* ── 竖屏手机：微调图标大小，保持散落感 ── */
@media (max-width: 768px) and (orientation: portrait) {
  .desk-label {
    font-size: 0.78rem;
    text-align: center;
  }
}

/* ==================== 通用毛玻璃卡片（保留供其他用途）==================== */
.glass-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 124, 237, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 技能标签（保留供其他用途）==================== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ==================== Footer ==================== */
.footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 初始隐藏，比海面晚 0.35s 入场，保证海面先滑入 */
.footer-content {
  position: absolute;
  top: 263px;
  z-index: 4;
  text-align: center;
  color: rgba(255, 255, 255, 1);
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  opacity: 0;
  transform: translateY(28px) translateY(-10vh);
  transition: opacity 0.65s ease 0.35s,
              transform 0.65s cubic-bezier(0.33, 1, 0.68, 1) 0.35s;
}

.footer.is-active .footer-content {
  opacity: 1;
  transform: translateY(-10vh);
}

.footer-name {
  font-family: var(--font-serif);
  font-size: var(--type-title);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.1em;
  text-shadow: 0 2px 12px rgba(0, 80, 180, 0.4);
}

.footer-contacts {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-contact-item {
  font-family: var(--font-sans);
  font-size: var(--type-subtitle);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.25s ease;
}

.footer-contact-item:hover {
  color: white;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em;
}

@media (max-width: 768px) {
  .footer {
    height: 100vh;
  }

  .footer-content {
    padding: 12px 16px;
    gap: 8px;
    transform: translateY(24px) translateY(-14vh);
  }

  .footer.is-active .footer-content {
    transform: translateY(-14vh);
  }
}
