/* ========================================
   GEO 动效规范 v1.0
   可酪创新 · geoclawi.com
   配套文档：docs/motion-spec.md
   ======================================== */

/* ------------------------------------------------------------
   0. 动效级别（由 JS 写入 html.motion-level）
   full  = 桌面高配，全动效
   low   = 移动端 / 低端设备，减法
   off   = 用户或系统关闭，全部停
   ------------------------------------------------------------ */
:root {
  --geo-blue:    #E85D3F;
  --geo-green:   #1D9E75;   /* 成功态保留绿，与主色区分 */
  --geo-rose:    #E85D3F;
  --geo-crawler: rgba(232, 93, 63, .14);
  --geo-line:    rgba(232, 93, 63, .09);
  --ease-in:     cubic-bezier(.16, 1, .3, 1);
  --ease-out:    cubic-bezier(.4, 0, .2, 1);
  --ease-back:   cubic-bezier(.2, .9, .3, 1.4);
  --dur-in:      .6s;
  --dur-hover:   .2s;
}

/* ========================================
   1. 扩展 data-animate 类型
   保留原有 fade-up，向后兼容
   ======================================== */
/* 仅当 html.js（JS 可用）时才隐藏初始态。
   无 JS / 打印 / 全页截图 / Lighthouse 时内容默认可见。 */
html.js [data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--dur-in) var(--ease-out),
              transform var(--dur-in) var(--ease-out);
}

html.js [data-animate].animated {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   0. 无 JS 兜底（必须在所有 [data-animate] 规则之前生效）
   style.css:1598 有未加前缀的 [data-animate]{opacity:0}，
   这里用更高优先级覆盖：html 无 .js 类时强制全部可见。
   覆盖打印 / 全页截图 / Lighthouse / JS 加载失败四种场景。
   ======================================== */
html:not(.js) [data-animate] {
  opacity: 1 !important;
  transform: none !important;
}
html:not(.js) [data-animate="stagger"] > * {
  opacity: 1 !important;
  transform: none !important;
}


html.js [data-animate="fade"] { transform: none; }
html.js [data-animate="fade-left"] { transform: translateX(-24px); }
html.js [data-animate="fade-right"] { transform: translateX(24px); }
html.js [data-animate="scale-in"] { transform: scale(.96); }

html.js [data-animate="stagger"] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s var(--ease-in),
              transform .5s var(--ease-in);
}
html.js [data-animate="stagger"].animated > * {
  opacity: 1;
  transform: none;
}

/* data-delay 支持（hero 已在用） */
[data-animate][data-delay="100"] { transition-delay: .1s; }
[data-animate][data-delay="200"] { transition-delay: .2s; }
[data-animate][data-delay="300"] { transition-delay: .3s; }
[data-animate][data-delay="400"] { transition-delay: .4s; }
[data-animate][data-delay="600"] { transition-delay: .6s; }

/* ========================================
   2. Hero · AI 抓取流（P0 主动效）
   ======================================== */
.geo-crawl {
  position: relative;
  padding: 4px 0;
  max-width: 560px;
}

.geo-crawl-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 6px;
  opacity: .38;
  transition: opacity .3s, background .3s;
  font-size: 13px;
  line-height: 1.6;
}
.geo-crawl-row.on {
  opacity: 1;
  background: var(--geo-line);
}
.geo-crawl-row .ln {
  flex: none;
  width: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--dark-3, #888);
}
.geo-crawl-row .tx { color: var(--dark-2, #5f5e5a); }
.geo-crawl-row.on .tx { color: var(--dark, #2c2c2a); }
.geo-crawl-row .tx b {
  color: var(--geo-blue);
  font-weight: 500;
  background: var(--geo-crawler);
  border-radius: 3px;
  padding: 0 3px;
}

.geo-crawl-cursor {
  position: absolute;
  left: 0; top: 0;
  width: 2px; height: 26px;
  background: var(--geo-blue);
  border-radius: 2px;
  box-shadow: 0 0 10px 2px rgba(232, 93, 63, .45);
  transition: transform .28s var(--ease-out);
  will-change: transform;
  pointer-events: none;
}
.geo-crawl-url {
  position: absolute;
  left: 22px; top: -22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: #fff;
  background: var(--geo-blue);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  transition: transform .28s var(--ease-out), background .3s;
}

/* 落定轻震 */
.geo-crawl.stamped { transform: translateX(2px); }

/* ========================================
   3. Hero · 答案气泡（P0 副动效）
   ======================================== */
.geo-qa {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  margin-top: 28px;
}
.geo-qa-q {
  align-self: flex-end;
  max-width: 78%;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px 12px 3px 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--dark, #2c2c2a);
}
.geo-qa-a {
  align-self: flex-start;
  max-width: 88%;
  background: rgba(29, 158, 117, .10);
  border: 1px solid rgba(29, 158, 117, .32);
  border-radius: 12px 12px 12px 3px;
  padding: 12px 15px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--dark, #2c2c2a);
  min-height: 48px;
}
.geo-qa-a .brand {
  color: var(--geo-rose);
  font-weight: 500;
  border-bottom: 1.5px solid var(--geo-rose);
  padding-bottom: 1px;
}
.geo-qa-caret {
  display: inline-block;
  width: 1.5px; height: 13px;
  background: var(--geo-green);
  vertical-align: -2px;
  margin-left: 2px;
}

/* ========================================
   4. Metrics · 收录状态印章（P0）
   ======================================== */
.geo-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.geo-metric {
  position: relative;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, .08));
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
  overflow: hidden;
}
.geo-metric .mm-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--dark, #2c2c2a);
  margin-bottom: 4px;
}
.geo-metric .mm-status {
  font-size: 12px;
  color: var(--geo-green);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.geo-metric .mm-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--geo-green);
}
.geo-metric .mm-cite {
  font-size: 22px;
  font-weight: 500;
  color: var(--dark, #2c2c2a);
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.geo-metric .mm-note {
  font-size: 11px;
  color: var(--dark-3, #888);
  margin-top: 2px;
}
.geo-stamp {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid #E85D3F;
  color: #E85D3F;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}

/* ========================================
   5. Trust 数据条
   ======================================== */
.geo-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.geo-trust-item {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, .08));
  border-radius: 10px;
  padding: 14px 22px;
  text-align: center;
  min-width: 110px;
}
.geo-trust-item .tv {
  font-size: 24px;
  font-weight: 500;
  color: var(--primary, var(--geo-rose));
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.geo-trust-item .tl {
  font-size: 12px;
  color: var(--dark-3, #888);
  margin-top: 2px;
}

/* ========================================
   6. 排名爬升榜（P1）
   ======================================== */
.geo-rank { display: flex; flex-direction: column; gap: 8px; }
.geo-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, .08));
  opacity: .3;
  transform: translateX(-14px);
  transition: opacity .45s var(--ease-out),
              transform .45s var(--ease-out),
              background .45s, border-color .45s;
}
.geo-rank-row.on { opacity: 1; transform: translateX(0); }
.geo-rank-row.mine {
  background: rgba(223, 161, 131, .10);
  border-color: rgba(223, 161, 131, .42);
}
.geo-rank-row .no {
  width: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--dark-3, #888);
}
.geo-rank-row.mine .no { color: var(--primary, var(--geo-rose)); }
.geo-rank-row .nm { font-size: 13px; flex: 1; color: var(--dark, #2c2c2a); }
.geo-rank-row .sc {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--dark-3, #888);
}

/* ========================================
   7. 收录状态印章动画
   ======================================== */
@keyframes geoStamp {
  0%   { transform: translate(-50%, -50%) scale(2.4) rotate(-18deg); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1)   rotate(-6deg);  opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; }
}
.geo-metric .geo-stamp { animation: geoStamp 2.4s var(--ease-back) infinite; }

/* ========================================
   8. 卡片 hover（仅真 hover 设备）
   ======================================== */
@media (hover: hover) and (pointer: fine) {
  .geo-metric:hover {
    transform: translateY(-3px);
    transition: transform var(--dur-hover) var(--ease-out);
  }
  .geo-case-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  }
}

/* ========================================
   9. 页脚滚动进度条
   ======================================== */
.geo-progress {
  position: fixed;
  left: 0; top: 0;
  height: 2px;
  width: 0;
  background: var(--primary, var(--geo-rose));
  z-index: 101;
  pointer-events: none;
}

/* ========================================
   10. 键盘焦点可见性（P0 无障碍）
   ======================================== */
:focus-visible {
  outline: 2px solid var(--geo-rose);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ========================================
   11. 移动端 / 低端设备
   ======================================== */
@media (max-width: 768px) {
  .geo-crawl-row { font-size: 12px; padding: 8px; }
  .geo-qa { margin-top: 20px; }
  .geo-qa-q, .geo-qa-a { max-width: 94%; font-size: 12.5px; }
  .geo-metrics { grid-template-columns: repeat(2, 1fr); }
  .geo-metric { padding: 14px 10px; }
  .geo-metric .mm-cite { font-size: 18px; }
}

@media (max-width: 375px) {
  .geo-crawl-row .tx { font-size: 11.5px; }
  .geo-metrics { grid-template-columns: 1fr; }
}

/* ========================================
   12. 动效级别：low
   ======================================== */
html.motion-level-low .geo-crawl-cursor { display: none; }
html.motion-level-low .geo-metric .geo-stamp { display: none; }
html.motion-level-low html.js [data-animate="stagger"].animated > * {
  transition-delay: 0s !important;
}

/* ========================================
   13. 动效级别：off（用户手动关闭）
   ======================================== */
html.motion-off *,
html.motion-off *::before,
html.motion-off *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.motion-off [data-animate] {
  opacity: 1 !important;
  transform: none !important;
}
html.motion-off .geo-crawl-cursor,
html.motion-off .geo-qa-caret,
html.motion-off .geo-stamp { display: none !important; }

/* 关闭态下抓取流直接全部点亮 */
html.motion-off .geo-crawl-row { opacity: 1; background: var(--geo-line); }

/* ========================================
   14. prefers-reduced-motion（P0 无障碍）
   必须在最后，优先级最高
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
  }
  html.js [data-animate="stagger"] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .geo-crawl-cursor,
  .geo-qa-caret,
  .geo-metric .geo-stamp { display: none !important; }
  .geo-crawl-row { opacity: 1; background: var(--geo-line); }
}

/* ========================================
   15. Hero 动效容器布局
   ======================================== */
.geo-hero-demo {
  margin-top: 26px;
  max-width: 620px;
}

/* 树动画移除后，hero 右侧原本由 canvas 填充，现为空白。
   桌面端把字幕特效改为双栏横展：左抓取流、右答案气泡。
   小于 1025px 仍为单栏堆叠。 */
@media (min-width: 1025px) {
  .geo-hero-demo {
    max-width: 100%;
    display: grid;
    grid-template-columns: 1.12fr 1fr;
    gap: 14px;
    align-items: start;
  }
  .geo-qa { margin-top: 0; }
}

@media (max-width: 768px) {
  .geo-hero-demo { margin-top: 20px; }
}

/* ========================================
   16. Hero 动效可读性修复
   canvas 树会压在动效文字下方，必须加底衬托出
   ======================================== */
.geo-hero-demo {
  position: relative;
  z-index: 1;
}
.geo-crawl,
.geo-qa {
  position: relative;
  z-index: 2;                 /* 明确高于 .hero-bg(0)，压住 canvas 枝干 */
  isolation: isolate;         /* 独立层叠上下文，防止子树 z-index 外泄 */
  background: rgba(14, 16, 21, .96);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 16px 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.geo-qa {
  background: rgba(14, 16, 21, .96);
  margin-top: 14px;
}

/* hero 区域恒为深色底（.hero 自带深色背景），
   故底衬固定用深色。不做亮色分支，避免依赖不存在的
   .theme-dark 类导致误判。文字颜色已在 §16 末尾统一覆盖。 */

@media (max-width: 768px) {
  .geo-crawl, .geo-qa {
    padding: 13px 14px;
    /* 移动端树更密（canvas 铺满全屏），底衬需接近不透明才够对比度 */
    background: rgba(14, 16, 21, .97);
    border-color: rgba(255, 255, 255, .12);
  }
  .geo-crawl-row .tx,
  .geo-qa-q,
  .geo-qa-a {
    color: rgba(255, 255, 255, .95) !important;
  }
  .geo-crawl-row .ln { color: rgba(255, 255, 255, .55); }
}

/* hero 为深色底，底衬内文字必须用浅色，否则继承 body 的深色 --dark 看不清 */
.geo-crawl-row .tx,
.geo-qa-q,
.geo-qa-a {
  color: rgba(255, 255, 255, .88) !important;
}
.geo-crawl-row.on .tx { color: #fff !important; }
.geo-crawl-row .ln { color: rgba(255, 255, 255, .45); }

/* ========================================
   17. 树动画移除后的修正
   原 .hero 的 cursor:crosshair 是配合 canvas 鼠标交互的，
   canvas 已移除，准星会让整块区域显得像取色器，改回默认。
   ======================================== */
.hero {
  cursor: default;
}

/* 树移除后 hero 为纯色深底，字幕特效是唯一视觉焦点，
   轻微加大字号对比，让信息层级更清晰 */
.hero .geo-crawl-row {
  font-size: 13.5px;
}

/* ========================================
   18. 动效放大为主视觉（hero 精简后）
   原 hero-badge / desc / stats / hint / scroll 已移除，
   字幕特效成为英雄区唯一视觉焦点 —— 字号、间距、层级整体放大。
   ======================================== */

/* hero 撑满首屏，垂直居中 */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
}

/* 动效组顶部留白（原由 badge/desc 占据的空间） */
.geo-hero-demo {
  margin-top: 34px;
}

/* 抓取流：字号放大 13.5 → 16px */
.hero .geo-crawl-row {
  font-size: 16px;
  padding: 13px 16px;
}
.hero .geo-crawl-row .ln {
  font-size: 13px;
  width: 20px;
}
.hero .geo-crawl-row b {
  font-weight: 500;
}
/* 光标加高，匹配放大的行高 */
.hero .geo-crawl-cursor {
  height: 42px;
  width: 3px;
}
.hero .geo-crawl-url {
  font-size: 12px;
  top: -26px;
  left: 28px;
  padding: 3px 9px;
}

/* 答案气泡：字号放大 13 → 15.5px */
.hero .geo-qa-q,
.hero .geo-qa-a {
  font-size: 15.5px;
  line-height: 1.8;
}
.hero .geo-qa-q { padding: 14px 18px; }
.hero .geo-qa-a { padding: 16px 20px; min-height: 72px; }
.hero .geo-qa-a .brand { border-bottom-width: 2px; }
.hero .geo-qa-caret {
  width: 2px; height: 16px;
}

/* h1 单行显示（原为 <br> 两行）
   分隔符 · 降低不透明度区分层级；nowrap 保证一行。
   字号按屏幕分级，确保最窄 375px 也放得下。 */
.hero .hero-content h1 {
  font-size: 44px;
  line-height: 1.3;
  letter-spacing: 1px;
  white-space: nowrap;
}
.hero .hero-content h1 .h1-sep {
  opacity: .45;
  font-weight: 400;
}
.hero .hero-content h1 .h1-sub {
  font-weight: 700;
}
/* GEO 业务关键词：实色主橙，最醒目（品牌名为渐变，二者不混淆） */
.hero .hero-content h1 .h1-g {
  color: var(--primary);
  font-weight: 700;
}
@media (max-width: 1024px) {
  .hero .hero-content h1 { font-size: 36px; }
}
@media (max-width: 768px) {
  .hero .hero-content h1 { font-size: 24px; letter-spacing: 0; }
  /* 压缩分隔符两侧空格宽度，省出约 1/4 字宽 × 4 个空格 */
  .hero .hero-content h1 { word-spacing: -0.25em; }
}
/* 414px 及以下（大手机）：三段共 16 字符，24px 已放不下 */
@media (max-width: 414px) {
  .hero .hero-content h1 { font-size: 20px; }
}
@media (max-width: 375px) {
  .hero .hero-content h1 { font-size: 19px; }
}
@media (max-width: 360px) {
  .hero .hero-content h1 { font-size: 18px; }
}
/* 320px 超小屏（iPhone SE 一代） */
@media (max-width: 320px) {
  .hero .hero-content h1 { font-size: 17px; }
}
.hero .hero-btns { margin-top: 4px; }
.hero .hero-btns .btn {
  padding: 13px 30px;
  font-size: 15px;
}

/* 双栏间距放大 */
@media (min-width: 1025px) {
  .geo-hero-demo { gap: 18px; }
}

/* 移动端同步放大，但不超过可读范围 */
@media (max-width: 768px) {
  .hero .geo-crawl-row { font-size: 14px; padding: 11px 12px; }
  .hero .geo-qa-q,
  .hero .geo-qa-a { font-size: 14px; }
  .geo-hero-demo { margin-top: 24px; }
}

/* ========================================
   19. 打印兜底
   打印 / 存 PDF 时 JS 是启用的，IntersectionObserver 不会触发，
   下方区块会停留在 opacity:0 —— 打印出来是空白页。
   这里强制全部可见。
   ======================================== */
@media print {
  html.js [data-animate],
  html.js [data-animate="stagger"] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .geo-progress,
  .geo-crawl-cursor,
  .geo-qa-caret { display: none !important; }
}

/* ========================================
   20. 导航菜单单行排列
   原 .nav-links 为 flex + gap 32px，8 个菜单项 + 语言切换在
   中等宽度下会挤压或换行。这里统一为 nowrap 单行，
   按屏幕宽度分级压缩 gap / 字号，窄桌面用横向滚动兜底。
   移动端（<769px）仍沿用原有汉堡抽屉交互，不做横向滚动。
   ======================================== */
.nav-container {
  flex-wrap: nowrap;
}
.nav-links {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.nav-links li {
  flex: none;                 /* 各项不被压缩，保证文字完整 */
}

/* 笔记本（1280 以下）：适度压缩间距 */
@media (min-width: 769px) and (max-width: 1280px) {
  .nav-links { gap: 20px; }
  .nav-links a { font-size: 0.875rem; }
}

/* 小笔记本 / 平板（1024 以下）：进一步压缩 */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.8125rem; }
  .logo-text { font-size: 0.95rem; }
}

/* 窄桌面（900 以下）：单行横向滚动兜底，绝不换行或截断 */
@media (min-width: 769px) and (max-width: 900px) {
  .nav-links {
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;          /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
}

/* ========================================
   21. 图标改 SVG 后的配色
   原为 emoji（彩色），已替换为 lucide 风格 stroke SVG，
   stroke="currentColor" 会继承文字色，这里统一给品牌主橙。
   ======================================== */
.feature-icon svg { color: var(--primary); display: block; }
.contact-icon svg { color: var(--primary); display: block; }
.contact-icon { display: flex; justify-content: center; }
