.czone-toc-shell {
  --czone-toc-accent: #4b1f5e;
  width: 100%;
  overflow: visible !important;
}

.czone-toc-inline-wrap {
  width: 100%;
  margin: clamp(40px, 5vw, 72px) 0 clamp(52px, 6vw, 88px);
}

.czone-toc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  align-items: start;
  gap: clamp(42px, 5vw, 76px);
  width: 100%;
  overflow: visible !important;
}

.czone-toc-content {
  min-width: 0;
  overflow: visible !important;
}

.czone-toc-sidebar {
  position: sticky;
  top: var(--czone-toc-offset, 100px);
  align-self: start;
  max-height: calc(100vh - var(--czone-toc-offset, 100px) - 28px);
  overflow: hidden auto;
  scrollbar-width: thin;
}

.czone-toc {
  --czone-toc-accent: #4b1f5e;
  width: 100%;
  color: #575550;
  font-family: inherit;
  box-sizing: border-box;
}

.czone-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.czone-toc-title {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font: inherit;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: .05em;
}

.czone-toc-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  box-shadow: none;
}

.czone-toc-toggle:hover,
.czone-toc-toggle:focus,
.czone-toc-toggle:focus-visible {
  border: 0;
  background: transparent;
  color: var(--czone-toc-accent);
  box-shadow: none;
  outline: 2px solid transparent;
}

.czone-toc-toggle span {
  display: block;
  width: 17px;
  height: 17px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: translateY(4px) rotate(45deg);
  transition: transform .25s ease;
}

.czone-toc.is-collapsed .czone-toc-toggle span {
  transform: translateY(-4px) rotate(225deg);
}

.czone-toc-list {
  display: flex;
  flex-direction: column;
  max-height: 1800px;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  opacity: 1;
  list-style: none !important;
  transition: max-height .32s ease, opacity .2s ease;
}

.czone-toc.is-collapsed .czone-toc-list {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.czone-toc-list li {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.45;
  list-style: none !important;
}

.czone-toc-list a {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: .55em;
  color: #575550;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none !important;
  transition: color .18s ease;
}

.czone-toc-depth-1 a { padding-left: 1.55em; }
.czone-toc-depth-2 a { padding-left: 3.1em; }
.czone-toc-depth-3 a { padding-left: 4.65em; }

.czone-toc-list a:hover,
.czone-toc-list a:focus,
.czone-toc-list a.is-active {
  color: var(--czone-toc-accent) !important;
}

.czone-toc-list a.is-active {
  font-weight: 600;
}

/* 圖一：文章前方完整目錄 */
.czone-toc--inline {
  padding: 30px 52px;
  border-top: 1px solid #ead2a0;
  border-bottom: 1px solid #ead2a0;
  background: #fffdf9;
  color: #111;
}

.czone-toc--inline .czone-toc-header {
  margin-bottom: 28px;
}

.czone-toc--inline.is-collapsed .czone-toc-header {
  margin-bottom: 0;
}

.czone-toc--inline.is-collapsed {
  padding: 16px 28px;
}

.czone-toc--inline .czone-toc-title {
  color: #575550;
  font-size: 24px !important;
}

.czone-toc--inline .czone-toc-toggle {
  color: #575550;
}

.czone-toc--inline .czone-toc-list {
  gap: 8px;
}

.czone-toc--inline .czone-toc-list a {
  font-size: 16px;
}

/* 圖二：右側 Sticky 章節目錄 */
.czone-toc--sidebar {
  color: #575550;
}

.czone-toc--sidebar .czone-toc-header {
  margin-bottom: 28px;
}

.czone-toc--sidebar.is-collapsed .czone-toc-header {
  margin-bottom: 0;
}

.czone-toc--sidebar .czone-toc-title {
  color: #575550;
  font-size: 30px !important;
}

.czone-toc--sidebar .czone-toc-list {
  gap: 13px;
}

.czone-toc--sidebar .czone-toc-list a {
  font-size: 16px;
}

.czone-toc-content h1[id],
.czone-toc-content h2[id],
.czone-toc-content h3[id],
.czone-toc-content h4[id] {
  scroll-margin-top: calc(var(--czone-toc-offset, 100px) + 20px);
}

.entry-content:has(.czone-toc-shell) {
  overflow: visible;
}

@media (max-width: 1024px) {
  .czone-toc-inline-wrap {
    margin-bottom: 38px;
  }

  .czone-toc-layout {
    display: block;
  }

  .czone-toc-sidebar {
    display: none;
  }

  .czone-toc--inline {
    padding: 24px 32px;
  }

  .czone-toc--inline.is-collapsed {
    padding: 14px 22px;
  }

  .czone-toc--inline .czone-toc-title {
    font-size: 24px !important;
  }

  .czone-toc--inline .czone-toc-list a {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .czone-toc--inline {
    padding: 22px 20px;
  }

  .czone-toc--inline.is-collapsed {
    padding: 12px 18px;
  }

  .czone-toc--inline .czone-toc-header {
    margin-bottom: 24px;
  }

  .czone-toc--inline .czone-toc-title {
    font-size: 23px !important;
  }

  .czone-toc--inline .czone-toc-list {
    gap: 12px;
  }

  .czone-toc--inline .czone-toc-list a {
    font-size: 16px;
  }

  .czone-toc-depth-1 a { padding-left: 1em; }
  .czone-toc-depth-2 a { padding-left: 2em; }
  .czone-toc-depth-3 a { padding-left: 3em; }
}

@media (prefers-reduced-motion: reduce) {
  .czone-toc-toggle span,
  .czone-toc-list,
  .czone-toc-list a {
    transition: none;
  }
}
