/* ========================================================================
   Help Directory — category hover-menus, three-column layout, TOC, related
   rail, feature atlas, action buttons.
   Mirrors .cc-menu / .cc-menu-panel in workspace.css.
   ======================================================================== */

/* --- Category nav bar --- */
.help-category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.help-cat-menu {
  position: relative;
  flex: 0 0 auto;
}

.help-cat-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.85rem;
  padding: 0.3rem 0.6rem;
  color: var(--text);
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.78rem;
  white-space: nowrap;
}

.help-cat-menu.has-active > .help-cat-trigger {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.1);
}

.help-cat-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 14rem;
  max-width: min(26rem, calc(100vw - 2rem));
  max-height: min(65vh, 26rem);
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.25rem;
  padding: 0.5rem;
  margin-top: 0.12rem;
  background: rgba(12, 16, 28, 0.98);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  z-index: 130;
  pointer-events: auto;
}

.help-cat-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.35rem;
  height: 0.35rem;
}

.help-cat-menu:hover > .help-cat-panel,
.help-cat-menu.is-open > .help-cat-panel {
  display: flex;
}

.help-cat-menu.is-closed > .help-cat-panel {
  display: none !important;
}

.help-cat-topic-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.help-cat-topic-btn:hover {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.2);
}

.help-cat-topic-btn.active {
  border-color: #22d3ee;
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.18);
}

/* --- Three-column help layout --- */
.help-layout {
  display: grid;
  grid-template-columns: 11rem 1fr 14rem;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  min-height: 16rem;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: 1fr;
  }
  .help-toc-nav { display: none; }
  .help-related-rail { grid-row: auto; }
}

/* --- TOC sidebar --- */
.help-toc-nav {
  position: sticky;
  top: 0;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.help-toc-heading {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}

.help-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-toc-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.2rem 0.4rem;
  margin-bottom: 0.1rem;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  background: transparent;
  color: rgba(148, 163, 184, 0.85);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.help-toc-item:hover {
  color: var(--text);
  background: rgba(34, 211, 238, 0.06);
}

.help-toc-item.active {
  border-left-color: var(--cyan);
  color: var(--cyan);
}

.help-toc-item[data-toc-depth="3"] {
  padding-left: 0.9rem;
  font-size: 0.72rem;
}

/* --- Related rail (right sidebar) --- */
.help-related-rail {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 480px;
  overflow-y: auto;
  padding-left: 0.35rem;
}

.help-related-section-title {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}

.help-related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.help-related-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(34, 211, 238, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.help-related-chip:hover {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
}

/* --- Action buttons --- */
.help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.help-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.5rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.help-action-btn:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.4);
}

.help-action-btn::before {
  content: "→";
  font-size: 0.68rem;
}

/* --- Feature Atlas section --- */
.help-feature-atlas {
  margin-top: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.help-feature-atlas-heading {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.help-feature-atlas .dim {
  margin: 0 0 0.45rem;
}

.help-atlas-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.35rem;
}

.help-atlas-feature-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.78rem;
  color: var(--text);
}

.help-atlas-feature-state {
  display: inline-block;
  min-width: 5rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.help-atlas-feature-state[data-state="implemented"] {
  color: var(--lime);
  background: rgba(163, 230, 53, 0.1);
  border: 1px solid rgba(163, 230, 53, 0.25);
}

.help-atlas-feature-state[data-state="partial"] {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.help-atlas-feature-state[data-state="planned"],
.help-atlas-feature-state[data-state="simulated"],
.help-atlas-feature-state[data-state="experimental"] {
  color: rgba(148, 163, 184, 0.8);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* --- Prerequisite / next-step badges --- */
.help-prereq-badge {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  color: rgba(148, 163, 184, 0.7);
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.help-prereq-badge[data-kind="next"] {
  color: rgba(34, 211, 238, 0.7);
  background: rgba(34, 211, 238, 0.05);
  border-color: rgba(34, 211, 238, 0.15);
}

/* --- Learning-path inline indicator --- */
.help-learning-path-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.6);
  font-style: italic;
}

/* Hide old flat chip nav when directory is active */
.help-directory-active #help-topic-nav {
  display: none;
}
