/* ============================================================================
   Whale Holdings 官网 —— 布局与组件（方向「Daylight IDE」）
   取值一律走 var(--token)（见 tokens.css）。
   签名：① 贯穿全页的左侧行号槽（区块=源文件 block，CSS counter 连续递增）
        ② Hero 里「活的 agent diff」面板
   质量地板：可见键盘 focus、reduced-motion、语义结构、AA 对比、响应式。
   ========================================================================== */

/* —— Reset / base ——————————————————————————————————————————————— */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  -webkit-tap-highlight-color: transparent;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px; /* 锚点不被 sticky nav 遮 */
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}
h1,
h2,
h3,
p,
figure,
ul,
ol {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}
img,
svg {
  display: block;
  max-width: 100%;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* 可见键盘 focus（仅键盘，不打扰鼠标） */
:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--ring);
}

/* 跳到主内容（a11y） */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus {
  top: var(--sp-3);
}

/* —— 通用排版工具 ——————————————————————————————————————————————— */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
}
.mono {
  font-family: var(--font-mono);
}
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--ink);
}
h2.display {
  font-size: var(--fs-h2);
}
h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-h3);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
}
.lede {
  font-size: var(--fs-lg);
  color: var(--muted);
  max-width: 52ch;
}
.section-head {
  max-width: 60ch;
  margin-bottom: var(--sp-7);
}
.section-head .lede {
  margin-top: var(--sp-3);
}

/* —— 按钮 ——————————————————————————————————————————————————————— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 46px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease),
    background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.btn:focus-visible {
  /* 保留按钮微阴影的同时叠加 focus 环 */
  box-shadow: var(--ring), 0 1px 0 rgba(0, 0, 0, 0.04);
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.btn-primary:hover {
  background: var(--accent-press);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--surface);
}
.btn-sm {
  height: 38px;
  padding: 0 var(--sp-4);
}
.btn-block {
  width: 100%;
}
.text-link {
  color: var(--accent-ink);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.text-link:hover {
  border-color: var(--accent-ink);
}
.text-link .arr {
  transition: transform var(--dur) var(--ease);
  display: inline-block;
}
.text-link:hover .arr {
  transform: translateX(3px);
}

/* ============================================================================
   行号槽（签名结构）——————————————————————————————————————————————
   每个 .block 顶左角渲染一个 mono 编号（CSS counter 自动递增、跨区块连续），
   左侧 1px 边框首尾相接形成连续 rail。内容在 .wrap 内居中、限宽。
   ========================================================================== */
body {
  counter-reset: ln;
}
.block {
  position: relative;
  padding-left: var(--gutter);
  border-left: 1px solid var(--line);
}
.block::before {
  counter-increment: ln;
  content: counter(ln, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: var(--sp-9);
  width: var(--gutter);
  padding-right: 14px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--faint);
  letter-spacing: 0.02em;
}
/* 信任条用 .wrap.flush（padding sp-7），编号同步对齐到 sp-7（否则与内容错位） */
.trust.block::before {
  top: var(--sp-7);
}
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-9) var(--edge);
}
.wrap.flush {
  padding-top: var(--sp-7);
  padding-bottom: var(--sp-7);
}
.alt {
  background: var(--paper-2);
}

/* —— 顶部导航 ——————————————————————————————————————————————————— */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 246, 243, 0.92); /* 兜底：不支持 color-mix 的浏览器 */
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px); /* Safari/WebKit */
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--edge);
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.brand svg {
  width: 22px;
  height: 22px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  margin-left: var(--sp-4);
}
.nav-links a {
  font-size: var(--fs-sm);
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
}

/* —— Hero ——————————————————————————————————————————————————————— */
.hero .wrap {
  padding-top: var(--sp-9);
  padding-bottom: var(--sp-9);
  display: grid;
  grid-template-columns: 1fr 1.1fr; /* 略偏向 diff 面板，使签名成为 hero 视觉锚点 */
  gap: var(--sp-8);
  align-items: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: var(--sp-5) 0 var(--sp-5);
}
.hero h1 .grad {
  color: var(--accent);
}
.hero .lede {
  font-size: var(--fs-lg);
  max-width: 46ch;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}
.hero-note {
  margin-top: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--faint);
}

/* —— 代码 / diff 面板（hero 签名 + showcase 复用）————————————————— */
.code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
}
.code-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: #fafbf9; /* 兜底 */
  background: color-mix(in srgb, var(--paper-2) 55%, var(--surface));
}
.dots {
  display: inline-flex;
  gap: 6px;
}
.dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-2);
}
.code-file {
  color: var(--muted);
  font-size: var(--fs-label);
}
.code-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
  font-size: var(--fs-label);
}
/* 请求行（自然语言 prompt） */
.code-prompt {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--paper-2);
}
.code-prompt .chev {
  color: var(--accent);
  font-weight: 700;
}
.code-body {
  padding: var(--sp-3) 0;
  counter-reset: cl;
  overflow-x: auto;
}
.cl {
  display: grid;
  grid-template-columns: 44px 16px 1fr;
  align-items: baseline;
  padding: 1px var(--sp-4) 1px 0;
  white-space: pre;
  line-height: 1.7;
}
.cl::before {
  counter-increment: cl;
  content: counter(cl);
  color: var(--faint);
  text-align: right;
  padding-right: var(--sp-3);
  user-select: none;
}
.cl .sign {
  text-align: center;
  font-weight: 600;
}
.cl.add {
  background: var(--syn-add-bg);
}
.cl.add .sign {
  color: var(--syn-add);
}
.cl.add .sign::before {
  content: '+';
}
.cl.del {
  background: var(--syn-del-bg);
}
.cl.del .sign {
  color: var(--syn-del);
}
.cl.del .sign::before {
  content: '\2212'; /* − */
}
.cl.del code {
  color: var(--syn-del);
}
/* 极简语法上色 */
.tok-k {
  color: var(--syn-key);
}
.tok-f {
  color: var(--syn-fn);
}
.tok-s {
  color: var(--syn-str);
}
.tok-n {
  color: var(--syn-num);
}
.tok-c {
  color: var(--syn-com);
}
/* 校验结果行 */
.code-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  background: #f1f7f3; /* 兜底 */
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
  font-size: var(--fs-label);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
}
.check svg {
  width: 14px;
  height: 14px;
}

/* —— 信任条 ——————————————————————————————————————————————————— */
/* 信任条内衬由 .wrap.flush（sp-7）统一掌管，避免与 .block::before 对齐冲突 */
.trust-label {
  display: block;
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--faint);
}
.trust-row {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4) var(--sp-7);
}
.trust-row span {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--muted);
  opacity: 0.8;
}

/* —— How it works（真实序列，编号合理）—————————————————————————— */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
  counter-reset: step;
}
.step {
  position: relative;
  padding-top: var(--sp-5);
  border-top: 2px solid var(--ink);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--accent-ink);
}
.step h3 {
  margin: var(--sp-2) 0 var(--sp-2);
  font-size: 1.0625rem;
}
.step p {
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* —— Features 网格 ——————————————————————————————————————————————— */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  transition: border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feature:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.feature .ic {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: var(--sp-4);
}
.feature .ic svg {
  width: 20px;
  height: 20px;
}
.feature h3 {
  font-size: 1.0625rem;
  margin-bottom: var(--sp-2);
}
.feature p {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.feature .tag {
  display: block;
  margin-bottom: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--faint);
}

/* —— Showcase（请求 → diff → PR）——————————————————————————————— */
.showcase {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: var(--sp-7);
  align-items: center;
}
.showcase .code {
  font-size: var(--fs-mono);
}
.showcase ul.bullets {
  display: grid;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}
.bullets li {
  position: relative;
  padding-left: var(--sp-5);
  color: var(--muted);
  font-size: var(--fs-sm);
}
.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}
.bullets li b {
  color: var(--ink);
  font-weight: 600;
}

/* —— Pricing ——————————————————————————————————————————————————— */
.pricing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}
.price {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}
.price.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-card);
}
.price .plan {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}
.price .featured-tag {
  float: right;
  color: var(--accent-ink);
}
.price .amount {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  margin: var(--sp-3) 0 0;
}
.price .amount small {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--muted);
  letter-spacing: 0;
}
.price .plan-desc {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: var(--sp-2) 0 var(--sp-5);
}
.price ul.feats {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-sm);
}
.price .feats li {
  display: flex;
  gap: var(--sp-2);
  color: var(--ink-2);
}
.price .feats li svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 3px;
  color: var(--accent);
}
.price .btn {
  margin-top: auto;
}

/* —— CTA band ———————————————————————————————————————————————————— */
.cta-band {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--sp-9) var(--sp-7);
  position: relative;
  overflow: hidden;
}
.cta-band::after {
  /* 角落的微弱代码纸纹（径向绿光，克制） */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    60% 120% at 88% 12%,
    rgba(31, 157, 87, 0.32),
    transparent 62%
  );
  pointer-events: none;
}
.cta-band > * {
  position: relative;
}
.cta-band h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-h2);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: #fff;
}
.cta-band p {
  color: #c9cdd2;
  margin-top: var(--sp-3);
  max-width: 48ch;
}
.cta-band .hero-cta {
  margin-top: var(--sp-6);
}
.cta-band .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.cta-band .btn-ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* —— Footer ——————————————————————————————————————————————————— */
.footer {
  border-top: 1px solid var(--line);
}
.footer .wrap {
  padding-top: var(--sp-8);
  padding-bottom: var(--sp-7);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--sp-6);
}
.foot-brand p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-top: var(--sp-3);
  max-width: 30ch;
}
.foot-email {
  display: inline-flex;
  align-items: center;
  min-height: 40px; /* 点击区 */
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--accent-ink); /* 深绿，落在浅底上达 AA */
  transition: color var(--dur) var(--ease);
}
.foot-email:hover {
  color: var(--accent);
  text-decoration: underline;
}
.foot-col h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 var(--sp-3);
  font-weight: 500;
}
.foot-col a {
  display: inline-flex;
  align-items: center;
  min-height: 40px; /* 点击区：原 ~34px */
  color: var(--muted);
  font-size: var(--fs-sm);
  transition: color var(--dur) var(--ease);
}
.foot-col a:hover {
  color: var(--ink);
}
.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-label);
  color: var(--faint);
  font-family: var(--font-mono);
}

/* ============================================================================
   Hero diff 一次性揭示动效（JS 加 .js 到 <html>，加 .play 到 .code）
   无 JS / reduced-motion → 直出终态（下方 media query 兜底）。
   ========================================================================== */
.js .hero .code .cl,
.js .hero .code .code-foot .check {
  opacity: 0;
}
.js .hero .code .code-prompt .typed {
  border-right: 2px solid var(--accent);
}
/* 延迟由各元素的内联 --i 驱动（不写死行数，任意条数都错落） */
.hero .code.play .cl {
  animation: lineIn 0.34s var(--ease) both;
  animation-delay: calc(0.05s + var(--i, 0) * 0.085s);
}
.hero .code.play .code-foot .check {
  animation: lineIn 0.3s var(--ease) both;
  animation-delay: calc(0.5s + var(--i, 0) * 0.11s);
}
@keyframes lineIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 安全网：<head> 内联脚本若在 4s 内未能触发揭示（site.js 加载失败/出错），
   强制显示 diff 全部内容，杜绝「内容因 .js 隐藏后永久不可见」。 */
.reveal-fallback .hero .code .cl,
.reveal-fallback .hero .code .code-foot .check {
  opacity: 1 !important;
  animation: none !important;
}
.reveal-fallback .hero .code .code-prompt .typed {
  border-right: none;
}

/* ============================================================================
   响应式
   ========================================================================== */
@media (max-width: 960px) {
  :root {
    --gutter: 40px;
  }
  .hero .wrap {
    grid-template-columns: 1fr;
    gap: var(--sp-7);
  }
  .features,
  .pricing {
    grid-template-columns: repeat(2, 1fr);
  }
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
  .showcase {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }
  .foot-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6);
  }
  .foot-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  /* 行号槽在小屏收起：内容贴边、去 rail/编号，避免拥挤 */
  .block {
    padding-left: 0;
    border-left: none;
  }
  .block::before {
    display: none;
  }
  :root {
    --edge: 18px;
  }
  .wrap {
    padding-top: var(--sp-8);
    padding-bottom: var(--sp-8);
  }
  .nav-links {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav.open .nav-links {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: var(--sp-3) var(--edge);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }
  .nav.open .nav-links a {
    padding: var(--sp-3) 0;
    width: 100%;
  }
  .features,
  .pricing,
  .steps {
    grid-template-columns: 1fr;
  }
  .cta-band {
    padding: var(--sp-7) var(--sp-5);
  }
  .hero h1 {
    margin-top: var(--sp-4);
  }
  .cl {
    grid-template-columns: 32px 14px 1fr;
  }
}

/* 触发动效前的隐藏只在「支持动效」时生效；reduced-motion 直出终态 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .hero .code .cl,
  .js .hero .code .code-foot .check {
    opacity: 1;
  }
  .js .hero .code .code-prompt .typed {
    border-right: none;
  }
}
