/* Siqvex 支付页 0.2 在产品页样式之上 只有亮色
   左边商品和金额 右边支付方式 合计金额最大 主按钮在支付方式下面
   预览和真实订单靠订单号那一行区分 读取时不整块消失 只把旧内容压暗 数字变了轻轻落位 */

.checkout { padding-top: 56px; padding-bottom: 96px; }

.checkout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}
.checkout h1 {
  font-size: clamp(36px, 4.6vw, 56px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -.025em;
}

/* 读取中的那句话 前面一个转圈 读完淡出 */
#checkout-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  font-size: 16px;
  color: var(--muted);
  transition: opacity var(--t-color) var(--ease-out);
}
#checkout-status:empty { opacity: 0; }
#checkout-root[aria-busy="true"] #checkout-status:not(:empty)::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: checkout-spin 720ms linear infinite;
}
@keyframes checkout-spin { to { transform: rotate(360deg); } }

/* 错误 高度连续展开 出现时红字轻晃 */
.checkout-error-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-size) var(--ease-in-out);
}
.checkout-error-wrap:has(#checkout-error:not(:empty)) { grid-template-rows: 1fr; }
#checkout-error {
  min-height: 0;
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #b42318;
}
#checkout-error:not(:empty) {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef3f2;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #fecdca;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 32px;
}

.checkout-card {
  min-width: 0;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius-outer);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 2px rgb(40 55 80 / .04),
    0 8px 24px -12px rgb(40 55 80 / .1);
}
.checkout-card h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; }

/* 商品卡片 读取时一直占位 第一次是灰条 刷新时旧内容压暗 不整块消失
   脚本给它加hidden 这里只在确实出错 页面不再忙时才真正隐藏 */
#checkout-summary[hidden] { display: block !important; }
#checkout-root[aria-busy="false"] #checkout-summary[hidden] { display: none !important; }
.checkout-summary > * { transition: opacity var(--t-color) var(--ease-out); }
#checkout-root[aria-busy="true"] .checkout-summary > * { opacity: .55; }

.checkout-summary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

/* 状态标签 预览是灰色描边 订单按状态上色 颜色依赖checkout.js写的data-state */
.checkout-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
}
.checkout-state:empty { display: none; }
.checkout-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}
.checkout-state[data-state="unpaid"] { color: #b54708; background: #fffaeb; box-shadow: inset 0 0 0 1px #fedf89; }
.checkout-state[data-state="partial"] { color: #175cd3; background: #eff8ff; box-shadow: inset 0 0 0 1px #b2ddff; }
.checkout-state[data-state="paid"] { color: var(--accent); background: #effaf8; box-shadow: inset 0 0 0 1px #b7e6df; }
.checkout-state[data-state="cancelled"] { color: var(--faint); }

.checkout-product {
  margin: 20px 0 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* 金额列表 每行左名右值 合计单独一大行 */
.checkout-lines { margin: 24px 0 0; }
.checkout-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.5;
}
.checkout-line dt { color: var(--muted); }
.checkout-line dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.checkout-line-number dd { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; letter-spacing: .02em; }
.checkout-line-total {
  align-items: center;
  margin-top: 8px;
  padding: 20px 0 8px;
  border-top: 1px solid var(--text);
}
.checkout-line-total dt { font-size: 18px; font-weight: 600; color: var(--text); }
.checkout-line-total dd { font-size: 36px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.checkout-line-due dd { font-size: 20px; font-weight: 600; }

/* 预览 外框换成虚线 订单号那一行出现时就是真实订单 用实线 */
.checkout-summary:not(:has(#checkout-number-row:not([hidden]))) {
  box-shadow: none;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box;
  outline: 1.5px dashed #c9d2dd;
  outline-offset: -1.5px;
}

/* 第一次读取 还没有内容的地方画成灰条 轻轻扫光 */
#checkout-root[aria-busy="true"] .checkout-product:empty,
#checkout-root[aria-busy="true"] .checkout-line dd:empty {
  display: block;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef1f5 25%, #f6f8fa 50%, #eef1f5 75%) 0 0 / 200% 100%;
  animation: checkout-shimmer 1200ms var(--ease-in-out) infinite;
}
#checkout-root[aria-busy="true"] .checkout-product:empty { width: 60%; height: 32px; }
#checkout-root[aria-busy="true"] .checkout-line dd:empty { width: 88px; }
#checkout-root[aria-busy="true"] .checkout-line-total dd:empty { width: 140px; height: 40px; }
#checkout-root[aria-busy="true"] .checkout-summary:has(.checkout-product:empty) > * { opacity: 1; }
@keyframes checkout-shimmer { to { background-position: -200% 0; } }

.checkout-airwallex:not([hidden]) {
  margin-top: 20px;
  min-width: 0;
}
.checkout-airwallex iframe { max-width: 100%; }
@keyframes checkout-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.checkout-note {
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

/* 登录和刷新 */
.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.checkout-signin:not([hidden]) { display: inline-flex; animation: checkout-reveal var(--t-enter) var(--ease-strong) backwards; }
.checkout-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition:
    color var(--t-color) var(--ease-out),
    background-color var(--t-color) var(--ease-out),
    transform var(--t-press) var(--ease-strong);
}
@media (hover: hover) {
  .checkout-refresh:hover:not(:disabled) { color: var(--text); background: rgb(16 23 35 / .05); }
}
.checkout-refresh:active:not(:disabled) { transform: scale(.97); }
.checkout-refresh:disabled { cursor: default; }
.checkout-refresh-icon { width: 16px; height: 16px; }
/* 读取中图标转圈 读完转完这一圈再停 */
#checkout-root[aria-busy="true"] .checkout-refresh-icon { animation: checkout-spin 720ms linear infinite; }

/* 联系和导航 */
.checkout-contact {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  color: var(--faint);
}
.checkout-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 8px;
}
.checkout-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  transition: color var(--t-color) var(--ease-out);
}
.checkout-links a::after {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 1.6px solid currentColor;
  border-right: 1.6px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--t-press) var(--ease-strong);
}
@media (hover: hover) {
  .checkout-links a:hover { color: var(--muted); }
  .checkout-links a:hover::after { transform: translateX(2px) rotate(45deg); }
}

/* 数字和状态变了的那一下 由checkout-view.js加上 */
.checkout-changed { animation: checkout-settle 280ms var(--ease-strong); }
@keyframes checkout-settle {
  from { opacity: .3; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.checkout-shake { animation: checkout-shake 240ms var(--ease-in-out); }
@keyframes checkout-shake {
  0%, 100% { transform: none; }
  30% { transform: translateX(-4px); }
  65% { transform: translateX(3px); }
}

.rise-3 { animation-delay: calc(var(--boot) + 120ms); }

@supports (corner-shape: superellipse(1.25)) {
  .checkout-card, #checkout-error { corner-shape: superellipse(1.25); }
}

@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .checkout { padding-top: 32px; padding-bottom: 72px; }
  .checkout-layout { margin-top: 24px; }
  .checkout-card { padding: 24px 20px; border-radius: 16px; }
  .checkout-product { font-size: 24px; }
  .checkout-line-total dd { font-size: 32px; }
  .checkout-actions > * { flex: 1 1 0; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  #checkout-root[aria-busy="true"] #checkout-status:not(:empty)::before,
  #checkout-root[aria-busy="true"] .checkout-refresh-icon,
  #checkout-root[aria-busy="true"] .checkout-product:empty,
  #checkout-root[aria-busy="true"] .checkout-line dd:empty { animation: none; }
  .checkout-error-wrap, .checkout-summary > *, .checkout-refresh, .checkout-links a, .checkout-links a::after { transition: none; }
  .checkout-airwallex:not([hidden]), .checkout-signin:not([hidden]) { animation: fade var(--t-fade) var(--ease-out) backwards; }
  .checkout-changed, .checkout-shake { animation: none; }
  .checkout-refresh:active:not(:disabled) { transform: none; }
}

/* 像素背景 没有顶栏底栏 页面只剩支付本身 背景用像素小物撑一点气氛
   角落是有序抖动点阵 里面几颗点轮流亮成强调色 边上金币 银行卡 锁 一格一格上下跳
   全部在内容后面 卡片是白底 叠上去不影响阅读 不用脚本 */
.checkout-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  animation: fade 600ms var(--ease-out) var(--boot) backwards;
}
.checkout { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; padding-top: clamp(56px, 11vh, 120px); }

.px, .px-dither { position: absolute; display: block; image-rendering: pixelated; }
.px-dither { width: 432px; height: 432px; }
.px-dither-tr { top: 0; right: 0; transform: scaleX(-1); }
.px-dither-bl { bottom: 0; left: 0; transform: scaleY(-1); }
.px-tw { fill: var(--accent); opacity: 0; animation: px-tw 5.6s steps(1) calc(var(--i) * 400ms) infinite; }

.px-coin { width: 72px; top: 18%; left: max(24px, calc(50% - 680px)); }
.px-lock { width: 60px; bottom: 12%; left: max(48px, calc(50% - 650px)); }
.px-card { width: 96px; top: 50%; right: max(16px, calc(50% - 712px)); }
.px-spark { width: 20px; }
.px-spark-1 { top: calc(18% - 28px); left: calc(max(24px, calc(50% - 680px)) + 76px); }
.px-spark-2 { top: calc(50% + 80px); right: calc(max(16px, calc(50% - 712px)) + 64px); }
.px-spark-3 { top: 9%; right: 22%; }

.px-coin, .px-lock, .px-card { animation: px-bob 2.4s steps(1) infinite; }
.px-lock { animation-delay: -.8s; }
.px-card { animation-delay: -1.6s; }
.px-spark { animation: px-blink 3.2s steps(1) infinite; }
.px-spark-2 { animation-delay: -1.1s; }
.px-spark-3 { animation-delay: -2.2s; }

/* 一次跳一格 不做补间 像素该有的样子 */
@keyframes px-bob {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes px-blink {
  0% { opacity: 1; transform: none; }
  40% { opacity: .35; transform: scale(.6); }
  50% { opacity: 0; }
  60% { opacity: .35; transform: scale(.6); }
  70% { opacity: 1; transform: none; }
}
@keyframes px-tw {
  0% { opacity: 0; }
  6% { opacity: 1; }
  12% { opacity: .4; }
  18% { opacity: 0; }
}

@media (max-width: 1100px) {
  .px-card { width: 88px; top: auto; bottom: 8%; }
  .px-spark-2 { top: auto; bottom: calc(8% + 72px); right: calc(max(24px, calc(50% - 700px)) + 96px); }
  .px-lock { display: none; }
}
@media (max-width: 720px) {
  .checkout { padding-top: 48px; }
  .px-dither { width: 264px; height: 264px; }
  .px-coin { width: 48px; top: 20px; left: auto; right: 20px; }
  .px-spark-1 { top: 64px; left: auto; right: 76px; }
  .px-card, .px-lock, .px-spark-2, .px-spark-3 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .checkout-bg { animation: fade var(--t-fade) var(--ease-out) backwards; }
  .px-coin, .px-lock, .px-card, .px-spark, .px-tw { animation: none; }
}
