/* Joe article TOC v3 — mouse-resizable width; no body reflow
 * v1: _backup_toc_20261009/v1_initial/
 * v2: _backup_toc_20261009/v2_no_reflow/
 */
:root {
  --joe-toc-width: 248px;
  --joe-toc-gap: 14px;
  --joe-toc-header-offset: 80px;
  --joe-toc-fg: #5c6370;
  --joe-toc-fg-strong: #2f3540;
  --joe-toc-fg-mute: #8b929e;
  --joe-toc-active: #3b6fd8;
  --joe-toc-border: rgba(15, 23, 42, 0.08);
  --joe-toc-bg: rgba(255, 255, 255, 0.92);
  --joe-toc-bg-solid: #f7f8fa;
}

.joe_detail__article h1,
.joe_detail__article h2,
.joe_detail__article h3,
.joe_detail__article h4,
.joe_detail__article h5,
.joe_detail__article h6 {
  scroll-margin-top: var(--joe-toc-header-offset);
}

.joe-toc {
  display: none;
}

.joe-toc.is-ready {
  display: block;
}

/* Panel floats in left margin — NEVER changes .joe_container width */
.joe-toc__panel {
  position: fixed;
  top: var(--joe-toc-header-offset);
  left: var(--joe-toc-gap);
  z-index: 90;
  width: var(--joe-toc-width);
  max-height: calc(100vh - var(--joe-toc-header-offset) - 24px);
  display: flex;
  flex-direction: column;
  background: var(--joe-toc-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--joe-toc-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.06);
  overflow: visible;
}

.joe-toc__panel.is-resizing {
  user-select: none;
  transition: none;
}

.joe-toc__resize {
  position: absolute;
  top: 8px;
  right: -5px;
  bottom: 8px;
  width: 10px;
  cursor: col-resize;
  z-index: 2;
  touch-action: none;
  background: transparent;
}

.joe-toc__resize::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 36px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
  transition: background 0.15s ease, height 0.15s ease;
}

.joe-toc__resize:hover::after,
.joe-toc__panel.is-resizing .joe-toc__resize::after {
  background: rgba(59, 111, 216, 0.55);
  height: 48px;
}

body.joe-toc-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.joe-toc-resizing iframe {
  pointer-events: none;
}


.joe-toc.is-collapsed .joe-toc__panel {
  display: none;
}

.joe-toc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px 10px 14px;
  border-bottom: 1px solid var(--joe-toc-border);
  background: var(--joe-toc-bg-solid);
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.joe-toc__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--joe-toc-fg-mute);
  margin: 0;
}

.joe-toc__collapse {
  border: none;
  background: transparent;
  color: var(--joe-toc-fg-mute);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
}

.joe-toc__collapse:hover {
  color: var(--joe-toc-fg-strong);
  background: rgba(15, 23, 42, 0.05);
}

.joe-toc__nav {
  margin: 0;
  padding: 8px 6px 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}

.joe-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.joe-toc__item {
  margin: 0;
}

.joe-toc__link {
  display: block;
  padding: 5px 10px;
  margin: 1px 4px;
  border-radius: 7px;
  color: var(--joe-toc-fg);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  word-break: break-word;
}

.joe-toc__link:hover {
  color: var(--joe-toc-fg-strong);
  background: rgba(15, 23, 42, 0.04);
}

.joe-toc__link.is-active {
  color: var(--joe-toc-active);
  border-left-color: var(--joe-toc-active);
  background: rgba(59, 111, 216, 0.08);
  font-weight: 600;
}

/* Hierarchy: only top levels compete for attention */
.joe-toc__item--h1 > .joe-toc__link {
  margin-top: 8px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--joe-toc-fg-strong);
}

.joe-toc__item--h1:first-child > .joe-toc__link {
  margin-top: 0;
}

.joe-toc__item--h2 > .joe-toc__link {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--joe-toc-fg-strong);
}

.joe-toc__item--h3 > .joe-toc__link {
  padding-left: 18px;
  font-size: 12px;
  color: var(--joe-toc-fg);
}

.joe-toc__item--h4 > .joe-toc__link {
  padding-left: 28px;
  font-size: 11.5px;
  color: var(--joe-toc-fg-mute);
}

.joe-toc__item--h5 > .joe-toc__link,
.joe-toc__item--h6 > .joe-toc__link {
  padding-left: 36px;
  font-size: 11.5px;
  color: var(--joe-toc-fg-mute);
  opacity: 0.92;
}

.joe-toc__fab {
  position: fixed;
  top: calc(var(--joe-toc-header-offset) + 8px);
  left: 10px;
  z-index: 91;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--joe-toc-border);
  background: var(--joe-toc-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--joe-toc-fg-strong);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.joe-toc.is-collapsed .joe-toc__fab,
.joe-toc.is-narrow .joe-toc__fab {
  display: inline-flex;
}

.joe-toc.is-narrow:not(.is-collapsed) .joe-toc__fab {
  display: none;
}

.joe-toc.is-narrow .joe-toc__panel {
  left: 10px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - var(--joe-toc-header-offset) - 20px);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.16);
}

.joe-toc__mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(15, 23, 42, 0.28);
}

.joe-toc.is-narrow:not(.is-collapsed) .joe-toc__mask {
  display: block;
}

/* v2: intentionally NO body.joe-toc-open padding — toggle must not reflow article */

@media (max-width: 900px) {
  .joe-toc__panel {
    top: 70px;
  }
}
