/* =================================================
   目次（Table of Contents）スタイル
   ================================================= */

/* メインコンテンツとサイドバーのラッパー */
.page-content-with-sidebar {
  position: relative;
  padding: 0 0 120px 0;
}

.business-overview-page .page-content-with-sidebar {
  padding: 0 0 120px 0;
}

.content-sidebar-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}

/* メインコンテンツエリア */
.main-content-area {
  flex: 1;
  min-width: 0; /* フレックスアイテムのオーバーフロー対策 */
  padding: 2%;
}

/* .main-content-area > section:first-of-type {
  padding: 0 0 60px 0;
} */

/* サイドバー目次 */
.page-sidebar-toc {
  position: sticky;
  top: 100px;
  width: 180px;
  flex-shrink: 0;
  align-self: flex-start;
}

.toc-wrapper {
  padding-left: 16px;
}

/* 目次リスト */
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin: 0;
  padding: 0;
}

.toc-item + .toc-item {
  margin-top: 8px;
}

/* 目次リンク */
.toc-link {
  display: block;
  padding: 12px 0 12px 16px;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.3s ease;
  position: relative;
}

/* 左側の円（疑似要素） */
.toc-link::before {
  content: "";
  position: absolute;
  display: block;
  visibility: hidden;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform: scale(0);
  border-radius: 100%;
  background-color: var(--primary-color);
}

.toc-link:hover {
  background: var(--gradient-subtle-light);
  color: var(--primary-color);
}

.toc-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* アクティブ時に円を表示 */
.toc-link.active::before {
  visibility: visible;
  transform: scale(1);
}

/* 目次テキスト */
.toc-link-text-en {
  display: block;
  font-family: var(--font-en, 'Roboto', sans-serif);
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
  letter-spacing: -0.04em;
    text-indent: -0.04em;
}

.toc-link.active .toc-link-text-en {
  opacity: 1;
}

.toc-link-text {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
}

/* レスポンシブ対応 */
@media (max-width: 991.98px) {

  .main-content-area {
    width: 100%;
  }

  .page-content-with-sidebar {
    padding: 16px 0;
  }

  .content-sidebar-wrapper {
    flex-direction: column;
  }

  .page-sidebar-toc {
    position: relative;
    top: 0;
    width: 100%;
    order: -1; /* モバイルでは目次を上に表示 */
    padding-top: 0;
  }

  .toc-wrapper {
    padding: 20px 16px;
  }
  
  .toc-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: center;
  }

  .toc-link {
    padding: 0;
    padding-right: 24px;
    position: relative;
  }

  /* SP時のみ右端に▼を表示 */
  .toc-link::after {
    content: "▼";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    color: var(--primary-color);
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .toc-link.active::after {
    opacity: 1;
  }

  /* タブレット以下はアクティブ時も左の円は非表示（▼で状態を示す） */
  .toc-link.active::before {
    visibility: hidden;
    transform: scale(0);
  }

  .toc-item + .toc-item {
    margin-top: 0;
}

  .toc-link-text-en {
    font-size: 0.5rem;
  }

  .toc-link-text {
    font-size: 0.7rem;
  }
}

.page-sidebar-toc {
  animation: gp-fade-in-up var(--animation-duration) var(--animation-easing);
}

/* スクロールバーのカスタマイズ（Webkit） */
.toc-wrapper::-webkit-scrollbar {
  width: 6px;
}

.toc-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.toc-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.toc-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 目次が長い場合のスクロール対応 */
@media (min-width: 992px) {
  .toc-wrapper {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
  }
}

/* 各ページ別の調整用クラス */
.company-page-toc,
.about-page-toc,
.greeting-page-toc,
.business-department-page-toc {
  /* ページ固有のスタイルがあれば追加 */
}

/* サンプル構造に合わせたスタイル調整 */
.page-sidebar-toc .toc-navigation {
  position: relative;
}

/* ホバー時のスムーズなトランジション */
.toc-link {
  transition: 
    background-color 0.3s ease,
    color 0.3s ease,
    padding-left 0.3s ease,
    transform 0.2s ease;
}

.toc-link:active {
  transform: scale(0.98);
}

