/* =========================================
   SPACEX STYLE - OCISLY HABITAT
   Version: 3.0 (Production Grade)
   ========================================= */

:root {
  --bg-color: #000000;
  --text-white: #ffffff;
  --text-gray: #e0e0e0;
  --font-title: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* 定义安全区域变量 */
  --safe-top: env(safe-area-inset-top, 20px);

  /* 页面过渡用的‘软边’ */
  --edge-fade: 18vh;
  --edge-fade-mobile: 14vh;
}

@media (max-width: 650px){
  :root{ --edge-fade: var(--edge-fade-mobile); }
}

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

body { 
  background: var(--bg-color); 
  color: var(--text-white); 
  font-family: var(--font-body); 
  overflow-x: hidden; 
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   0. 页面过渡增强 (Smooth + Reveal + Edge Fade)
   ========================================= */
html{ scroll-behavior: smooth; }
main > section{ scroll-margin-top: calc(80px + var(--safe-top)); }

.reveal{
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.85s cubic-bezier(0.19, 1, 0.22, 1), transform 0.85s cubic-bezier(0.19, 1, 0.22, 1);
  will-change: opacity, transform;
}
.is-visible .reveal{
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .reveal{ opacity: 1; transform: none; transition: none; }
}

/* =========================================
   1. 导航栏 (Navigation) - 修复
   ========================================= */
.nav-bar { 
  position: absolute; 
  top: 0; left: 0; width: 100%; 
  /* 优化：使用 safe-area 防止刘海遮挡 */
  padding: calc(20px + var(--safe-top)) 50px 20px;
  display: flex; align-items: center; 
  z-index: 100; 
}

/* 优化：Logo 改为 a 标签样式 */
.logo { 
  font-family: var(--font-title); 
  font-weight: 700; 
  font-size: 20px; 
  letter-spacing: 12px; 
  margin-right: 50px; 
  text-decoration: none;
  color: #fff;
}

.nav-links { display: flex; gap: 30px; }

/* 优化：改为 a 标签交互 */
.nav-links a { 
  font-family: var(--font-title); 
  font-size: 13px; 
  font-weight: 700; 
  text-transform: uppercase; 
  text-decoration: none;
  color: #fff;
  letter-spacing: 1px; 
  opacity: 0.8; 
  transition: 0.3s; 
}
.nav-links a:hover { 
  opacity: 1; 
  text-shadow: 0 0 10px rgba(255,255,255,0.5); 
}

@media (max-width: 1000px) { 
  .nav-links { display: none; } 
  .nav-bar { justify-content: center; } 
  .logo { margin-right: 0; } 
}

/* =========================================
   2. 第一屏 (Hero Section) - 修复
   ========================================= */
#canvas-container { 
  position: absolute; 
  top: 0; left: 0; width: 100%; height: 100%; 
  z-index: 0;
  background-color: var(--bg-color);
}

.hero-section { 
  position: relative; 
  height: 100vh; 
  height: 100dvh;
  display: flex; align-items: center; 
  padding-left: 10%; 
  /* 优化：顶部增加 padding 防止导航遮挡内容 */
  padding-top: 80px; 
  z-index: 10; 
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
}

.content-wrapper { 
  max-width: 520px; 
  pointer-events: auto; 
}

/* 第一屏底部柔化：让第二屏从黑里‘长出来’ */
.hero-section::after{
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -1px;
  height: var(--edge-fade);
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,0.35) 35%,
    rgba(0,0,0,0.85) 78%,
    rgba(0,0,0,1) 100%
  );
}

h1.hero-title { 
  font-family: var(--font-title); 
  font-size: clamp(40px, 6vw, 75px); 
  font-weight: 700; 
  line-height: 0.95; 
  text-transform: uppercase; 
  margin-bottom: 28px; 
}

.hero-desc { 
  font-size: 16px; 
  line-height: 1.5; 
  color: var(--text-white); 
  margin-bottom: 45px; 
}

/* 优化：新增按钮组容器样式 */
.btn-group {
    display: flex;
    gap: 20px;
}

.outline-btn { 
  display: inline-flex; 
  align-items: center; 
  padding: 16px 35px; 
  border: 2px solid #fff; 
  color: #fff; 
  text-decoration: none; 
  font-family: var(--font-title); 
  font-weight: 700; 
  font-size: 14px; 
  text-transform: uppercase; 
  transition: 0.3s; 
}
.outline-btn:hover { 
  background: #fff; 
  color: #000; 
}


/* =========================================
   3. 第二屏 (Launch Section) - Starman Edition
   ========================================= */
.section-launch {
  position: relative;
  z-index: 20; 
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 10%;
  
  /* --- 更改背景图 --- */
  background-image: url('../images/Starman_SpaceX.jpg'); 
  background-size: cover;
  
  /* --- 关键调整：位置 --- */
  /* center center 可能会切掉车头，建议稍微往下聚焦 */
  background-position: center 60%; 
  
  box-shadow: inset 0 50px 100px -20px rgba(0,0,0,0.8);
}

/* 遮罩层调整：为了应对左上角明亮的地球，加深左侧渐变 */
.section-launch::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* 旧的渐变比较淡。
       新的渐变：左侧纯黑(0.8)逐渐变透明，确保白色文字在地球背景前依然清晰 
    */
    background:
        linear-gradient(180deg,
            rgba(0,0,0,0.95) 0%,
            rgba(0,0,0,0.35) 18%,
            rgba(0,0,0,0.06) 52%,
            rgba(0,0,0,0.35) 78%,
            rgba(0,0,0,0.95) 100%
        ),
        linear-gradient(90deg, 
            rgba(0,0,0,0.85) 0%, 
            rgba(0,0,0,0.55) 40%, 
            rgba(0,0,0,0) 100%
        );
    z-index: 0;
}

.launch-content { position: relative; z-index: 1; max-width: 600px; }

.section-title {
    font-family: var(--font-title);
    font-size: 48px;
    line-height: 1;
    text-transform: uppercase;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.section-desc {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 40px;
    opacity: 0.95;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    font-weight: 500;
}

.learn-more-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 15px 30px;
    color: #fff;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}
.learn-more-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: #fff;
    transform: translateY(-2px);
}
.learn-more-btn .arrow { transition: transform 0.3s; }
.learn-more-btn:hover .arrow { transform: translateX(5px); }

/* =========================================
   4. MODAL - WHITE ENGINEERING CARD
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 999;
    background-color: rgba(242, 242, 240, 0.96);
    background-image:
        linear-gradient(#e5e5e0 1px, transparent 1px),
        linear-gradient(90deg, #e5e5e0 1px, transparent 1px);
    background-size: 60px 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-white-card {
    position: relative;
    background: #f8f8f6; 
    color: #1a1a1a;       
    width: 90%;
    max-width: 520px;
    padding: 40px 30px 50px; 
    box-shadow: 0 30px 60px rgba(0,0,0,0.15);
    border: 1px solid #d1d1cc;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
}
.modal-overlay.active .modal-white-card { transform: scale(1); }

.close-btn-dark {
    position: absolute;
    top: 15px; right: 15px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s;
}
.close-btn-dark:hover { color: #000; }

.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.tech-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; color: #a0a09a; text-transform: uppercase; }
.ut-tag { font-family: var(--font-mono); font-size: 10px; background: #1a1a1a; color: #fff; padding: 3px 6px; font-weight: 700; }
.card-title-big { font-family: var(--font-title); font-size: 42px; line-height: 0.9; margin-bottom: 30px; color: #1a1a1a; text-transform: uppercase; }

.card-body { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.qr-section { width: 150px; }
#qrcode { background: #fff; padding: 8px; border: 1px solid #1a1a1a; margin-bottom: 8px; }
#qrcode img { display: block; width: 100%; }
.qr-caption-dark { font-family: var(--font-mono); font-size: 9px; color: #888; line-height: 1.4; }

.telemetry-sidebar {
    flex: 1; text-align: right;
    font-family: var(--font-mono); font-size: 10px; color: #888; line-height: 2.2;
    border-right: 3px solid #ef6c00; padding-right: 15px;
    display: flex; flex-direction: column; justify-content: center;
}
.t-row b { color: #1a1a1a; font-weight: 700; letter-spacing: 1px; margin-left: 5px; }

.card-divider { border: none; border-top: 1px solid #1a1a1a; margin: 0 0 20px 0; opacity: 0.15; }

.card-footer-info { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 10px; }
.info-block .label { font-family: var(--font-mono); font-size: 9px; color: #a0a09a; letter-spacing: 2px; margin-bottom: 4px; font-weight: 700; }
.info-block .val { font-family: var(--font-body); font-size: 14px; font-weight: 700; color: #1a1a1a; }
.font-mono { font-family: var(--font-mono); font-size: 13px; }
.card-note { font-family: var(--font-mono); font-size: 10px; color: #94948e; margin-top: 10px; }

.card-stripes { position: absolute; bottom: 0; left: 0; width: 100%; height: 6px; display: flex; }
.s-red { width: 15%; background: #c62828; }
.s-orange { width: 35%; background: #ef6c00; }
.s-black { width: 50%; background: #1a1a1a; }

.site-footer { position: relative; z-index: 20; background: #000; color: #666; padding: 50px 10%; font-size: 11px; display: flex; gap: 30px; text-transform: uppercase; letter-spacing: 1px; }

@media (max-width: 650px) {
    .hero-section { justify-content: center; text-align: center; padding: 0 20px; }
    /* 优化：移动端文字不顶到状态栏 */
    .content-wrapper { margin-top: 0; }
    .card-body { flex-direction: column; align-items: flex-start; }
    .telemetry-sidebar { text-align: left; border-right: none; border-top: 3px solid #ef6c00; padding-right: 0; padding-top: 10px; width: 100%; margin-top: 15px; }
    .card-title-big { font-size: 32px; }
    .site-footer { flex-direction: column; text-align: center; gap: 10px; }
}

/* =========================================
   5. 第三屏 (Archive / Black Hole)
   ========================================= */

.section-archives {
  position: relative;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  background: #000;
  z-index: 20;
  pointer-events: none;
}

/* 第二屏到底部、第三屏到顶部的‘接缝’：黑幕渐入，避免硬切 */
.section-archives::before{
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -1px;
  height: var(--edge-fade);
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,0.85) 25%,
    rgba(0,0,0,0) 100%
  );
}

#blackhole-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.0s ease;
}
.section-archives.is-visible #blackhole-canvas{ opacity: 1; }

.archives-content {
  position: relative;
  z-index: 10;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.85);
}

.arch-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 22px;
  display: flex;
  gap: 22px;
  text-transform: uppercase;
}

.arch-title {
  font-family: var(--font-title);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  text-transform: uppercase;
  margin-bottom: 18px;
  text-shadow: 0 0 28px rgba(255,255,255,0.25);
}

.arch-desc {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255,255,255,0.82);
  margin-bottom: 52px;
  max-width: 520px;
}

.icloud-log-btn {
  display: inline-block;
  padding: 16px 48px;
  background: transparent;
  border: 2px solid #ffffff;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 4px;
  transition: all 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
}

.icloud-log-btn:hover {
  background: #ffffff;
  color: #000000;
}

.arch-footer-tech {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.35);
  margin-top: 40px;
  text-transform: uppercase;
}

.performance-info {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  text-align: left;
  line-height: 1.6;
  display: none;
  pointer-events: none;
}

.performance-info.visible {
  display: block;
}
