/*
  Studio v2: the "What you need" guide at the top of the conversation column.
  Blue means next (needs you), green means done. Never red, and every state has its word.
*/

/* The guide gets its own row above the conversation; the conversation keeps the space
   that is left and scrolls on its own. */
.studio-v2 .studio-thread:has(> #studioGuide:not([hidden])) {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.studio-guide {
  min-inline-size: 0;
  max-block-size: min(46vh, 30rem);
  overflow-y: auto;
  padding: 10px 14px 12px;
  background: var(--surface);
  border-block-end: 1px solid var(--line-strong);
}

.guide-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.guide-heading {
  margin: 0;
  font-size: 15px;
}

.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  background: none;
  border: 0;
  cursor: pointer;
}

.guide-chevron {
  inline-size: 8px;
  block-size: 8px;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.guide-toggle[aria-expanded="true"] .guide-chevron {
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
  .guide-chevron {
    transition: none;
  }
}

.guide-progress {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.guide-body {
  display: grid;
  gap: 10px;
  margin-block-start: 8px;
}

.guide-body p {
  margin: 0;
}

.guide-question {
  font-weight: 700;
}

.guide-route {
  display: grid;
  gap: 8px;
}

.guide-route-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-route-button {
  max-inline-size: 100%;
  white-space: normal;
  text-align: start;
}

.guide-route-button[aria-pressed="true"] {
  color: var(--v2-attn-ink);
  background: var(--v2-attn-bg);
  border-color: var(--v2-attn-ink);
}

/* ---------- The steps ---------- */
.guide-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: guide;
}

.guide-step {
  display: grid;
  gap: 4px;
  min-inline-size: 0;
  padding: 7px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  counter-increment: guide;
}

.guide-step-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.guide-mark::before {
  content: counter(guide);
  display: inline-grid;
  place-items: center;
  inline-size: 20px;
  block-size: 20px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.guide-step-title {
  overflow-wrap: anywhere;
}

.guide-status {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.guide-how,
.guide-after {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.guide-how {
  color: var(--text-muted);
}

/* Done: green, with a tick and the word. */
.guide-step[data-state="done"] .guide-mark::before {
  content: "\2713";
  color: #ffffff;
  background: var(--v2-done-ink);
  border-color: var(--v2-done-ink);
}

.guide-step[data-state="done"] .guide-status {
  color: var(--v2-done-ink);
}

.guide-step[data-state="done"] .guide-how {
  display: none;
}

/* Next: blue, and the only step that shows how and what happens next. */
.guide-step[data-state="next"] {
  background: var(--v2-attn-bg);
  border-color: var(--v2-attn-ink);
  border-inline-start-width: 3px;
}

.guide-step[data-state="next"] .guide-mark::before,
.guide-step[data-state="next"] .guide-status {
  color: var(--v2-attn-ink);
}

.guide-step[data-state="next"] .guide-how {
  color: var(--text);
}

.guide-step:not([data-state="next"]) .guide-after,
.guide-step:not([data-state="next"]) .guide-prompts,
.guide-step:not([data-state="next"]) .guide-actions {
  display: none;
}

/* Waiting: quiet. */
.guide-step[data-state="waiting"] .guide-step-title {
  color: var(--text-muted);
  font-weight: 600;
}

/* Waiting steps show their instructions too, quietly, so nobody meets a step cold. */
.guide-step[data-state="waiting"] .guide-how {
  font-size: 12.5px;
}

.guide-prompts {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.guide-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
}

.guide-prompt-text {
  min-inline-size: 0;
  overflow-wrap: anywhere;
  font-style: italic;
}

.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-actions .button,
.guide-prompt .button {
  max-inline-size: 100%;
  white-space: normal;
}

/* The month the first check runs for, on the step that runs it. */
.guide-month {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
}

.guide-month label {
  font-weight: 600;
}

.guide-month input[type="month"] {
  inline-size: auto;
  min-block-size: 32px;
  padding: 2px 8px;
}

/* What happened when a guide button was pressed, in words. */
.guide-result {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
}

.guide-result:empty {
  display: none;
}

.guide-result[data-tone="done"] {
  color: var(--v2-done-ink);
}

.guide-result[data-tone="attn"] {
  color: var(--v2-attn-ink);
}
