/* 文章正文 vs 展示图：按竖/方/横智能排版 */

.post-content .ri-article-intro {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef2f8 100%);
  border: 1px solid rgba(59, 111, 245, 0.12);
  color: #2d3039;
  line-height: 1.75;
}

.post-content .ri-article-intro p {
  margin-bottom: 0.65rem;
}

.post-content .ri-article-intro p:last-child {
  margin-bottom: 0;
}

.post-content .ri-article-intro b,
.post-content .ri-article-intro strong {
  color: #1a1c23;
}

.post-content .ri-showcase {
  margin: 1.25rem 0 0.5rem;
  padding: 1rem 1rem 1.1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #eef0f5;
  box-shadow: 0 8px 24px rgba(26, 28, 35, 0.04);
}

.post-content .ri-showcase-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2d3039;
}

.post-content .ri-showcase-title::before {
  content: "";
  width: 4px;
  height: 1em;
  border-radius: 2px;
  background: #3b6ff5;
}

.post-content .ri-showcase-section + .ri-showcase-section {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px dashed #e8ebf2;
}

.post-content .ri-showcase-sub {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5d616e;
}

/* —— 通用画框 —— */
.post-content .ri-showcase-gallery {
  display: grid;
  gap: 0.75rem;
}

.post-content .ri-showcase-gallery a.ri-frame {
  margin: 0;
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #eef0f5;
  background: #f3f5f9;
  box-shadow: 0 4px 14px rgba(26, 28, 35, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-content .ri-showcase-gallery a.ri-frame:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(26, 28, 35, 0.12);
}

.post-content .ri-showcase-gallery img.ri-shot {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* —— 竖图：手机截图，双列 9:16 —— */
.post-content .ri-gallery-portrait {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-content .ri-frame-portrait {
  aspect-ratio: 9 / 16;
}

.post-content .ri-frame-portrait img.ri-shot {
  object-fit: cover !important;
  object-position: top center !important;
}

/* —— 方图：接近 1:1，双列正方 —— */
.post-content .ri-gallery-square {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 992px) {
  .post-content .ri-gallery-square {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.post-content .ri-frame-square {
  aspect-ratio: 1 / 1;
}

.post-content .ri-frame-square img.ri-shot {
  object-fit: contain !important;
  object-position: center !important;
  background: #f8f9fb;
}

/* —— 横图：电脑端，通栏 / 双列，16:10 容器 + contain 防裁切 —— */
.post-content .ri-gallery-landscape {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .post-content .ri-gallery-landscape:has(> :nth-child(2)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.post-content .ri-frame-landscape {
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #1a1c23 0%, #0f1117 100%);
}

.post-content .ri-frame-landscape img.ri-shot {
  object-fit: contain !important;
  object-position: center !important;
}

/* 只有一张横图时更舒展 */
.post-content .ri-gallery-landscape:has(> :only-child) .ri-frame-landscape {
  aspect-ratio: 16 / 9;
  max-height: 420px;
}

@media (max-width: 575.98px) {
  .post-content .ri-showcase {
    padding: 0.85rem;
  }

  .post-content .ri-showcase-gallery {
    gap: 0.55rem;
  }

  .post-content .ri-gallery-portrait,
  .post-content .ri-gallery-square {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-content .ri-gallery-landscape {
    grid-template-columns: 1fr !important;
  }
}

/* 兜底：未包进画廊的正文大图 */
.post-content > p > img,
.post-content > img,
.post-content figure:not(.ri-showcase-gallery figure) img {
  max-width: min(100%, 560px) !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  margin: 0.75rem auto;
}
