/* ============================================================
   SIB LAB - 2カラムレイアウト & サイドバー目次
   格納場所: css/siblab-sidebar.css
   ============================================================ */

/* ------------------------------
   2カラムラッパー
   ------------------------------ */
.ol-article-with-sidebar.ol-content-frame {
  display: flex;
  align-items: flex-start;
  gap: 48px;
  max-width: 1200px;
}

.ol-article-with-sidebar .ol-article__body {
  flex: 1;
  min-width: 0;
  padding-top: 40px;
}

/* ------------------------------
   サイドバー
   ------------------------------ */
.ol-article__sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  transition: opacity 0.3s ease;
}

.ol-article__sidebar-inner {
  background: #fff;
  border-top: 2px solid #111;
  padding: 24px 0 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;
}

.ol-article__sidebar-inner::-webkit-scrollbar {
  display: none;
}

/* ------------------------------
   ez-toc コンテナ
   aside + #ez-toc-container の組み合わせ（特異度 1,1,0）で
   プラグインの #ez-toc-container（1,0,0）に !important なしで勝つ
   ------------------------------ */
aside.ol-article__sidebar #ez-toc-container {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  box-shadow: none;
}

/* 目次タイトル */
aside.ol-article__sidebar #ez-toc-container .ez-toc-title-container {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

aside.ol-article__sidebar #ez-toc-container .ez-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #111;
  text-transform: uppercase;
}

/* トグルアイコンのみ非表示
   ラベルごと消すと「目次」タイトルも消えるためアイコンだけ対象にする */
aside.ol-article__sidebar .ez-toc-cssicon {
  display: none;
}

aside.ol-article__sidebar .ez-toc-cssicon-toggle-label {
  cursor: default;
  pointer-events: none;
}

/* 目次リスト */
aside.ol-article__sidebar #ez-toc-container .ez-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 第1階層アイテム */
aside.ol-article__sidebar #ez-toc-container .ez-toc-list > li {
  padding-left: 0;
  margin-bottom: 2px;
}

/* リンク色
   aside + #ez-toc-container（特異度 1,1,1）で
   プラグインの #ez-toc-container a（1,0,1）に勝つ
   font-weight のみ: theme の li { font-weight: 500 !important } に対抗するため !important が必要
   → style.css の body,p,li,... ルールから li を削除できれば !important 不要になる */
aside.ol-article__sidebar #ez-toc-container a,
aside.ol-article__sidebar #ez-toc-container a:link,
aside.ol-article__sidebar #ez-toc-container a:visited {
  color: #999;
  font-size: 12px;
  font-weight: 600 !important;
  text-decoration: none;
  display: block;
  padding: 6px 0;
  line-height: 1.5;
  transition: color 0.2s ease;
}

aside.ol-article__sidebar #ez-toc-container a:hover,
aside.ol-article__sidebar #ez-toc-container .ez-toc-list > li.active > a {
  color: #111;
  text-decoration: none;
}

/* 第2階層以下は非表示 */
aside.ol-article__sidebar #ez-toc-container .ez-toc-list .ez-toc-list {
  display: none;
}

/* ------------------------------
   PC：記事内 ez-toc & フローティングボタン非表示
   ------------------------------ */
@media (min-width: 768px) {
  .ol-article-with-sidebar .ol-article__content #ez-toc-container {
    display: none !important;
  }

  #floating-toc-btn {
    display: none !important;
  }
}

/* ------------------------------
   スマホ：1カラムに戻す
   ------------------------------ */
@media (max-width: 767px) {
  .ol-article-with-sidebar.ol-content-frame {
    flex-direction: column;
  }

  .ol-article-with-sidebar .ol-article__body {
    padding-top: 20px;
  }

  .ol-article__sidebar {
    display: none;
  }

  .ol-article-with-sidebar .ol-article__content #ez-toc-container {
    display: block !important;
  }

  #floating-toc-btn {
    display: flex !important;
  }
}

/* ============================================================
   フローティング目次ボタン（スマホ用・style.css から移管）
   ============================================================ */

#floating-toc-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 999999;
  width: 60px;
  height: 60px;
  background: #222;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  border: none;
}

.toc-text {
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1;
  pointer-events: none;
}

#floating-toc-content {
  display: none;
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 260px;
  max-height: 60vh;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 18px;
  overflow-y: auto;
  cursor: default;
}

#floating-toc-btn.active #floating-toc-content {
  display: block;
}

.floating-toc-title {
  font-weight: bold;
  font-size: 14px;
  color: #333;
  margin: 0 0 10px 0;
  border-bottom: 2px solid #222;
  padding-bottom: 6px;
  text-align: left;
}

#floating-toc-content nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#floating-toc-content a {
  display: block;
  padding: 7px 0;
  color: #444;
  text-decoration: none;
  font-size: 12.5px;
  border-bottom: 1px solid #f0f0f0;
}

#floating-toc-content li.ez-toc-page-2,
#floating-toc-content li.ez-toc-heading-level-3 {
  padding-left: 1.2em;
}

#floating-toc-content li.ez-toc-page-3,
#floating-toc-content li.ez-toc-heading-level-4 {
  padding-left: 2.4em;
}

@media screen and (max-width: 767px) {
  #floating-toc-btn {
    width: 50px;
    height: 50px;
    bottom: 85px;
    right: 15px;
  }

  .toc-text {
    font-size: 11px;
  }

  #floating-toc-content {
    width: 85vw;
    max-width: 280px;
    bottom: 60px;
    padding: 15px;
  }

  #floating-toc-content a {
    font-size: 12px;
  }
}
