/*
Theme Name:   Kadence Child
Theme URI:    https://www.kadencewp.com/
Description:  Kadence 子主题 — 案例详情页统一版式
Author:       chuanggao
Template:     kadence
Version:      1.1.5
Text Domain:  kadence-child
*/

/* ============================================================
   案例详情页（post_type = case，模板 single-case.php）
   所有规则都以 .case-detail / .case- 前缀限定，不影响其它页面
   ============================================================ */

.case-detail{
  --cg-ink:#111111;
  --cg-body:#333333;
  --cg-muted:#7a7a7a;
  --cg-line:#e6e6e6;
  --cg-bg:#f5f6f7;
  --cg-accent:#cc3333;
  --cg-accent-dark:#b32d2d;
  --cg-container:1440px;

  font-family:"Open Sans","Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size:16px;
  line-height:1.9;
  color:var(--cg-body);
}

.case-container{
  width:100%;
  max-width:var(--cg-container);
  margin:0 auto;
  padding:0 20px;
}

/* ---------- 顶部封面 ---------- */
.case-banner{
  position:relative;
  width:100%;
  height:clamp(220px, 32vw, 420px);
  overflow:hidden;
  background:#d8d8d8;
}
.case-banner img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center 45%;
  display:block;
}

/* ---------- 标题与元信息 ---------- */
.case-head{
  text-align:center;
  padding:44px 0 10px;
}
.case-head h1{
  margin:0 auto 18px;
  max-width:900px;
  font-size:28px;
  line-height:1.5;
  font-weight:700;
  color:var(--cg-ink);
  letter-spacing:0;
  text-align:center;
}
.case-meta{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:18px;
  margin-bottom:30px;
}
.case-meta-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:22px;
  font-size:15px;
  line-height:1.5;
  color:#000;
}
.case-origin{
  max-width:100%;
  word-break:break-word;
  text-align:center;
}
.case-views span{color:#000;}

.case-share{
  display:flex;
  align-items:center;
  gap:6px;
}
.case-share a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:24px;
  border-radius:50%;
  background:#ececec;
  color:#777;
  font-style:normal;
  font-size:11px;
  line-height:1;
  text-decoration:none;
  transition:background .2s, color .2s;
}
.case-share a:hover{background:var(--cg-accent);color:#fff;}

.btn-inquire{
  display:inline-block;
  width:180px;
  height:38px;
  line-height:38px;
  text-align:center;
  background:var(--cg-accent);
  color:#fff;
  font-size:14px;
  letter-spacing:.02em;
  text-decoration:none;
  border:0;
  border-radius:0;
  cursor:pointer;
  transition:background .2s;
}
.btn-inquire:hover{background:var(--cg-accent-dark);color:#fff;}

/* ---------- 正文 ---------- */
.case-body{
  max-width:100%;
  margin:0;
  padding:10px 0 64px;
  font-size:16px;
  line-height:1.9;
  color:var(--cg-body);
}
.case-body p{margin:0 0 18px;}
.case-body a{color:#0b6bcb;text-decoration:underline;}
.case-body a:hover{color:var(--cg-accent);}
.case-body img{max-width:100%;height:auto;display:block;}

.case-body h2{
  margin:42px 0 14px;
  font-size:20px;
  line-height:1.5;
  font-weight:700;
  color:var(--cg-ink);
  scroll-margin-top:120px;
}
.case-body h3{
  margin:26px 0 10px;
  font-size:17px;
  line-height:1.5;
  font-weight:700;
  color:var(--cg-ink);
  scroll-margin-top:120px;
}

/* 表格：编辑器的普通表格、预览稿的 .case-spec 都统一成这套 */
.case-body table,
.case-spec{
  width:100%;
  border-collapse:collapse;
  margin:6px 0 26px;
  font-size:15px;
  line-height:1.6;
}
.case-body table th,
.case-body table td,
.case-spec th,
.case-spec td{
  border:1px solid var(--cg-line);
  padding:12px 16px;
  text-align:left;
  vertical-align:top;
}
.case-body table th,
.case-spec th{
  background:#f2f3f4;
  font-weight:700;
  color:var(--cg-ink);
}
.case-body table td:first-child,
.case-spec td:first-child{
  width:38%;
  background:#fbfbfb;
  color:#555;
}

/* 手写三图容器（编辑器里用 HTML 块时） */
.case-gallery{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
  margin:10px 0 28px;
}
.case-gallery img{
  width:100%;
  height:100%;
  aspect-ratio:4 / 3;
  object-fit:cover;
  background:#eee;
}

/* Gutenberg 画廊区块：新版 figure 直接放图，老版图在 ul > li 里 */
.case-body .wp-block-gallery{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
  margin:10px 0 28px;
  padding:0;
}
.case-body .wp-block-gallery ul,
.case-body .wp-block-gallery .blocks-gallery-grid{
  display:contents;   /* 让老结构的 li 直接成为网格子项 */
}
.case-body .wp-block-gallery li,
.case-body .wp-block-gallery .wp-block-image{
  margin:0;
  list-style:none;
}
.case-body .wp-block-gallery li img,
.case-body .wp-block-gallery .wp-block-image img{
  width:100%;
  height:100%;
  aspect-ratio:4 / 3;
  object-fit:cover;
  background:#eee;
}

/* 单图（编辑器默认走 figure） */
.case-body figure{margin:10px 0 28px;}
.case-body figure img{width:100%;height:auto;}

/* 清单 */
.case-body ol,
.case-body ul{
  margin:0 0 22px;
  padding-left:22px;
}
.case-body ol li,
.case-body ul li{margin-bottom:8px;}

/* ---------- 右侧悬浮目录 ---------- */
.case-layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 260px;
  gap:56px;
  align-items:start;
}
.case-main{min-width:0;}

.case-toc{
  position:sticky;
  top:160px;
  margin-top:40px;
  align-self:start;
  background:#fff;
  border:1px solid #e8e8e8;
  border-radius:8px;
  box-shadow:0 6px 20px rgba(0,0,0,.06);
  overflow:hidden;
}
.case-toc-inner{
  max-height:calc(100vh - 232px);
  overflow-y:auto;
  padding:20px 0 16px;
  scrollbar-width:thin;
  scrollbar-color:#ddd transparent;
}
.case-toc-inner::-webkit-scrollbar{width:5px;}
.case-toc-inner::-webkit-scrollbar-thumb{background:#ddd;border-radius:3px;}
.case-toc-title{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 18px 12px;
  padding-bottom:12px;
  border-bottom:1px solid #f0f0f0;
  font-size:12px;
  font-weight:600;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:#8f8f8f;
}
.case-toc-title::before{
  content:"";
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--cg-accent);
  flex:0 0 auto;
}
.case-toc-nav{padding:0 10px;}
.case-toc-link{
  display:block;
  margin:2px 0;
  padding:8px 12px;
  border-left:2px solid transparent;
  border-radius:4px;
  font-size:14px;
  line-height:1.55;
  color:#555;
  text-decoration:none;
  transition:color .2s, background .2s, border-color .2s;
}
.case-toc-link:hover{background:#f7f7f7;color:#111;}
.case-toc-link.is-sub{
  padding-left:26px;
  font-size:13px;
  color:#7b7b7b;
}
.case-toc-link.active{
  background:#fdf3f3;
  border-left-color:var(--cg-accent);
  color:var(--cg-accent);
  font-weight:600;
}

/* ---------- 上下篇导航 ---------- */
.case-pager{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
  margin:52px 0 0;
}
.case-pager-item{
  display:block;
  padding:13px 18px;
  border:1px solid #ddd;
  border-radius:4px;
  background:#fff;
  font-size:15px;
  line-height:1.5;
  color:#333;
  text-decoration:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  transition:border-color .2s, color .2s;
}
.case-pager-item:hover{border-color:#b5b5b5;color:#000;}
.case-pager-label{color:#8a8a8a;}

/* ---------- 标签 ---------- */
.case-tags{
  display:flex;
  flex-wrap:wrap;
  gap:11px 12px;
  margin:30px 0 0;
  padding-top:28px;
  border-top:1px solid var(--cg-line);
}
.case-tag{
  display:inline-block;
  padding:7px 17px;
  border:1px solid #ddd;
  border-radius:999px;
  background:#fff;
  font-size:14px;
  line-height:1.4;
  color:#333;
  text-decoration:none;
  white-space:nowrap;
  transition:border-color .2s, color .2s;
}
.case-tag:hover{border-color:var(--cg-accent);color:var(--cg-accent);}

/* ---------- 相关新闻 / 随机产品 ---------- */
.case-related{
  background:var(--cg-bg);
  padding:56px 0;
}
.case-random{
  background:#fff;
  padding:56px 0 72px;
}
.case-sec-title{
  margin:0 0 28px;
  font-size:26px;
  font-weight:700;
  line-height:1.4;
  color:var(--cg-ink);
  text-align:center;
}
.case-cards{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:24px;
  margin:0;
}
.case-card{
  display:block;
  background:#fff;
  text-decoration:none;
  transition:box-shadow .25s, transform .25s;
}
.case-card:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}
.case-card .thumb{
  aspect-ratio:4 / 3;
  overflow:hidden;
  background:#eee;
}
.case-card .thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.case-card .card-title{
  padding:14px 16px 18px;
  font-size:14px;
  line-height:1.6;
  color:#333;
}

/* ---------- 响应式 ---------- */
@media (max-width:1240px){
  .case-cards{grid-template-columns:repeat(3, 1fr);}
}
@media (max-width:1100px){
  .case-layout{grid-template-columns:1fr;gap:0;}
  .case-toc{display:none;}
  .case-cards{grid-template-columns:repeat(2, 1fr);}
  .case-gallery,
  .case-body .wp-block-gallery{grid-template-columns:repeat(3, 1fr);gap:12px;}
}
@media (max-width:767px){
  .case-banner{height:220px;}
  .case-head{padding:30px 0 6px;}
  .case-head h1{font-size:22px;line-height:1.45;}
  .case-meta{gap:12px;margin-bottom:20px;}
  .case-meta-row{font-size:13.5px;gap:14px;}
  .case-body{font-size:15px;line-height:1.8;padding-bottom:44px;}
  .case-body h2{font-size:18px;margin-top:32px;}
  .case-body h3{font-size:16px;}
  .case-body table,
  .case-spec{font-size:13.5px;}
  .case-body table th, .case-body table td,
  .case-spec th, .case-spec td{padding:9px 10px;}
  .case-body table td:first-child,
  .case-spec td:first-child{width:42%;}
  .case-gallery,
  .case-body .wp-block-gallery{grid-template-columns:1fr;gap:12px;}
  .case-cards{grid-template-columns:1fr;}
  .case-sec-title{font-size:22px;}
  .case-pager{grid-template-columns:1fr;gap:12px;margin-top:36px;}
  .case-pager-item{font-size:14px;}
  .case-tags{gap:9px;margin-top:24px;padding-top:22px;}
  .case-tag{font-size:13px;padding:6px 14px;}
  .btn-inquire{width:100%;max-width:280px;}
}

/* ---------- 仅管理员可见：Related News 为空的调试提示 ---------- */
.case-debug{
  width:calc(100% - 40px);
  max-width:1400px;
  margin:24px auto 0;
  padding:12px 16px;
  border:1px dashed #cc3333;
  background:#fff7f7;
  color:#cc3333;
  font-size:13px;
  line-height:1.6;
}

/* ---------- Customer testimonials (shortcode [cg_testimonials]) ---------- */
.cg-testi{
  display:grid;
  grid-template-columns:repeat(var(--cols, 3), minmax(0, 1fr));
  gap:24px;
  margin:8px 0 0;
}
.cg-testi-card{
  display:flex;
  flex-direction:column;
  min-width:0;
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:8px;
  padding:26px 24px 20px;
  box-shadow:0 6px 20px rgba(0,0,0,.05);
  overflow-wrap:anywhere;
  word-break:break-word;
}
.cg-testi-stars{
  display:flex;
  gap:3px;
  margin-bottom:14px;
  color:#cc3333;
  font-size:15px;
  line-height:1;
}
.cg-testi-stars .off{color:#dcdcdc;}
.cg-testi-quote{
  flex:1;
  min-width:0;
  margin:0 0 18px;
  padding:0;
  border:0;
  font-size:15px;
  line-height:1.8;
  color:#333;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.cg-testi-foot{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  padding-top:16px;
  border-top:1px solid #f0f0f0;
}
.cg-testi-avatar img{
  width:44px;
  height:44px;
  border-radius:50%;
  object-fit:cover;
  display:block;
}
.cg-testi-who{min-width:0;}
.cg-testi-name{
  display:block;
  font-size:14px;
  font-weight:700;
  color:#111;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.cg-testi-role{
  display:block;
  font-size:13px;
  color:#8a8a8a;
  line-height:1.5;
  overflow-wrap:anywhere;
}
@media (max-width:1024px){
  .cg-testi{grid-template-columns:repeat(2, minmax(0, 1fr));}
}
@media (max-width:640px){
  .cg-testi{grid-template-columns:1fr;gap:16px;}
  .cg-testi-card{padding:22px 18px 16px;}
}

.case-testi{
  background:#fff;
  padding:56px 0;
}
@media (max-width:767px){
  .case-testi{padding:36px 0;}
}
