/* Glossary tooltips: readable, not a dotted minefield */
abbr[title],
abbr[data-rt-tip] {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--md-default-fg-color--lighter);
  cursor: help;
}

abbr[title]:hover,
abbr[data-rt-tip]:hover {
  text-decoration-color: var(--md-accent-fg-color);
}

/* Instant custom tooltip (native title is ~1s).
   Material fg/bg tokens are translucent — use solid colours. */
.rt-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 22rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.25rem;
  background: #263238;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.35;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 60ms ease, transform 60ms ease;
}

[data-md-color-scheme="slate"] .rt-tooltip {
  background: #eceff1;
  color: #212121;
}

.rt-tooltip.is-on {
  opacity: 1;
  transform: translateY(0);
}

/* Material's own tooltip, if content.tooltips is active */
.md-tooltip,
.md-tooltip2 {
  transition-delay: 0ms !important;
}

/* Comparison tables: keep the first column visible while scrolling */
.md-typeset table:not([class]) {
  display: table;
  width: 100%;
}

.md-typeset table:not([class]) th:first-child,
.md-typeset table:not([class]) td:first-child {
  position: sticky;
  left: 0;
  background: var(--md-default-bg-color);
  box-shadow: 1px 0 0 var(--md-default-fg-color--lightest);
}

.md-typeset table:not([class]) th:first-child {
  background: var(--md-default-fg-color--lightest);
}

/* Card is clickable (JS) without covering abbr tooltips */
.md-typeset .grid.cards > ul > li {
  position: relative;
  min-width: 14rem;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.md-typeset .grid.cards > ul > li:hover {
  border-color: var(--md-accent-fg-color);
}

.md-typeset .grid.cards > ul > li a {
  text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Run diagrams — reusable track, nodes, edges. Always fit the page.  */
/* ------------------------------------------------------------------ */

.rt {
  --rt-start: #ef6c00;
  --rt-job: #78909c;
  --rt-focus: #42a5f5;
  --rt-link: #ef6c00;
  --rt-line: #90a4ae;
  margin: 1.1rem 0 1.4rem;
  padding: 0.85rem 0.9rem 0.95rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.4rem;
  background: var(--md-code-bg-color);
  overflow: hidden;
}

.rt__title {
  margin: 0 0 0.8rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.rt__heading {
  margin: 1.05rem 0 0.5rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.rt__heading:first-of-type {
  margin-top: 0.15rem;
}

.rt__note {
  margin: 0.7rem 0 0;
  font-size: 0.68rem;
  color: var(--md-default-fg-color--light);
}

.rt-run {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.rt-run + .rt-run {
  margin-top: 0.7rem;
}

.rt-run__name {
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--md-default-fg-color--light);
}

.rt-track {
  display: grid;
  align-items: center;
  min-width: 0;
}

.rt-track--3 {
  grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1.15fr) 12px minmax(0, 1fr);
}

.rt-track--4 {
  grid-template-columns: minmax(0, 0.85fr) 10px minmax(0, 1.15fr) 10px minmax(0, 1.15fr) 10px minmax(0, 0.85fr);
}

.rt-track--5 {
  grid-template-columns: minmax(0, 0.8fr) 8px minmax(0, 1.1fr) 8px minmax(0, 1fr) 8px minmax(0, 1.1fr) 8px minmax(0, 0.8fr);
}

/* Start / end of a run (depot, home, configured end) */
.rt-node {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.15rem;
  padding: 0.4rem 0.45rem;
  border-radius: 0.45rem;
  border: 1.5px solid var(--rt-job);
  background: var(--md-default-bg-color);
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rt-node--start,
.rt-node--end {
  border-color: var(--rt-start);
  background: #fff3e0;
  color: #e65100;
}

[data-md-color-scheme="slate"] .rt-node--start,
[data-md-color-scheme="slate"] .rt-node--end {
  background: #3e2723;
  color: #ffcc80;
}

.rt-node--job {
  border-color: var(--rt-job);
}

.rt-node--focus {
  border-color: var(--rt-focus);
  background: #e3f2fd;
  color: #1565c0;
}

[data-md-color-scheme="slate"] .rt-node--focus {
  background: #0d47a1;
  color: #bbdefb;
}

.rt-node--linked {
  border-color: var(--rt-link);
  background: #fff3e0;
  color: #e65100;
}

[data-md-color-scheme="slate"] .rt-node--linked {
  background: #3e2723;
  color: #ffcc80;
}

.rt-node.is-hot {
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.35);
}

.rt-edge {
  position: relative;
  height: 2px;
  background: var(--rt-line);
  align-self: center;
}

.rt-edge::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  border: 4px solid transparent;
  border-left-color: var(--rt-line);
  transform: translateY(-50%);
}

.rt-edge--carry {
  height: 3px;
  background: var(--rt-focus);
}

.rt-edge--carry::after {
  border-left-color: var(--rt-focus);
}

.rt-edge--rest {
  height: 0;
  background: none;
  border-top: 2px dashed var(--rt-link);
}

.rt-edge--rest::after {
  border-left-color: var(--rt-link);
}

.rt-node--muted {
  border-style: dashed;
  border-color: var(--rt-job);
  color: var(--md-default-fg-color--light);
  font-weight: 600;
}

/* later_than connector: fixed-height gap between the two runs */
.rt-cross {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  gap: 0.55rem;
  height: 2.4rem;
  margin: 0;
  color: var(--rt-link);
  overflow: hidden;
}

.rt-cross__body {
  position: relative;
  min-width: 0;
  height: 2.4rem;
}

.rt-cross__svg {
  display: block;
  width: 100%;
  height: 2.4rem;
}

.rt-cross__label {
  position: absolute;
  left: 50%;
  top: 0.15rem;
  transform: translateX(-50%);
  padding: 0 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--rt-link);
  background: var(--md-code-bg-color);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .rt-run,
  .rt-cross {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .rt-run__name {
    font-size: 0.64rem;
  }

  .rt-node {
    padding: 0.35rem 0.3rem;
    font-size: 0.64rem;
  }
}
