/* 智能体实战资料包：领取页三态 + 首页入口横幅。
   仅主站使用，放 local/ 不进 shared/，避免同步到全部子站。
   动效只用 transform/opacity，照顾低端移动端浏览器。 */

/* ---- 封面区 ---- */

.pack-hero {
  max-width: 960px;
  margin: 2rem auto 0;
  text-align: center;
}

.pack-cover {
  display: flex;
  justify-content: center;
}

.pack-cover-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: min(20rem, 100%);
  padding: 2rem 1.5rem 1.6rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 1rem;
  background-color: var(--md-default-bg-color);
  box-shadow: var(--md-shadow-z1);
}

/* 微光呼吸：只动 opacity/transform 的光晕 */
.pack-cover-card::before {
  content: "";
  position: absolute;
  inset: -16%;
  z-index: -1;
  background: radial-gradient(
    closest-side,
    rgba(255, 159, 28, 0.3),
    transparent 72%
  );
  opacity: 0.4;
  animation: pack-breathe 3.2s ease-in-out infinite;
  pointer-events: none;
}

[data-md-color-scheme="slate"] .pack-cover-card::before {
  background: radial-gradient(
    closest-side,
    rgba(255, 159, 28, 0.22),
    transparent 72%
  );
}

@keyframes pack-breathe {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.98);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.04);
  }
}

.pack-cover-title {
  font-size: 1.1rem;
  font-weight: 720;
  line-height: 1.4;
}

.pack-cover-sub {
  color: var(--md-default-fg-color--light);
  font-size: 0.74rem;
  line-height: 1.7;
}

.pack-cover-seal {
  margin-top: 0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background-color: rgba(255, 159, 28, 0.14);
  color: #c96a00;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.7;
}

[data-md-color-scheme="slate"] .pack-cover-seal {
  color: #ffb45e;
}

.pack-action {
  margin: 1.4rem auto 0;
}

.pack-claimed-note {
  margin: 0.9rem auto 0;
  color: var(--md-default-fg-color--light);
  font-size: 0.78rem;
  line-height: 1.7;
}

/* 目录分区标题：纯展示元素（非 Markdown 标题，避免隐藏内容进 toc/搜索） */
.md-typeset .pack-section-title {
  max-width: 960px;
  margin: 2rem auto 0;
  color: var(--md-default-fg-color--light);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

.pack-grid-wrap .pack-grid {
  margin-top: 1.1rem;
  margin-bottom: 1rem;
}

.pack-grid-wrap {
  margin-bottom: 3rem;
}

/* ---- 三态门控 ----
   pack-ready 由 pack.js 就绪后添加：无 JS 时按钮与提示隐藏、目录直接可见，
   页面退化为普通目录页。 */

.pack-page:not(.pack-ready) .pack-action,
.pack-page .pack-claimed-note {
  display: none;
}

/* 封面态：目录折叠 */
.pack-page.pack-ready[data-pack-state="sealed"] .pack-grid-wrap {
  display: none;
}

/* 开封态：封面卡拆封退场，按钮让位 */
.pack-page[data-pack-state="opening"] .pack-cover-card {
  animation: pack-unseal 0.55s ease-in forwards;
}

.pack-page[data-pack-state="opening"] .pack-cover-card::before {
  animation: none;
  opacity: 0;
}

.pack-page[data-pack-state="opening"] .pack-action {
  visibility: hidden;
}

@keyframes pack-unseal {
  to {
    opacity: 0;
    transform: translateY(-14px) scale(1.05);
  }
}

/* 开封态：两分区 12 张卡片单一序列接续翻出（学习资料在前），
   末张 1.12s + 0.42s ≈ 1.54s（脚本 1.6s 后切 claimed）；分区标题随所在分区淡入 */
.pack-page[data-pack-state="opening"] .pack-card,
.pack-page[data-pack-state="opening"] .pack-section-title {
  animation: pack-card-in 0.42s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.pack-page[data-pack-state="opening"] .pack-section-title:nth-of-type(1) {
  animation-delay: 0.3s;
}

.pack-page[data-pack-state="opening"] .pack-grid-learning .pack-card:nth-child(1) {
  animation-delay: 0.35s;
}

.pack-page[data-pack-state="opening"] .pack-grid-learning .pack-card:nth-child(2) {
  animation-delay: 0.42s;
}

.pack-page[data-pack-state="opening"] .pack-grid-learning .pack-card:nth-child(3) {
  animation-delay: 0.49s;
}

.pack-page[data-pack-state="opening"] .pack-grid-learning .pack-card:nth-child(4) {
  animation-delay: 0.56s;
}

.pack-page[data-pack-state="opening"] .pack-grid-learning .pack-card:nth-child(5) {
  animation-delay: 0.63s;
}

.pack-page[data-pack-state="opening"] .pack-section-title:nth-of-type(2) {
  animation-delay: 0.66s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(1) {
  animation-delay: 0.7s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(2) {
  animation-delay: 0.77s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(3) {
  animation-delay: 0.84s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(4) {
  animation-delay: 0.91s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(5) {
  animation-delay: 0.98s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(6) {
  animation-delay: 1.05s;
}

.pack-page[data-pack-state="opening"] .pack-grid:not(.pack-grid-learning) .pack-card:nth-child(7) {
  animation-delay: 1.12s;
}

@keyframes pack-card-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
}

/* 已领取态：封面与按钮收起，只留轻提示行 */
.pack-page[data-pack-state="claimed"] .pack-cover,
.pack-page[data-pack-state="claimed"] .pack-action {
  display: none;
}

.pack-page.pack-ready[data-pack-state="claimed"] .pack-claimed-note {
  display: block;
}

/* ---- 首页入口横幅 ---- */

.pack-banner-wrap {
  max-width: 960px;
  margin: 1.7rem auto 0;
}

.md-typeset a.pack-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.75rem;
  padding: 0.8rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  background:
    linear-gradient(
        var(--md-default-bg-color),
        var(--md-default-bg-color)
      )
      padding-box,
    linear-gradient(90deg, #ff9f1c, #ff4d00) border-box;
  color: var(--md-default-fg-color);
  text-decoration: none;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.md-typeset a.pack-banner:hover,
.md-typeset a.pack-banner:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--md-shadow-z2);
  color: var(--md-default-fg-color);
  text-decoration: none;
}

.pack-banner-title {
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.5;
}

.pack-banner-desc {
  flex: 1;
  color: var(--md-default-fg-color--light);
  font-size: 0.78rem;
  line-height: 1.7;
}

.pack-banner-cta {
  margin-left: auto;
  color: #e05d00;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

[data-md-color-scheme="slate"] .pack-banner-cta {
  color: #ffb45e;
}

@media (max-width: 760px) {
  .pack-banner-desc {
    flex-basis: 100%;
    order: 3;
  }

  /* 窄屏下光晕不超出卡片横向边界，避免横向滚动 */
  .pack-hero {
    overflow-x: clip;
  }

  .pack-cover-card::before {
    inset: -12% 0;
  }
}

/* ---- 减动效 ---- */

@media (prefers-reduced-motion: reduce) {
  .pack-cover-card::before,
  .pack-page[data-pack-state="opening"] .pack-cover-card,
  .pack-page[data-pack-state="opening"] .pack-card,
  .pack-page[data-pack-state="opening"] .pack-section-title {
    animation: none !important;
  }

  .md-typeset a.pack-banner {
    transition: none;
  }
}
