/**
 * 病例详情页 - 网页式阅读排版（墨蓝学术风 · 可读性优化）
 * 关联：case-detail.html
 */

/* ===== 页面与纸张 ===== */
.case-page {
  background: #eef1f6;
  min-height: calc(100vh - var(--header-height));
  padding: 2.5rem 0 4rem;
}

.case-layout {
  display: block;
}

.case-sheet {
  max-width: 860px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 3rem 3.4rem;
  line-height: 1.7;
}

/* ===== 面包屑 ===== */
.case-breadcrumb {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 1.6rem;
  line-height: 1.5;
}
.case-breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
}
.case-breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== 题头 ===== */
.case-masthead {
  margin-bottom: 1.4rem;
}
.case-kicker {
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}
.case-title {
  font-size: 1.95rem;
  line-height: 1.38;
  color: var(--color-primary-dark);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.case-byline {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  color: #56627a;
  font-size: 0.9rem;
}
.case-byline .case-author {
  color: var(--color-text-secondary);
  font-weight: 600;
}
.case-byline .case-date {
  color: #6b7689;
}
.case-rule {
  margin: 1.3rem 0 0;
  border: none;
  border-top: 1px solid #e6ebf2;
}

/* 影像数量徽标 */
.case-meta-bar {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--color-primary-dark);
  background: var(--color-primary-bg);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin: 0 0 0.6rem;
}

/* ===== 正文 ===== */
.case-prose {
  counter-reset: case-sec;
  margin-top: 1.4rem;
  font-size: 1.0625rem;
}

.case-section {
  counter-increment: case-sec;
  margin: 2.6rem 0;
}
.case-section:first-child {
  margin-top: 0.6rem;
}

/* 章节大标题（带编号圆标） */
.case-h2 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  padding-bottom: 0.6rem;
  margin: 0 0 1.1rem;
  border-bottom: 2px solid var(--color-primary-bg);
  letter-spacing: 0.01em;
}
.case-h2::before {
  content: counter(case-sec);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

/* 正文段落 */
.case-p {
  margin: 0.9rem 0;
  font-size: 1.0625rem;
  line-height: 1.95;
  color: #2a3340;
}

/* 小标题（【xxx】） */
.case-h3 {
  font-size: 1.04rem;
  font-weight: 700;
  color: #1f2a3a;
  margin: 1.6rem 0 0.7rem;
  padding: 0.45rem 0.8rem;
  background: #f3f6fb;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}

/* 列表 */
.case-list {
  margin: 0.7rem 0 1.2rem;
  padding-left: 1.5rem;
}
.case-list li {
  margin: 0.5rem 0;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: #2a3340;
}
.case-list:not(.case-list--ol) {
  list-style: disc;
}
.case-list--ol {
  list-style: decimal;
}

/* ===== 原文来源（置于病例内容最末） ===== */
.case-source {
  margin-top: 2.8rem;
}
.case-source-text {
  margin: 0.4rem 0 0;
  padding: 1rem 1.25rem;
  background: #f7f9fc;
  border-left: 3px solid var(--color-primary);
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #45525f;
  font-style: italic;
  word-break: break-word;
}

/* ===== 影像图库（置于正文下方） ===== */
.case-gallery {
  margin-top: 2.8rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--color-border);
}
.case-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0.4rem;
}
.case-fig {
  margin: 0;
  background: #f6f8fc;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.case-fig:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.case-fig img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #eef2f8;
  cursor: zoom-in;
  display: block;
}
.case-fig figcaption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.55rem 0.75rem;
  line-height: 1.5;
  border-top: 1px solid #e6ebf2;
}
.case-fig--empty .case-fig-ph {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  background: #eef2f8;
  font-size: 0.85rem;
}

/* ===== 加载 / 错误 ===== */
.case-loading,
.case-error {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin: 2rem 0;
}
.case-back-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.case-back-link:hover {
  text-decoration: underline;
}

/* ===== 图片灯箱 ===== */
.case-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 2rem;
}
.case-lightbox.active {
  display: flex;
}
.case-lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.case-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}

/* ===== 响应式 ===== */
@media (max-width: 700px) {
  .case-page {
    padding: 1rem 0 2rem;
  }
  .case-sheet {
    padding: 1.8rem 1.25rem;
    border-radius: 0;
  }
  .case-title {
    font-size: 1.5rem;
  }
  .case-gallery-grid {
    grid-template-columns: 1fr;
  }
  .case-fig img {
    height: 170px;
  }
}
