/* ============================================
   暗黑放映室 — CSS 自定义属性 + 基础层
   来源: design-tokens.md
   ============================================ */

:root {
  /* ----- 背景 ----- */
  --bg-deep:      #0A0A0F;
  --bg-surface:   #16161E;
  --bg-elevated:  #1E1E28;

  /* ----- 文字 ----- */
  --text-primary:   #F2F2F2;  /* 接近纯白，暗底上更清晰 */
  --text-secondary: #A8A6B0;  /* 辅助文字更亮更易读 */
  --text-muted:     #5C5A66;  /* 弱化文字也不可过暗 */

  /* ----- 强调 ----- */
  --accent-blue:  #64B5F6;
  --accent-gold:  #FFB74D;

  /* ----- 状态 ----- */
  --success: #81C784;
  --error:   #E57373;

  /* ----- 字体 ----- */
  --font-display: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body:    'Noto Sans SC', 'Inter', 'PingFang SC', sans-serif;
  --font-poetic:  'Noto Serif SC', serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* ----- 间距 ----- */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  0.75rem;  /* 原 1rem */
  --space-lg:  1.5rem;   /* 原 2rem */
  --space-xl:  3rem;     /* 原 4rem */
  --space-2xl: 5rem;     /* 原 8rem */

  /* ----- 圆角 ----- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* ----- 阴影 ----- */
  --shadow-card:  0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-glow:  0 0 24px rgba(100, 181, 246, 0.15);
  --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.6);

  /* ----- 动画 ----- */
  --duration-fast:   150ms;
  --duration-normal: 300ms;
  --duration-slow:   600ms;
  --duration-breath: 3000ms;
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ----- 断点（文档参考用）----- */
  --bp-mobile:  480px;
  --bp-tablet:  768px;
  --bp-desktop: 1024px;
  --bp-wide:    1440px;
}

/* ===== 全局重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 排版基础 ===== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--text-primary);
}

/* ===== 每个Section的通用样式 ===== */
section {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-2xl) var(--space-xl);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 分区编号标签 ===== */
.section-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--accent-blue);
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

/* ===== 分区标题 ===== */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-lg);
  letter-spacing: 0.02em;
}

/* ===== 工具类 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================
   Section 1: Hero · 追光区
   ============================================ */

#hero {
  padding: 0;
  overflow: hidden;
  cursor: crosshair;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 7rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  text-shadow: 0 0 80px rgba(100, 181, 246, 0.2);
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.375rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  font-weight: 400;
}

.hero-cta {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-secondary);
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
}

.hero-cta:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   Section 2: About · 自述区
   ============================================ */

#about {
  background-color: var(--bg-deep);
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ---- 宣言文字 ---- */

.declaration-line {
  font-family: var(--font-body);
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 500;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  border-left: 2px solid var(--accent-blue);
  padding-left: var(--space-lg);
}

.declaration-line:last-of-type {
  color: var(--accent-gold);
  font-family: var(--font-poetic);
  font-style: italic;
  border-left-color: var(--accent-gold);
}

/* ---- 时间线按钮 ---- */

.timeline-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: 1px solid var(--text-muted);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  margin-top: var(--space-lg);
}

.timeline-toggle:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

.toggle-icon {
  font-size: 1.2rem;
  transition: transform var(--duration-normal) var(--ease-out);
}

.timeline-toggle.open .toggle-icon {
  transform: rotate(45deg);
}

/* ---- 肖像占位 ---- */

.portrait-placeholder {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--text-muted);
  transition: border-color var(--duration-normal) var(--ease-out);
}

.portrait-placeholder:hover {
  border-color: var(--accent-blue);
}

.portrait-placeholder svg {
  width: 80px;
  height: 80px;
}

/* ---- 时间线 ---- */

.timeline {
  max-width: 600px;
  margin: var(--space-lg) auto 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out),
              opacity var(--duration-normal) var(--ease-out);
  opacity: 0;
}

.timeline.expanded {
  max-height: 800px;
  opacity: 1;
}

.timeline-item {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--bg-elevated);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-blue);
  white-space: nowrap;
  min-width: 70px;
}

.timeline-event {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ============================================
   Section 3: Works · 放映区
   ============================================ */

#works {
  background-color: var(--bg-surface);
}

#works .section-label,
#works .section-title {
  text-align: center;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ---- 作品卡片 ---- */

.work-card {
  background: var(--bg-deep);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.work-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.work-card-preview {
  aspect-ratio: 16 / 10;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out);
}

.work-card:hover .work-card-preview {
  transform: scale(1.03);
}

.work-card-placeholder {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-md);
}

/* 未来替换为真实截图时：.work-card-preview img { width:100%; height:100%; object-fit:cover; } */

.work-card-info {
  padding: var(--space-lg);
}

.work-card-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.work-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.work-card-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-blue);
  transition: color var(--duration-fast) var(--ease-out);
}

.work-card:hover .work-card-link {
  color: var(--text-primary);
}

/* ============================================
   Section 4: Toolkit · 兵器谱区
   ============================================ */

#toolkit {
  background-color: var(--bg-deep);
}

#toolkit .section-label,
#toolkit .section-title {
  text-align: center;
}

.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.tool-card {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  background: var(--bg-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
}

.tool-card:hover {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

.tool-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.tool-name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Section 5: Footer · 星尘区
   ============================================ */

#footer {
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-deep);
  min-height: 100vh;
}

#stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.footer-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* ---- 星辰语录 ---- */

.cosmic-quote {
  margin-bottom: var(--space-xl);
}

.cosmic-quote p {
  font-family: var(--font-poetic);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 2;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  opacity: 0;
  transform: translateY(10px);
  animation: quote-fade-in 1s var(--ease-out) forwards;
}

.cosmic-quote p:nth-child(1) { animation-delay: 0.3s; }
.cosmic-quote p:nth-child(2) { animation-delay: 0.8s; }
.cosmic-quote p:nth-child(3) { animation-delay: 1.3s; }

.cosmic-quote footer {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-lg);
  opacity: 0;
  animation: quote-fade-in 1s var(--ease-out) 1.8s forwards;
}

@keyframes quote-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- 联系链接 ---- */

.contact-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.contact-link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: all var(--duration-normal) var(--ease-out);
}

.contact-link:hover {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

/* ---- 底部收尾 ---- */

.footer-ending {
  font-family: var(--font-poetic);
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   响应式设计
   ============================================ */

/* ---- 平板及以下 (≤1024px) ---- */
@media (max-width: 1024px) {
  section {
    padding: var(--space-xl) var(--space-lg);
    min-height: auto;
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about-visual {
    order: -1; /* 照片放上面 */
  }

  .portrait-placeholder {
    width: 180px;
    height: 180px;
  }

  .works-grid {
    grid-template-columns: 1fr;
    max-width: 450px;
  }

  .toolkit-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 500px;
  }
}

/* ---- 手机 (≤480px) ---- */
@media (max-width: 480px) {
  :root {
    font-size: 15px;
  }

  section {
    padding: var(--space-xl) var(--space-md);
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .declaration-line {
    font-size: 1rem;
    padding-left: var(--space-md);
  }

  .toolkit-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
  }

  .contact-links {
    flex-direction: column;
    gap: var(--space-md);
  }

  .timeline-item {
    flex-direction: column;
    gap: var(--space-xs);
  }
}

/* ===== 键盘焦点 ===== */
.hero-cta:focus-visible,
.timeline-toggle:focus-visible,
.contact-link:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.work-card:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}
