/*
 * Swimlane of the guides "What happens after you post" and "What happens after you sign"
 * (templates/core/guides/_swimlane.html, inside the step screens frame of step-screens.css).
 * Three actor columns repeat on every screen. A row is a label, an arrow from the source column to the target column
 * and an optional note. Arrow style carries the kind, colour is never the only cue:
 *   cap     solid, thin       a step handled through Capstacker
 *   reply   dashed, thin      a response, acceptance or handover
 *   direct  solid, thick      money goes straight between the parties (the label is also highlighted)
 * A row spans two columns (span-1: Founder-Capstacker, span-3: Capstacker-Operator) or all three (span-2). Columns sit
 * at 1/6, 3/6 and 5/6 of the width. Tokens only.
 */

.guide-swimlane {
  --lane-cap: var(--ds-accent-strong);
  --lane-reply: var(--ds-text-muted);
  --lane-direct: var(--ds-text);
}

.guide-swimlane__head {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
}

.guide-swimlane__title {
  margin: 0;
  font-size: var(--ds-type-h3-size);
  line-height: var(--ds-type-h3-leading);
  font-weight: 600;
  text-wrap: balance;
}

.guide-swimlane__lede {
  max-width: 52ch;
  margin: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
  text-wrap: pretty;
}

/* Actors */
.guide-swimlane__actors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ds-space-8);
}

.guide-swimlane__actor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--ds-space-4) var(--ds-space-8);
  border: 1px solid var(--ds-border);
  border-top: 3px solid var(--lane-actor, var(--ds-text-secondary));
  border-radius: var(--ds-radius-12);
  background: var(--ds-surface);
  text-align: center;
}

.guide-swimlane__actor--1 {
  --lane-actor: var(--ds-accent-strong);
}

.guide-swimlane__actor-name {
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
  font-weight: 600;
}

.guide-swimlane__actor-sub {
  color: var(--ds-text-muted);
  font-size: var(--ds-type-caption-size);
  line-height: var(--ds-type-caption-leading);
  overflow-wrap: anywhere;
}

/* Lanes: dashed lifelines behind groups of rows */
.guide-swimlane__lanes {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-12);
}

.guide-swimlane__life {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed var(--ds-border);
}

.guide-swimlane__life--0 {
  left: calc(100% / 6);
}

.guide-swimlane__life--1 {
  left: 50%;
}

.guide-swimlane__life--2 {
  left: calc(100% * 5 / 6);
}

.guide-swimlane__group {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: var(--ds-space-12) 0 var(--ds-space-4);
  border: 1px dashed var(--ds-border);
  border-radius: var(--ds-radius-12);
}

.guide-swimlane__group-label {
  position: absolute;
  top: -8px;
  left: var(--ds-space-8);
  margin: 0;
  padding-inline: var(--ds-space-8);
  background: var(--ds-ground);
  color: var(--ds-text-muted);
  font-size: var(--ds-type-eyebrow-size);
  line-height: var(--ds-type-eyebrow-leading);
  letter-spacing: var(--ds-type-eyebrow-tracking);
  font-weight: 600;
  text-transform: uppercase;
}

/* Rows: label above the arrow, note below; label and note are centred on the arrow and wrap before they leave the row */
.guide-swimlane__row {
  --lane-color: var(--lane-cap);
  --lane-mid: 50%;
  --lane-reach: 94%;
  --lane-from: calc(100% / 6);
  --lane-width: calc(100% * 2 / 3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 40px;
  padding-block: var(--ds-space-4);
}

.guide-swimlane__row[data-kind="reply"] {
  --lane-color: var(--lane-reply);
}

.guide-swimlane__row[data-kind="direct"] {
  --lane-color: var(--lane-direct);
}

.guide-swimlane__row--span-1 {
  --lane-mid: calc(100% / 3);
  --lane-reach: 64%;
  --lane-from: calc(100% / 6);
  --lane-width: calc(100% / 3);
}

.guide-swimlane__row--span-3 {
  --lane-mid: calc(100% * 2 / 3);
  --lane-reach: 64%;
  --lane-from: 50%;
  --lane-width: calc(100% / 3);
}

.guide-swimlane__label,
.guide-swimlane__note {
  position: relative;
  left: var(--lane-mid);
  width: max-content;
  max-width: var(--lane-reach);
  margin: 0;
  padding-inline: var(--ds-space-8);
  background: var(--ds-ground);
  text-align: center;
  transform: translateX(-50%);
}

.guide-swimlane__label {
  font-size: var(--ds-type-small-size);
  line-height: 1.2;
  font-weight: 600;
}

.guide-swimlane__note {
  color: var(--ds-text-muted);
  font-size: var(--ds-type-caption-size);
  line-height: 1.25;
  text-wrap: pretty;
}

.guide-swimlane__row[data-kind="direct"] .guide-swimlane__label {
  border-radius: var(--ds-radius-pill);
  background: var(--ds-highlight);
  color: var(--ds-text);
}

/* Arrows */
.guide-swimlane__track {
  position: relative;
  display: block;
  flex: none;
  height: 12px;
}

.guide-swimlane__arrow {
  position: absolute;
  top: 5px;
  left: var(--lane-from);
  width: var(--lane-width);
  height: 0;
  border-top: 2px solid var(--lane-color);
}

.guide-swimlane__arrow--reply {
  border-top-style: dashed;
}

.guide-swimlane__arrow--direct {
  top: 4px;
  border-top-width: 4px;
}

.guide-swimlane__arrow--right::after,
.guide-swimlane__arrow--left::before {
  content: "";
  position: absolute;
  top: -6.5px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.guide-swimlane__arrow--direct.guide-swimlane__arrow--right::after,
.guide-swimlane__arrow--direct.guide-swimlane__arrow--left::before {
  top: -8px;
  border-top-width: 6px;
  border-bottom-width: 6px;
}

.guide-swimlane__arrow--right::after {
  right: -1px;
  border-left: 9px solid var(--lane-color);
}

.guide-swimlane__arrow--left::before {
  left: -1px;
  border-right: 9px solid var(--lane-color);
}

.guide-swimlane__arrow--direct.guide-swimlane__arrow--right::after {
  border-left-width: 11px;
}

.guide-swimlane__arrow--direct.guide-swimlane__arrow--left::before {
  border-right-width: 11px;
}

/* Panels: what it costs, what Capstacker does not do */
.guide-swimlane__panel {
  padding: var(--ds-space-8) var(--ds-space-12);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-12);
  background: var(--ds-surface);
}

.guide-swimlane__panel-title {
  margin: 0 0 var(--ds-space-8);
  color: var(--ds-text-muted);
  font-size: var(--ds-type-eyebrow-size);
  line-height: var(--ds-type-eyebrow-leading);
  letter-spacing: var(--ds-type-eyebrow-tracking);
  font-weight: 600;
  text-transform: uppercase;
}

.guide-swimlane__facts {
  display: grid;
  gap: var(--ds-space-8);
  margin: 0;
}

.guide-swimlane__fact {
  display: grid;
  grid-template-columns: 8em minmax(0, 1fr);
  gap: var(--ds-space-8);
  font-size: var(--ds-type-small-size);
  line-height: var(--ds-type-small-leading);
}

.guide-swimlane__fact dt {
  font-weight: 600;
}

.guide-swimlane__fact dd {
  margin: 0;
  color: var(--ds-text-muted);
}

.guide-swimlane__nots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ds-space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-swimlane__not {
  padding: var(--ds-space-4) var(--ds-space-8);
  border: 1px dashed var(--ds-border);
  border-radius: var(--ds-radius-pill);
  color: var(--ds-text-muted);
  font-size: var(--ds-type-caption-size);
  line-height: var(--ds-type-caption-leading);
  text-align: center;
}

.guide-swimlane__not::before {
  content: "\00D7";
  margin-right: var(--ds-space-4);
  font-weight: 600;
}

/* Legend, above the navigation */
.guide-swimlane__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ds-space-4) var(--ds-space-16);
  margin: 0;
  padding: 0;
  color: var(--ds-text-muted);
  font-size: var(--ds-type-caption-size);
  line-height: var(--ds-type-caption-leading);
  list-style: none;
}

.guide-swimlane__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-8);
}

.guide-swimlane__key {
  display: inline-block;
  width: 24px;
  border-top: 2px solid var(--lane-cap);
}

.guide-swimlane__key--reply {
  border-top-color: var(--lane-reply);
  border-top-style: dashed;
}

.guide-swimlane__key--direct {
  border-top-color: var(--lane-direct);
  border-top-width: 4px;
}

@media (max-width: 420px) {
  .guide-swimlane__fact {
    grid-template-columns: 6.5em minmax(0, 1fr);
  }
}

@media (max-height: 640px) {
  .guide-swimlane__lede {
    display: none;
  }

  .guide-swimlane__note {
    font-size: var(--ds-type-caption-size);
    line-height: 1.2;
  }
}
