/* ============================================================
   StarMoon-z1 — 单视口视频背景落地页
   ============================================================ */

/* Geist Pixel Circle — local fallback display face */
@font-face {
  font-family: "Geist Pixel Circle";
  src: url("fonts/GeistPixel-Circle.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --text: #ffffff;
  --muted: #8e8e8e;
  --nav-text: #2e2e2e;
  --pill-dark: #28282a;
  --sign-in-text: #c8c8c8;
  --nav-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  --trust-bg: #28282a;
  --trust-border: rgba(255, 255, 255, 0.4);
  --trust-text: #c4c2c3;
  --font-sans: "Inter", "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "BubbledotICG-FinePos", "Geist Pixel Circle", monospace;
  --font-cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

a { text-decoration: none; color: inherit; }

/* ---------------- Background video ---------------- */
.bg {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}
.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}

/* ---------------- Page frame ---------------- */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: clamp(16px, 2.4vh, 28px) clamp(14px, 3vw, 32px);
}

/* ---------------- Header ---------------- */
.site-header {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 2.8vw, 28px);
  animation: slideDown 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo-btn {
  flex-shrink: 0;
  width: clamp(40px, 4.4vw, 46px);
  height: clamp(40px, 4.4vw, 46px);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--nav-shadow);
  display: grid;
  place-items: center;
  transition: transform 0.3s ease;
}
.logo-btn:hover { transform: scale(1.04); }
.logo-btn img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
}

.nav-pill {
  flex: 1;
  max-width: 430px;
  height: clamp(44px, 5.2vw, 48px);
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--nav-shadow);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
}
.nav-link {
  position: relative;
  font-weight: 500;
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: -0.01em;
  color: var(--nav-text);
  opacity: 0.5;
  padding: 6px 10px;
  transition: opacity 0.25s ease;
}
.nav-link:hover { opacity: 0.75; }
.nav-link.is-active { opacity: 1; }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #000;
  transform: translateX(-50%);
  box-shadow: -5px 0 0 #000, 5px 0 0 #000;
}

.signin-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: clamp(44px, 5.2vw, 48px);
  padding: 0 clamp(18px, 2.4vw, 26px);
  border-radius: 999px;
  background: var(--pill-dark);
  color: var(--sign-in-text);
  font-weight: 500;
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: -0.01em;
  box-shadow: var(--nav-shadow);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.signin-btn i { font-size: 1.05em; }
.signin-btn:hover {
  background: #323234;
  color: #fff;
  transform: translateY(-1px);
}

/* Burger (mobile only) */
.burger { display: none; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 900px;
}

/* 环境徽章行（对应 README 徽章） */
.trust {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 12px);
  margin-bottom: clamp(16px, 2.5vh, 26px);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: clamp(30px, 3.6vw, 34px);
  padding: 0 clamp(12px, 1.8vw, 16px);
  border-radius: 999px;
  background: var(--trust-bg);
  border: 1px solid var(--trust-border);
  color: var(--trust-text);
  font-weight: 500;
  font-size: clamp(11px, 1.3vw, 12.5px);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.badge i { font-size: 0.95em; opacity: 0.85; }
.badge:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
}
.badge.b1 i { color: #3b82f6; }   /* Python 蓝 */
.badge.b2 i { color: #f97316; }   /* PyTorch 橙 */
.badge.b3 i { color: #4ade80; }   /* Apache 绿 */
.badge.b4 i { color: #76b900; }   /* CUDA/NVIDIA 绿 */

/* Headline */
.headline {
  font-weight: 400;
  color: #fff;
  font-size: clamp(30px, 6.4vw, 76px);
  letter-spacing: -0.04em;
  line-height: 1.12;
  overflow: hidden;
}
.headline .line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  animation: headlineFade 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.headline .l1 {
  font-family: var(--font-display);
  animation-delay: 0.12s;
}
.headline .l2 {
  font-family: var(--font-cn);
  font-weight: 600;
  font-size: 0.62em;           /* 中文行小一号，视觉重心给英文点阵 */
  letter-spacing: 0.02em;
  margin-top: 0.18em;
  animation-delay: 0.3s;
}

/* Subhead */
.subhead {
  max-width: min(560px, 92%);
  margin-top: clamp(14px, 2.2vh, 22px);
  font-family: var(--font-cn);
  font-size: clamp(calc(13.5px + 2pt), calc(1.55vw + 2pt), calc(16.5px + 2pt));
  font-weight: 400;
  color: #d0d0d0;
  opacity: 0.8;
  line-height: 1.6;
}

/* CTA row */
.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(10px, 1.8vw, 16px);
  margin-top: clamp(20px, 3.2vh, 32px);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: clamp(11px, 1.6vh, 13px) clamp(22px, 3vw, 28px);
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: clamp(13.5px, 1.5vw, 14.5px);
  letter-spacing: -0.01em;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.15),
    0 0 22px rgba(255, 255, 255, 0.32),
    0 0 44px rgba(255, 255, 255, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.cta i { font-size: 0.85em; transition: transform 0.3s ease; }
.cta.anim { animation-name: revealPulse; }
.cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 30px rgba(255, 255, 255, 0.42),
    0 0 60px rgba(255, 255, 255, 0.18);
}
.cta:hover i { transform: translateX(3px); }

.cmd {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: clamp(10px, 1.5vh, 12px) clamp(16px, 2.4vw, 22px);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d8d8d8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(12px, 1.4vw, 13.5px);
  cursor: pointer;
  user-select: none;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.cmd:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.cmd .cmd-prompt { color: #4ade80; }
.cmd i { opacity: 0.55; font-size: 0.9em; transition: opacity 0.25s ease; }
.cmd:hover i { opacity: 1; }
.cmd.copied { border-color: #4ade80; }
.cmd.copied i { color: #4ade80; opacity: 1; }

/* ---------------- Stats footer ---------------- */
.stats {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 2vw, 24px);
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.stat-icon {
  font-family: var(--font-display);
  color: #fff;
  font-size: clamp(22px, 3vw, 33px);
  line-height: 1.15;
}
.stat-value {
  font-weight: 500;
  color: #fff;
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-label {
  color: var(--muted);
  font-family: var(--font-cn);
  font-size: clamp(11px, 1.2vw, 12.5px);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ---------------- Animations ---------------- */
.anim {
  opacity: 0;
  transform: translateY(22px) scale(0.98);
  filter: blur(6px);
  animation: reveal 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes reveal {
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes revealPulse {
  0%   { opacity: 0; transform: translateY(22px) scale(0.98); filter: blur(6px); }
  60%  { opacity: 1; transform: translateY(0) scale(1.015); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes headlineFade {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes linkIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Mobile menu ---------------- */
/* hidden 属性必须压过 display:flex，否则菜单永远展开 */
.menu-overlay[hidden],
.mobile-menu[hidden] {
  display: none;
}
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: overlayIn 0.28s ease both;
}
.mobile-menu {
  display: none;               /* 默认收起；JS 去掉 hidden 后由下方规则恢复 */
  position: fixed;
  top: calc(clamp(16px, 2.4vh, 28px) + 48px + 14px);
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  z-index: 101;
  width: min(400px, calc(100vw - 40px));
  background: #fff;
  border-radius: 28px;
  padding: 22px 18px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: menuIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  flex-direction: column;
}
.mobile-menu:not([hidden]) {
  display: flex;
}
.m-link {
  position: relative;
  display: block;
  text-align: center;
  padding: 13px 10px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--nav-text);
  opacity: 0.65;
  border-radius: 14px;
  transition: opacity 0.2s ease, background 0.2s ease;
  animation: linkIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.m-link:nth-child(1) { animation-delay: 0.05s; }
.m-link:nth-child(2) { animation-delay: 0.1s; }
.m-link:nth-child(3) { animation-delay: 0.15s; }
.m-link:nth-child(4) { animation-delay: 0.2s; }
.m-link:hover { opacity: 1; background: rgba(0, 0, 0, 0.04); }
.m-link.is-active { opacity: 1; }
.m-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #000;
  transform: translateX(-50%);
  box-shadow: -5px 0 0 #000, 5px 0 0 #000;
}
.m-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  height: 46px;
  border-radius: 999px;
  background: var(--pill-dark);
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  animation: linkIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.26s both;
  transition: background 0.25s ease;
}
.m-signin:hover { background: #323234; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .nav-pill, .signin-btn { display: none; }

  .site-header { justify-content: space-between; max-width: 100%; }

  .logo-btn { width: 48px; height: 48px; }

  .burger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--pill-dark);
    box-shadow: var(--nav-shadow);
    cursor: pointer;
    transition: background 0.3s ease;
    position: relative;
    z-index: 1;
  }
  /* 菜单打开时整个 header 浮到遮罩之上（logo + 白底 X 汉堡均清晰可见可点） */
  body.menu-open .site-header {
    z-index: 102;
  }
  .burger .bar {
    display: block;
    width: 18px;
    height: 1.5px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.3s ease, background 0.3s ease;
  }
  .burger.open { background: #fff; }
  .burger.open .bar { background: #000; }
  .burger.open .bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .burger.open .bar:nth-child(2) { opacity: 0; }
  .burger.open .bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .headline {
    letter-spacing: -0.08em;
    line-height: 1.05;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(14px, 3vh, 22px) clamp(10px, 2vw, 16px);
  }
}

@media (max-width: 420px) {
  .headline {
    letter-spacing: -0.09em;
    line-height: 1.04;
  }
}

/* ---------------- 移动端细节优化 ---------------- */
@media (max-width: 480px) {
  /* CTA 行纵排，命令块整行宽 */
  .cta-row {
    flex-direction: column;
    align-items: stretch;
    width: min(340px, 100%);
  }
  .cta { justify-content: center; }
  .cmd { justify-content: center; white-space: normal; word-break: break-all; }

  /* 徽章更小更紧凑 */
  .badge { height: 30px; padding: 0 11px; font-size: 11px; }

  /* stats 行距收紧 */
  .stats { gap: 16px 10px; }
}

/* 触摸设备：去掉 hover 位移/发光残留（避免点按后样式粘滞） */
@media (hover: none) {
  .cta:hover, .card:hover, .step:hover,
  .badge:hover, .logo-btn:hover, .avatar:hover,
  .signin-btn:hover, .cmd:hover {
    transform: none;
  }
  .cta:active { transform: scale(0.97); }
  .logo-btn:active { transform: scale(0.95); }
}

/* Short viewports: tighten hero rhythm */
@media (max-height: 700px) {
  .trust { margin-bottom: clamp(10px, 2vh, 16px); }
  .subhead { margin-top: clamp(10px, 1.8vh, 16px); }
  .cta-row { margin-top: clamp(14px, 2.4vh, 22px); }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim, .headline .line {
    opacity: 1;
    transform: none;
    filter: none;
  }
  .headline { color: #fff; }
}
