/* ============================================
   案例页通用排版与组件
   ============================================
   两套主题（暗色 / 浅色）共用这套排版与组件
   颜色 / 阴影通过 CSS 变量切换，HTML 只需声明主题 tokens
   ============================================ */


/* ============================================
   导航颜色 Token（默认浅色；暗色页面在 HTML 里覆盖）
   ============================================ */
:root {
  --nav-btn-bg:            #fff;
  --nav-btn-border:        #e7e8ee;
  --nav-btn-hover-bg:      #fff;
  --nav-btn-hover-border:  #1b1c1d;
  --nav-icon-color:        #7c7f9a;
  --nav-icon-hover-color:  #1b1c1d;
  --nav-title-color:       #1b1c1d;
  --nav-num-color:         #7c7f9a;
  --nav-num-active-color:  #1b1c1d;
  --nav-label-color:       #7c7f9a;
  --nav-label-active-color:#1b1c1d;
  --nav-indicator-color:   #1b1c1d;
  --nav-item-hover-color:  #1b1c1d;
}

.case-page {
  background: var(--bg-page, #fff);
  color: var(--text-main, #1b1c1d);
  min-height: 100vh;
}


/* ============================================
   左侧固定导航
   ============================================ */
.case-nav {
  position: fixed;
  top: 0; left: 0;
  width: fit-content; height: 100vh;
  padding: 80px 32px 40px 32px;
  display: flex; flex-direction: column;
  gap: 42px;
  z-index: 100;
  overflow-y: auto;
}

.case-nav__btns {
  display: flex; flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* 返回按钮 */
.case-nav__back,
.case-nav__menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--nav-btn-border);
  border-radius: 8px;
  padding: 6px;
  flex-shrink: 0;
  text-decoration: none;
  background: var(--nav-btn-bg);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.case-nav__menu-btn { display: none; }
.case-nav__back svg,
.case-nav__menu-btn svg {
  color: var(--nav-icon-color);
  transition: color 0.2s ease;
}
.case-nav__back:hover,
.case-nav__menu-btn:hover {
  background: var(--nav-btn-hover-bg);
  border-color: var(--nav-btn-hover-border);
}
.case-nav__back:hover svg,
.case-nav__menu-btn:hover svg {
  color: var(--nav-icon-hover-color);
}

/* Contents 标题 */
.case-nav__title {
  margin: 0 0 24px;
  font-family: var(--font-en);
  font-weight: 500; font-size: 24px; line-height: 1;
  color: var(--nav-title-color);
}

.case-nav__list {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column;
  gap: 16px;
}

.case-nav__item {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.case-nav__item:hover .case-nav__label,
.case-nav__item:hover .case-nav__num {
  color: var(--nav-item-hover-color);
}

.case-nav__left {
  display: flex; align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.case-nav__indicator {
  width: 0; height: 1.5px;
  background: var(--nav-indicator-color);
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.case-nav__item--active .case-nav__indicator { width: 12px; }

.case-nav__num {
  font-family: var(--font-en);
  font-size: 14px; font-weight: 400; line-height: 1;
  color: var(--nav-num-color);
  width: 20px; flex-shrink: 0;
  transition: color 0.2s ease, font-weight 0.2s ease;
}
.case-nav__item--active .case-nav__num {
  font-weight: 500;
  color: var(--nav-num-active-color);
}

.case-nav__label {
  font-family: var(--font-cn, "PingFang SC", sans-serif);
  font-size: 14px; font-weight: 400; line-height: 1.4;
  color: var(--nav-label-color);
  transition: color 0.2s ease;
  white-space: nowrap;
}
.case-nav__item--active .case-nav__label {
  color: var(--nav-label-active-color);
}


/* ============================================
   主内容区
   ============================================ */
.case-main {
  width: 760px;
  margin: 0 auto;
  padding-top: 80px;
  padding-bottom: 120px;
}


/* ============================================
   Hero
   ============================================ */
.case-hero {
  padding-bottom: 64px;
  display: flex; flex-direction: column;
  gap: 32px;
}

.case-hero__title {
  margin: 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 32px; font-weight: 500;
  color: var(--text-main);
  line-height: normal;
}

.case-hero__cover {
  width: 100%;
  border-radius: 16px;
  background: var(--bg-image);
  overflow: hidden;
}
.case-hero__cover img {
  width: 100%; height: auto;
  display: block;
}

.case-hero__block {
  display: flex; flex-direction: column;
  gap: 6px;
}

.case-hero__label {
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; font-weight: 400;
  color: var(--text-tertiary);
  line-height: normal;
}

.case-hero__text {
  margin: 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; font-weight: 400;
  line-height: 180%; letter-spacing: 0.14px;
  color: var(--text-primary);
}

.case-hero__meta {
  display: flex;
  gap: 80px;
  flex-wrap: wrap;
  align-items: center;
}

.case-hero__meta-item {
  display: flex; flex-direction: column;
  gap: 6px;
}

.case-hero__meta-label {
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; font-weight: 400;
  color: var(--text-tertiary);
  line-height: normal;
}

.case-hero__meta-value {
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; font-weight: 400;
  line-height: 180%; letter-spacing: 0.14px;
  color: var(--text-primary);
}


/* ============================================
   分割线
   ============================================ */
.case-divider        { width: 100%; height: 1px; background: var(--divider-strong); flex-shrink: 0; }
.case-divider--inner { width: 100%; height: 1px; background: var(--divider-soft);   flex-shrink: 0; }


/* ============================================
   Section
   ============================================ */
.case-section {
  display: flex; flex-direction: column;
  gap: 48px;
}
.case-section + .case-section { margin-top: 64px; }

.case-section__header {
  display: flex; flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
}

.case-section__en {
  margin: 0;
  display: flex; align-items: center;
  gap: 6px;
  font-family: "Elms Sans", "Inter", sans-serif;
  font-size: 28px; font-weight: 600; line-height: 28px;
  color: var(--accent);
}

.case-section__zh {
  margin: 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 28px; font-weight: 500;
  line-height: 1.6;
  color: var(--text-main);
  white-space: normal;
}

.case-section__body {
  display: flex; flex-direction: column;
  gap: 80px;
}


/* ============================================
   Subsection（子章节容器）
   ============================================ */
.case-subsection {
  display: flex; flex-direction: column;
  gap: 24px;
}


/* ============================================
   子标题：2.1 / 名称
   ============================================ */
.case-subheading {
  display: flex; align-items: center;
  gap: 6px;
  line-height: 1.8;
  white-space: nowrap;
}
.case-subheading__num,
.case-subheading__slash {
  font-family: "Elms Sans", "Inter", sans-serif;
  font-size: 24px; font-weight: 600;
  color: var(--text-tertiary);
}
.case-subheading__title {
  font-family: "PingFang SC", sans-serif;
  font-size: 24px; font-weight: 500;
  color: var(--text-main);
}


/* ============================================
   正文 / 强调
   ============================================ */
.case-p {
  margin: 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; font-weight: 400;
  line-height: 180%; letter-spacing: 0.14px;
  color: var(--text-primary);
}
.case-p--accent { color: var(--accent); }
.case-p--muted  { color: var(--text-tertiary); }

/* case-strong / case-accent：保留为语义标签，不改字重 / 颜色 */
.case-strong { }
.case-accent { }

.case-h2 {
  margin: 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 16px; font-weight: 500;
  color: var(--text-main);
}


/* ============================================
   case-card-grid（三列信息卡）
   ============================================ */
.case-card-grid {
  display: flex;
  gap: 20px;
  align-items: stretch;
}
.case-card {
  flex: 1 0 0;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}
.case-card__label {
  font: 400 14px/1.6 "PingFang SC", sans-serif;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.case-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.case-card__title {
  margin: 0;
  font: 500 20px/1.6 "PingFang SC", sans-serif;
  color: var(--text-main);
}
.case-card__desc {
  margin: 0;
  font: 400 14px/1.8 "PingFang SC", sans-serif;
  color: var(--text-secondary);
}


/* ============================================
   case-figure（图片组件）
   ============================================ */
.case-figure {
  width: 100%;
  margin: 0;
  border-radius: 16px;
  position: relative;
  border: 1px solid var(--border-image);
}
.case-figure img {
  width: 100%; height: auto;
  display: block;
  border-radius: 14px; /* 比容器小 1px，避免描边露角 */
}

/* 图片加载失败：JS 自动添加 case-figure--empty
   仅作用于「裸 figure」本身，绝不能加到 switch 的 viewport 上（否则会压缩 active slide） */
.case-figure.case-figure--empty {
  height: 420px;
  background: var(--bg-image);
  overflow: hidden;
}
.case-figure.case-figure--empty img { display: none; }
.case-figure.case-figure--empty .case-figure__no { display: flex; }
.case-figure__no {
  display: none;
  position: absolute; inset: 0;
  align-items: center; justify-content: center;
  font-family: "Elms Sans", "Inter", sans-serif;
  font-size: 14px;
  color: var(--text-tertiary);
}


/* ============================================
   case-figure--switch（多图切换）
   ============================================ */
.case-figure--switch {
  overflow: visible;
  border: 0; border-radius: 0;
  background: transparent;
  display: flex; flex-direction: column;
  align-items: center;
}
.case-figure--switch .case-figure__viewport {
  position: relative;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border-image);
}
.case-figure--switch .case-figure__slide {
  width: 100%; height: auto;
  display: none;
  border-radius: 14px; /* 比 viewport 小 1px，避免描边露角 */
}
.case-figure--switch .case-figure__slide.is-active { display: block; }

.case-figure--h430 .case-figure__viewport {
  height: 426px;
  overflow: hidden;
  position: relative;
}
.case-figure--h430 .case-figure__slide {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 100%; height: auto;
  display: none;
}
.case-figure--h430 .case-figure__slide.is-active {
  display: block;
}


/* ============================================
   case-figure__pager（翻页胶囊）
   颜色全部通过主题变量切换
   ============================================ */
.case-figure__pager {
  margin-top: 16px;
  display: inline-flex; align-items: center;
  gap: 4px;
  padding: 6px 8px; height: 28px;
  border-radius: 8px;
  background: var(--pager-bg);
  backdrop-filter: var(--pager-backdrop);
  -webkit-backdrop-filter: var(--pager-backdrop);
}

.case-figure__nav {
  width: 24px; height: 24px;
  padding: 0; border: 0; border-radius: 6px;
  background: transparent;
  color: var(--pager-fg);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.case-figure__nav:hover:not(:disabled) {
  background: var(--pager-hover-bg);
  color: var(--pager-fg-strong);
}
.case-figure__nav:disabled { cursor: not-allowed; opacity: 0.3; }
.case-figure__nav svg { width: 16px; height: 16px; display: block; }

.case-figure__count {
  display: inline-flex; align-items: center;
  gap: 4px;
  padding: 0 4px;
  font: 500 14px/1 "Elms Sans", "Inter", sans-serif;
  letter-spacing: 0.28px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.case-figure__count-cur,
.case-figure__count-total {
  display: inline-block;
  min-width: 10px;
  text-align: center;
}
.case-figure__count-cur            { color: var(--pager-fg-strong); }
.case-figure__count-sep,
.case-figure__count-total          { color: var(--pager-fg-dim); }


/* ============================================
   case-table（多行多列数据表）
   ============================================ */
.case-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-family: "PingFang SC", sans-serif;
}
.case-table th {
  padding: 14px 16px;
  text-align: left; vertical-align: middle;
  font-size: 14px; font-weight: 400;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}
.case-table td {
  padding: 16px;
  font-size: 14px; font-weight: 400;
  line-height: 1.7; letter-spacing: 0.14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-secondary);
  vertical-align: top;
}
.case-table tr:last-child td { border-bottom: 0; }
.case-table--bordered {
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  overflow: hidden;
}


/* ============================================
   Before/After 对比组件
   ============================================ */
.case-compare { position: relative; }

.case-compare__viewport {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  transform: translateZ(0);
}
.case-compare__after {
  width: 100%; height: auto;
  display: block;
  border-radius: 16px;
}
.case-compare__before-wrap {
  position: absolute; inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.case-compare__before-wrap.is-revealed { opacity: 1; }
.case-compare__before {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.case-compare__btn {
  position: absolute;
  top: 36px; right: 36px;
  height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--compare-btn-border);
  border-radius: 8px;
  background: var(--compare-btn-bg);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: var(--compare-btn-fg);
  cursor: pointer;
  display: inline-flex; align-items: center;
  gap: 6px;
  z-index: 3;
  transition: background 0.15s ease;
}
.case-compare__btn:hover { background: var(--compare-btn-hover-bg); }
.case-compare__icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.case-compare.is-active .case-compare__icon { transform: rotate(180deg); }
.case-compare__btn-text {
  font: 400 14px/1 "PingFang SC", sans-serif;
  white-space: nowrap;
}


/* ============================================
   响应式：内容与侧边栏重叠时收起为浮层目录
   ============================================ */
@media (max-width: 1400px) {
  .case-nav__menu-btn { display: flex; }
  .case-nav { overflow: visible; height: auto; }

  .case-nav__contents {
    position: fixed;
    top: calc(80px + 32px + 12px + 12px + 32px);
    left: 32px;
    background: var(--nav-btn-bg);
    border: 1px solid var(--nav-btn-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(27, 28, 29, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 200;
  }
  .case-nav__contents--open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .case-main {
    width: auto;
    max-width: 760px;
    padding-left: 24px;
    padding-right: 24px;
  }
}


/* ============================================
   Demo 封面按钮（叠在图片右上角）
   ============================================ */
.case-figure--demo {
  position: relative;
}
.case-demo-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  height: 38px;
  padding: 6px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.60);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #ffffff;
  font: 400 14px/1 "PingFang SC", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.14px;
  transition: background 0.15s ease;
  z-index: 2;
}
.case-demo-btn:hover { background: rgba(0, 0, 0, 0.75); }
.case-demo-btn svg { flex-shrink: 0; }


/* ============================================
   Demo Modal（全屏遮罩 + 90vw 内容框）
   ============================================ */
.demo-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.demo-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.demo-modal__box {
  position: relative;
  width: 90vw; height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  transform: translateY(12px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.demo-modal.is-open .demo-modal__box { transform: translateY(0); }

.demo-modal__close {
  position: absolute;
  top: 24px; right: 24px;
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 1001;
  transition: background 0.15s ease;
}
.demo-modal__close:hover { background: rgba(255, 255, 255, 0.22); }

.demo-modal__iframe {
  width: 100%; height: 100%;
  border: none;
  display: block;
}
