/*
 * 导航海报：
 * - PC：海报图宽 410px（由 --poster-image-width / inline width），外壳 padding 不计入图宽
 * - 顶部：品牌信息 + CTA 按钮；底部仅 Description（无则不渲染）
 */

.entry-content .article-nav-poster,
.wp-block-post-content .article-nav-poster,
.article-nav-poster {
  --poster-image-width: 410px;
  position: relative;
  z-index: 2;
  display: block;
  box-sizing: border-box;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  float: none;
  clear: both;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.entry-content .article-nav-poster-wrap,
.wp-block-post-content .article-nav-poster-wrap,
.article-nav-poster-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  margin: 1.25rem 0;
  transition: transform 0.3s ease;
}

.article-nav-poster-wrap.has-code-drawer {
  margin-bottom: 0.35rem;
}

.article-nav-poster-wrap.has-code-drawer:hover {
  transform: translateY(-6px);
}

.article-nav-poster-wrap.has-code-drawer:hover .article-nav-poster {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.article-nav-poster-wrap.has-code-drawer .article-nav-poster--linked:hover {
  transform: none;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}

.article-nav-poster-wrap.has-code-drawer:hover .article-nav-poster--linked {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.article-nav-poster-wrap.has-code-drawer:hover .article-nav-poster__button {
  background: color-mix(in srgb, var(--color-primary, #f08347) 86%, #000);
}

/* 抽屉宽度跟随海报卡片，不被长文案撑破 */
.article-nav-poster-wrap .article-nav-code--drawer {
  box-sizing: border-box;
  width: 0;
  min-width: 100%;
  max-width: 100%;
  margin: -10px 0 0;
  padding: 0 8px;
  pointer-events: auto;
}

.article-nav-poster-wrap .article-nav-code__capsule--drawer {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.article-nav-poster--linked {
  cursor: pointer;
}

.article-nav-poster--linked:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.article-nav-poster__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: 100%;
  padding: 16px;
  box-sizing: border-box;
  /* 空白区穿透到下方 card-link；交互区再单独打开 pointer-events */
  pointer-events: none;
}

/* 整卡点击：穿透到 card-link；海报图 / 码块 / CTA 保留自身交互 */
.article-nav-poster__card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.article-nav-poster__heading,
.article-nav-poster__footer {
  position: relative;
  z-index: 2;
}

.article-nav-poster__image-wrap,
.article-nav-poster-wrap .article-nav-code--drawer,
.article-nav-poster__button {
  pointer-events: auto;
}

/* —— 顶部：图标 + 文案（可收缩） + 按钮（不收缩） —— */
.article-nav-poster__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--poster-image-width);
  max-width: 100%;
  margin: 0 0 12px;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
}

/* img-inactive：避开线上正文图尺寸规则 */
.entry-content .article-nav-poster__brand-icon,
.wp-block-post-content .article-nav-poster__brand-icon,
.article-nav-poster__brand-icon {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  flex: 0 0 40px;
  display: block;
  object-fit: cover !important;
  border-radius: 50% !important;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  background: #fff;
  margin: 0 !important;
  padding: 0 !important;
}

.article-nav-poster__titles {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.article-nav-poster__title {
  margin: 0;
  color: #000;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-nav-poster__tag {
  display: block;
  margin: 0;
  color: #9ca7ae;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-nav-poster__button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 42%;
  height: 32px;
  padding: 0 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--color-primary, #f08347);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.article-nav-poster--linked:hover .article-nav-poster__button {
  background: #f39d6f;
}

/* —— 海报图：宽度由 inline / CSS 变量决定，外壳不参与 —— */
.article-nav-poster__image-wrap {
  position: relative;
  z-index: 2;
  display: block;
  width: var(--poster-image-width);
  max-width: 100%;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #f8fafc 0%, #eef2f7 100%);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.article-nav-poster__zoom {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

/* img-inactive：避开线上 WPCode「正文图 max-width:50%」规则（img:not(.img-inactive)） */
.entry-content .article-nav-poster__image,
.wp-block-post-content .article-nav-poster__image,
.article-nav-poster__image {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 800px !important;
  object-fit: contain !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.article-nav-poster__image-wrap[style*="aspect-ratio"] .article-nav-poster__image,
.entry-content
  .article-nav-poster__image-wrap[style*="aspect-ratio"]
  .article-nav-poster__image,
.wp-block-post-content
  .article-nav-poster__image-wrap[style*="aspect-ratio"]
  .article-nav-poster__image {
  width: 100% !important;
  height: 100% !important;
  max-height: none;
  object-fit: contain !important;
}

.article-nav-poster__zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.article-nav-poster__zoom:hover .article-nav-poster__zoom-hint,
.article-nav-poster__zoom:focus-visible .article-nav-poster__zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

/* —— 底部：仅 Description —— */
.entry-content .article-nav-poster__footer,
.wp-block-post-content .article-nav-poster__footer,
.article-nav-poster__footer {
  display: block;
  width: var(--poster-image-width);
  max-width: 100%;
  margin: 12px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-size: inherit;
  color: inherit;
  caption-side: unset;
  box-sizing: border-box;
}

.entry-content .article-nav-poster__desc,
.wp-block-post-content .article-nav-poster__desc,
.article-nav-poster__desc {
  margin: 0 !important;
  color: #8f8f8f;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  max-width: 100%;
  white-space: normal;
}

.article-nav-poster--preview {
  pointer-events: none;
}

@media screen and (max-width: 768px) {
  .article-nav-poster--linked:hover {
    transform: none;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  }

  .article-nav-poster__inner {
    padding: 14px;
    width: 100%;
  }

  .article-nav-poster__heading {
    gap: 8px;
  }

  .article-nav-poster__title {
    font-size: 14px;
  }

  .article-nav-poster__button {
    height: 30px;
    padding: 0 0.65rem;
    font-size: 12px;
    max-width: 38%;
  }

  .entry-content .article-nav-poster__desc,
  .wp-block-post-content .article-nav-poster__desc,
  .article-nav-poster__desc {
    font-size: 13px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .article-nav-poster__zoom-hint {
    opacity: 1;
    transform: none;
  }
}

/* 移动端：整卡与图占满内容列 */
@media (max-width: 689.98px) {
  .entry-content .article-nav-poster,
  .entry-content figure.article-nav-poster,
  .wp-block-post-content .article-nav-poster,
  .wp-block-post-content figure.article-nav-poster,
  .article-nav-poster {
    width: 100% !important;
    max-width: 100% !important;
  }

  .article-nav-poster__inner,
  .article-nav-poster__heading,
  .article-nav-poster__footer,
  .article-nav-poster__image-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  .entry-content .article-nav-poster__image,
  .wp-block-post-content .article-nav-poster__image,
  .article-nav-poster__image {
    max-height: none;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }

  .article-nav-poster__image-wrap[style*="aspect-ratio"] .article-nav-poster__image,
  .entry-content
    .article-nav-poster__image-wrap[style*="aspect-ratio"]
    .article-nav-poster__image,
  .wp-block-post-content
    .article-nav-poster__image-wrap[style*="aspect-ratio"]
    .article-nav-poster__image {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    object-fit: contain !important;
  }
}
