/* Article-only visual styling. No text content is changed. */
/* WordPress applies single-{post_type} to the body for published pages and draft previews. */
body:is(.single-bunseki, .single-jissho) {
  --bl-accent: #c44d78;
  --bl-accent-strong: #92264f;
  --bl-ink: #30333d;
  --bl-muted: #666978;
  --bl-paper: #fff9f7;
  --bl-border: #ead9df;
}

/* Marker spans already inserted by the writer. */
body:is(.single-bunseki, .single-jissho) .bl-marker {
  background: linear-gradient(to bottom, transparent 59%, rgba(255, 217, 101, .78) 59%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 .06em;
  border-radius: 2px;
  font-weight: 600;
  color: inherit;
}

/* Research finding / hypothesis box. */
body:is(.single-bunseki, .single-jissho) .bl-kasetsu {
  position: relative;
  margin: 2.25em 0;
  padding: 1.25em 1.4em 1.15em;
  background: linear-gradient(135deg, #fff9f6 0%, #fff5f8 100%);
  border: 1px solid #f0d9df;
  border-left: 5px solid var(--bl-accent);
  border-radius: 12px;
  box-shadow: 0 2px 9px rgba(87, 38, 61, .045);
  overflow-wrap: anywhere;
}
body:is(.single-bunseki, .single-jissho) .bl-kasetsu::before {
  content: "研究結果・仮説";
  display: inline-block;
  margin: 0 0 .85em;
  padding: .29em .8em;
  background: var(--bl-accent);
  color: #fff;
  border-radius: 999px;
  font-size: .78rem;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: .06em;
}
body:is(.single-bunseki, .single-jissho) .bl-kasetsu p {
  margin: 0 0 .85em;
  line-height: 1.85;
}
body:is(.single-bunseki, .single-jissho) .bl-kasetsu p:last-child {
  margin-bottom: 0;
}
body:is(.single-bunseki, .single-jissho) .bl-kasetsu .bl-hypo {
  display: block;
  margin: 0 0 .45em;
  color: var(--bl-accent-strong);
  font-size: 1.03em;
  font-weight: 750;
  line-height: 1.7;
}

/* Existing editor-generated table of contents. */
body:is(.single-bunseki, .single-jissho) .toc {
  margin: 2em 0 2.3em;
  padding: 1.1em 1.3em;
  background: #fafbfc;
  border: 1px solid #e4e8ed;
  border-radius: 12px;
  font-size: .94em;
  line-height: 1.85;
}
body:is(.single-bunseki, .single-jissho) .toc > p:first-child {
  margin: 0 0 .6em;
  font-weight: 700;
  color: var(--bl-ink);
}
body:is(.single-bunseki, .single-jissho) .toc > p:first-child strong {
  font-size: 1.06em;
}
body:is(.single-bunseki, .single-jissho) .toc ol {
  margin: 0;
  padding-left: 1.35em;
}
body:is(.single-bunseki, .single-jissho) .toc ol ol {
  margin: .3em 0 .45em;
  padding-left: 1.35em;
}
body:is(.single-bunseki, .single-jissho) .toc li {
  margin: .22em 0;
  padding-left: .05em;
}
body:is(.single-bunseki, .single-jissho) .toc a {
  color: #715064;
  text-decoration: none;
  text-underline-offset: 3px;
}
body:is(.single-bunseki, .single-jissho) .toc a:hover,
body:is(.single-bunseki, .single-jissho) .toc a:focus-visible {
  color: var(--bl-accent-strong);
  text-decoration: underline;
}

/* Article headings only (avoid site header/footer and sidebar). */
body:is(.single-bunseki, .single-jissho) article h2 {
  margin-top: 2.3em;
  margin-bottom: .95em;
  padding: .55em .75em;
  border-left: 5px solid var(--bl-accent);
  background: #fff5f8;
  border-radius: 0 7px 7px 0;
  color: #342d35;
  line-height: 1.5;
  font-weight: 750;
}
body:is(.single-bunseki, .single-jissho) article h3 {
  margin-top: 1.8em;
  margin-bottom: .8em;
  padding: .15em 0 .45em;
  border-bottom: 2px solid #edc8d5;
  color: #3b3740;
  line-height: 1.55;
  font-weight: 700;
}
body:is(.single-bunseki, .single-jissho) article p,
body:is(.single-bunseki, .single-jissho) article li {
  line-height: 1.93;
  overflow-wrap: anywhere;
}
body:is(.single-bunseki, .single-jissho) article p {
  margin-bottom: 1.35em;
}

@media (max-width: 767px) {
  body:is(.single-bunseki, .single-jissho) .bl-kasetsu {
    margin: 1.8em 0;
    padding: 1.05em 1em 1.15em;
    border-radius: 9px;
  }
  body:is(.single-bunseki, .single-jissho) .toc {
    padding: 1em 1em;
    font-size: .91em;
  }
  body:is(.single-bunseki, .single-jissho) article h2 {
    padding: .5em .65em;
    line-height: 1.5;
  }
  body:is(.single-bunseki, .single-jissho) article p,
  body:is(.single-bunseki, .single-jissho) article li {
    line-height: 1.85;
  }
}


/* 1. 研究結果ボックス内の見出し：外側の見出し装飾を打ち消して二重の左線と大きな空白をなくす */
body:is(.single-bunseki, .single-jissho) .bl-kasetsu h2 {
  margin: 0 0 .8em;
  padding: 0 0 .5em;
  background: none;
  border: 0;
  border-bottom: 1px solid #f0d9df;
  border-radius: 0;
  font-size: 1.25em;
}

/* 2. スマホで見出しが大きすぎて1文字だけ改行される問題 */
@media (max-width: 767px) {
  body:is(.single-bunseki, .single-jissho) article .bl-content h2 { font-size: 22px; }
  body:is(.single-bunseki, .single-jissho) article .bl-content h3 { font-size: 18px; }
}

/* 3. 目次の二重表示：スマホでは記事最下部に回るテーマのサイドバー目次を隠す／PCでは本文内の目次を隠し、サイドバー目次をスクロールに追従させる */
@media (max-width: 1039px) {
  body:is(.single-bunseki, .single-jissho) .bl-aside .bl-toc { display: none; }
}
@media (min-width: 1040px) {
  body:is(.single-bunseki, .single-jissho) .bl-content > .toc { display: none; }
  body:is(.single-bunseki, .single-jissho) .bl-aside .bl-toc { position: sticky; top: 24px; }
}

/* 4. 目次のリンクが押しにくい（現在の高さ約23px）→ 押しやすい高さ（約44px）にする */
body:is(.single-bunseki, .single-jissho) .toc li { margin: 0; }
body:is(.single-bunseki, .single-jissho) .toc a { display: block; padding: .55em 0; }

/* 5. マーカーに太字がかかり、太字との区別がつかない → マーカーは太さを変えない */
body:is(.single-bunseki, .single-jissho) .bl-marker { font-weight: inherit; }

/* 6. 自動付与された sec- ID の出典・参考見出しを控えめな見た目にする */
body:is(.single-bunseki, .single-jissho) article .bl-content h2[id^="sec-"] {
  margin-top: 3em;
  padding: 1em 0 0;
  font-size: 16px;
  color: #666978;
  background: none;
  border-left: 0;
  border-top: 1px solid #ead9df;
  border-radius: 0;
}
