/* ============================================================================
 * R112 · 界面交互流畅度（悬停 / 按压 / 切换）
 * ----------------------------------------------------------------------------
 * 目标：鼠标扫过按钮、任务行、卡片时有连续的过渡；按下有即时反馈；
 *      只过渡颜色/阴影/位移等合成属性，不过渡 width/height/padding 等布局属性，
 *      避免悬停时文字重排、行高跳动。
 * 载入顺序：放在所有主题样式之后（index.html 最后一个 <link>），统一覆盖。
 * ========================================================================== */

:root {
  --ui-ease: cubic-bezier(.2, .65, .3, 1);
  --ui-ease-out: cubic-bezier(.16, 1, .3, 1);
  --ui-t-fast: 120ms;
  --ui-t: 180ms;
  --ui-t-slow: 240ms;
}

/* ------------------------------------------------------------ 基础交互元素 */
button,
a,
summary,
label,
tr,
[role="button"],
.btn,
.tab,
.nav-item,
.flow-card,
.plug-card,
.search-hit,
.file-drop,
.auto-round,
.auto-create,
.auto-card,
.auto-tpl,
.auto-tpl-go,
.auto-link,
.home-act,
.home-new,
.home-more-toggle,
.home-more-item,
.home-sec-head,
.home-sec-more,
.home-task,
.home-logout,
.gh-recognize-act,
.gh-notice-reset,
.gh-tab,
.gh-chip,
.gh-mini,
.gh-cite,
.gh-plus,
.gh-send,
.gh-history-row,
.gh-file button,
.zside-act,
.zside-icon-btn,
.zside-filter-item,
.zside-project,
.zside-group-head,
.zside-task-row,
.zside-task,
.zside-task-act,
.zside-more,
.zside-ico,
.zside-account,
.zside-search input,
.login-field input,
.plug-go,
.input,
.select,
.textarea {
  transition:
    background-color var(--ui-t-fast) var(--ui-ease),
    color var(--ui-t-fast) var(--ui-ease),
    border-color var(--ui-t-fast) var(--ui-ease),
    box-shadow var(--ui-t) var(--ui-ease),
    opacity var(--ui-t-fast) var(--ui-ease),
    transform var(--ui-t-fast) var(--ui-ease);
}

/* 触屏：去掉 300ms 点击延迟与系统灰色高亮，按压反馈由 :active 提供 */
button,
a,
summary,
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------ 按压反馈 */
.btn:active:not(:disabled),
.gh-tab:active,
.gh-chip:active,
.gh-plus:active,
.gh-send:active:not(:disabled),
.gh-mini:active,
.home-act:active,
.zside-icon-btn:active,
.zside-ico:active,
.zside-task-act:active,
.zside-filter-item:active,
.auto-round:active,
.auto-create:active {
  transform: scale(.97);
  transition-duration: 60ms;
}

.plug-card:active,
.flow-card:active,
.auto-card:active,
.auto-tpl:active {
  transform: scale(.99);
  transition-duration: 70ms;
}

/* 整行元素不做缩放（避免文字发虚），用底色回应按下 */
.zside-act:active,
.zside-project:active,
.zside-group-head:active,
.zside-more:active,
.home-task:active,
.gh-history-row:active {
  transform: scale(.985);
  transition-duration: 60ms;
}

.zside-task:active { background: rgba(200, 16, 46, .06); }
.zside-task-row.is-active .zside-task:active { background: rgba(200, 16, 46, .08); }
.home-task:active,
.gh-history-row:active { background: #e9edf3; }

/* ------------------------------------------------------------ 悬停抬升（卡片 / 标签） */
.gh-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(23, 43, 77, .09);
}

/* ------------------------------------------------------------ 首页分类标签：白色胶囊滑动切换 */
.gh-tabs {
  position: relative;
  isolation: isolate;
}
.gh-tab {
  position: relative;
  z-index: 1;
  background: transparent;
}
.gh-tab.is-active:hover { background: transparent; }

.gh-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  z-index: 0;
  width: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 43, 77, .12);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--ui-t-slow) var(--ui-ease-out),
    width var(--ui-t-slow) var(--ui-ease-out),
    opacity var(--ui-t-fast) linear;
}
.gh-tabs.is-ready .gh-tab-indicator { opacity: 1; }
/* 指示器就位前保留白色底，避免首帧没有选中态 */
.gh-tab.is-active {
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 43, 77, .12);
}
.gh-tabs.is-ready .gh-tab.is-active {
  background: transparent;
  box-shadow: none;
}

/* 分类切换时常用任务淡入（不改变布局，动画结束后不占位） */
.gh-chip { animation: ui-chip-in var(--ui-t) var(--ui-ease-out); }
@keyframes ui-chip-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ 侧栏任务行：悬停不再挤压标题 */
.zside-task .meta { transition: opacity var(--ui-t-fast) linear; }

/* ------------------------------------------------------------ 键盘可达性 */
:where(button, a, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid rgba(200, 16, 46, .55);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ 降低动态效果 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .gh-chip:hover { transform: none; }
}
