/* ============================================================
 * front.css · 订单页的「AI 作品」面板
 *
 * 位置由 front.js 决定：插在状态卡之后、核心的发货内容块之前。买家的动线是
 * 「付完钱回来看图」，作品离页顶越近越好，手机上尤其如此。
 * 颜色一律取主题的 --theme- / --surface / --border- / --ink 系列，不自带配色，皮肤与深色模式跟随站点。
 * 图片是本站 /uploads 下的文件（服务端出图时已全部本地化），所以按原始比例铺满格子即可。
 * 「生成中」那颗点在 prefers-reduced-motion 下由核心 app.css 的全局动画归零规则收掉，这里不再单写一份。
 * ============================================================ */

.aig-item + .aig-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.aig-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 10px;
}

.aig-item-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  color: var(--ink);
}

/* 状态徽标靠右：一排小标签里它才是结论，视线先落到它上面 */
.aig-item-head .sk-badge {
  margin-left: auto;
  flex: none;
}

.aig-live::before {
  animation: aig-pulse 1.6s var(--motion-ease) infinite;
}

@keyframes aig-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .28; }
}

.aig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
}

.aig-cell {
  margin: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  overflow: hidden;
}

/* 一张图时不许它铺满整块面板：格子按方图给到 420px 就够看清，页面也不会被顶高一屏 */
.aig-grid > .aig-cell:only-child {
  justify-self: center;
  width: min(100%, 420px);
}

.aig-cell > a {
  display: block;
  line-height: 0;
  background: var(--surface);
}

.aig-cell img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform var(--motion-base) var(--motion-ease);
}

.aig-cell > a:hover img {
  transform: scale(1.015);
}

.aig-cell figcaption {
  display: flex;
  justify-content: center;
  padding: 8px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}

/* 下载是这一格唯一的动作：做成一颗描边胶囊，手机上要够拇指点，但不给阴影与底色 */
.aig-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease);
}

.aig-dl:hover,
.aig-dl:active {
  color: var(--theme-primary);
  border-color: var(--theme-primary);
}

.aig-dl i {
  flex: none;
  font-size: 15px;
}

.aig-note {
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.6;
}

/* 保留期这一行要在图片下面看得见，又不能抢作品的视觉重量 */
.aig-keep {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.6;
}

.aig-keep i {
  flex: none;
  font-size: 15px;
}

.aig-keep.is-gone {
  color: var(--gold);
}

@media (max-width: 620px) {
  .aig-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .aig-item-head strong {
    font-size: 14px;
  }

  .aig-cell figcaption {
    padding: 7px;
  }

  /* 拇指点得中：手机上这颗胶囊比桌面大一档 */
  .aig-dl {
    min-height: 36px;
    padding: 0 16px;
  }

  /* 只有一张图＝这一单的全部交付物，居中并给足尺寸，别缩在左上角留一半空白 */
  .aig-grid > .aig-cell:only-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(78%, 320px);
  }

  /* 奇数张时最后那张独占一行：整行居中，宽度与上面那两格一致，看着才是一组 */
  .aig-grid > .aig-cell:last-child:nth-child(odd):not(:only-child) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 4px);
  }
}
