/* ==========================================================================
   动效层 (motion)
   --------------------------------------------------------------------------
   硬约束（来自 Issue 验收标准）：
     AC7  滚动进场：进入视口时淡入上移，位移 ≤24px，时长 ≤600ms，只播一次
     AC8  交互态：hover 有过渡，焦点环可见
     AC9  prefers-reduced-motion: reduce 下全部降级为无动画
     AC10 不引入布局抖动：加动效前后 scrollHeight 必须逐页相同

   两条关键实现决策（都是踩过坑之后的结论，改动前请先读）
   --------------------------------------------------------
   1. 进场位移用独立的 translate 属性，不用 transform。
      transform 要留给卡片 hover 用；两者是不同属性，可叠加不互覆盖。

   2. 进场用 @keyframes animation，不用 transition。
      这是本轮修正的一个真实缺陷：`transition` 是简写属性，
      `.motion-ready .reveal.is-visible`（三选择器）写 transition 会以更高
      优先级整体覆盖掉 `.home-service-card`（一选择器）的
      `transition: transform ...`，导致 hover 位移瞬间到位、没有过渡。
      animation 与 transition 是两套机制、互不干扰，这样卡片 hover 的
      transform 过渡才能保住。

   另：本文件不含 `position: sticky/fixed` 相关规则 —— 全站头部是
   position:relative（非吸顶），滚动状态样式没有意义，已移除。
   ========================================================================== */

/* ---------- 滚动进场 ---------- */

.motion-ready .reveal {
  opacity: 0;
  translate: 0 24px;
}

.motion-ready .reveal.is-visible {
  animation: reveal-in 520ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes reveal-in {
  from {
    opacity: 0;
    translate: 0 24px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* 同一组内的元素按顺序轻微错开，读起来有节奏而不是一起弹出来 */
.motion-ready .reveal[data-reveal-delay="1"] { animation-delay: 70ms; }
.motion-ready .reveal[data-reveal-delay="2"] { animation-delay: 140ms; }
.motion-ready .reveal[data-reveal-delay="3"] { animation-delay: 210ms; }
.motion-ready .reveal[data-reveal-delay="4"] { animation-delay: 280ms; }
.motion-ready .reveal[data-reveal-delay="5"] { animation-delay: 350ms; }

/* ---------- 交互态：hover 过渡（AC8） ---------- */

.button,
.nav-contact,
.circle-arrow,
.home-service-card,
.home-scenario-grid > a,
.gb-card,
.gs10-plan-card,
.gs11-track {
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease,
    color 180ms ease, border-color 180ms ease;
}

@media (hover: hover) {
  .home-service-card:hover,
  .home-scenario-grid > a:hover,
  .gb-card:hover {
    transform: translateY(-3px);
  }

  .button:hover,
  .nav-contact:hover {
    transform: translateY(-1px);
  }

  .home-service-card:hover .circle-arrow,
  .home-scenario-grid > a:hover .circle-arrow {
    transform: translate(2px, -2px);
  }

  /* 图片在卡片放大时轻微推进，给出景深而不是整块平移 */
  .home-service-card img,
  .home-scenario-grid > a img {
    transition: transform 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .home-service-card:hover img,
  .home-scenario-grid > a:hover img {
    transform: scale(1.03);
  }
}

/* ---------- 键盘焦点：必须看得见（AC8 / AC12） ----------
 * 双色焦点环：内环金色（深色底上醒目），外环深棕（浅色底上醒目）。
 * 单色行不通 —— 品牌金 #E2C16F 对白底只有 1.74:1，达不到 WCAG 1.4.11 的 3:1；
 * 而深棕对深色 section 又几乎不可见。两层叠加后两种底色上都清晰。
 * 注意：这里 **不设 border-radius** —— 那会把胶囊按钮（99px）和卡片（26px）
 * 在聚焦瞬间改成方块。
 */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(10, 46, 98, 0.55);
}

/* ---------- 降级：所有动效归零（AC9） ---------- */

@media (prefers-reduced-motion: reduce) {
  .motion-ready .reveal {
    opacity: 1;
    translate: 0 0;
    animation: none;
  }

  .motion-ready .reveal.is-visible {
    animation: none;
  }

  .button,
  .nav-contact,
  .circle-arrow,
  .home-service-card,
  .home-scenario-grid > a,
  .gb-card,
  .gs10-plan-card,
  .gs11-track,
  .home-service-card img,
  .home-scenario-grid > a img {
    transition: none;
  }

  @media (hover: hover) {
    .home-service-card:hover,
    .home-scenario-grid > a:hover,
    .gb-card:hover,
    .button:hover,
    .nav-contact:hover,
    .home-service-card:hover .circle-arrow,
    .home-scenario-grid > a:hover .circle-arrow,
    .home-service-card:hover img,
    .home-scenario-grid > a:hover img {
      transform: none;
    }
  }
}
