/* =============================================================
   KIDI 首页视觉层
   [INPUT]: 依赖 site.css 的 :root 令牌与共享导航/页脚；依赖 i18n.js 与 landing.js
   [OUTPUT]: 提供首页八个区块的样式：hero 问答 / 知识库 / 机器人 / 四步 / 场景 / 数字 / 价格 / 联系
   [POS]: index.html 的唯一页面样式层；共享壳样式留在 site.css，不在此重复
   [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
   ============================================================= */

/* -------------------------------------------------------------
   1. 版式与基础件
   ------------------------------------------------------------- */
.home-hero { position: relative; background: var(--paper); }

.home-h1 {
  margin: 0;
  max-width: 11em;
  color: var(--ink);
  font-size: clamp(2.5rem, 4.2vw, 3.5rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.home-lead {
  margin: 20px 0 0;
  max-width: 33em;
  color: var(--ink-2);
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.65;
}

.home-h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.875rem, 3vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.home-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.section-head { max-width: 44rem; }
.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.875rem, 3vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.section-head p {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  line-height: 1.65;
}
.section-head--light h2 { color: #f7f3ea; }
.section-head--light p { color: #cfc8bc; }

/* 拉丁字母语种的主标题更紧凑，避免三行以上 */
:lang(en) .home-h1,
:lang(fr) .home-h1,
:lang(de) .home-h1,
:lang(es) .home-h1 {
  max-width: 15em;
  font-size: clamp(1.9rem, 2.65vw, 2.375rem);
  line-height: 1.12;
  letter-spacing: -0.028em;
}
:lang(ja) .home-h1,
:lang(ko) .home-h1,
:lang(ar) .home-h1 {
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  line-height: 1.25;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.btn-primary:hover { background: var(--bronze); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--bronze);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.18s ease;
}
.link-arrow svg { width: 18px; height: 18px; transition: transform 0.18s ease; }
.link-arrow:hover { color: var(--ink); }
.link-arrow:hover svg { transform: translateX(3px); }
:dir(rtl) .link-arrow svg { transform: scaleX(-1); }
:dir(rtl) .link-arrow:hover svg { transform: scaleX(-1) translateX(3px); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--bronze);
  outline-offset: 3px;
}
.how-band :focus-visible,
.robot-stage :focus-visible,
.plan-row--dark :focus-visible {
  outline-color: var(--bronze-3);
}

#knowledge, #bots, #how, #cases, #why, #pricing, #contact { scroll-margin-top: 84px; }

html { scroll-behavior: smooth; }

/* 滚动进入：无脚本可见，减少动态时不动 */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.1, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.1, 1);
  transition-delay: var(--d, 0ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* -------------------------------------------------------------
   2. Hero 问答舞台
   ------------------------------------------------------------- */
.chat-panel {
  padding: 22px;
  border-radius: 24px;
  background: #efece5;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.chat-head-title { color: var(--ink); font-size: 1rem; font-weight: 600; }
.chat-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--online);
  font-size: 0.875rem;
  white-space: nowrap;
}
.chat-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 0 16px;
}
.chat-msg {
  align-self: flex-end;
  max-width: 90%;
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px 18px 4px 18px;
  background: #ffffff;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}
.chat-msg time {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: end;
}
.chat-reply {
  align-self: flex-start;
  max-width: 94%;
  min-height: 6.4rem;
  margin: 0;
  padding: 16px 18px;
  border-radius: 18px 18px 18px 4px;
  background: var(--ink);
  color: #f7f3ea;
  font-size: 1rem;
  line-height: 1.6;
}
.chat-caret {
  display: none;
  width: 2px;
  height: 1.05em;
  margin-inline-start: 3px;
  vertical-align: -0.16em;
  background: var(--bronze-3);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.chat-sources {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.chat-asks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chat-asks button {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.chat-asks button:hover { background: #f7f5f0; color: var(--ink); }
.chat-asks button[aria-pressed="true"] { background: var(--bronze); color: #ffffff; }

/* -------------------------------------------------------------
   3. 知识库：九项能力 + 可操作的知识条目
   ------------------------------------------------------------- */
.feature-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feature-item {
  display: flex;
  gap: 16px;
  padding: 15px 0;
}
.feature-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f2f1ee;
  color: var(--bronze);
}
.feature-icon svg { width: 21px; height: 21px; }
.feature-item h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}
.feature-item p {
  margin: 7px 0 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.65;
}

.kb-panel {
  padding: 20px;
  border-radius: 24px;
  background: #ece9e2;
}
.kb-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.kb-panel-title { color: var(--ink); font-size: 1rem; font-weight: 600; }
.kb-learned {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--online);
  font-size: 0.875rem;
  white-space: nowrap;
}
.kb-learned i { width: 8px; height: 8px; border-radius: 50%; background: var(--online); }

.kb-card {
  padding: 20px;
  border-radius: 18px;
  background: #ffffff;
}
.kb-source { margin: 0 0 10px; color: var(--muted); font-size: 0.875rem; }
.kb-q {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}
.kb-a { margin: 0; color: var(--ink-2); font-size: 1rem; line-height: 1.65; }

.kb-extra { margin-top: 16px; }
.kb-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.kb-thumbs figure { margin: 0; }
.kb-thumbs img {
  display: block;
  width: 100%;
  height: 92px;
  border-radius: 10px;
  background: var(--paper-3);
  object-fit: cover;
}
.kb-thumbs figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}
.kb-facts { display: grid; gap: 8px; margin: 0; }
.kb-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.875rem;
  line-height: 1.45;
}
.kb-row dt { color: var(--muted); flex: none; }
.kb-row dd { margin: 0; color: var(--ink); font-weight: 500; text-align: end; }

.kb-controls { display: grid; grid-template-columns: 1fr; gap: 14px 12px; margin-top: 18px; }
@media (min-width: 640px) { .kb-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kb-group { display: grid; gap: 7px; }
.kb-group-label { color: var(--muted); font-size: 0.875rem; line-height: 1.3; }
.kb-options { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-option {
  min-height: 38px;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.kb-option:hover { background: #f7f5f0; color: var(--ink); }
.kb-option[aria-pressed="true"] { background: var(--ink); color: #ffffff; }

/* -------------------------------------------------------------
   4. 机器人：三种渠道 + 墨色对话台
   ------------------------------------------------------------- */
.robot-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  background: var(--stage);
  color: #efeae1;
}
.robot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #b8b0a3;
  font-size: 0.875rem;
}
.robot-channel { color: var(--bronze-3); font-size: 1rem; font-weight: 600; }
.robot-in {
  align-self: flex-start;
  max-width: 92%;
  margin: 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: #2b221a;
  color: #f4f0e7;
  font-size: 1rem;
  line-height: 1.6;
}
.robot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.robot-tag {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #cfc8bc;
  font-size: 0.875rem;
  line-height: 1.4;
}
.robot-out {
  align-self: flex-end;
  max-width: 94%;
  padding: 18px;
  border-radius: 16px;
  background: #f7f3ea;
  color: var(--ink);
}
.robot-out-label {
  display: block;
  margin-bottom: 8px;
  color: var(--bronze);
  font-size: 0.875rem;
  font-weight: 600;
}
.robot-out p { margin: 0; font-size: 1rem; line-height: 1.6; }
.robot-ref { margin-top: 10px !important; color: var(--muted); font-size: 0.875rem !important; }
.robot-link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  color: var(--bronze-3);
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.16s ease;
}
.robot-link svg { width: 17px; height: 17px; transition: transform 0.16s ease; }
.robot-link:hover { color: #ffffff; }
.robot-link:hover svg { transform: translateX(3px); }

.channel-card {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 16px;
  padding: 22px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.channel-card:hover { background: rgba(255, 255, 255, 0.55); }
.channel-card[aria-pressed="true"] { background: #ffffff; transform: translateY(-2px); }
.channel-body { display: block; }
.channel-title { display: block; font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
.channel-tags { display: block; margin-top: 5px; color: var(--bronze); font-size: 0.875rem; line-height: 1.4; }
.channel-desc { display: block; margin-top: 9px; color: var(--ink-2); font-size: 1rem; line-height: 1.6; }
.channel-card::after {
  content: "→";
  color: var(--bronze);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}
.channel-card:hover::after { transform: translateX(3px); }
.channel-card[aria-pressed="true"]::after { color: var(--ink); transform: translateX(3px); }
:dir(rtl) .channel-card::after { content: "←"; }
:dir(rtl) .channel-card:hover::after,
:dir(rtl) .channel-card[aria-pressed="true"]::after { transform: translateX(-3px); }

/* -------------------------------------------------------------
   5. 四步：一条消息从夜里走到明天
   ------------------------------------------------------------- */
.how-band {
  position: relative;
  overflow: hidden;
  background: var(--stage);
  color: #efeae1;
}
.how-clock {
  position: absolute;
  top: 40px;
  inset-inline-end: -80px;
  width: 380px;
  height: 380px;
  color: var(--bronze-3);
  opacity: 0.16;
  pointer-events: none;
}
.how-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 0;
  padding: 0;
  list-style: none;
}
.how-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}
.how-label { color: var(--bronze-3); font-size: 0.875rem; font-weight: 600; line-height: 1.4; }
.how-step .msg-card {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #f7f3ea;
  color: var(--ink);
}
.how-step .msg-card p { margin: 0; font-size: 1rem; line-height: 1.55; }
.how-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.875rem;
}
.how-meta strong { color: var(--bronze); font-weight: 600; }
.how-clause { margin: 0; color: #cfc8bc; font-size: 1rem; line-height: 1.6; }

/* -------------------------------------------------------------
   6. 场景：桌面账本表，窄屏卡片
   ------------------------------------------------------------- */
.case-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 1rem;
}
.case-table thead th {
  padding: 14px 20px;
  background: #eeece6;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: start;
  white-space: nowrap;
}
.case-table thead th:first-child { border-start-start-radius: 14px; border-end-start-radius: 14px; }
.case-table thead th:last-child { border-start-end-radius: 14px; border-end-end-radius: 14px; }
.case-table tbody tr { background: #ffffff; }
.case-table tbody th,
.case-table tbody td {
  padding: 20px;
  color: var(--ink-2);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  text-align: start;
  vertical-align: top;
}
.case-table tbody th { color: var(--ink); font-size: 1rem; font-weight: 600; white-space: nowrap; }
.case-table tbody th:first-child { border-start-start-radius: 14px; border-end-start-radius: 14px; }
.case-table tbody td:last-child { border-start-end-radius: 14px; border-end-end-radius: 14px; }
.case-effect { color: var(--bronze) !important; font-weight: 600 !important; }

.case-card {
  padding: 20px;
  border-radius: 16px;
  background: #ffffff;
}
.case-card h3 { margin: 0 0 14px; color: var(--ink); font-size: 1.25rem; font-weight: 600; }
.case-card dl { display: grid; gap: 12px; margin: 0; }
.case-card dt { color: var(--muted); font-size: 0.875rem; line-height: 1.4; }
.case-card dd { margin: 4px 0 0; color: var(--ink-2); font-size: 1rem; line-height: 1.55; }

/* -------------------------------------------------------------
   7. 数字
   ------------------------------------------------------------- */
.figure { display: flex; flex-direction: column; }
.figure-value {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(2.75rem, 4.2vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}
.figure-label { margin: 0 0 8px; color: var(--ink); font-size: 1.25rem; font-weight: 600; }
.figure-note { margin: 0; color: var(--ink-2); font-size: 1rem; line-height: 1.65; }

/* -------------------------------------------------------------
   8. 价格：五行版本，横排账本
   ------------------------------------------------------------- */
.plan-sheet { display: flex; flex-direction: column; gap: 10px; }
.plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 20px;
  padding: 22px;
  border-radius: 18px;
  background: #ffffff;
}
.plan-name h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}
.plan-name p { margin: 5px 0 0; color: var(--muted); font-size: 0.875rem; }
.plan-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bronze);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}
.plan-specs {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.plan-specs li { color: var(--ink-2); font-size: 1rem; line-height: 1.5; }
.plan-price {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: end;
  white-space: nowrap;
}
.plan-cta {
  display: inline-flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: #efece5;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.plan-cta:hover { background: var(--bronze); color: #ffffff; }
.plan-row--recommended { background: #f5f2ee; }
.plan-cta--solid { background: var(--ink); color: #ffffff; }
.plan-cta--solid:hover { background: var(--bronze); }
.plan-row--dark { background: var(--stage); }
.plan-row--dark .plan-name h3,
.plan-row--dark .plan-price { color: #f7f3ea; }
.plan-row--dark .plan-name p,
.plan-row--dark .plan-specs li { color: #cfc8bc; }
.plan-cta--light { background: #f7f3ea; color: var(--ink); }
.plan-cta--light:hover { background: var(--bronze-3); color: var(--ink); }

/* -------------------------------------------------------------
   9. 联系
   ------------------------------------------------------------- */
.contact-label { margin: 0 0 8px; color: var(--muted); font-size: 0.875rem; }
.contact-value {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  font-weight: 600;
  line-height: 1.4;
}
.contact-value a { color: inherit; text-decoration: none; }
.contact-value a:hover { color: var(--bronze); text-decoration: underline; text-underline-offset: 4px; }

.contact-card { margin: 0; }
.contact-card > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 24px;
  background: var(--paper-2);
  object-fit: cover;
}
.contact-qr {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -44px 22px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #ffffff;
}
.contact-qr img { display: block; width: 72px; height: 72px; flex: none; }
.contact-qr-label { margin: 0 0 4px; color: var(--ink); font-size: 1rem; font-weight: 600; }
.contact-qr-note { margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

/* -------------------------------------------------------------
   10. 响应式
   ------------------------------------------------------------- */
@media (min-width: 768px) {
  .how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .how-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .plan-row {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr) minmax(0, 0.62fr) auto;
    align-items: center;
    gap: 28px;
    padding: 24px 28px;
  }
  .plan-specs { grid-column: auto; }
  .plan-price { grid-column: auto; }
  .plan-cta { grid-column: auto; }
}

@media (max-width: 640px) {
  .how-clock { display: none; }
  .chat-panel { padding: 16px; border-radius: 20px; }
  .chat-msg, .chat-reply { max-width: 100%; }
  .kb-panel { padding: 16px; border-radius: 20px; }
  .contact-qr { margin: -32px 12px 0; padding: 12px; }
  .contact-qr img { width: 60px; height: 60px; }
}

/* -------------------------------------------------------------
   11. 减少动态
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .chat-caret { display: none !important; animation: none; }
  .btn-primary:hover,
  .channel-card[aria-pressed="true"],
  .link-arrow:hover svg,
  .robot-link:hover svg { transform: none; }
  .site-footer-art { animation: none; }
}

/* 渠道切换时回复气泡的入场 */
.robot-out.is-flash { animation: robot-reply 0.32s ease; }
@keyframes robot-reply {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .robot-out.is-flash { animation: none; }
}

@media (min-width: 1024px) and (min-height: 860px) {
  .kb-panel { position: sticky; top: 96px; }
}
