/* Small scene steps stay distinct from the main production timeline. */
#creation .creation-chapters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

#creation .creation-chapters .action-link {
  --chapter-marker: 18px;
  --chapter-edge: 14px;
  --chapter-line-y: 12.5px;
  position: relative;
  display: grid;
  grid-template-rows: var(--chapter-marker) 15px;
  justify-items: center;
  align-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 4px 0;
  gap: 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  box-shadow: none;
  color: #687262;
  text-align: center;
  font-size: 12px;
  line-height: 15px;
  transform: none;
}

#creation .creation-chapters .action-link small {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--chapter-marker);
  height: var(--chapter-marker);
  box-sizing: border-box;
  border: 1px solid #c8cec3;
  border-radius: 50%;
  background: #fff;
  color: #687262;
  font-size: 9px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  opacity: 1;
  transition: color .18s, border-color .18s, background-color .18s;
}

#creation .creation-chapters .action-link span {
  display: block;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: nowrap;
}

/* Each incoming line joins two numbers without passing behind the markers. */
#creation .creation-chapters .action-link::before,
#creation .creation-chapters .action-link::after {
  content: "";
  position: absolute;
  pointer-events: none;
  top: var(--chapter-line-y);
  left: calc(-50% + var(--chapter-edge));
  width: calc(100% - var(--chapter-edge) * 2);
  height: 1.5px;
  border-radius: 2px;
  background: #d8ddd3;
}

#creation .creation-chapters .action-link::after {
  background: #f4512b;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .18s ease-out;
}

#creation .creation-chapters .action-link:first-child::before,
#creation .creation-chapters .action-link:first-child::after {
  content: none;
}

#creation .creation-chapters .action-link:is([data-chapter-state="previous"], [aria-current="step"])::after {
  transform: scaleX(1);
}

#creation .creation-chapters .action-link[data-chapter-state="previous"] small {
  border-color: #e2a28c;
  color: #b74327;
}

#creation .creation-chapters .action-link[aria-current="step"] {
  color: #253128;
  font-weight: 700;
}

#creation .creation-chapters .action-link[aria-current="step"] small {
  border-color: #f4512b;
  background: #fff1e9;
  color: #b74327;
}

#creation .creation-chapters .action-link:focus-visible {
  outline: 2px solid #df542e;
  outline-offset: -2px;
}

@media (hover: hover) {
  #creation .creation-chapters .action-link:not(:disabled):hover span {
    color: #b74327;
  }
}

/* The existing short landscape side rail has room for two compact rows. */
@media (max-width: 1100px) and (max-height: 500px) and (orientation: landscape) {
  #creation .creation-chapters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 4px;
  }
  #creation .creation-chapters .action-link {
    --chapter-marker: 14px;
    --chapter-edge: 11px;
    --chapter-line-y: 8.5px;
    grid-template-rows: var(--chapter-marker) 14px;
    min-height: 34px;
    padding: 2px 0;
    gap: 2px;
    font-size: 11px;
    line-height: 14px;
  }
  #creation .creation-chapters .action-link small { font-size: 8px; }
  #creation .creation-chapters .action-link:nth-child(odd)::before,
  #creation .creation-chapters .action-link:nth-child(odd)::after { content: none; }
}

@media (max-width: 1100px) and (max-height: 340px) and (orientation: landscape) {
  #creation .creation-chapters,
  #creation.creation-motion-enabled .creation-result { row-gap: 0; }
  #creation .creation-chapters .action-link {
    --chapter-marker: 12px;
    --chapter-line-y: 6.5px;
    grid-template-rows: var(--chapter-marker) 12px;
    min-height: 28px;
    padding: 1px 0;
    font-size: 10px;
    line-height: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #creation .creation-chapters .action-link small,
  #creation .creation-chapters .action-link::after { transition: none; }
}
