/* ============================================================
   YB 官网样式 —— 单源定义
   所有色值 / 字号 / 间距 / 圆角 / 断点 只在本文件 :root 定义一次
   数值来源：yb-website-design.md 第四章
   ============================================================ */

:root {
  /* 配色（4.1） */
  --bg:            #0E1116;  /* 主背景 深炭黑 */
  --bg-card:       #161B22;  /* 次级背景 卡片/分区 */
  --border:        #262C36;  /* 边框色 */
  --text:          #E6EDF3;  /* 正文文字 近白 */
  --text-secondary:#8B949E;  /* 次级文字 */
  --accent:        #00E5A0;  /* 强调色 薄荷绿 */
  --accent-hover:  #00C88C;  /* 强调色悬停 */
  --warn:          #FFB020;  /* 警示/提示（少用） */

  /* 字体（4.2） */
  --font: -apple-system, "PingFang SC", "Source Han Sans SC", "Noto Sans SC",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* 字号（移动优先，4.2） */
  --fs-h1: 32px;
  --fs-h2: 26px;
  --fs-h3: 20px;
  --fs-body: 16px;

  /* 行高（4.2） */
  --lh-heading: 1.2;
  --lh-body: 1.7;

  /* 间距与圆角（4.3） */
  --section-space: 64px;   /* 区块上下留白（移动） */
  --radius-card: 20px;     /* 卡片圆角 */
  --radius-pill: 999px;    /* 按钮胶囊 */
  --radius-small: 12px;    /* 小元素圆角 */

  /* 布局 */
  --max-width: 1120px;
}

/* 桌面 ≥ 1024px（4.4） */
@media (min-width: 1024px) {
  :root {
    --fs-h1: 56px;
    --fs-h2: 40px;
    --fs-h3: 24px;
    --fs-body: 17px;
    --section-space: 120px;
  }
}

/* ---------- 基础 ---------- */

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 700;
  line-height: var(--lh-heading);
}

img, svg { display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

.section { padding-block: var(--section-space); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 按钮（胶囊形，hover 变深 + 上浮 2px） ---------- */

.btn {
  display: inline-block;
  min-height: 44px;
  padding: 12px 32px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-body);
  font-weight: 700;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.2s ease-out, transform 0.2s ease-out, color 0.2s ease-out;
}

.btn-primary {
  background: var(--accent);
  color: #0E1116;
  border: none;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  text-decoration: none;
}
.btn-primary:disabled {
  background: var(--accent);
  color: #0E1116;
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ---------- 顶部导航 ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 17, 22, 0.9);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.site-nav-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo（SVG，原 1254×1254 画布留白大，显示高度统一控制） */
.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-img {
  display: block;
  height: 36px;      /* 导航栏高：正方形字标 */
  width: auto;
}

.logo-footer { height: 32px; }

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* 移动端默认收起（无 JS 时用 :focus-within 兜底展开）。
     max-height 0→420px 做高度过渡（fr 过渡规范不可插值，max-height 全兼容） */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: block;
  /* max-height 折叠动画：全浏览器兼容（fr 过渡规范上不可插值，弃用） */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  visibility: hidden;
  transition: max-height 250ms ease-out, opacity 250ms ease-out,
              transform 250ms ease-out, visibility 0s linear 250ms;
}
.nav-menu-inner {
  padding: 12px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-menu a {
  display: block;
  padding: 10px 8px;
  color: var(--text);
  font-size: var(--fs-body);
  border-radius: var(--radius-small);
  transition: color 0.2s ease-out, background-color 0.2s ease-out;
}
.nav-menu a:hover { color: var(--accent); text-decoration: none; background: var(--bg); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
}

/* 汉堡按钮 → 关闭 X 的形变（中杆淡出，上下杆旋转合拢） */
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 250ms ease-out, opacity 250ms ease-out;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 移动端展开态：JS 加 .open。
   focus-within 兜底仅在无 JS 时生效（html:not(.js)）——
   JS 可用时真实触摸的链接会保持 :focus，focus-within 会把已关闭的菜单重新顶开 */
.nav-menu.open,
html:not(.js) nav:focus-within .nav-menu {
  max-height: 420px;   /* 覆盖 6 项菜单最大高度，实际高度由内容决定 */
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  transition: max-height 250ms ease-out, opacity 250ms ease-out,
              transform 250ms ease-out, visibility 0s;
}

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-menu {
    position: static;
    background: none;
    border: none;
    display: block;
    /* 覆盖移动端动画隐藏态：桌面常驻可见，无过渡 */
    max-height: none;
    overflow: visible;
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: none;
  }
  .nav-menu-inner {
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 4px;
  }
  .nav-menu a { padding: 8px 14px; }
  .nav-menu a:hover { background: var(--bg-card); }
}

/* ---------- ① Hero ---------- */

.hero {
  min-height: calc(100svh - 53px);
  display: flex;
  align-items: center;
  padding-block: var(--section-space);
}

.hero-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
  display: grid;
  gap: 48px;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  margin-bottom: 20px;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: var(--fs-body);
  max-width: 34em;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* 手机 mockup 与循环动画 */
.hero-visual { display: flex; justify-content: center; }

.phone-mock {
  position: relative;
  width: 200px;
}

.phone-screen {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--bg-card);
  overflow: hidden;
  aspect-ratio: 200 / 360;
}

.phone-glow {
  position: absolute;
  left: 50%;
  bottom: -40px;
  width: 260px;
  height: 80px;
  transform: translateX(-50%);
  background: var(--accent);
  opacity: 0.3;
  filter: blur(40px);
  border-radius: 50%;
  pointer-events: none;
}

.skeleton-svg { width: 100%; height: 100%; }

.ground-line {
  stroke: var(--border);
  stroke-width: 2;
}

/* 人形剪影：暗色身体 */
.body-fill {
  stroke: #2F3A47;
  stroke-width: 14;
  stroke-linecap: round;
  fill: none;
}
.figure circle { fill: #2F3A47; stroke: none; }

/* 骨骼线：扫描动画 —— 白光从头顶节点沿身体向下延伸，再逆序收回 */
/* pathLength=1 归一化：每条线 dash 1 → 0 = 从起点画到终点 */
.skeleton-lines line {
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: 4s ease-in-out infinite;
}

/* 时间轴（4s 周期）：
   向下扫描 0→60%：躯干(0-12) → 上臂(12-24) → 前臂(24-36) → 大腿(36-48) → 小腿(48-60)
   保持 60→70%
   收回 70→100%：小腿 → 大腿 → 前臂 → 上臂 → 躯干（逆序，线尾先收） */

.skeleton-lines .seg-torso   { animation-name: scan-torso; }
.skeleton-lines .seg-uparm   { animation-name: scan-uparm; }
.skeleton-lines .seg-forearm { animation-name: scan-forearm; }
.skeleton-lines .seg-thigh   { animation-name: scan-thigh; }
.skeleton-lines .seg-shin    { animation-name: scan-shin; }

@keyframes scan-torso {
  0%       { stroke-dashoffset: 1; }
  12%      { stroke-dashoffset: 0; }
  97%      { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 1; }
}
@keyframes scan-uparm {
  0%, 12%  { stroke-dashoffset: 1; }
  24%      { stroke-dashoffset: 0; }
  91%      { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 1; }
}
@keyframes scan-forearm {
  0%, 24%  { stroke-dashoffset: 1; }
  36%      { stroke-dashoffset: 0; }
  84%      { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 1; }
}
@keyframes scan-thigh {
  0%, 36%  { stroke-dashoffset: 1; }
  48%      { stroke-dashoffset: 0; }
  77%      { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 1; }
}
@keyframes scan-shin {
  0%, 48%  { stroke-dashoffset: 1; }
  60%      { stroke-dashoffset: 0; }
  70%      { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 1; }
}

/* 关键点：扫描到达时变绿，收回时熄灭（与骨骼线时间轴对齐） */
/* 4s 周期：向下扫描 0→60%（躯干0-12 上臂12-24 前臂24-36 大腿36-48 小腿48-60）
   保持 60→70%，收回 70→100% */
.joints circle {
  fill: var(--text-secondary);
  animation: 4s ease-in-out infinite;
}
/* 点位拓扑：
   1=头(132) 2=肩(167) 3=肘L 4=肘R 5=髋(204) 6=膝L 7=膝R 8=踝L 9=踝R */
.joints circle:nth-child(1) { animation-name: joint-head; }
.joints circle:nth-child(2) { animation-name: joint-shoulder; }
.joints circle:nth-child(3),
.joints circle:nth-child(4) { animation-name: joint-elbow; }
.joints circle:nth-child(5) { animation-name: joint-hip; }
.joints circle:nth-child(6),
.joints circle:nth-child(7) { animation-name: joint-knee; }
.joints circle:nth-child(8),
.joints circle:nth-child(9) { animation-name: joint-ankle; }

@keyframes joint-head {
  0%        { fill: var(--text-secondary); }
  2%        { fill: var(--accent); }
  97%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}
@keyframes joint-shoulder {
  0%, 12%   { fill: var(--text-secondary); }
  14%       { fill: var(--accent); }
  91%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}
@keyframes joint-elbow {
  0%, 24%   { fill: var(--text-secondary); }
  26%       { fill: var(--accent); }
  84%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}
@keyframes joint-hip {
  0%, 36%   { fill: var(--text-secondary); }
  38%       { fill: var(--accent); }
  77%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}
@keyframes joint-knee {
  0%, 48%   { fill: var(--text-secondary); }
  50%       { fill: var(--accent); }
  70%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}
@keyframes joint-ankle {
  0%, 60%   { fill: var(--text-secondary); }
  62%       { fill: var(--accent); }
  70%       { fill: var(--accent); }
  100%      { fill: var(--text-secondary); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-lines line,
  .joints circle { animation: none; }
  .skeleton-lines line { stroke-dashoffset: 0; }
  .joints circle { fill: var(--accent); }
  .library-track { animation: none; }
  .nav-menu,
  .nav-menu.open,
  .nav-menu a,
  .nav-toggle-bar { transition: none; }
  .faq-body.faq-anim { transition: none; clip-path: none !important; }
  .faq-item.closing-box { transition: none; }
  html { scroll-behavior: auto; }
}

/* 桌面：左文右图 */
@media (min-width: 1024px) {
  .hero-inner { grid-template-columns: 1.2fr 0.8fr; gap: 64px; }
  .hero-visual { justify-content: flex-end; }
}

/* ---------- 区块标题 ---------- */

.section h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  margin-bottom: 48px;
}

.section-sub {
  color: var(--text-secondary);
  margin: -32px 0 48px;
}

/* ---------- ② 三步 ---------- */

.steps-grid {
  display: grid;
  gap: 24px;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 28px;
}

.step-num {
  display: inline-block;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

.icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  margin-bottom: 20px;
}

.step-card h3, .feature-card h3, .library-card h3 {
  font-size: var(--fs-h3);
  margin-bottom: 12px;
}

.step-card p, .feature-card p, .library-card p {
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- ③ 核心能力 ---------- */

.feature-grid {
  display: grid;
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 28px;
}

@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- ④ 动作库 ---------- */

/* 手机：自动无缝循环滚动（无滚动条）；桌面：网格。
   外层 .library-scroller 是裁剪窗口，内层 .library-track 携带正本+副本做位移 */
.library-scroller {
  overflow: hidden;                 /* 只做裁剪窗口，不滚动 */
  padding-bottom: 0;
}

.library-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(78vw - 48px);  /* 定值卡宽：78% 视口减去 container 左右 padding */
  gap: 16px;
  width: max-content;               /* 使位移 -50% 相对内容总宽，正本=副本 → 无缝 */
  animation: library-loop 36s linear infinite;
}

@keyframes library-loop {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.library-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px 24px;
}

@media (min-width: 768px) {
  .library-scroller { overflow: visible; }
  .library-track {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-columns: auto;
    width: auto;
    animation: none;                /* 桌面网格不滚动 */
    transform: none;
  }
  .library-dup { display: none; }   /* 桌面只显示正本，循环副本隐藏 */
}

/* ---------- ⑤ 隐私承诺 ---------- */

.privacy-section {
  background: var(--bg-card);
  border-block: 1px solid var(--border);
}

.privacy-container {
  max-width: 760px;
  text-align: center;
}

.privacy-lead { color: var(--text-secondary); margin-bottom: 32px; font-weight: 700; line-height: var(--lh-heading); }

.privacy-list {
  list-style: none;
  display: grid;
  gap: 14px;
  justify-items: start;          /* 列表整体左对齐，✓ 对齐同一列 */
  justify-content: center;       /* 列表块在容器里仍居中 */
  margin-bottom: 32px;
}

.privacy-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-body);
}

.x-mark {
  color: var(--accent);
  font-weight: 700;
  width: 1.2em;                  /* 固定宽，任何行 ✓ 都在同列 */
  text-align: center;
  flex: none;
}

.privacy-note { margin-bottom: 24px; }

.privacy-link a { font-size: 15px; }

/* ---------- ⑥ FAQ ---------- */

.faq-container { max-width: 760px; }

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  font-weight: 700;
  min-height: 44px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.faq-chevron {
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg);
  transition: transform 250ms ease-out;
}
.faq-item[open] .faq-chevron { transform: rotate(225deg); }

/* 展开动画：高度/open 瞬时切换（零 layout 动画帧），
   视觉动画走 clip-path + opacity（GPU 合成器，手机不卡）。
   收起：内容从下往上被裁出视线；展开：反向裁入 + 淡入 */
.faq-body {
  padding: 0 24px 18px;
}
/* 收起时卡片高度平滑收拢（范围仅单卡，layout 成本极低） */
.faq-item.closing-box {
  overflow: hidden;
  transition: max-height 200ms ease-out;
}
.faq-body.faq-anim {
  transition: clip-path 250ms ease-out, opacity 250ms ease-out;
  will-change: clip-path, opacity;
}
/* 显式兜底：关闭态内容必须隐藏（防个别浏览器 UA 规则未生效） */
.faq-item:not([open]) .faq-body { display: none; }

/* ---------- ⑦ 下载 CTA ---------- */

.cta-section {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.cta-container {
  max-width: 760px;
  text-align: center;
}

.cta-section h2 { margin-bottom: 16px; }

.cta-sub {
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.cta-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.cta-form input {
  width: 100%;
  max-width: 420px;
  min-height: 48px;
  padding: 12px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: var(--fs-body);
  font-family: inherit;
}
.cta-form input::placeholder { color: var(--text-secondary); }
.cta-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.cta-note {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .cta-form {
    flex-direction: row;
    justify-content: center;
  }
  .cta-form input { flex: 0 1 360px; }
}

/* ---------- ⑧ Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 48px;
}

.footer-grid {
  display: grid;
  gap: 32px;
  justify-items: center;
  text-align: center;
}

.footer-brand {
  display: grid;
  justify-items: center;   /* logo 与标语各自居中 */
}

.footer-brand p {
  color: var(--text-secondary);
  margin-top: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: center;
}
.footer-links a { color: var(--text-secondary); font-size: 15px; }
.footer-links a:hover { color: var(--accent); }

.footer-copy { color: var(--text-secondary); font-size: 14px; }

.footer-note {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    text-align: left;
  }
  .footer-brand { justify-self: start; }
  .footer-copy { justify-self: end; text-align: right; }
}

/* ---------- 子页 ---------- */

.subpage { min-height: calc(100svh - 53px - 180px); }

.subpage-container { max-width: 760px; }

.subpage h1 {
  font-size: var(--fs-h2);
  font-weight: 800;
  margin-bottom: 24px;
}

.subpage-placeholder { color: var(--text-secondary); }

/* ---------- 隐私政策页排版 ---------- */

.policy-updated {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.subpage h2 {
  font-size: var(--fs-h3);
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
}

.subpage ul {
  margin: 0 0 16px;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: var(--text-secondary);
}

.subpage ul strong { color: var(--text); }

.subpage p { color: var(--text-secondary); margin-bottom: 16px; }
.subpage p strong { color: var(--text); }

/* ---------- 滚动淡入（JS 增强，无 JS 时直接可见） ---------- */

.reveal {
  opacity: 1;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

/* 仅当 JS 成功运行时才先隐藏再淡入 */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
}

.js .reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

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