/* ================================
   tea-toc.css ver.1.0 2025.07.14
                     ver.2.0 2026.02.06
   目次等スタイル
   ================================ */

/* 保険：シングル以外では出さない */
body:not(.single) .wp-block-simpletoc { display: none !important; }

/* プラグイン側の擬似ラベル等を停止（必要最低限） */
.single .wp-block-simpletoc::after,
.single .wp-block-simpletoc ul::after,
.single ul.simpletoc-list::after { content: none !important; }

/* ===== Single（一般記事＋辞典）共通：枠は UL の背面で生成 ===== */

.single .entry-content h2.simpletoc-title{
  margin: 0 0 .6em;
  color: var(--tw-heading-color, #3f1f07);
  position: relative;
  z-index: 1; /* 枠より前 */
}

.single .entry-content ul.simpletoc-list{
  list-style: none !important; /* 「・」再発防止 */
  margin: 0;
  padding: 8px 18px 22px 24px; /* タイトルと1行目の間隔もここで管理 */
  position: relative;
}

.single .entry-content ul.simpletoc-list::before{
  content: "";
  position: absolute;
  z-index: -1;
  inset: -48px -16px -8px -16px; /* 上へ伸ばして h2 も同じ枠に見せる */
  border-radius: 12px;
  background: #fffaf3;
  border: 2px solid #cbb98a;
  box-shadow:
    -10px 0 0 0 rgba(58,26,9,.44),
     0 10px 0 0 rgba(58,26,9,.26),
    12px 12px 18px 0 rgba(63,31,7,.14),
    -6px -6px 12px 0 rgba(146,65,7,.08);
  pointer-events: none;
}

/* TOC内リンク：本文色を継承（青化防止） */
.single .entry-content .simpletoc-list a{
  color: inherit;
  text-decoration: none;
}
.single .entry-content .simpletoc-list a:hover{ text-decoration: underline; }

/* 一般記事（single-post）の文字サイズ暴走だけ抑える（最小限） */
.single.single-post .wp-block-simpletoc{
  font-size: 1rem;
  line-height: 1.7;
}
@media (max-width: 480px){
  .single.single-post .wp-block-simpletoc{ font-size: .97rem; }
}

/* ===== 固定ページ：Query Loop 内に混入する SimpleTOC を非表示 ===== */
body.page .wp-block-query .simpletoc-title,
body.page .wp-block-query .simpletoc-list { display: none !important; }

/* ===== 固定ページ：カード用のページ内目次（コンパクト） ===== */
body.page .list-toc .simpletoc-title{
  font-size: 1rem;
  font-weight: 700;
  margin: .4rem 0 .3rem;
  color: var(--tw-heading-color, #3f1f07);
}
body.page .list-toc .simpletoc-list{
  background:#fff7ee;
  border-radius:12px;
  box-shadow:0 2px 6px rgba(0,0,0,.06);
  padding:.6rem .8rem;
  margin:.5rem 0 1rem;
  list-style:none;
}
body.page .list-toc .simpletoc-list > li{ margin:.22rem 0; }
body.page .list-toc .simpletoc-list a{ text-decoration:none; color:inherit; }
body.page .list-toc .simpletoc-list a:hover{ text-decoration: underline; }

/* home は TOC を消す（保険） */
body.home [class*="simpletoc"]{ display: none !important; }

/* 辞典（tw-entry）でも枠を出す：entry-content 依存を外す */
.single :is(.entry-content, .tw-entry, .entry) .wp-block-simpletoc{
  position: relative;
  padding: 18px 18px 22px 24px;
  background: #fffaf3;
  border: 2px solid #cbb98a;
  border-radius: 12px;
  box-shadow:
    -10px 0 0 0 rgba(58,26,9,.44),
     0 10px 0 0 rgba(58,26,9,.26),
    12px 12px 18px 0 rgba(63,31,7,.14),
    -6px -6px 12px 0 rgba(146,65,7,.08);
}

/* 中身整形（辞典でも共通） */
.single :is(.entry-content, .tw-entry, .entry) .wp-block-simpletoc h2.simpletoc-title{
  margin: 0 0 .6em;
  color: var(--tw-heading-color, #3f1f07);
}
.single :is(.entry-content, .tw-entry, .entry) .wp-block-simpletoc .simpletoc-list{
  list-style: none !important;
  margin: 0;
  padding: 0;
}

/* ===== Dictionary terms (tw-entry) : naked SimpleTOC frame ===== */
/* 形：article.tw-entry 直下に h2.simpletoc-title + ul.simpletoc-list が来る */
.single article.tw-entry > h2.simpletoc-title + ul.simpletoc-list{
  position: relative;
  list-style: none !important;
  margin: 0;
  padding: 8px 18px 22px 24px; /* 題字と1行目の間隔もここで確保 */
}

/* タイトルを手前に */
.single article.tw-entry > h2.simpletoc-title{
  margin: 0 0 .6em;
  color: var(--tw-heading-color, #3f1f07);
  position: relative;
  z-index: 1;
}

/* 枠はULの背面で生成（タイトルも同じ枠に見せるため上へ拡張） */
.single article.tw-entry > h2.simpletoc-title + ul.simpletoc-list::before{
  content: "";
  position: absolute;
  z-index: -1;
  inset: -48px -16px -8px -16px;
  border-radius: 12px;
  background: #fffaf3;
  border: 2px solid #cbb98a;
  box-shadow:
    -10px 0 0 0 rgba(58,26,9,.44),
     0 10px 0 0 rgba(58,26,9,.26),
    12px 12px 18px 0 rgba(63,31,7,.14),
    -6px -6px 12px 0 rgba(146,65,7,.08);
  pointer-events: none;
}

/* 辞典TOC内リンク：青化防止 */
.single article.tw-entry > h2.simpletoc-title + ul.simpletoc-list a{
  color: inherit;
  text-decoration: none;
}
.single article.tw-entry > h2.simpletoc-title + ul.simpletoc-list a:hover{
  text-decoration: underline;
}

/* ===== Single post: TOC text size normalize ===== */
.single .entry-content ul.simpletoc-list{
  list-style: none !important;
  padding-left: 1.2em; /* 左余白は好みで */
}
.single .entry-content ul.simpletoc-list li::marker{
  content: "";
}


.single.single-post .entry-content h2.simpletoc-title{
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
}

.single .entry-content .wp-block-simpletoc{
  padding-left: 2.2rem !important;
  padding-right: 1.2rem !important; /* バランス用・任意 */
}


.single .entry-content ul.simpletoc-list{
  list-style: none !important;
}


.single.single-post .wp-block-simpletoc .simpletoc-list{
  margin: 0;
  padding-left: 1.2em; /* 控えめ */
}
.single.single-post .wp-block-simpletoc .simpletoc-list li{
  margin: .25em 0;
}

/* 用語辞典（一般記事側）：TOC枠を少し内側へ（左寄り補正） */
.single .entry-content .wp-block-simpletoc{
  margin-left: 12px;   /* 8〜18pxで調整 */
  margin-right: 12px;  /* 左右同量にして品位を保つ */
}