/* ============================================================
   css/style.css
   Apple 极简主义 / 瑞士排版 / 杂志感设计
   ============================================================ */

/* ==================== 0. 自定义网页字体（@font-face） ==================== */

@font-face {
    font-family: 'CustomFont';
    src: url('/fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CustomFont';
    src: url('/fonts/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ==================== 1. CSS 变量与主题系统 ==================== */

/* 强制浅色主题 */
:root {
  /* 颜色变量 */
  --bg-color: #FFFFFF;            /* 背景色：纯白 */
  --text-primary: #000000;        /* 主文字：纯黑 */
  --text-secondary: #666666;      /* 辅助文字：高级灰 */
  --border-color: #EAEAEA;        /* 分割线：极浅灰 */
  --nav-bg: rgba(255, 255, 255, 0.5);

  /* 尺寸变量 */
  --nav-height: 42px;             /* 【更新】高度改为原本的 2/3 */
  --max-width: 1200px;
  --spacing-side: 80px;
  
  /* 字体变量 */
  --font-family: 'CustomFont', -apple-system, 'SF Pro Display', 'Inter', 'Helvetica Neue', 'Arial', sans-serif;
  --font-weight-bold: 700;
  --font-weight-regular: 400;

  /* 过渡变量 */
  --transition-theme: 0.3s ease;
  --transition-reveal: 0.6s ease-out;
}

/* ==================== 2. 全局重置与基础样式 ==================== */

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

html {
  scroll-behavior: smooth;
}

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

a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.6;
}

ul {
  list-style: none;
}

/* ==================== 3. 排版系统（Typography） ==================== */

h1, h2, h3, h4 {
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-optical-sizing: auto;
}

h2.section-title {
  font-size: 2.5rem;
  margin-bottom: 48px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

p {
  font-weight: var(--font-weight-regular);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==================== 4. 固定顶部导航栏 ==================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: transparent !important;
  border-bottom: none !important;
  z-index: 1000;
  transition: border-bottom 0.3s ease;
}

/* 毛玻璃背景层（白色，仅在 .scrolled 时激活） */
.navbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background: transparent;
  transition: opacity 0.4s ease;
}

/* 滚动激活：白色毛玻璃 */
.navbar.scrolled {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important; /* 浅灰色细边框 */
}
.navbar.scrolled::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.65); /* 白色毛玻璃 */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* 导航栏顶部高光（适应白色背景，改为淡黑色） */
.navbar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.04), transparent);
  pointer-events: none;
  z-index: -1;
}

.nav-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-side);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo 适当缩小 */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.logo img {
    display: block;
    width: 20px;  /* 从 28px 缩小为 20px */
    height: 20px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-list {
  display: flex;
  gap: 24px;
}

.nav-list a {
  font-size: 0.8rem; /* 文字从 0.95rem 缩小为 0.8rem */
  position: relative;
  color: #FFFFFF; /* 默认在 Hero 视频上是白色 */
  transition: color 0.3s ease;
}

/* 激活状态时（白色背景上），文字变为黑色，保证可读性 */
.navbar.scrolled .nav-list a {
  color: #000000;
}

.nav-list a.active {
  font-weight: var(--font-weight-bold);
}

/* 汉堡菜单按钮（在 Hero 视频上方时线条为白色） */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger .bar {
  width: 20px;
  height: 2px;
  background-color: #FFFFFF;
  transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}
.navbar.scrolled .hamburger .bar {
  background-color: #000000; /* 滚动到白色背景时线条变黑 */
}

/* ==================== 5. 页面主体区域 ==================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-side);
}

.section {
  padding: 120px 0;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 48px;
  letter-spacing: -0.02em;
}

/* ==================== 6. Hero 首屏区域 ==================== */

#hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 var(--spacing-side);
  background-color: var(--bg-color);
  transition: background var(--transition-theme);
  overflow: hidden;
}

.hero-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.hero-bg-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

/* 【更新】改为纯白文字 */
.hero-title {
  font-size: 1.8rem;
  font-weight: var(--font-weight-bold);
  color: #FFFFFF;
  letter-spacing: 0.02em;
}

/* ==================== 7. About 关于区域 ==================== */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.about-text p {
  font-size: 1.1rem;
  line-height: 1.8;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
}

.tag {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid var(--text-primary);
  border-radius: 999px;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background 0.2s, color 0.2s;
}

/* ==================== 8. Summer Camp 夏令营区域 ==================== */

.summer-camp .camp-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
    max-width: 800px;
}

.summer-camp .camp-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.summer-camp .camp-text p:last-child {
    margin-bottom: 0;
}

.summer-camp .camp-text p:nth-child(2) {
    color: var(--text-secondary);
}

.camp-button {
    display: inline-flex;
    align-items: center;
    padding: 14px 32px;
    border: 1px solid var(--text-primary);
    border-radius: 999px;
    background: transparent;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.camp-button .arrow {
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.camp-button:hover {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.camp-button:hover .arrow {
    transform: translateX(4px);
}

@media screen and (max-width: 767px) {
    .summer-camp .camp-content {
        max-width: 100%;
    }
    .camp-button {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 2.1 黑客帝国区域 ==================== */
.hacker-empire .hacker-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
    max-width: 800px;
}

.hacker-empire .hacker-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hacker-empire .hacker-text .hacker-sub {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.hacker-empire .hacker-button {
    display: inline-flex;
    align-items: center;
    padding: 14px 32px;
    border: 1px solid var(--text-primary);
    border-radius: 999px;
    background: transparent;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.hacker-empire .hacker-button .arrow {
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.hacker-empire .hacker-button:hover {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.hacker-empire .hacker-button:hover .arrow {
    transform: translateX(4px);
}

@media screen and (max-width: 767px) {
    .hacker-empire .hacker-content {
        max-width: 100%;
    }
    .hacker-empire .hacker-button {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 9. Portfolio 作品集区域 ==================== */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

.portfolio-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.placeholder-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--border-color);
  border-radius: 4px;
  margin-bottom: 8px;
}

.portfolio-item h3 {
  font-size: 1.2rem;
}

.portfolio-item p {
  font-size: 0.95rem;
}

/* ==================== 10. Timeline 历程区域 ==================== */

.timeline-item {
  display: flex;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item .year {
  width: 80px;
  font-weight: var(--font-weight-bold);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.timeline-item .desc {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ==================== 11. Contact 联系与 Footer 区域 ==================== */

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-info a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer .container > * {
  display: block;
  margin-bottom: 8px;
}

.footer .container a {
  display: inline-block;
  margin-right: 4px;
  text-decoration: none;
}

#footer-tagline {
  margin-top: 12px;
  max-width: 600px;
  font-size: 0.75rem;
  line-height: 1.6;
}

/* ==================== 12. Contact 与 Footer 区域 ==================== */

.contact-email {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
    margin-bottom: 24px;
    cursor: default;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 28px;
    margin-top: 8px;
}

.social-link, .social-label {
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.social-link:hover, .social-label:hover {
    border-bottom-color: var(--text-primary);
    opacity: 0.7;
}

.social-item {
    position: relative;
    display: inline-block;
}

.qr-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: #FFFFFF;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 10;
    width: 140px;
}

.qr-popup.active {
    display: block;
}

.qr-popup img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

@media (max-width: 767px) {
    .social-links {
        gap: 18px;
    }
    .qr-popup {
        bottom: calc(100% + 12px);
        width: 120px;
        left: 0;
        transform: none;
    }
}

/* ==================== 13. 视口滚动出现动画 ==================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-reveal), transform var(--transition-reveal);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media screen and (min-width: 768px) and (max-width: 1199px) {
  :root {
    --spacing-side: 60px;
  }
  .section {
    padding: 100px 0;
  }
}

@media screen and (max-width: 767px) {
  :root {
    --spacing-side: 24px;
  }
  .section {
    padding: 80px 0;
  }
  .section-title {
    font-size: 2rem;
    margin-bottom: 32px;
  }

  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background-color: #FFFFFF;
    flex-direction: column;
    justify-content: center;
    gap: 32px;
    transform: translateX(100%);
    transition: transform 0.3s ease-out, background var(--transition-theme);
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  /* 【彻底修复】手机菜单样式 */
  .nav-list {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    font-size: 1.2rem;
    color: #000000;
  }
  /* 【新增修复】强制手机菜单内的链接文字为黑色，防止白字混入白底 */
  .nav-list a {
    color: #000000 !important;
  }
  
  .hamburger.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .timeline-item {
    flex-direction: column;
    gap: 4px;
  }
  .timeline-item .year {
    width: auto;
  }
}

/* ==================== 15. 社交图标 SVG 样式 ==================== */

.social-link svg,
.social-label svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity 0.2s;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 2px;
}

/* ==================== 16. 社交图标图片适配（已删除强制变黑代码） ==================== */

.social-img {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.social-link:hover .social-img {
    opacity: 0.7;
}

/* ==================== 17. 预留未来扩展接口 ==================== */

/* ==================== 画廊跑马灯 ==================== */

.gallery-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
}

.carousel-track {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    animation-name: scroll;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

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

.carousel-item {
    flex-shrink: 0;
    width: 320px;
    height: 210px;
    margin-right: 24px;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--border-color);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 767px) {
    .gallery-wrapper {
        padding-left: 12px;
    }
    .carousel-item {
        width: 230px;
        height: 150px;
        margin-right: 16px;
    }
}

/* ==================== 右下角胶囊播放栏（改回白色毛玻璃） ==================== */

.player-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    transform: none;
    width: min(480px, 92%);
    height: 72px;
    border-radius: 999px;
    /* 白色毛玻璃 */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    
    /* 默认隐藏，动画浮现 */
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease, background var(--transition-theme);
    
    display: flex;
    align-items: center;
    padding: 6px 8px 6px 10px;
    gap: 14px;
}

/* 浮现状态 */
.player-wrapper.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.album-art {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--border-color);
    border: 1px solid rgba(0,0,0,0.04);
}
.album-art img { width: 100%; height: 100%; object-fit: cover; }

.meta-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding-right: 4px;
    min-width: 0;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
}

/* 内容全部改为黑色，适配白色毛玻璃 */
.song-title {
    font-size: 16px;
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
    flex: 1;
    padding-right: 8px;
}

.progress-time {
    font-size: 13px;
    color: #666666;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.progress-container {
    position: relative;
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    transition: background 0.2s;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #000000;
    border-radius: 4px;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #000000;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}
.progress-container:hover .progress-thumb { opacity: 1; }

.play-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    color: #000000;
}
.play-btn:hover { background: rgba(0,0,0,0.15); transform: scale(1.02); }
.play-btn:active { transform: scale(0.92); }
.play-btn svg { width: 20px; height: 20px; fill: currentColor; }

@media (max-width: 640px) {
    .player-wrapper {
        bottom: 16px;
        right: 16px;
        height: 62px;
        width: calc(100% - 32px);
        padding: 4px 6px 4px 8px;
        gap: 10px;
    }
    .album-art { width: 46px; height: 46px; border-radius: 12px; }
    .song-title { font-size: 14px; }
    .play-btn { width: 40px; height: 40px; }
    .play-btn svg { width: 18px; height: 18px; }
    .progress-time { font-size: 11px; }
    .meta-wrapper { gap: 2px; }
}
@media (max-width: 420px) {
    .song-title { display: none; }
    .player-wrapper { height: 56px; }
    .album-art { width: 38px; height: 38px; }
    .play-btn { width: 36px; height: 36px; }
}

/* ==================== 18. Apple 设计规范 即时反馈 ==================== */

.camp-button:active,
.hacker-button:active,
.back-home-btn:active {
    transform: scale(0.97) translateY(-1px);
    transition: transform 80ms ease-out;
}

.play-btn:active {
    transform: scale(0.88);
}

/* ==================== 2.2 实用工具区域（新增） ==================== */
.tools .tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.tool-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    line-height: 1;
}

.tool-name {
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 767px) {
    .tools .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}
@media (max-width: 480px) {
    .tools .tools-grid {
        grid-template-columns: 1fr;
    }
}