/* Topbar — root / brand / back / crumbs / profile + settings & expand controls */

.root-control {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.root-home {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.root-home:focus-visible {
  background: var(--soft);
  outline: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: max-content;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0;
}

.root-my-stuff {
  padding-left: var(--space-2);
}

.mark {
  display: block;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid var(--color-logo-border);
  border-radius: var(--radius-sm);
  /* Painted as a background (not an <img>) so re-rendering the topbar on every
     navigation reuses the cached image instead of reloading and flashing. */
  background: var(--ink) url("../../assets/maze-logo.png") center / cover no-repeat;
}


.trail-wrap {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.72;
}

/* On screens whose left rail carries the lineage (topic, room), the trail is
   mobile-only chrome — above the rail's 900px breakpoint the rail covers it. */
@media (min-width: 901px) {
  .trail-wrap-rail-covered {
    display: none;
  }
}

.header-back {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 7px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--clay);
  font: inherit;
  font-family: var(--font-ui);
  font-size: 1.06rem;
}

.header-back-chevron {
  display: inline-block;
  line-height: 1;
  transform: translateY(2px) rotate(180deg);
  transition: transform 0.12s ease;
}

.header-back:hover {
  color: var(--clay);
}

.header-back:hover .header-back-chevron {
  transform: translateY(2px) rotate(180deg) scaleX(1.32);
}

.crumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.94rem;
}

.crumbs span,
.crumbs button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumbs button {
  max-width: min(520px, 50vw);
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
}

.crumbs button:hover {
  color: var(--ink);
}

.profile {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Header settings (gear) menu */
.settings-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  /* Tighten the gap to the search trigger (topbar uses a wider flex gap). */
  margin-left: calc(-1 * var(--space-2));
}

/* No outline — just the icon. A solid header-matched fill still occludes
   scrolled content (e.g. carousel arrows); "subdued" is the muted color. */
.settings-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  background: var(--paper);
  color: color-mix(in srgb, var(--muted) 58%, var(--paper));
}

.settings-button:hover,
.settings-button:focus-visible {
  color: var(--muted);
  outline: 0;
}

.expand-toggle {
  margin-left: calc(-1 * var(--space-3));
}

.expand-toggle svg {
  transform: rotate(-45deg);
}
