/* =====================================================================
   CSS TOC Sidebar
   Squarespace Custom CSS panel navigation
   ===================================================================== */

#css-toc-container,
#css-toc-container * {
  box-sizing: border-box;
}

#css-toc-container {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 2147483647;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  pointer-events: none;
}

#css-toc-container > * {
  pointer-events: auto;
}

/* ---------- Toggle button (always visible) ---------- */

.css-toc-toggle {
  position: absolute;
  top: 80px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  color: #ffffff;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.12s ease, transform 0.12s ease;
}

.css-toc-toggle:hover {
  background: #333333;
  transform: scale(1.05);
}

.css-toc-toggle:active {
  background: #000000;
  transform: scale(0.96);
}

#css-toc-container.css-toc--open .css-toc-toggle {
  display: none;
}

/* ---------- Sidebar panel ---------- */

.css-toc-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #d6d6d6;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

#css-toc-container.css-toc--open .css-toc-sidebar {
  transform: translateX(0);
}

/* ---------- Header ---------- */

.css-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
}

.css-toc-title {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  color: #1a1a1a;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.css-toc-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #6b6b6b;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.css-toc-close:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

/* ---------- Search/filter ---------- */

.css-toc-search-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
}

.css-toc-search {
  width: 100%;
  padding: 7px 10px;
  background: #ffffff;
  border: 1px solid #d6d6d6;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.css-toc-search::placeholder {
  color: #9b9b9b;
}

.css-toc-search:focus {
  border-color: #1a1a1a;
  box-shadow: 0 0 0 1px #1a1a1a;
}

/* ---------- List ---------- */

.css-toc-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.css-toc-list::-webkit-scrollbar {
  width: 8px;
}

.css-toc-list::-webkit-scrollbar-track {
  background: transparent;
}

.css-toc-list::-webkit-scrollbar-thumb {
  background: #d6d6d6;
  border-radius: 4px;
}

.css-toc-list::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

.css-toc-item {
  margin: 0;
  padding: 0;
}

.css-toc-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.css-toc-link:hover {
  background: #f5f5f5;
}

.css-toc-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.css-toc-line {
  font-size: 11px;
  color: #9b9b9b;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.css-toc-item--active .css-toc-link {
  background: #f5f5f5;
  border-left-color: #1a1a1a;
  font-weight: 600;
}

.css-toc-item--active .css-toc-line {
  color: #6b6b6b;
}

/* ---------- Empty state ---------- */

.css-toc-empty {
  display: none;
  padding: 24px 20px;
  text-align: center;
  color: #6b6b6b;
}

.css-toc-empty-title {
  margin: 0 0 12px 0;
  font-weight: 600;
  font-size: 13px;
  color: #1a1a1a;
}

.css-toc-empty-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: #6b6b6b;
}

.css-toc-empty code {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 0;
  background: #f5f5f5;
  border: 1px solid #ebebeb;
  border-radius: 2px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  color: #1a1a1a;
}

/* ---------- Credit footer ---------- */

.css-toc-credit {
  padding: 10px 16px;
  border-top: 1px solid #ebebeb;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9b9b9b;
  flex-shrink: 0;
}
