/* Compact visual language shared with Rust Hero, adapted for repository maps. */

.chapter-meta {
  display: none;
  flex-wrap: wrap;
  gap: 0.4em 1.25em;
  margin-block: 1.5em 3em;
  padding-block: 0.75em;
  border-block: 1px solid var(--table-border-color);
  color: var(--icons);
  font-size: 0.8em;
}

.chapter-meta span:not(:last-child) {
  padding-inline-end: 1.25em;
  border-inline-end: 1px solid var(--table-border-color);
}

.on-this-page {
  display: none;
}

/* Treat mdBook part titles as an accordion for this repository-heavy book. */
.chapter li.part-title:has(.sidebar-group-toggle) {
  margin-block: 0.7rem 0.15rem;
}

.sidebar-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--sidebar-fg);
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-group-toggle:hover,
.sidebar-group-toggle:focus-visible {
  color: var(--sidebar-active);
}

.sidebar-group-toggle:focus-visible {
  outline: 2px solid var(--sidebar-active);
  outline-offset: 3px;
  border-radius: 2px;
}

.sidebar-group-chevron {
  display: inline-block;
  color: var(--icons);
  transition: transform 160ms ease;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
  transform: rotate(90deg);
}

.chapter li.sidebar-section-item a {
  padding-inline-start: 1.4rem;
}

.content main {
  text-wrap: pretty;
}

.repo-flow {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  margin-block: 1.4rem 2rem;
  overflow-x: auto;
}

.repo-node {
  display: flex;
  min-width: 9rem;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--table-border-color);
  border-radius: 6px;
  background: var(--table-alternate-bg);
}

.repo-node code {
  color: var(--fg);
  font-weight: 600;
}

.repo-node span {
  color: var(--icons);
  font-size: 0.8em;
}

.repo-arrow {
  align-self: center;
  flex: 0 0 auto;
  color: var(--icons);
  font-family: var(--mono-font);
}

.trace-table {
  min-width: 44rem;
  font-size: 0.9em;
}

.table-wrap {
  overflow-x: auto;
}

.content pre,
.content pre code.hljs {
  background-color: #303030;
  color: #eeeeee;
}

@media (max-width: 700px) {
  .repo-flow {
    flex-direction: column;
  }

  .repo-arrow {
    align-self: flex-start;
    margin-inline-start: 1rem;
    transform: rotate(90deg);
  }
}

/* Interactive, source-linked architecture traces. */

.architecture-explorer {
  margin-block: 1.5rem 2.5rem;
}

.architecture-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-end: 1.6rem;
}

.architecture-picker button,
.architecture-path button {
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

.architecture-picker button {
  padding: 0.48rem 0.78rem;
  border: 1px solid var(--table-border-color);
  border-radius: 999px;
  background: transparent;
}

.architecture-picker button[aria-selected="true"] {
  border-color: var(--links);
  background: var(--table-alternate-bg);
  color: var(--links);
}

.architecture-picker button:focus-visible,
.architecture-path button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--links) 40%, transparent);
  outline-offset: 2px;
}

.architecture-intro h2 {
  margin-block-end: 0.25rem;
}

.architecture-intro p {
  max-width: 52rem;
  margin-block-start: 0;
  color: var(--icons);
}

.architecture-path {
  display: grid;
  grid-template-columns: repeat(var(--step-count, 5), minmax(8rem, 1fr));
  gap: 2rem;
  margin: 1.6rem 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.architecture-path li {
  position: relative;
  min-width: 8rem;
}

.architecture-path li:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -1.45rem;
  content: "→";
  color: var(--icons);
  transform: translateY(-50%);
}

.architecture-path button {
  width: 100%;
  min-height: 6.5rem;
  padding: 0.8rem;
  border: 1px solid var(--table-border-color);
  border-radius: 7px;
  background: var(--table-alternate-bg);
  text-align: left;
}

.architecture-path button:hover {
  border-color: var(--icons);
}

.architecture-path button[aria-current="step"] {
  border-color: var(--links);
  box-shadow: inset 0 3px 0 var(--links);
}

.architecture-node-kind,
.architecture-eyebrow {
  display: block;
  color: var(--icons);
  font-size: 0.76em;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.architecture-node-title {
  display: block;
  margin-block-start: 0.35rem;
  font-weight: 600;
}

.architecture-detail {
  max-width: 52rem;
  padding: 1.1rem 1.2rem;
  border-inline-start: 4px solid var(--links);
  background: var(--table-alternate-bg);
}

.architecture-detail-heading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.architecture-detail-heading h3 {
  margin: 0.1rem 0 0;
}

.architecture-step-number {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--links);
  color: var(--bg);
  font-family: var(--mono-font);
  font-weight: 700;
}

.architecture-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block: 1rem;
}

.architecture-facts div {
  min-width: 0;
}

.architecture-facts dt {
  color: var(--icons);
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
}

.architecture-facts dd {
  margin: 0.25rem 0 0;
}

@media (max-width: 700px) {
  .architecture-path {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    overflow: visible;
  }

  .architecture-path li:not(:last-child)::after {
    top: auto;
    right: 50%;
    bottom: -1.35rem;
    transform: translateX(50%) rotate(90deg);
  }

  .architecture-path button {
    min-height: 4.5rem;
  }

  .architecture-facts {
    grid-template-columns: 1fr;
  }
}
