/* =========================================================
   components.css — 通用组件
   按钮 / 卡片 / 标签 / 表单 / 弹窗 / 轮播 / 时间轴 / 标签页 / 提示
   ========================================================= */

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 12px 24px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; line-height: 1;
  border: 1px solid transparent; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .12s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary { background: var(--brand-600); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-700); box-shadow: var(--shadow-2); }
.btn--ghost { background: transparent; color: var(--brand-600); border-color: var(--border-2); }
.btn--ghost:hover { border-color: var(--brand-600); background: var(--brand-50); }
.btn--light { background: #fff; color: var(--brand-ink); }
.btn--light:hover { background: var(--brand-50); }
.btn--sm { padding: 9px 18px; font-size: 14px; }
.btn--lg { padding: 15px 32px; font-size: 16px; }
.btn--block { width: 100%; }

/* 文字链接 */
.link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand-600); font-weight: 600; font-size: 15px;
}
[data-theme="dark"] .link { color: var(--brand-500); }
.link svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.link:hover svg { transform: translateX(3px); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--border-2); }
.card__icon {
  width: 46px; height: 46px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
  margin-bottom: var(--sp-4);
}
.card__icon svg { width: 22px; height: 22px; }
.card__title { font-size: 18px; font-weight: 600; margin-bottom: var(--sp-2); }
.card__desc { font-size: 15px; color: var(--text-2); }
.card__foot { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }

/* ---------------- 标签 / 徽标 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2);
}
.tag--brand { background: var(--brand-50); color: var(--brand-600); }
.tag--accent { background: var(--accent-50); color: var(--accent-600); }
[data-theme="dark"] .tag--accent { color: var(--accent-500); }

/* ---------------- 标签页筛选 ---------------- */
.tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
.tab {
  padding: 9px 20px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all .2s var(--ease);
}
.tab:hover { border-color: var(--brand-300); color: var(--brand-600); }
.tab[aria-selected="true"] { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
/* 表单纵向节奏：.stack 目前只用于表单，字段之间统一留气 */
form.stack { gap: var(--sp-4); }
form.stack > .form__note,
form.stack > .form__status { margin-top: 0; }
.field__label { font-size: 14px; font-weight: 600; }
.field__label .req { color: var(--danger-500); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 15px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50);
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%237C8896' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  padding-right: 38px;
}
.select:disabled { background-color: var(--surface-2); cursor: not-allowed; }
.field__hint { font-size: 13px; color: var(--text-3); }
.field__error { font-size: 13px; color: var(--danger-500); display: none; }
.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea { border-color: var(--danger-500); }
.field.is-invalid .field__error { display: block; }

/* 单选按钮组 */
.radio-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span {
  display: block; padding: 10px 18px; border-radius: var(--r-pill);
  border: 1px solid var(--border-2); font-size: 14px; cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover span { border-color: var(--brand-300); }
.chip input:checked + span { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.chip input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.form__note { font-size: 13px; color: var(--text-3); margin-top: var(--sp-3); }
.form__status { margin-top: var(--sp-3); font-size: 14px; display: none; }
.form__status.is-show { display: block; }
.form__status--ok { color: var(--success-500); }
.form__status--err { color: var(--danger-500); }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: var(--sp-5);
  background: rgba(30, 20, 12, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s var(--ease);
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__panel {
  background: var(--surface); border-radius: var(--r-lg);
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  padding: var(--sp-6);
  transform: translateY(16px) scale(.98);
  transition: transform .25s var(--ease);
  position: relative;
}
.modal.is-open .modal__panel { transform: none; }
.modal__panel:focus { outline: none; }
.modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-3);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__close svg { width: 18px; height: 18px; }
body.is-locked { overflow: hidden; }

/* 加老师微信弹窗（提交成功后 / 停留 60 秒自动弹出，共用一块） */
.modal--wx { z-index: 130; }
.modal__panel--wx { width: min(420px, 100%); text-align: center; }
.wx { display: grid; justify-items: center; }
.wx__eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--brand-600);
}
.wx__eyebrow svg { width: 15px; height: 15px; }
.wx h2 { margin-top: 10px; }
.wx__lead { margin-top: 8px; font-size: 14.5px; line-height: 1.72; color: var(--text-2); max-width: 23em; }
.wx__qr {
  margin-top: var(--sp-5); padding: 12px 12px 10px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: #fff;
}
.wx__qr img { width: 200px; height: 200px; display: block; }
.wx__qr figcaption { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.wx__alt { margin-top: var(--sp-4); font-size: 12.5px; color: var(--text-3); }
.wx__alt a { color: var(--brand-600); border-bottom: 1px solid currentColor; }
.wx .btn { margin-top: var(--sp-5); }
@media (max-width: 560px) {
  .modal__panel--wx { padding: var(--sp-5) var(--sp-4); }
  .wx__qr img { width: 180px; height: 180px; }
  .wx__lead { font-size: 14px; }
}

/* ---------------- 案例滚动带（横向无缝循环，零依赖） ----------------
   没有 JS 时就是一条可横滑的 scroll-snap 列表（内容不会被藏掉）；
   JS 复制一整组卡片、算好一轮时长后才加 .is-ready 切到动画模式。
   ⚠️ 间距必须用 margin-right 而不是 flex 的 gap —— 动画走 translateX(-50%)，
       gap 会让「一半」比一组卡片少半个间距（1160 变 1152），接缝处会跳一下。 */
.carousel { position: relative; }
.carousel__track {
  display: flex;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: var(--sp-2);
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide { flex: 0 0 auto; scroll-snap-align: start; margin-right: var(--sp-4); }

/* 动画模式：轨道按内容撑开（max-content），-50% 才等于「一组」的宽度 */
.carousel.is-ready { overflow: hidden; padding-block: 4px 6px; margin-block: -4px -6px; }
.carousel.is-ready .carousel__track {
  width: max-content; overflow: visible;
  scroll-snap-type: none; padding-bottom: 0;
  animation: caseMarquee var(--mq-dur, 40s) linear infinite;
  will-change: transform;
}
.carousel.is-ready:hover .carousel__track,
.carousel.is-ready:focus-within .carousel__track { animation-play-state: paused; }
@keyframes caseMarquee { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

/* 减弱动效：不跑动画，退回可横滑 + 去掉复制出来的那一组 */
@media (prefers-reduced-motion: reduce) {
  .carousel.is-ready { overflow: visible; padding-block: 0; margin-block: 0; }
  .carousel.is-ready .carousel__track {
    width: auto; overflow-x: auto; animation: none;
    scroll-snap-type: x mandatory; padding-bottom: var(--sp-2);
  }
  .carousel.is-ready .carousel__slide[aria-hidden="true"] { display: none; }
}

/* ---------------- 数据统计 ---------------- */
.stat { text-align: center; }
.stat__num {
  font-family: var(--font-num); font-weight: 700;
  font-size: clamp(30px, 4vw, 46px); line-height: 1;
  color: var(--brand-600); font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .stat__num { color: var(--brand-500); }
.stat__unit { font-size: 18px; font-weight: 600; margin-left: 2px; }
.stat__label { margin-top: var(--sp-2); font-size: 14px; color: var(--text-2); }

/* ---------------- 合作伙伴滚动墙 ---------------- */
.marquee { overflow: hidden; position: relative; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__inner { display: flex; gap: var(--sp-6); width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee__inner { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee__inner { animation: none; } }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 200;
  transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 12px 22px; border-radius: var(--r-pill);
  font-size: 14px; box-shadow: var(--shadow-2);
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s var(--ease);
}
.toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------------- 回到顶部 ---------------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand-600); color: var(--on-brand);
  display: grid; place-items: center;
  box-shadow: var(--shadow-2);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all .25s var(--ease);
}
.to-top.is-show { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 18px; height: 18px; }

/* ---------------- 主题切换 ---------------- */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------------- 面包屑 ---------------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: 13px; color: var(--text-3); }
.crumbs a:hover { color: var(--brand-600); }
.crumbs li { display: flex; align-items: center; gap: var(--sp-2); }
.crumbs li + li::before { content: "/"; color: var(--border-2); }

/* ---------------- 分页 ---------------- */
.pager { display: flex; justify-content: center; align-items: center; gap: var(--sp-2); margin-top: var(--sp-7); }
.pager__btn {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); font-size: 14px; color: var(--text-2);
  display: grid; place-items: center; transition: all .2s var(--ease);
}
.pager__btn:hover { border-color: var(--brand-300); color: var(--brand-600); }
.pager__btn.is-current { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.pager__btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------------- 折叠问答 ---------------- */
.acc { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.acc__item + .acc__item { border-top: 1px solid var(--border); }
.acc__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); text-align: left;
  font-size: 16px; font-weight: 600;
}
.acc__head:hover { background: var(--bg-soft); }
.acc__head svg { width: 16px; height: 16px; flex: none; transition: transform .25s var(--ease); color: var(--text-3); }
.acc__head[aria-expanded="true"] svg { transform: rotate(180deg); }
.acc__panel { padding: 0 var(--sp-5) var(--sp-5); font-size: 15px; color: var(--text-2); display: none; }
.acc__panel.is-open { display: block; }
