/* 沿用原站下拉樣式，補上鍵盤焦點開啟；手機版沿用展開式子選單。 */
.clinic-partner-nav:focus-within .dropdown { display: block; }
.clinic-partner-nav a:focus-visible { outline: 2px solid #3d6e5a; outline-offset: 4px; }

.partner-series-intro { max-width: 800px; margin: 0 auto; padding: 12px 24px 40px; text-align: center; }
.partner-series-intro p, .partner-empty p { font-size: 18px; line-height: 1.8; color: #6b5a4d; }
.partner-empty { max-width: 800px; margin: 0 auto; padding: 48px 24px 100px; text-align: center; }
.partner-empty h2 { font-size: 30px; font-weight: 500; color: #4e3b30; }
.partner-empty a { display: inline-block; margin-top: 20px; color: #3d6e5a; text-underline-offset: 5px; }

/* 陪跑日記沿用品牌故事的桌機／手機文字比例；平板接回全站既有變數。
   變數只在陪跑日記生效，讓列表、文章與未發布文章範本共用同一層級。 */
.diary-page {
  --diary-heading: clamp(28px, 3.5vw, 44px);
  --diary-heading-line: 1.35;
  --diary-subtitle: clamp(18px, 2vw, 33px);
  --diary-subtitle-line: 1.48;
  --diary-body: clamp(15px, 1.25vw, 24px);
  --diary-body-line: clamp(28px, 2.6vw, 38px);
}

.diary-page:not(.diary-article-page) .cases-hero-label h1 {
  font-size: clamp(28px, 2.35vw, 44px);
}

@media (min-width: 768px) and (max-width: 1439px) {
  .diary-page {
    --diary-heading: var(--ly-tablet-title);
    --diary-heading-line: 1.36;
    --diary-subtitle: var(--ly-tablet-subtitle);
    --diary-body: var(--ly-tablet-body);
    --diary-body-line: var(--ly-tablet-line);
  }
}

/* 陪跑日記共用 Banner；品牌綠保留為圖片載入前的底色。 */
.diary-page .diary-hero-placeholder {
  width: 100%;
  aspect-ratio: 1640 / 662;
  background-color: #a9bdb3;
  background-image: url("../images/cases/diary/diary-banner-strategy-meeting.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* 陪跑日記列表：參考編輯式版面，以左右交錯圖文呈現。 */
.diary-editorial {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(82px, 8vw, 132px) 0 clamp(104px, 10vw, 160px);
}

.diary-editorial-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, .84fr);
  align-items: start;
}

/* Keep unpublished story templates in the HTML without displaying them. */
.diary-editorial-item[hidden] {
  display: none !important;
}

.diary-editorial-item + .diary-editorial-item {
  margin-top: clamp(96px, 11vw, 172px);
}

.diary-editorial-item.is-reversed {
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
}

.diary-editorial-media {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  aspect-ratio: 1.52 / 1;
  overflow: hidden;
  background: #c6d2ca;
}

.diary-editorial-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.diary-editorial-item.is-reversed .diary-editorial-media {
  grid-column: 2;
  background: #c6d2ca;
}

.diary-editorial-index {
  position: absolute;
  z-index: 1;
  top: 24px;
  left: 18px;
  color: rgba(255, 255, 255, .68);
  font-family: var(--font-deco);
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 300;
  letter-spacing: .16em;
  line-height: 1;
  writing-mode: vertical-rl;
}

.diary-editorial-item.is-reversed .diary-editorial-index {
  right: 18px;
  left: auto;
}

.diary-editorial-copy {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  margin-top: clamp(42px, 4.5vw, 64px);
  margin-left: clamp(-72px, -5vw, -48px);
  padding: clamp(42px, 4vw, 62px) clamp(34px, 4vw, 58px);
  box-sizing: border-box;
  background: rgba(249, 246, 242, .98);
  color: #4e3b30;
}

.diary-editorial-item.is-reversed .diary-editorial-copy {
  grid-column: 1;
  margin-right: clamp(-72px, -5vw, -48px);
  margin-left: 0;
}

.diary-editorial-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.diary-editorial-heading h2 {
  margin: 0;
  font-family: var(--font-deco);
  font-size: var(--diary-heading);
  font-weight: 400;
  line-height: var(--diary-heading-line);
  letter-spacing: .06em;
}

.diary-editorial-line {
  width: clamp(42px, 5vw, 76px);
  height: 1px;
  background: rgba(78, 59, 48, .32);
  transform: rotate(-46deg);
  transform-origin: center;
}

.diary-editorial-category {
  flex: 0 0 auto;
  font-size: 13px;
  letter-spacing: .12em;
  color: #806f62;
}

.diary-editorial-meta {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: .06em;
  color: #8a7660;
}

.diary-editorial-meta.is-featured {
  /* 診所／醫師名稱使用副標層級，與文章署名一致。 */
  font-size: var(--diary-subtitle);
  line-height: var(--diary-subtitle-line);
  font-weight: 400;
  letter-spacing: .04em;
}

.diary-editorial-summary {
  max-width: 35em;
  margin: 0;
  font-size: 15px;
  line-height: 2;
  color: #6b5a4d;
}

.diary-editorial-summary.is-featured {
  font-size: var(--diary-body);
  line-height: var(--diary-body-line);
}

.diary-editorial-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  min-height: 44px;
  margin-top: 28px;
  padding: 0 24px;
  box-sizing: border-box;
  border-radius: 25px;
  background: rgb(78, 59, 48);
  color: #fff;
  font-size: 12px;
  letter-spacing: .24em;
  text-decoration: none;
  transition: background-color .25s ease, transform .25s ease;
}

.diary-editorial-more:hover,
.diary-editorial-more:focus-visible {
  background: rgb(63, 47, 38);
  transform: translateY(-2px);
}

.diary-editorial-more:focus-visible {
  outline: 2px solid #3d6e5a;
  outline-offset: 4px;
}

/* 文章內頁使用輕量品牌標題卡，與列表頁的照片 Banner 分開。 */
.diary-article-page .diary-hero-placeholder {
  height: 100% !important;
  aspect-ratio: auto !important;
  border-radius: inherit !important;
  background: rgb(169, 189, 179) !important;
}

.diary-article-page .diary-hero-frame {
  width: 100vw !important;
  max-width: none !important;
  height: 241px !important;
  margin-left: 50% !important;
  aspect-ratio: auto !important;
  border: 0;
  border-radius: 0 !important;
  box-shadow: none;
  transform: translateX(-50%);
}

.diary-article-page .cases-hero {
  min-height: 0 !important;
  padding-bottom: clamp(48px, 6vw, 82px);
}

.diary-article-page .diary-hero-frame .cases-hero-label {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  text-align: center;
}

.diary-article-page .diary-hero-frame .cases-hero-label::before {
  display: none !important;
}

.diary-article-page .cases-hero-label .diary-hero-title {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 34px);
  margin: 0;
  color: #fff;
  font-family: var(--font-deco);
  font-size: clamp(30px, 3vw, 46px) !important;
  font-weight: 400;
  line-height: 1.2 !important;
  letter-spacing: .1em !important;
  white-space: nowrap;
}

.diary-article-page .diary-hero-title::before,
.diary-article-page .diary-hero-title::after {
  content: "";
  width: clamp(28px, 4vw, 64px);
  height: 1px;
  background: rgba(255, 255, 255, .68);
}

.diary-article-main {
  padding: clamp(70px, 7vw, 112px) 24px clamp(104px, 10vw, 156px);
}

.diary-article {
  width: min(100%, 860px);
  margin: 0 auto;
  color: #4e3b30;
}

.diary-article-header {
  padding-bottom: clamp(42px, 5vw, 64px);
  border-bottom: 1px solid rgba(78, 59, 48, .16);
}

.diary-article-header h1 {
  margin: 0;
  font-family: var(--font-deco);
  /* 文章主標題固定高於段落標題，維持清楚的 H1／H2 層級。 */
  font-size: clamp(40px, 4vw, 52px);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: .015em;
  white-space: normal;
}

.diary-article-meta {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 24px 0 0;
  color: #806f62;
  font-size: var(--diary-subtitle);
  line-height: var(--diary-subtitle-line);
  font-weight: 400;
  letter-spacing: .05em;
}

.diary-article-keywords {
  margin: 18px 0 0;
  color: #8a7660;
  font-size: 13px;
  line-height: 1.8;
}

.diary-article-lead {
  margin: clamp(40px, 5vw, 64px) 0 clamp(48px, 6vw, 76px);
  padding: clamp(28px, 4vw, 44px);
  background: #f6f1eb;
  color: #5f4c40;
  font-size: var(--diary-body);
  line-height: var(--diary-body-line);
}

/* 保留文章原本的尺寸與自訂封面，外觀比照首頁；點擊後原地載入 YouTube。 */
.diary-article-video {
  width: 100%;
  margin: 0 0 clamp(56px, 7vw, 86px);
}

.diary-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  /* 與首頁 .dream-video-wrapper 相同，手機則共用首頁的圓角變數。 */
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.diary-video-launch,
.diary-video-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.diary-video-launch {
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.diary-video-launch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 標題與觀看入口使用漸層襯底，中央封面保持原色、不放大裁切。 */
.diary-video-launch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .6), transparent 25%, transparent 75%, rgba(0, 0, 0, .3));
  pointer-events: none;
}

.diary-video-title {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  padding: 16px 18px;
  overflow: hidden;
  color: #fff;
  font-family: Arial, "Noto Sans TC", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  white-space: nowrap;
}

.diary-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 68px;
  height: 48px;
  border-radius: 14px / 10px;
  background: #ff0033;
  transform: translate(-50%, -50%);
  transition: background-color .2s ease;
}

.diary-video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 18px solid #fff;
  transform: translate(-50%, -50%);
}

.diary-video-launch:hover .diary-video-play,
.diary-video-launch:focus-visible .diary-video-play {
  background: #f00;
}

.diary-video-launch:focus-visible,
.diary-video-youtube:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -5px;
}

.diary-video-youtube {
  position: absolute;
  right: 0;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 6px 0 0 6px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-family: Arial, "Noto Sans TC", sans-serif;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

.diary-video-youtube svg { width: 25px; height: 18px; }
.diary-video-youtube strong { font-size: 19px; letter-spacing: -.7px; }
.diary-video-youtube:hover { background: #212121; }

@media (max-width: 620px) {
  /* 使用首頁現有值；不改動其他頁面或全站圓角規範。 */
  .diary-video-embed { border-radius: var(--ly-mobile-radius-md, 12px); }
  .diary-video-title { padding: 10px 12px; font-size: 15px; }
  .diary-video-youtube { bottom: 6px; padding: 0 10px; gap: 4px; font-size: 12px; }
  .diary-video-youtube strong { font-size: 17px; }
}

.diary-article-body {
  width: min(100%, 760px);
  margin: 0 auto;
}

.diary-article-body > p {
  margin: 0 0 1.25em;
  /* 與品牌故事內文使用相同字級及行距。 */
  font-size: var(--diary-body);
  line-height: var(--diary-body-line);
  letter-spacing: .025em;
}

.diary-article-body h2 {
  margin: clamp(58px, 7vw, 86px) 0 24px;
  /* 移除標題前的裝飾綠線，與正文左緣對齊。 */
  padding-left: 0;
  border-left: 0;
  font-family: var(--font-deco);
  /* 段落標題參考品牌故事；文章 H1 另外保留較大一級。 */
  font-size: var(--diary-heading);
  font-weight: 400;
  line-height: var(--diary-heading-line);
  letter-spacing: .035em;
}

.diary-article-cta {
  margin-top: clamp(60px, 7vw, 90px);
  padding: clamp(32px, 5vw, 52px);
  border-radius: 20px;
  background: #a9bdb3;
  color: #263d34;
}

.diary-article-cta p {
  margin: 0;
  font-size: var(--diary-body);
  line-height: var(--diary-body-line);
}

.diary-article-actions {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.diary-article-actions .btn-pill-green {
  text-decoration: none;
}

/* 平板文章主標題高於全域段落標題，最多 52px。 */
@media (min-width: 768px) and (max-width: 1439px) {
  .diary-article-header h1 {
    font-size: min(52px, calc(var(--ly-tablet-title) + 8px));
  }

}

@media (max-width: 900px) {
  .diary-editorial {
    width: min(100% - 32px, 680px);
    padding: 64px 0 96px;
  }

  .diary-editorial-item,
  .diary-editorial-item.is-reversed {
    grid-template-columns: 1fr;
  }

  .diary-editorial-item + .diary-editorial-item { margin-top: 84px; }
  .diary-editorial-media,
  .diary-editorial-item.is-reversed .diary-editorial-media {
    grid-column: 1;
    grid-row: 1;
  }
  .diary-editorial-copy,
  .diary-editorial-item.is-reversed .diary-editorial-copy {
    grid-column: 1;
    grid-row: 2;
    width: calc(100% - 28px);
    margin: -38px 14px 0;
    padding: 32px clamp(24px, 6vw, 42px) 36px;
  }
  .diary-editorial-heading { margin-bottom: 20px; }

  .diary-article-main { padding-top: 56px; }
}

@media (max-width: 767px) {
  .partner-series-intro p, .partner-empty p { font-size: 17px; }

  .diary-page .diary-hero-placeholder { aspect-ratio: 16 / 9; }
  .diary-article-page .diary-hero-placeholder { height: 150px; aspect-ratio: auto; }
  .diary-article-page .diary-hero-frame { height: 220px !important; }

  .diary-editorial { padding-top: 54px; }
  .diary-editorial-media { aspect-ratio: 1.34 / 1; }
  .diary-editorial-index { top: 18px; left: 14px; font-size: 18px; }
  .diary-editorial-item.is-reversed .diary-editorial-index { right: 14px; }
  .diary-editorial-heading { gap: 12px; }
  .diary-editorial-heading h2 { letter-spacing: .03em; }
  .diary-editorial-line { width: 38px; }
  .diary-editorial-category { font-size: 12px; }
  .diary-editorial-summary { font-size: 15px; line-height: 1.9; }
  .diary-editorial-summary.is-featured { font-size: var(--diary-body); line-height: var(--diary-body-line); }

  .diary-article-main { padding-right: 20px; padding-left: 20px; }
  .diary-article-header h1 { font-size: 34px; white-space: normal; }
  .diary-article-meta { flex-wrap: wrap; gap: 6px 10px; }
  .diary-article-lead { padding: 26px 24px; }
  .diary-article-cta { padding: 28px 24px; }

  /* 直式平板與手機維持橫向自動輪播，避免 Logo 改成單欄向下堆疊。 */
  .cases-page .partner-logo-marquee {
    width: 100vw !important;
    max-width: none !important;
    margin-left: 50% !important;
    transform: translateX(-50%) !important;
    overflow: hidden !important;
  }
  .cases-page .partner-logo-track {
    position: relative !important;
    left: 0;
    width: max-content !important;
    max-width: none !important;
    display: flex !important;
    margin: 0 !important;
    animation: partner-marquee-mobile var(--partner-duration, 34s) linear infinite !important;
    will-change: transform !important;
  }
  .cases-page .partner-logo-row.is-reverse .partner-logo-track {
    animation-direction: reverse !important;
  }
  .cases-page .partner-logo-set,
  .cases-page .partner-logo-set + .partner-logo-set {
    width: auto !important;
    max-width: none !important;
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center !important;
    gap: var(--partner-gap) !important;
    padding-right: var(--partner-gap) !important;
  }
  .cases-page .partner-logo {
    width: auto !important;
    height: var(--partner-row-height) !important;
    flex: 0 0 var(--logo-visual-width, var(--logo-layout-width-mobile, var(--logo-layout-width-tablet))) !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .cases-page .partner-logo img {
    width: auto !important;
    height: auto !important;
    max-width: var(--mobile-logo-max-width, 172px) !important;
    max-height: var(--mobile-logo-height, 42px) !important;
  }
}

@keyframes partner-marquee-mobile {
  from { left: 0; }
  to { left: -50%; }
}

/* 主頁從 981px 起沿用原站桌機字級與間距；後加字級只保留在手機／平板。
   不在桌機另設覆寫，讓原有標題、內文、署名與間距自然恢復。 */
@media (max-width: 980px) {
  .cases-page:not(.diary-page) .cases-hero-label h1 {
    font-size: clamp(28px, 2.35vw, 44px);
    line-height: 1.18;
  }

  .cases-page:not(.diary-page) .cases-intro h2,
  .cases-page:not(.diary-page) .partners-section h2 {
    font-size: clamp(26px, 3vw, 44px);
    line-height: clamp(40px, 4.5vw, 60px);
  }

  .cases-page:not(.diary-page) .cases-intro p,
  .cases-page:not(.diary-page) .story-body p {
    font-size: clamp(15px, 1.25vw, 24px);
    line-height: clamp(28px, 2.6vw, 38px);
  }

  .cases-page:not(.diary-page) .story-card h2 {
    font-size: clamp(28px, 3.5vw, 44px) !important;
    line-height: 1.35 !important;
  }

  /* 主頁署名沿用原版卡片樣式；副標字級僅套用在故事摘要標題。 */
  .cases-page:not(.diary-page) .story-headline {
    font-size: clamp(18px, 2vw, 33px) !important;
    line-height: 1.48 !important;
  }
}

@media (min-width: 768px) and (max-width: 980px) {
  .cases-page:not(.diary-page) .cases-intro h2,
  .cases-page:not(.diary-page) .partners-section h2 {
    font-size: var(--ly-tablet-title);
    line-height: 1.36;
  }

  .cases-page:not(.diary-page) .cases-intro p,
  .cases-page:not(.diary-page) .story-body p {
    font-size: var(--ly-tablet-body);
    line-height: var(--ly-tablet-line);
  }
}

@media (max-width: 980px) {
  .cases-page:not(.diary-page) .story-card h2 {
    font-size: 23px !important;
    line-height: 1.35 !important;
  }

  .cases-page:not(.diary-page) .story-headline {
    font-size: 18px !important;
    line-height: 1.55 !important;
  }

  .cases-page:not(.diary-page) .story-mobile-summary,
  .cases-page:not(.diary-page) .story-more-body p {
    font-size: 15px;
    line-height: 1.85;
  }

}

/* 主頁僅修正 768–980px 的平板單欄卡片；981px 起沿用原有桌機字級。
   !important 用於覆蓋既有 tablet-responsive.css 與緊湊版型的字級例外。 */
@media (min-width: 768px) and (max-width: 980px) {
  .cases-page:not(.diary-page) .story-card h2 {
    font-size: var(--ly-tablet-title) !important;
    line-height: 1.36 !important;
  }

  .cases-page:not(.diary-page) .story-headline {
    font-size: var(--ly-tablet-subtitle) !important;
    line-height: 1.48 !important;
  }
}

/* 主頁副標與正文同寬，優先在語意段落之間換行。
   長段落在窄螢幕可於詞組之間折行；保留「感覺」「單打獨鬥」等完整詞組。 */
.cases-page:not(.diary-page) .story-headline {
  width: 100%;
  max-width: none !important;
  text-wrap: wrap !important;
}

.cases-page:not(.diary-page) .story-headline-phrase {
  display: inline-block;
  max-width: 100%;
}

.cases-page:not(.diary-page) .story-headline-word {
  display: inline-block;
  white-space: nowrap;
}
