.workflow-host,
.workflow-host > * {
  min-width: 0;
}

#api {
  scroll-margin-top: 110px;
}

body:has(#api:target, #api :target) .dashboard-sidebar a.is-active {
  color: var(--muted);
  background: var(--panel);
  border-color: var(--line);
}

body:has(#api:target, #api :target) .dashboard-sidebar a[href="#api"] {
  color: white;
  background: var(--graphite);
  border-color: var(--graphite);
}

.api-workflow {
  margin: 28px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 110px;
}

.api-workflow > summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.api-workflow-figure {
  margin: 18px 0 0;
  --workflow-arrow: var(--muted);
}

.api-workflow-figure,
.api-workflow-figure * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.api-workflow-figure figcaption {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.workflow-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.workflow-node > strong {
  font-size: 16px;
  line-height: 1.4;
}

.workflow-node code {
  max-width: 100%;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: normal;
}

.workflow-node > code {
  font-size: 16px;
}

.workflow-node a,
.workflow-outcomes a {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.workflow-start {
  width: min(100%, 560px);
  margin: 0 auto 48px;
}

.workflow-start::after,
.workflow-track > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  height: 23px;
  border-left: 2px solid var(--workflow-arrow);
}

.workflow-start::before,
.workflow-track > li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(100% + 15px);
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--workflow-arrow);
  border-bottom: 2px solid var(--workflow-arrow);
  transform: rotate(45deg);
}

.workflow-lanes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.workflow-lanes::before {
  content: "";
  position: absolute;
  top: -25px;
  left: calc(25% - 7px);
  right: calc(25% - 7px);
  border-top: 2px solid var(--workflow-arrow);
}

.workflow-lane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.workflow-lane::before {
  content: "";
  position: absolute;
  top: -25px;
  left: 50%;
  height: 16px;
  border-left: 2px solid var(--workflow-arrow);
}

.workflow-lane h3,
.workflow-collection h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.5;
}

.workflow-charge,
.workflow-free {
  font-size: 13px;
  font-weight: 600;
}

.workflow-charge {
  color: #8a5800;
}

.workflow-free {
  color: #08764a;
}

.workflow-track,
.workflow-sms-track {
  display: grid;
  gap: 26px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-track {
  flex: 1;
}

.workflow-check {
  border-left: 3px solid #b07815;
}

.workflow-success {
  border-left: 3px solid #16815b;
}

.workflow-failure {
  color: #a13434;
  font-size: 13px;
  line-height: 1.5;
}

.workflow-collection {
  position: relative;
  margin-top: 42px;
  padding-top: 24px;
  border-top: 2px solid var(--workflow-arrow);
  scroll-margin-top: 110px;
}

.workflow-collection::before {
  content: "";
  position: absolute;
  top: -42px;
  bottom: calc(100% + 1px);
  left: calc(25% - 7px);
  right: calc(25% - 7px);
  border-left: 2px solid var(--workflow-arrow);
  border-right: 2px solid var(--workflow-arrow);
}

.workflow-sms-track {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workflow-sms-track > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + 1px);
  width: 25px;
  border-top: 2px solid var(--workflow-arrow);
}

.workflow-sms-track > li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(50% - 4px);
  left: calc(100% + 16px);
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--workflow-arrow);
  border-right: 2px solid var(--workflow-arrow);
  transform: rotate(45deg);
}

.workflow-outcomes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.workflow-outcomes p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.workflow-outcomes strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

#workflow-reuse {
  scroll-margin-top: 110px;
}

@media (max-width: 760px) {
  .workflow-lanes,
  .workflow-sms-track,
  .workflow-outcomes {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-lanes {
    gap: 30px;
  }

  .workflow-start {
    margin-bottom: 28px;
  }

  .workflow-start::after,
  .workflow-start::before,
  .workflow-lanes::before,
  .workflow-lane::before,
  .workflow-collection::before {
    display: none;
  }

  .workflow-lane + .workflow-lane {
    padding-top: 24px;
    border-top: 1px dashed var(--line);
  }

  .workflow-sms-track > li:not(:last-child)::after {
    top: calc(100% + 1px);
    left: 50%;
    width: 0;
    height: 23px;
    border-top: 0;
    border-left: 2px solid var(--workflow-arrow);
  }

  .workflow-sms-track > li:not(:last-child)::before {
    top: calc(100% + 15px);
    left: calc(50% - 4px);
    border-top: 0;
    border-right: 2px solid var(--workflow-arrow);
    border-bottom: 2px solid var(--workflow-arrow);
  }
}
