/* Wayfinding timelines (ENG-1494) — vertical maps of linked nodes on landing pages. */

.wayfinding {
  margin: 1.25rem 0 2rem;
}

/* Track: an <ol> of nodes; markers, lines and arrows are decorative.
   !important beats Material's `[dir=ltr] .md-typeset ol` indent so the timeline sits hard-left. */
.md-typeset .wayfinding-track {
  margin: 0 !important;
  padding: 0 !important;
}

.md-typeset .wayfinding-track > li {
  margin: 0 !important;
}

.wf-node {
  position: relative;
  display: block;
  padding-bottom: 1.6rem;
}

/* `.wf-node` sets an author display, so re-hide collapsed nodes explicitly. */
.wf-node[hidden] {
  display: none;
}

/* The marker + body row; carries the hover/focus highlight as one block. */
.wf-node-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 0.85rem;
  border-radius: 8px;
  transition: background 0.2s ease-in-out;
}

/* Connector line and arrowhead between markers. */
.wf-node::before {
  content: "";
  position: absolute;
  left: calc(1.25rem - 1px);
  top: 2.5rem;
  bottom: -0.1rem;
  width: 2px;
  background: var(--wf-line);
}

.wf-node::after {
  content: "";
  position: absolute;
  left: calc(1.25rem - 4px);
  bottom: 0.15rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--wf-line);
}

.wf-node:last-child::before,
.wf-node:last-child::after,
.wf-node-last-visible::before,
.wf-node-last-visible::after {
  display: none;
}

.wayfinding-no-arrows .wf-node::after {
  display: none;
}

.wf-node-marker {
  position: relative;
  z-index: 1;
  grid-column: 1;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--body-link_color);
  background: var(--md-default-bg-color, var(--body-background_color));
  color: var(--body-link_color);
  font-size: 22px;
  transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}

.wf-node-body {
  grid-column: 2;
  min-width: 0;
  padding: 0.35rem 0.5rem 0.35rem 0;
}

.wf-node-title {
  font-weight: bold;
  color: var(--body-link_color);
  line-height: 1.3;
}

/* Links in a node body carry no rest underline; the title inherits the bold teal. */
.wf-node-body a {
  text-decoration: none;
}

.wf-node-title a {
  color: inherit;
}

.wf-node-blurb {
  display: block;
  margin-top: 0.2rem;
  color: var(--body-text_color);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Single-link node: overlaid <a> covers the whole node, like `.card a`. */
.wf-node-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  text-decoration: none;
}

.wf-node:has(.wf-node-link) {
  cursor: pointer;
}

/* Hovering/focusing a node's primary link — the single-node overlay or a group's
   title link — fills the marker and tints the row block. Child links highlight
   individually instead (see .wf-node-branches). */
.wf-node:has(.wf-node-link:hover, .wf-node-title a:hover) .wf-node-marker,
.wf-node:has(.wf-node-link:focus-visible, .wf-node-title a:focus-visible) .wf-node-marker {
  background: var(--body-link_color);
  color: #fff;
}

.wf-node:has(.wf-node-link:hover, .wf-node-title a:hover) .wf-node-row,
.wf-node:has(.wf-node-link:focus-visible, .wf-node-title a:focus-visible) .wf-node-row {
  background: var(--wf-tint);
}

.wf-node:has(.wf-node-link):hover .wf-node-title,
.wf-node:has(.wf-node-link:focus-visible) .wf-node-title {
  text-decoration: underline;
}

/* Group node branches — indented under the title; each child link gets a chip on hover/focus. */
.md-typeset .wf-node-branches {
  list-style: none;
  margin: 0.45rem 0 0;
  padding-left: .75rem;
}

/* !important beats Material's `[dir=ltr] .md-typeset ul li` 1.25em indent, so ours is the only one. */
.md-typeset .wf-node-branches > li {
  list-style: none;
  margin: 0 !important;
}

.wf-node-branches a {
  font-size: 0.84rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  transition: background 0.2s ease-in-out;
}

.wf-node-branches a:hover,
.wf-node-branches a:focus-visible {
  background: var(--wf-chip);
}

/* Show More toggle (revealed by wayfinding.js when there are hidden nodes). */
.wf-more {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--body-link_color);
  background: transparent;
  border: 1px solid var(--body-link_color);
  border-radius: 1rem;
  cursor: pointer;
  transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}

.wf-more::after {
  content: "expand_more";
  font-family: "Material Icons";
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease-in-out;
}

.wf-more[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.wf-more:hover,
.wf-more:focus-visible {
  background: var(--body-link_color);
  color: #fff;
}

.wf-more[hidden] {
  display: none;
}

/* Focus ring, matching accessibility.css. */
.wf-node-link:focus-visible,
.wf-node-body a:focus-visible,
.wf-more:focus-visible {
  outline: 2px solid var(--md-primary-fg-color);
  outline-offset: 2px;
  border-radius: 4px;
}

[data-md-color-scheme="slate"] {
  --wf-line: #04cfcf4f;
  --wf-tint: #04cfcf0a;
  --wf-chip: #04cfcf1f;
}

[data-md-color-scheme="default"] {
  --wf-line: #027f8859;
  --wf-tint: #027f880f;
  --wf-chip: #027f8824;
}

@media (prefers-reduced-motion: reduce) {
  .wf-node-marker,
  .wf-node-row,
  .wf-node-branches a,
  .wf-more,
  .wf-more::after {
    transition: none;
  }
}
