/* chatterbox_csi_walkthrough_ver8.css
   The credit-control walkthrough. Loaded after chatterbox_csi_ver8.css and built on
   its tokens and its thread and figure classes; this sheet sets no colour of its own.

   Every rule is scoped under .cw8-stage, so the component can sit on any family page.
   Base styles are the finished state of each scene: the family sheet turns transitions
   off when motion is reduced, and the page must read in full without any script.
   Solid cards only inside the stage, and nothing here loops. */

.cw8-stage {
  max-width: 1000px;
  margin: 2.6rem auto 0;
}

.cw8-stage .cw8-scenes {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.6rem;
}

.cw8-stage .cw8-scene {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: clamp(20px, 3.4vw, 40px);
}

/* ---- caption ---- */
.cw8-stage .cw8-caption h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  font-size: clamp(1.35rem, 2.3vw, 1.7rem);
  line-height: 1.2;
  color: var(--ink);
}

.cw8-stage .cw8-step {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
}

.cw8-stage .cw8-caption p {
  margin-top: 0.4rem;
  max-width: 56ch;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---- board: what goes in on the left, what it becomes on the right ---- */
.cw8-stage .cw8-board {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}

.cw8-stage .cw8-link {
  width: clamp(36px, 5vw, 64px);
}

.cw8-stage .cw8-link svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* The arrowheads take the colour of the line they finish. */
.cw8-stage .cw8-head {
  fill: var(--ocean-mid);
}

.cw8-stage .cw8-head.is-hand {
  fill: var(--coral-deep);
}

/* ---- shared small parts ---- */
.cw8-stage .cw8-kicker {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cw8-stage .cw8-foot {
  margin-top: 0.9rem;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.cw8-stage .cw8-state {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.cw8-stage .cw8-state i {
  font-size: 16px;
}

.cw8-stage .cw8-file,
.cw8-stage .cw8-counts,
.cw8-stage .cw8-release,
.cw8-stage .cw8-tracker,
.cw8-stage .cw8-owner,
.cw8-stage .cw8-panel {
  background: var(--sand);
  border: 1px solid var(--hairline-neutral);
  border-radius: var(--r-md);
  padding: clamp(16px, 2.2vw, 24px);
}

.cw8-stage .cw8-total {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  color: var(--ink-soft);
  font-size: 15px;
}

.cw8-stage .cw8-total strong,
.cw8-stage .cw8-count strong {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cw8-stage .cw8-count {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--hairline-neutral);
  border-radius: var(--r-md);
}

.cw8-stage .cw8-count span {
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink);
}

.cw8-stage .cw8-count em {
  font-style: normal;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.cw8-stage .cw8-count.is-selected {
  border-color: var(--hairline);
  border-top: 3px solid var(--teal-deep);
}

/* ---- scene 1: the file, and the round it becomes ---- */
.cw8-stage .cw8-file {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.cw8-stage .cw8-file-mark,
.cw8-stage .cw8-owner-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-size: 24px;
}

.cw8-stage .cw8-file strong,
.cw8-stage .cw8-owner strong {
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
}

.cw8-stage .cw8-file > span,
.cw8-stage .cw8-owner > span {
  font-size: 14.5px;
  color: var(--ink-soft);
}

.cw8-stage .cw8-chips {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cw8-stage .cw8-chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--hairline);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.cw8-stage .cw8-chips i {
  color: var(--teal-deep);
  font-size: 15px;
}

.cw8-stage .cw8-split,
.cw8-stage .cw8-said {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cw8-stage .cw8-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---- scene 2: approval, then the calls ---- */
.cw8-stage .cw8-release {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.cw8-stage .cw8-hours {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.cw8-stage .cw8-hours i {
  color: var(--teal-deep);
  transform: translateY(2px);
}

.cw8-stage .cw8-rows {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.cw8-stage .cw8-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--hairline-neutral);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  color: var(--ink-soft);
}

.cw8-stage .cw8-row strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--ink);
}

.cw8-stage .cw8-row strong i {
  font-size: 17px;
  color: var(--ink-soft);
}

.cw8-stage .cw8-row.is-followed {
  border-color: var(--teal-deep);
  box-shadow: 0 0 0 3px var(--teal-tint);
}

.cw8-stage .cw8-row.is-followed strong i {
  color: var(--teal-deep);
}

/* ---- scene 3: the exchange ---- */
.cw8-stage .cw8-talk {
  display: grid;
  gap: 14px;
}

.cw8-stage .thread-msg {
  max-width: 92%;
}

.cw8-stage .cw8-record {
  margin-top: 0;
  background: var(--card);
}

/* ---- scene 4: a colleague takes the work ---- */
.cw8-stage .cw8-owner {
  display: grid;
  gap: 4px;
  justify-items: start;
  border-color: var(--coral-glow);
}

.cw8-stage .cw8-owner-mark {
  background: var(--coral-tint);
  color: var(--coral-deep);
}

/* ---- scene 5: the round ---- */
.cw8-stage .cw8-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(12px, 2vw, 20px);
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}

.cw8-stage .cw8-bars {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.cw8-stage .cw8-bars li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: baseline;
  font-size: 14.5px;
  color: var(--ink);
}

.cw8-stage .cw8-bars strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Each bar is its count out of the 150 calls in the round. */
.cw8-stage .cw8-bar {
  grid-column: 1 / -1;
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--ocean-tint);
  overflow: hidden;
}

.cw8-stage .cw8-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--cw8-n) / 150 * 100%);
  border-radius: inherit;
  background: var(--ocean-mid);
}

.cw8-stage .cw8-waiting {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.cw8-stage .cw8-waiting i {
  font-size: 20px;
  color: var(--ink-soft);
}

.cw8-stage .cw8-panel.is-waiting {
  border-style: dashed;
}

/* ---- stepping through: only once the script has started ----
   The script adds .cw8-ready, the controls and the hidden attribute on the scenes
   that are not selected. Without it none of this applies and the list shows whole. */
.cw8-stage.cw8-ready .cw8-scenes {
  margin-top: 1.1rem;
}

.cw8-stage .cw8-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2rem;
}

/* Solid, like the cards: no glass inside the stage. */
.cw8-stage .cw8-step-button {
  min-height: 44px;
  flex: none;
  background: var(--card);
  border-color: var(--hairline);
  color: var(--ink);
}

.cw8-stage .cw8-step-button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

/* An unavailable step does not lift like a live button. */
.cw8-stage .cw8-step-button[aria-disabled="true"]:hover,
.cw8-stage .cw8-step-button[aria-disabled="true"]:active {
  transform: none;
}

.cw8-stage .cw8-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.cw8-stage .cw8-choice {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 240ms var(--ease-out), color 240ms var(--ease-out), border-color 240ms var(--ease-out);
}

.cw8-stage .cw8-choice:hover {
  color: var(--ink);
  border-color: var(--teal-deep);
}

.cw8-stage .cw8-choice[aria-current="step"] {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: var(--white);
}

/* The status line is read out on each change. It is shown on a phone, where it
   stands in for the row of scene choices. */
.cw8-stage .cw8-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The brief move as a scene is selected. The finished state is the base style above;
   .is-entering is where each part starts from, and is removed at once. */
.cw8-stage.cw8-ready .cw8-board > :not(.cw8-talk):not(.cw8-tracker),
.cw8-stage.cw8-ready .cw8-panels > *,
.cw8-stage.cw8-ready .cw8-row,
.cw8-stage.cw8-ready .cw8-talk > * {
  transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out);
}

.cw8-stage.cw8-ready .cw8-bar::after {
  transform-origin: left center;
  transition: transform 520ms var(--ease-out) 200ms;
}

.cw8-stage.cw8-ready .cw8-board > :nth-child(2),
.cw8-stage.cw8-ready .cw8-panels > :nth-child(2),
.cw8-stage.cw8-ready .cw8-row:nth-child(2),
.cw8-stage.cw8-ready .cw8-talk > :nth-child(2) {
  transition-delay: 120ms;
}

.cw8-stage.cw8-ready .cw8-board > :nth-child(3),
.cw8-stage.cw8-ready .cw8-panels > :nth-child(3),
.cw8-stage.cw8-ready .cw8-row:nth-child(3),
.cw8-stage.cw8-ready .cw8-talk > :nth-child(3) {
  transition-delay: 240ms;
}

.cw8-stage.cw8-ready .cw8-row:nth-child(4) {
  transition-delay: 360ms;
}

.cw8-stage.cw8-ready .cw8-row:nth-child(5) {
  transition-delay: 480ms;
}

.cw8-stage.cw8-ready .is-entering .cw8-board > :not(.cw8-talk):not(.cw8-tracker),
.cw8-stage.cw8-ready .is-entering .cw8-panels > *,
.cw8-stage.cw8-ready .is-entering .cw8-row,
.cw8-stage.cw8-ready .is-entering .cw8-talk > * {
  opacity: 0;
  transform: translateY(10px);
  transition: none;
}

.cw8-stage.cw8-ready .is-entering .cw8-bar::after {
  transform: scaleX(0);
  transition: none;
}

@media (max-width: 879px) {
  /* The arrow is turned on its side here, so it fades in place and does not move. */
  .cw8-stage.cw8-ready .cw8-board > .cw8-link {
    transition: opacity 360ms var(--ease-out) 120ms;
  }

  .cw8-stage.cw8-ready .is-entering .cw8-board > .cw8-link {
    transform: rotate(90deg);
  }

  .cw8-stage .cw8-board,
  .cw8-stage .cw8-panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .cw8-stage .cw8-link {
    justify-self: center;
    width: 44px;
    transform: rotate(90deg);
  }
}

/* Small labels are set at 11px to 13.5px above. On a phone nothing in a scene
   goes below 14px. 560px is the family's phone query, and decision D3 keeps
   the stage free of a fixed height below it. */
@media (max-width: 560px) {
  .cw8-stage .thread-who,
  .cw8-stage .thread-record dt,
  .cw8-stage .cw8-state,
  .cw8-stage .cw8-kicker,
  .cw8-stage .cw8-step {
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  .cw8-stage .cw8-foot,
  .cw8-stage .cw8-count em,
  .cw8-stage .cw8-chips li {
    font-size: 14px;
  }

  .cw8-stage .thread-record dd {
    font-size: 15px;
  }

  /* The record title wraps to two lines here, so its icon sits with the first. */
  .cw8-stage .thread-record .thread-who {
    align-items: flex-start;
  }

  .cw8-stage .thread-record .thread-who i {
    margin-top: 3px;
  }

  .cw8-stage .cw8-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .cw8-stage .cw8-choices {
    display: none;
  }

  /* The controls sit above the scenes, so here the stage takes the height of the
     scene on show; a fixed height would only leave blank space under the shorter
     scenes. */
  .cw8-stage.cw8-ready .cw8-scenes {
    min-height: 0 !important;
  }

  .cw8-stage .cw8-status {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink-soft);
  }

  /* The heading is already the first thing in the scene below, so only the count
     is shown. Both parts are still read out. */
  .cw8-stage .cw8-status-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* On paper the whole story shows, finished, whatever scene was selected. */
@media print {
  .cw8-stage .cw8-scene {
    box-shadow: none;
    break-inside: avoid;
  }

  .cw8-stage .cw8-controls {
    display: none;
  }

  .cw8-stage.cw8-ready .cw8-scene[hidden] {
    display: list-item;
  }

  .cw8-stage.cw8-ready .cw8-scenes {
    min-height: 0 !important;
  }

  .cw8-stage.cw8-ready .is-entering * {
    opacity: 1;
    transform: none;
  }
}
