/* 詳細ページ：html の smooth scroll とアンカーが二重になるのを防ぐ */
html:has(.site-main--detail) {
  scroll-behavior: auto;
}

/* ============================================================
   Detail Page — Hero override（パンくずのみ、短め）
   ============================================================ */
.hero--detail .hero-inner {
  max-width: 1440px;
  margin: 0 auto 10px;
}

.breadcrumb-scroll {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 0 0;
  width: 100%;
}

.breadcrumb--detail {
  position: relative;
  max-width: none;
  margin: 0;
  padding: 0 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.breadcrumb--detail::-webkit-scrollbar {
  display: none;
}

.breadcrumb-scroll-bar {
  position: relative;
  height: 6px;
  background-color: var(--color-client-card-bg);
  border-radius: 3px;
  overflow: hidden;
}

.breadcrumb-scroll-bar.is-hidden {
  display: none;
}

.breadcrumb-scroll-bar__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 48px;
  background-color: var(--color-border);
  border-radius: 3px;
  pointer-events: none;
}

.breadcrumb--detail ol {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: max-content;
  max-width: none;
  min-width: 100%;
}

.breadcrumb--detail ol li {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   Main section override
   ============================================================ */
.site-main--detail {
  /* overflow:hidden を解除してスティッキーサイドバーを有効化 */
  overflow: visible;
  /* gap は detail-layout で管理するので不要 */
  gap: 0;
}

/* ============================================================
   2カラム レイアウト (PC: 840px + 48px gap + 312px)
   ============================================================ */
.detail-layout {
  width: 1200px;
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 840px 1fr;
  gap: 48px;
  align-items: start;
}

/* ============================================================
   Article（左カラム）
   ============================================================ */
.detail-article {
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-width: 0;
}

/* メイン画像（Figma: 840×473px） */
.article-hero-img {
  width: 100%;
  max-width: 840px;
  aspect-ratio: 840 / 473;
  overflow: hidden;
  background-color: var(--color-placeholder);
}

.article-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* タイトルブロック */
.article-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
  letter-spacing: 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.article-date {
  font-size: 14px;
  font-weight: 400;
  color: #737373;
}

.article-company {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.7px;
  color: var(--color-dark);
}

/* ============================================================
   クライアント情報カード
   ============================================================ */
.client-card {
  background-color: var(--color-client-card-bg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.client-card-top {
  display: flex;
  align-items: center;
  gap: 24px;
}

.client-logo {
  width: 100px;
  height: 100px;
  background-color: #c5c5c5;
  flex-shrink: 0;
  overflow: hidden;
}

.client-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background-color: #fff;
}

.client-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.client-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
  white-space: nowrap;
}

.client-desc {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-dark);
}

/* クライアントテーブル */
.client-table {
  width: 100%;
  border-collapse: collapse;
}

.client-table th,
.client-table td {
  padding: 10px 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-dark);
  border-bottom: 1px solid #d1d1d1;
  text-align: left;
  vertical-align: middle;
}

.client-table th {
  font-weight: 700;
  width: 120px;
  white-space: nowrap;
}

.client-table td {
  font-weight: 400;
}

/* ============================================================
   課題・施策・成果 サマリーテーブル
   ============================================================ */
.summary-table {
  display: flex;
  flex-direction: column;
}

.summary-row {
  display: flex;
  align-items: stretch;
  gap: 24px;
  
}

.summary-label {
  background-color: var(--color-yellow);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: stretch;
}

.summary-list {
  list-style: disc;
  padding: 16px 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-list li {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
}

/* ============================================================
   本文テキスト
   ============================================================ */
.article-body {
  font-size: 16px;
  font-weight: 400;
  line-height: 2;
  color: var(--color-dark);
}

/* ============================================================
   セクション見出し（左: 黄色 6px ボーダー / 下: グレー 2px）
   ============================================================ */
.section-heading {
  border-bottom: 2px solid var(--color-border);
  width: 100%;
  scroll-margin-top: 104px;
}

.section-heading h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
  border-left: 6px solid var(--color-yellow);
  padding: 10px 12px 10px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Q&A ブロック
   ============================================================ */
.qa-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qa-question {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 32px;
}

.qa-q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background-color: var(--color-yellow);
  font-family: var(--font-en);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-dark);
  flex-shrink: 0;
  line-height: 1;
}

.qa-question p {
  font-size: 16px;
  font-weight: 700;
  line-height: 2;
  color: var(--color-dark);
  white-space: nowrap;
}

.qa-answer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  line-height: 2;
}

.qa-person {
  display: flex;
  align-items: center;
  gap: 16px;
}

.qa-person-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-dark);
}

.qa-person-title {
  font-size: 16px;
  font-weight: 400;
  color: #8a8a8a;
}

.qa-answer > p {
  font-size: 16px;
  font-weight: 400;
  line-height: 2;
  color: var(--color-dark);
}

/* ============================================================
   記事内画像
   ============================================================ */
.article-img {
  width: 100%;
  aspect-ratio: 4096 / 2731;
  overflow: hidden;
}

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

/* ============================================================
   KPI 数字ボックス
   ============================================================ */
.kpi-grid {
  display: flex;
  gap: 16px;
  width: 100%;
}

.kpi-box {
  flex: 1;
  border: 1px solid var(--color-yellow);
  background-color: rgba(251, 242, 149, 0.15);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.kpi-number {
  display: flex;
  align-items: flex-end;
  gap: 0;
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--color-dark);
  white-space: nowrap;
}

.kpi-value {
  font-size: 54px;
  line-height: 1;
}

.kpi-unit {
  font-size: 32px;
  line-height: 1.25;
}

.kpi-label {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  color: var(--color-dark);
}

/* ============================================================
   関連記事（未使用・将来実装用）
   ============================================================ */
/*
.related-articles {
  padding-top: 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.related-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 1px;
  color: var(--color-dark);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
*/

/* ============================================================
   Sidebar（右カラム）
   ============================================================ */
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 88px; /* ヘッダー高さ分オフセット */
}

/* 目次ボックス */
.sidebar-toc {
  border: 2px solid #e6e6e6;
  padding: 32px 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 黄色のアクセントバー（上端） */
.sidebar-toc-bar {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 6px;
  background-color: var(--color-yellow);
}

.sidebar-toc-heading {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 2px;
  color: var(--color-dark);
}

.sidebar-toc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.sidebar-toc-list li a {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-dark);
  transition: font-weight 0.15s ease;
}

.sidebar-toc-list li a.is-current {
  font-weight: 700;
}

.sidebar-toc-list li a:hover {
  opacity: 0.7;
}

.toc-num {
  font-family: var(--font-en);
  font-weight: 700;
  width: 22px;
  flex-shrink: 0;
  line-height: 1.5;
}

/* ============================================================
   CTA ボックス
   ============================================================ */
.sidebar-cta {
  border: 2px solid #e6e6e6;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cta-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  width: 100%;
}

.cta-heading p {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
  white-space: nowrap;
}

.cta-line {
  flex: 1;
  height: 1px;
  background-color: #d1d1d1;
}

.cta-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-dark);
}

.cta-desc {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.42px;
  color: var(--color-dark);
}

.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.sidebar-cta a.cta-btn,
.sidebar-cta a.cta-btn:visited {
  color: var(--color-dark);
  text-decoration: none;
}

.cta-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 16px 56px 16px 32px;
  border-radius: 44px;
  border: 1px solid transparent;
  box-sizing: border-box;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.8px;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.2s;
  width: 100%;
}

.cta-btn:hover {
  opacity: 0.8;
  text-decoration: none;
}

.cta-btn--primary {
  background-color: var(--color-yellow);
  color: var(--color-dark);
}

.cta-btn--secondary {
  background-color: #fff;
  border-color: var(--color-dark);
  color: var(--color-dark);
}

.cta-btn span:first-child {
  text-align: center;
  white-space: nowrap;
}

/* 右サイドバー CTA：幅が狭いため余白・字サイズを調整 */
.sidebar-cta .cta-btn {
  font-size: 14px;
  letter-spacing: 0.4px;
  padding: 14px 0;
  min-height: 56px;
    max-width: 248px;
}

.sidebar-cta .cta-arrow {
  right: 16px;
  width: 16px;
  height: 16px;
}

.cta-arrow {
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: url("https://chuyo.jp/wp-content/uploads/2025/10/arrow_black.png") no-repeat center / contain;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

/* PC CTA は sidebar に表示 */
.pc-cta {
  display: flex;
}

/* SP 固定フッター CTA（767px以下のみ表示） */
.detail-sp-fixed-cta {
  display: none;
}

.detail-sp-fixed-cta a.cta-btn,
.detail-sp-fixed-cta a.cta-btn:visited {
  color: var(--color-dark);
  text-decoration: none;
}

/* ============================================================
   SP インライン目次ボックス（記事本文内）
   ============================================================ */
.sp-toc-box {
  display: none; /* PC では非表示 */
}

.sp-toc-box .sidebar-toc-bar {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  height: 6px;
  background-color: var(--color-yellow);
}

.sp-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--color-dark);
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sp-toc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: var(--color-dark);
}

.sp-toc-icon::before {
  content: "－";
}

.sp-toc-toggle[aria-expanded="false"] .sp-toc-icon::before {
  content: "＋";
}

.sp-toc-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sp-toc-content.is-collapsed {
  display: none;
}


/* ============================================================
   Responsive — Tablet (max 1280px)
   ============================================================ */
@media (max-width: 1280px) {
  .detail-layout {
    width: 100%;
    max-width: 100%;
    padding-inline: 24px;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 32px;
  }

  .detail-article {
    min-width: 0;
  }

  .client-card {
    max-width: 100%;
    box-sizing: border-box;
  }

  .client-card-top {
    align-items: flex-start;
  }

  .client-info {
    flex: 1;
    min-width: 0;
  }

  .client-name {
    white-space: normal;
  }

  .client-table th,
  .client-table td {
    padding: 10px 12px;
  }

  .client-table td {
    word-break: break-word;
  }

  .section-heading h2 {
    white-space: normal;
  }

  .qa-question p {
    white-space: normal;
  }
}


/* ============================================================
   Responsive — SP (max 767px)
   ============================================================ */
@media (max-width: 767px) {

  /* Hero */
  .breadcrumb-scroll {
    padding: 16px 0 0;
    max-width: 100%;
  }

  .breadcrumb--detail {
    padding: 0 0 8px;
  }

  /* Main */
  .site-main--detail {
    padding: 64px 0;
    gap: 0;
    align-items: stretch;
  }

  /* 1カラムに変更 */
  .detail-layout {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 24px;
  }

  /* Sidebar を非表示（SP用 CTA は article 内に表示） */
  .detail-sidebar {
    display: none;
  }

  /* Article */
  .detail-article {
    gap: 24px;
    width: 100%;
  }

  /* ヒーロー画像：全幅・220px高 */
  .article-hero-img {
    width: calc(100% + 48px);
    max-width: none;
    margin-inline: -24px;
    aspect-ratio: auto;
    height: 220px;
  }

  .article-header {
    gap: 16px;
  }

  .site-main--detail .tags {
    gap: 12px;
  }

  .site-main--detail .tag {
    font-size: 12px;
    line-height: 1;
    padding: 4px;
  }

  .article-title {
    font-size: 20px;
    line-height: 1.5;
  }

  .article-meta {
    gap: 16px;
    flex-wrap: wrap;
  }

  .article-date {
    font-size: 14px;
    line-height: 1;
  }

  .article-company {
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.7px;
  }

  /* クライアントカード */
  .client-card {
    padding: 16px;
    gap: 16px;
  }

  .client-card-top {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }

  .client-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .client-logo {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
  }

  .client-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    white-space: normal;
  }

  .client-desc {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
  }

  .client-table th,
  .client-table td {
    padding: 8px;
    font-size: 14px;
    line-height: 1.5;
    vertical-align: top;
  }

  .client-table td {
    padding-top: 10px;
    padding-bottom: 10px;
    word-break: break-word;
  }

  .client-table th {
    width: 80px;
    min-width: 80px;
    padding-right: 8px;
    white-space: nowrap;
    font-weight: 700;
  }

  /* サマリーテーブル */
  .summary-row {
    flex-direction: column;
    gap: 0;
  }

  .summary-label {
    width: 100%;
    padding: 4px 48px;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
  }

  .summary-list {
    padding: 16px 0 16px 21px;
    gap: 4px;
  }

  .summary-list li {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
  }

  /* 本文 */
  .article-body {
    font-size: 14px;
    line-height: 1.8;
  }

  /* セクション見出し */
  .section-heading {
    scroll-margin-top: 72px;
  }

  .section-heading h2 {
    font-size: 18px;
    line-height: 1.5;
    white-space: normal;
    padding: 10px 16px;
  }

  /* QA */
  .qa-block {
    gap: 16px;
  }

  .qa-question {
    height: auto;
    align-items: flex-start;
    gap: 16px;
  }

  .qa-question p {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    white-space: normal;
  }

  .qa-answer {
    gap: 8px;
    line-height: 1.8;
  }

  .qa-person {
    gap: 16px;
    line-height: 2;
  }

  .qa-answer > p,
  .qa-person-name,
  .qa-person-title {
    font-size: 14px;
  }

  .qa-answer > p {
    line-height: 1.8;
  }

  /* KPI */
  .kpi-grid {
    flex-direction: column;
    gap: 8px;
  }

  .kpi-box {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
    justify-content: center;
  }

  .kpi-number {
    width: 100px;
    flex-shrink: 0;
    align-items: flex-end;
  }

  .kpi-value {
    font-size: 40px;
  }

  .kpi-unit {
    font-size: 32px;
  }

  .kpi-label {
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
    flex: 1;
    min-width: 0;
  }

  /* SP 目次ボックス */
  .sp-toc-box {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    border: 2px solid #e6e6e6;
    padding: 20px 24px 16px;
  }

  .sp-toc-toggle {
    font-size: 16px;
    letter-spacing: 1.6px;
  }

  .sp-toc-content.sidebar-toc-list li a {
    font-size: 14px;
    line-height: 1.5;
  }

  /* 固定フッター CTA */
  .detail-sp-fixed-cta {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .detail-sp-fixed-cta.is-hidden {
    display: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .detail-sp-fixed-cta.is-hidden .detail-sp-fixed-cta__buttons {
    pointer-events: none;
  }

  .detail-sp-fixed-cta__buttons {
    display: flex;
    gap: 12px;
    align-items: stretch;
    pointer-events: auto;
  }

  .detail-sp-fixed-cta .cta-btn {
    flex: 1;
    min-width: 0;
    width: auto;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.2px;
    padding: 12px 28px 12px 10px;
    min-height: 44px;
  }

  .detail-sp-fixed-cta .cta-arrow {
    right: 10px;
    width: 14px;
    height: 14px;
  }
}
