/* ==========================================================================
   动效层 · motion.css
   --------------------------------------------------------------------------
   2026 年移动端与后台的共识是：动效要么在解释状态，要么干脆不要。
   所以这一层只做四件事，全部只跑一次、全部可被 reduced-motion 关掉：
   1. 进入：区块依次上浮 8px，不缩放、不弹；
   2. 变化：进度环补位、号序票根呼吸一次、按钮按下沉 1px；
   3. 数据：后台折线描一次线（首次进入，不重复）；
   4. 定位：表格表头粘住、行悬停 160ms。

   刻意没做：滚动视差、循环呼吸、每次进页面都重播的图表动画。
   那些是噪音，不是动效。
   ========================================================================== */

/* ---------- 1. 进入 ---------- */
@keyframes m-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.js .stagger > * {
  animation: m-rise 420ms var(--ease) both;
}
.js .stagger > *:nth-child(1) {
  animation-delay: 40ms;
}
.js .stagger > *:nth-child(2) {
  animation-delay: 90ms;
}
.js .stagger > *:nth-child(3) {
  animation-delay: 140ms;
}
.js .stagger > *:nth-child(4) {
  animation-delay: 190ms;
}
.js .stagger > *:nth-child(5) {
  animation-delay: 240ms;
}
.js .stagger > *:nth-child(n + 6) {
  animation-delay: 280ms;
}

/* 页面切换：整屏淡入，像翻一页，而不是"加载" */
@keyframes m-page {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.js .phone,
.js .shell {
  animation: m-page 260ms var(--ease) both;
}

/* ---------- 2. 进度环补位（报告提交后 0→100 看得见） ---------- */
@property --p {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}
.js .ring {
  transition: --p 620ms var(--ease);
}

/* 号序票根：只在"接近叫号"时呼吸一次，不循环 */
@keyframes m-breathe {
  0% {
    box-shadow: 0 0 0 0 rgba(201, 138, 60, 0.34);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(201, 138, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(201, 138, 60, 0);
  }
}
.ticket__wait.is-near::before {
  animation: m-breathe 1.8s var(--ease-io) 1;
}

/* 提交成功：对勾描出来 */
@keyframes m-check {
  from {
    stroke-dashoffset: 26;
  }
  to {
    stroke-dashoffset: 0;
  }
}
.done__ic svg path {
  stroke-dasharray: 26;
  stroke-dashoffset: 0;
}
.js .done.in .done__ic svg path {
  animation: m-check 520ms var(--ease) 180ms both;
}

/* ---------- 3. 数据：折线描一次 ---------- */
@keyframes m-draw {
  from {
    stroke-dashoffset: 1400;
  }
  to {
    stroke-dashoffset: 0;
  }
}
.js .chart path[stroke]:not([stroke='none']) {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: m-draw 900ms var(--ease) 120ms forwards;
}
.js .chart path[fill^='url'] {
  opacity: 0;
  animation: m-page 700ms var(--ease) 420ms forwards;
}
.js .spark path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: m-draw 700ms var(--ease) 200ms forwards;
}

/* ---------- 4. 定位与反馈 ---------- */
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(6px);
}
.tbl tbody tr {
  transition:
    background 160ms var(--ease),
    box-shadow 160ms var(--ease);
}

/* KPI 不做位移，只加深边界：位移是装饰，边界是信息 */
.kpi {
  transition:
    border-color 200ms var(--ease),
    box-shadow 200ms var(--ease);
}
.kpi:hover {
  transform: none;
  border-color: var(--line-3);
  box-shadow: 0 6px 18px -14px rgba(40, 33, 20, 0.4);
}

/* 行点击的"按下去"感，统一 1px */
.row:active,
.opt:active,
.entry:active,
.pt:active {
  transform: translateY(1px);
}

/* ---------- 5. 聊天：内容从底部生长，选项贴着输入条 ---------- */
.phone > .chat {
  flex: 1 1 auto;
}
.chat > .msg:first-child,
.chat > .ctx + .msg,
.chat > .daymark + .msg {
  margin-top: auto;
}
.daymark {
  align-self: center;
  padding: 4px 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.phone .quick {
  padding-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .js .stagger > *,
  .js .phone,
  .js .shell,
  .js .chart path,
  .js .spark path,
  .js .done.in .done__ic svg path,
  .ticket__wait.is-near::before {
    animation: none !important;
  }
  .js .chart path[fill^='url'] {
    opacity: 1;
  }
  .js .chart path[stroke]:not([stroke='none']),
  .js .spark path {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
}
