/* POLARIS / Article Table of Contents | Ver. 0.3.1 (2026-11-20)
 * Presentation-only override for Cocoon's native TOC in ordinary posts.
 * Keeps heading links, numbering, checkboxes and collapse/expand behavior intact.
 * The accepted article TOC CSS is unchanged; v0.3.1 adds matching sidebar styles.
 * Scope excludes Pages, archives, Trail Map, portfolio and unrelated widgets.
 */
body.single-post #main .entry-content .toc-wrap {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 28px 0 32px;
}

body.single-post #main .entry-content .toc {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 28px 0 32px !important;
  padding: 0 !important;
  border: 1px solid #DCE6DF !important;
  border-radius: 10px !important;
  background: #FBFDFC !important;
  color: #203B35 !important;
  box-shadow: 0 4px 18px rgba(25, 60, 55, 0.035) !important;
  overflow: hidden;
  text-align: left !important;
}
/* When there is an outer .toc-wrap, avoid doubling its vertical margin. */
body.single-post #main .entry-content .toc-wrap > .toc {
  margin: 0 !important;
}

body.single-post #main .entry-content .toc .toc-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 52px;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 13px 18px !important;
  background: #F0F6F2 !important;
  color: #193C37 !important;
  border: 0 !important;
  border-bottom: 1px solid #DCE6DF !important;
  border-radius: 0 !important;
  text-align: left !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
body.single-post #main .entry-content .toc .toc-title::before {
  content: "";
  position: static;
  display: inline-block;
  box-sizing: border-box;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  margin: 0;
  border: 1px solid #C9DEE0;
  border-radius: 6px;
  background: #E4F0F4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2321658F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13'/%3E%3Cpath d='M3 6h.01M3 12h.01M3 18h.01' stroke-width='3'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}

body.single-post #main .entry-content .toc .toc-content {
  box-sizing: border-box;
  margin: 0 !important;
  padding: 13px 18px 15px !important;
  background: transparent !important;
  color: #203B35 !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.single-post #main .entry-content .toc .toc-list,
body.single-post #main .entry-content .toc .toc-content > ol,
body.single-post #main .entry-content .toc .toc-content > ul {
  box-sizing: border-box;
  margin: 0 !important;
  padding-left: 1.5em !important;
  background: transparent !important;
  border: 0 !important;
}
body.single-post #main .entry-content .toc .toc-list li {
  color: #21658F;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.7;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.single-post #main .entry-content .toc .toc-list li::marker {
  color: #21658F;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
/* Top-level dividers begin nearer the heading text, clear of the list number. */
body.single-post #main .entry-content .toc .toc-list > li + li {
  position: relative;
  border-top: 0 !important;
  padding-top: 6px !important;
  margin-top: 4px !important;
}
body.single-post #main .entry-content .toc .toc-list > li + li::after {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 0;
  height: 1px;
  background-color: #E8EFEB;
  pointer-events: none;
}
body.single-post #main .entry-content .toc .toc-list > li > a {
  font-weight: 700 !important;
  color: #193C37 !important;
}
body.single-post #main .entry-content .toc .toc-list a {
  display: block;
  margin: 0 !important;
  padding: 6px 6px !important;
  border: 0 !important;
  border-radius: 5px;
  color: #385A54 !important;
  background: transparent !important;
  font-size: inherit !important;
  line-height: 1.7 !important;
  font-weight: 500;
  text-decoration: none !important;
  text-underline-offset: 3px;
  box-shadow: none !important;
  transition: background-color .12s ease, color .12s ease;
}
body.single-post #main .entry-content .toc .toc-list a:hover,
body.single-post #main .entry-content .toc .toc-list a:focus-visible {
  background: #EAF4FA !important;
  color: #21658F !important;
  text-decoration: none !important;
}
body.single-post #main .entry-content .toc .toc-list a:focus-visible {
  outline: 2px solid #21658F !important;
  outline-offset: 1px;
}
/* Nested heading levels: visible hierarchy without gray heavy dividers. */
body.single-post #main .entry-content .toc .toc-list li > ol,
body.single-post #main .entry-content .toc .toc-list li > ul {
  margin: 2px 0 7px 7px !important;
  padding: 0 0 0 38px !important;
  border: 0 !important;
  border-left: 2px solid #E0EBE7 !important;
  background: transparent !important;
}
body.single-post #main .entry-content .toc .toc-list li li a {
  padding: 4px 6px !important;
  color: #58736E !important;
  font-weight: 400 !important;
  font-size: .94em !important;
}

@media (max-width: 767px) {
  body.single-post #main .entry-content .toc { margin: 22px 0 28px !important; border-radius: 8px !important; }
  body.single-post #main .entry-content .toc .toc-title { min-height: 48px; padding: 11px 13px !important; font-size: 15px !important; }
  body.single-post #main .entry-content .toc .toc-content { padding: 11px 11px 14px !important; font-size: 13.5px !important; }
  body.single-post #main .entry-content .toc .toc-list li > ol,
  body.single-post #main .entry-content .toc .toc-list li > ul { padding-left: 30px !important; }
  body.single-post #main .entry-content .toc .toc-list > li + li::after { left: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  body.single-post #main .entry-content .toc .toc-list a { transition: none; }
}


/* ================================================================
 * v0.3.1 — Cocoon TOC in the ordinary-post right sidebar
 *
 * Previous releases intentionally targeted #main .entry-content only.
 * Sidebar widgets use another DOM branch, so their Cocoon-default gray
 * header remained visible. The rules below carry the same approved
 * palette, frame, spacing and link affordances to that branch.
 * Only the inner .toc is styled: keep widget positioning, sticky behavior,
 * content, numbering, collapse and jump logic as Cocoon supplies them.
 * ================================================================ */
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid #DCE6DF !important;
  border-radius: 10px !important;
  background: #FBFDFC !important;
  color: #203B35 !important;
  box-shadow: 0 4px 18px rgba(25, 60, 55, 0.035) !important;
  overflow: hidden;
  text-align: left !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  margin: 0 !important;
  padding: 10px 12px !important;
  background: #F0F6F2 !important;
  color: #193C37 !important;
  border: 0 !important;
  border-bottom: 1px solid #DCE6DF !important;
  border-radius: 0 !important;
  text-align: left !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-title::before {
  content: "";
  position: static;
  display: inline-block;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin: 0;
  border: 1px solid #C9DEE0;
  border-radius: 5px;
  background: #E4F0F4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2321658F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13'/%3E%3Cpath d='M3 6h.01M3 12h.01M3 18h.01' stroke-width='3'/%3E%3C/svg%3E") center / 15px 15px no-repeat;
}
/* Cocoon outputs this toggle within the title on some versions. */
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-title :is(.toc-toggle, .toc-title-toggle, .toc-close, .toc-action) {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: #678078 !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-content {
  box-sizing: border-box;
  width: 100%;
  margin: 0 !important;
  padding: 11px 11px 13px !important;
  background: transparent !important;
  color: #203B35 !important;
  font-size: 12.5px !important;
  line-height: 1.6 !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc :is(.toc-list, .toc-content > ol, .toc-content > ul) {
  box-sizing: border-box;
  margin: 0 !important;
  padding-left: 1.5em !important;
  background: transparent !important;
  border: 0 !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list li {
  margin: 0 !important;
  padding: 0 !important;
  color: #21658F;
  line-height: 1.6;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list li::marker {
  color: #21658F;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list > li + li {
  position: relative;
  border-top: 0 !important;
  padding-top: 7px !important;
  margin-top: 5px !important;
}
/* Keep the rule clear of the list number, as approved in v0.3.0. */
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list > li + li::after {
  content: "";
  position: absolute;
  top: 0;
  left: 15px;
  right: 0;
  height: 1px;
  background-color: #E8EFEB;
  pointer-events: none;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list a {
  display: block;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 5px 5px !important;
  border: 0 !important;
  border-radius: 5px;
  background: transparent !important;
  color: #385A54 !important;
  font-size: inherit !important;
  line-height: 1.65 !important;
  font-weight: 500;
  overflow-wrap: anywhere;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background-color .12s ease, color .12s ease;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list > li > a {
  color: #193C37 !important;
  font-weight: 700 !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list a:is(:hover, :focus-visible) {
  background: #EAF4FA !important;
  color: #21658F !important;
  text-decoration: none !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list a:focus-visible {
  outline: 2px solid #21658F !important;
  outline-offset: 1px;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list li > :is(ol, ul) {
  box-sizing: border-box;
  margin: 3px 0 7px 6px !important;
  padding: 0 0 0 30px !important;
  border: 0 !important;
  border-left: 2px solid #E0EBE7 !important;
  background: transparent !important;
}
body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list li li a {
  padding: 4px 5px !important;
  color: #58736E !important;
  font-weight: 400 !important;
  font-size: .96em !important;
}
@media (prefers-reduced-motion: reduce) {
  body.single-post :is(#sidebar, .sidebar, .sidebar-scroll, .widget_toc, .toc-widget) .toc .toc-list a {
    transition: none;
  }
}
