/**
 * parent-secondary-nav — DS component styles.
 *
 * One vertical list of parent rows; parents with children disclose an
 * indented secondary list in place. Active-trail uses the same accent the
 * legacy admin sibling-body uses (--s-color-accent-active) so visual weight
 * matches the rest of the shell.
 *
 * BEM-ish class set (.psn / .psn__*) keeps every selector flat — admin
 * sibling-body, settings-section nav, and the DS catalog preview can all
 * share the same primitive without scope leakage.
 */

.psn {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  font-family: inherit;
  color: var(--s-color-fg-primary);
}

.psn__list {
  list-style: none;
  margin: 0;
  padding: var(--s-space-1) 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.psn__item {
  display: flex;
  flex-direction: column;
}

/* ── Parent row ────────────────────────────────────────────────────── */

.psn__parent {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
  width: 100%;
  padding: var(--s-space-1) var(--s-space-3);
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--s-radius-1);
  min-height: calc(var(--s-font-size-active) * 2);
  transition:
    color var(--s-duration-fast),
    background-color var(--s-duration-fast);
}

.psn__parent:hover {
  background: var(--s-brand-alpha-5, rgba(0, 0, 0, 0.04));
  color: var(--s-color-fg-primary);
}

.psn__parent:focus-visible {
  outline: 2px solid var(--s-color-accent-active, currentColor);
  outline-offset: -2px;
}

.psn__parent[aria-current="page"] {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium, 500);
  background: var(--s-brand-alpha-5, rgba(0, 0, 0, 0.04));
}

/* In-trail: an ancestor of the active route. Subtle, not loud. */
.psn__item[data-psn-in-trail="true"] > .psn__parent {
  color: var(--s-color-fg-primary);
}

.psn__parent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--s-color-fg-muted);
}

.psn__parent-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--s-font-size-1);
}

.psn__parent-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--s-color-fg-muted);
  transition: transform var(--s-duration-fast);
  transform: rotate(-90deg); /* collapsed → chevron points right */
}

.psn__item[data-psn-open="true"] > .psn__parent .psn__parent-chevron {
  transform: rotate(0deg); /* expanded → chevron points down */
  color: var(--s-color-fg-primary);
}

.psn__parent-hint {
  display: block;
  padding: 0 var(--s-space-3) var(--s-space-1);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
}

/* ── Children (secondary) ─────────────────────────────────────────── */

.psn__children {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--s-space-1) 0;
  display: flex;
  flex-direction: column;
}

.psn__child-wrap {
  display: flex;
}

.psn__child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--s-color-fg-muted);
  cursor: pointer;
  border-radius: var(--s-radius-1);
  /* Indent — visually obvious sub-level + alignment with parent label after icon. */
  padding: var(--s-space-1) var(--s-space-3) var(--s-space-1) calc(var(--s-space-3) * 2 + 14px);
  min-height: calc(var(--s-font-size-active) * 1.85);
  transition:
    color var(--s-duration-fast),
    background-color var(--s-duration-fast);
  position: relative;
}

/* Trail indicator: a 2px guide line down the secondary column. Subtle —
   reads as a "you opened this" cue, not as decoration. */
.psn__children::before {
  content: "";
}

.psn__child::before {
  content: "";
  position: absolute;
  left: calc(var(--s-space-3) * 2);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--s-color-border-subtle);
  border-radius: 1px;
}

.psn__child:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-brand-alpha-5, rgba(0, 0, 0, 0.04));
}

.psn__child:focus-visible {
  outline: 2px solid var(--s-color-accent-active, currentColor);
  outline-offset: -2px;
}

.psn__child--active,
.psn__child[aria-current="page"] {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium, 500);
  background: var(--s-brand-alpha-5, rgba(0, 0, 0, 0.04));
}

.psn__child--active::before,
.psn__child[aria-current="page"]::before {
  background: var(--s-color-accent-active, currentColor);
}

.psn__child-label {
  font-size: var(--s-font-size-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psn__child-hint {
  /* Internal dev annotations ("Email folded in", "Stub", etc.) are clutter in
     the user-facing nav — hidden 2026-06-09. Data still carries them for
     briefs/docs; the nav just doesn't surface them. */
  display: none;
}

/* ── Empty state ──────────────────────────────────────────────────── */

.psn__empty {
  padding: var(--s-space-3) var(--s-space-4);
  font-size: var(--s-font-size-1);
  color: var(--s-color-fg-muted);
  font-style: italic;
}

/* ── Compact variant for ds-components catalog thumbnail ─────────── */

.psn--thumb {
  pointer-events: none;
  font-size: var(--s-font-size-0);
}

.psn--thumb .psn__parent {
  padding: 2px var(--s-space-2);
  min-height: 0;
}

.psn--thumb .psn__child {
  padding: 2px var(--s-space-2) 2px calc(var(--s-space-2) * 2 + 8px);
  min-height: 0;
}

.psn--thumb .psn__parent-chevron,
.psn--thumb .psn__parent-icon {
  width: 10px;
  height: 10px;
}

.psn--thumb .psn__child::before {
  left: calc(var(--s-space-2) * 2);
}
