/* ===========================================
   CASE DETAIL 作品案例內頁（左：網頁視覺／右：案例分析編輯器）
   =========================================== */
.case-detail {
  min-height: 100vh;
  padding-top: 64px;
  background: var(--bg-gradient);
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  color: var(--text-primary);
}

/* ── 主舞台：直向排列（左右分割在上、導覽按鈕在下），與視窗等高 ── */
.case-detail .case-stage {
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 2.5vw, 2rem);
  width: 100%;
  max-width: 1360px;
  height: calc(100vh - 64px);
  margin: 0 auto;
  /* 底部不留額外留白：讓按鈕帶延伸到舞台底緣，按鈕在分隔線與下一區塊間上下置中 */
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem) 0;
}

/* ── 左右分割主區（填滿舞台扣除按鈕後的剩餘高度）── */
.case-detail .case-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3.5vw, 3.5rem);
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* ── 左：整個網頁視覺（與右欄等高，框內滾輪瀏覽）── */
.case-detail .case-visual {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.case-detail .case-visual-frame {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  border: 1px solid rgba(74, 26, 120, 0.14);
  border-radius: 0;
  box-shadow: 0 18px 44px rgba(74, 26, 120, 0.14);
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 26, 120, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
}
.case-detail .case-visual-frame::-webkit-scrollbar {
  width: 8px;
}
.case-detail .case-visual-frame::-webkit-scrollbar-thumb {
  background: rgba(74, 26, 120, 0.28);
  border-radius: 8px;
}
.case-detail .case-visual-frame::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 26, 120, 0.45);
}
.case-detail .case-visual-frame img {
  display: block;
  width: 100%;
  height: auto;
}
/* 上下滑動提示動態（框內浮動指示器，開始滾動後淡出）*/
.case-detail .case-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 2vw, 20px);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(74, 26, 120, 0.82);
  box-shadow: 0 6px 18px rgba(74, 26, 120, 0.32);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
  transform: translate(-50%, 0);
  animation: cue-bob 1.5s ease-in-out infinite;
}
.case-detail .case-scroll-cue svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.case-detail .case-visual.is-scrolled .case-scroll-cue {
  opacity: 0;
}
.case-detail .case-visual.no-scroll-cue .case-scroll-cue {
  display: none;
}
@keyframes cue-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -7px); }
}
@media (prefers-reduced-motion: reduce) {
  .case-detail .case-scroll-cue { animation: none; }
}

/* ── 右：案例分析（編輯器，與左欄等高）──
   頂部（麵包屑＋橫幅）與底部（按鈕）固定不動，僅中間內文用滾輪捲動 */
.case-detail .case-editor {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(74, 26, 120, 0.14);
  border-radius: 0;
  box-shadow: 0 18px 44px rgba(74, 26, 120, 0.14);
  --card-pad: clamp(1.2rem, 2.5vw, 2rem);
  padding: clamp(0.6rem, 1.2vw, 0.9rem) var(--card-pad) var(--card-pad);
  position: relative;
}
.case-detail .case-editor-head {
  flex: 0 0 auto;
}
.case-detail .case-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.9rem;
  padding-bottom: clamp(0.8rem, 2vw, 1.4rem);
  /* 隱藏原生捲軸，改用右側自訂進度條 */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.case-detail .case-editor-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* 右側常駐滾動進度條（讓使用者知道可捲動）*/
.case-detail .case-scrollbar {
  position: absolute;
  right: clamp(6px, 0.9vw, 10px);
  width: 3px;
  border-radius: 3px;
  background: rgba(74, 26, 120, 0.12);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.case-detail .case-editor.has-scroll .case-scrollbar {
  opacity: 1;
}
.case-detail .case-scrollbar-thumb {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  border-radius: 3px;
  background: var(--brand-purple);
  will-change: transform;
}

/* 麵包屑 */
.case-detail .case-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3em 0.55em;
  margin-bottom: clamp(0.35rem, 0.9vw, 0.6rem);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}
.case-detail .case-crumb > * + *::before {
  content: ">";
  margin-right: 0.55em;
  color: rgba(26, 10, 46, 0.3);
}
.case-detail .case-crumb a {
  color: rgba(26, 10, 46, 0.42);
  text-decoration: none;
  transition: color 0.2s;
}
.case-detail .case-crumb a:hover {
  color: var(--brand-purple);
}
.case-detail .case-crumb .current {
  color: #444444;
}

/* 案例分析橫幅 */
.case-detail .case-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em 1.5em;
  border-radius: 0;
  overflow: hidden;
  margin: 0 calc(-1 * var(--card-pad)) clamp(1.4rem, 3vw, 2rem);
  padding: clamp(0.9rem, 2vw, 1.4rem) clamp(1.4rem, 3vw, 2.2rem);
  background: linear-gradient(120deg, #A472D6 0%, #8A54C4 100%);
}
.case-detail .case-banner-title {
  font-family: "Noto Sans TC", sans-serif;
  font-size: clamp(1.3rem, 2.8vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: #ffffff;
}
.case-detail .case-banner-tags {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
.case-detail .case-banner-tags .sep {
  margin: 0 0.4em;
  color: rgba(255, 255, 255, 0.45);
}

/* 案例標題 */
.case-detail .case-title {
  font-family: var(--font-display), "Noto Sans TC", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-purple);
  line-height: 1.1;
  margin-bottom: clamp(1rem, 2.2vw, 1.5rem);
}

/* ── 編輯器富文本樣式已抽離至共用的 editor.css ── */

/* ── 區塊（品牌原始課題 / 傑卡專案成果 / 相關整合服務 / 製作團隊）── */
.case-detail .case-block {
  margin-top: clamp(1.6rem, 3vw, 2.2rem);
  padding-top: clamp(1.4rem, 2.6vw, 1.9rem);
  border-top: 1px solid rgba(74, 26, 120, 0.14);
}
.case-detail .case-block h3 {
  font-size: 1.22rem;
  font-weight: 700;
  color: #222222;
  letter-spacing: 0.02em;
  margin-bottom: 0.9em;
}
.case-detail .case-block ul,
.case-detail .case-block ol {
  padding-left: 1.35em;
}
.case-detail .case-block li {
  font-size: 0.95rem;
  line-height: 1.9;
  color: #444444;
}
.case-detail .case-block ul li::marker {
  color: var(--brand-purple);
}
.case-detail .case-block ol li::marker {
  color: #333333;
  font-weight: 700;
}
.case-detail .case-services {
  font-size: 0.98rem;
  color: #444444;
  letter-spacing: 0.03em;
}
.case-detail .case-block ul.case-team {
  list-style: none;
  padding-left: 0;
}
.case-detail .case-team li {
  font-size: 0.95rem;
  line-height: 2;
  color: #444444;
}
.case-detail .case-team li b {
  display: inline-block;
  min-width: 8.5em;
  color: #222222;
  font-weight: 500;
}

/* ── 導覽按鈕 BACK / WEBSITE（橫跨整列、上下置中）── */
.case-detail .case-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem clamp(1.2rem, 3vw, 2.5rem);
  width: 100%;
  min-height: clamp(5rem, 11vw, 8rem);
  margin-top: 0;
  border-top: 1px solid rgba(74, 26, 120, 0.12);
}
/* 比例對齊「更多作品」.more-btn（字級、內距、字距、圓角一致）*/
.case-detail .case-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  min-width: 14rem;
  max-width: 100%;
  padding: 0.85em 2.2em;
  font-family: inherit;
  font-size: var(--body-size);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out-expo), box-shadow 0.25s, background 0.25s, color 0.25s, border-color 0.25s;
}
.case-detail .case-btn .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  flex: 0 0 auto;
}
.case-detail .case-btn .btn-icon svg {
  width: 0.85em;
  height: 0.85em;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.case-detail .case-btn .btn-word {
  padding: 0 0.4em;
}
.case-detail .case-btn--ghost {
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid rgba(74, 26, 120, 0.22);
}
.case-detail .case-btn--ghost .btn-icon {
  background: rgba(74, 26, 120, 0.1);
}
.case-detail .case-btn--ghost .btn-icon svg {
  stroke: var(--brand-purple);
}
.case-detail .case-btn--primary {
  color: #ffffff;
  background: linear-gradient(120deg, #6B2BA8 0%, #4A1A78 100%);
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(74, 26, 120, 0.22);
}
.case-detail .case-btn--primary .btn-icon {
  background: rgba(255, 255, 255, 0.2);
}
.case-detail .case-btn--primary .btn-icon svg {
  stroke: #ffffff;
}
@media(hover: hover) {
  .case-detail .case-btn:hover {
    transform: translateY(-2px);
  }
  .case-detail .case-btn--ghost:hover {
    border-color: var(--brand-purple);
    color: var(--brand-purple);
  }
  .case-detail .case-btn--primary:hover {
    box-shadow: 0 12px 26px rgba(74, 26, 120, 0.32);
  }
}

/* ===========================================
   其他作品 Works（沿用既有卡片與按鈕視覺）
   =========================================== */
.case-detail .case-others {
  background: rgba(74, 26, 120, 0.03);
  border-top: 1px solid rgba(74, 26, 120, 0.1);
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 7vw, 6rem);
}
.case-detail .case-others-container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}
.case-detail .case-others-head {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: clamp(1.6rem, 3.5vw, 2.6rem);
}
.case-detail .case-others-head .dot {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8A4FC0, #4A1A78 70%);
  box-shadow: 0 6px 16px rgba(74, 26, 120, 0.25);
}
.case-detail .case-others-head h2 {
  font-family: var(--font-display), "Noto Sans TC", sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: var(--brand-purple);
  letter-spacing: 0.03em;
}

/* 卡片格（沿用 works-card 視覺）*/
.case-detail .case-others-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.2rem, 2.8vw, 2.2rem) clamp(1rem, 2.5vw, 1.8rem);
}
.case-detail .works-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: rgba(74, 26, 120, 0.04);
  border: 1px solid rgba(74, 26, 120, 0.12);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.case-detail .works-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(74, 26, 120, 0.06);
}
.case-detail .works-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
@media(hover: hover) {
  .case-detail .works-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(74, 26, 120, 0.25);
  }
}
.case-detail .works-card-body {
  padding: clamp(0.7rem, 1.4vw, 1rem) clamp(0.85rem, 1.6vw, 1.2rem);
}
.case-detail .works-card-title {
  font-size: var(--body-size);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.25;
}
.case-detail .works-poster {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 1.2em;
  text-align: center;
  color: #ffffff;
}
.case-detail .works-poster .poster-en {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
}
.case-detail .works-poster .poster-zh {
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  opacity: 0.92;
}
.case-detail .poster-1 { background: linear-gradient(150deg, #6B2BA8 0%, #4A1A78 100%); }
.case-detail .poster-2 { background: linear-gradient(150deg, #4A1A78 0%, #2A1145 100%); }
.case-detail .poster-3 { background: linear-gradient(150deg, #7A3DB8 0%, #46208a 100%); }

/* VIEW MORE 按鈕（沿用首頁作品集 more 按鈕視覺）*/
.case-detail .case-others-more {
  text-align: center;
  margin-top: clamp(1.8rem, 4vw, 3rem);
}
.case-detail .more-btn {
  display: inline-block;
  box-sizing: border-box;
  min-width: 14rem;
  max-width: 100%;
  padding: 0.85em 2.2em;
  font-family: inherit;
  font-size: var(--body-size);
  font-weight: 600;
  text-align: center;
  color: #1a1a1a;
  background: var(--brand-gold);
  border-radius: 6px;
  text-decoration: none;
  letter-spacing: 0.08em;
  transition: background 0.2s, color 0.2s;
}
.case-detail .more-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ── 進場動畫（其他作品卡片捲進視窗時淡入）── */
@keyframes case-fade-up {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
.js-reveal .case-detail .case-others-grid .works-card {
  opacity: 0;
}
.js-reveal .case-detail .case-others-grid .works-card.is-inview {
  opacity: 1;
  animation: case-fade-up 0.6s var(--ease-out-expo) backwards;
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .case-detail .case-others-grid .works-card { opacity: 1; }
  .js-reveal .case-detail .case-others-grid .works-card.is-inview { animation: none; }
}

/* ── 側邊聯絡我們按鈕（沿用 works 版）── */
.side-contact {
  position: fixed;
  right: 0;
  top: 42%;
  z-index: 9989;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  padding: 1em 0.55em;
  color: #ffffff;
  text-decoration: none;
  background: var(--brand-purple);
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 4px 14px rgba(74, 26, 120, 0.25);
  transition: background 0.2s, padding-right 0.2s;
}
.side-contact .side-contact-text {
  writing-mode: vertical-rl;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  font-weight: 500;
}
.side-contact svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
}
@media(hover: hover) {
  .side-contact:hover {
    background: var(--brand-purple-light);
    padding-right: 0.85em;
  }
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 992px) {
  .case-detail .case-stage {
    height: auto;
  }
  .case-detail .case-split {
    grid-template-columns: 1fr;
    gap: clamp(1.5rem, 4vw, 2.5rem);
  }
  /* 手機：案例分析在上、作品預覽在下 */
  .case-detail .case-editor {
    order: 1;
    height: auto;
    display: block;
    overflow: visible;
  }
  .case-detail .case-visual {
    order: 2;
    height: auto;
  }
  /* 手機：預覽改為整張長圖自然展開、隨頁面捲動（不做框內滾動）*/
  .case-detail .case-visual-frame {
    flex: 0 0 auto;
    height: auto;
    overflow: visible;
  }
  .case-detail .case-editor-body {
    overflow: visible;
    padding-right: 0;
  }
  .case-detail .case-crumb {
    justify-content: flex-start;
  }
}
@media (max-width: 768px) {
  .case-detail .case-others-grid { grid-template-columns: repeat(2, 1fr); }
  .side-contact { padding: 0.8em 0.45em; }
  .side-contact .side-contact-text { font-size: 0.78rem; }
}
@media (max-width: 560px) {
  .case-detail { padding-top: 56px; }
  /* 按鈕折成上下兩排後 min-height 已撐不出留白，改用內距讓按鈕不貼著上下邊線 */
  .case-detail .case-actions { padding: 1.6rem 0; }
  .case-detail .case-others-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .case-detail .case-team li b { min-width: 0; display: block; }
  .side-contact svg { display: none; }
}
