/* ===========================================================================
   Onboarding — the interviewer thinking out loud
   ===========================================================================
   Runs on the dark shell with no card: this is a stream the customer watches,
   not a single question to answer. */

.build {
  width: 100%; max-width: 1060px; margin: 0 auto;
  padding: calc(var(--vh) * .06) 0 calc(var(--vh) * .2); display: flex; flex-direction: column; gap: 26px;
  animation: cdFadeIn .5s ease both;
}
.build__title {
  margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -.03em;
  font-weight: var(--weight-strong); color: var(--on-ink); text-wrap: pretty;
}
.build__lines { display: flex; flex-direction: column; gap: 14px }
/* New lines rise into place. They used to slide in from the right edge,
   which now runs them across the profile panel beside the conversation. */
@keyframes buildRise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { .build__think, .build__ask { animation: none } }

/* A thought. Dims once the next one lands, so the live line is obvious. */
.build__think {
  display: flex; align-items: flex-start; gap: 12px; padding: 2px;
  opacity: .55; transition: opacity .5s ease;
  animation: buildRise .45s cubic-bezier(.22, .8, .28, 1) both;
}
.build__think[data-live="true"] { opacity: 1 }
.build__think .ms { font-size: 17px; margin-top: 2px; color: color-mix(in srgb, var(--on-ink) 65%, transparent) }
.build__think[data-live="true"] .ms { color: var(--ob-accent); animation: cdSpin 1.1s linear infinite }
.build__thinktext { font-size: 14.5px; font-weight: var(--weight-strong); color: var(--on-ink) }
.build__thinkdetail { font-size: 12.5px; color: color-mix(in srgb, var(--on-ink) 55%, transparent); margin-top: 3px; text-wrap: pretty }

/* A question put back to the customer. A card, because it wants an answer. */
.build__ask {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--card);
  animation: buildRise .45s cubic-bezier(.22, .8, .28, 1) both;
  transition: opacity .5s ease, padding .5s ease;
}
.build__ask[data-answered="true"] { padding: 14px 16px; border-color: #E4E4E4; opacity: .72 }
/* Already on screen before this repaint: only the newest line slides in. */
.build__think[data-seen], .build__ask[data-seen] { animation: none }
.build__asktext { font-size: 15px; font-weight: var(--weight-strong); color: var(--text); line-height: 1.4; text-wrap: pretty }
.build__askwhy { font-size: 12.5px; color: var(--muted); margin-top: 6px; text-wrap: pretty }
/* pre-wrap keeps the lines an answer was typed in. */
.build__answer {
  font-size: 13.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap;
  background: var(--page); border-radius: 12px; padding: 11px 14px;
}

.build__cta {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start; border: none; background: #FFF; color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: var(--weight-strong);
  padding: 14px 26px; border-radius: 16px; cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Answer blocks: rank, scale, rate, split (app/interview-blocks.js)
   --------------------------------------------------------------------------- */
.ib { display: flex; flex-direction: column; gap: 10px }
.ib__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
}
.ib__label .ms { font-size: 16px }
.ib__text { text-align: left; text-wrap: pretty }

/* Rank: one option a row, the place number where the add icon was. */
.ib__rank { display: flex; flex-direction: column; gap: 8px }
.ib__rankrow { justify-content: flex-start; border-radius: 14px; padding: 11px 14px; min-height: 46px }
.ib__rankrow .ms { color: var(--muted) }
.ib__place {
  flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-left: -3px; border-radius: 50%;
  background: var(--on-ink); color: var(--ink);
  font-size: 12.5px; font-weight: var(--weight-strong); font-variant-numeric: tabular-nums;
}
.ib__rankrow[aria-disabled="true"] { opacity: .45; cursor: default }
.ib__rankrow[aria-disabled="true"]:hover { border-color: var(--line) }

/* Scale: equal stops on one row; the dot grows along it. Stacked on a phone
   when there are more than four, so no label is squeezed to a word a line. */
.ib__scale { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px }
.ib__stop {
  flex-direction: column; justify-content: center; gap: 6px;
  border-radius: 14px; padding: 12px 8px; min-height: 72px; text-align: center;
}
.ib__stop .ib__text { text-align: center }
/* A fixed box, so the labels line up however big the dot. */
.ib__stop .ib__dot { margin: 0; height: 22px; display: grid; place-items: center; line-height: 1; color: var(--ink) }
.ib__stop:hover .ib__dot, .ib__stop:focus-visible .ib__dot { color: inherit }
@media (max-width: 560px) {
  .ib__scale { grid-template-columns: 1fr }
  .ib__stop { flex-direction: row; justify-content: flex-start; min-height: 46px; padding: 11px 14px; gap: 10px }
  .ib__stop .ib__dot { width: 22px; text-align: center }
}

/* Rate: a row per option, split by hairlines, its stops at the end. */
.ib__rates { display: flex; flex-direction: column }
.ib__rate {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid #EDEDED;
}
.ib__rate:first-child { border-top: none; padding-top: 2px }
.ib__ratename { font-size: 14px; font-weight: 500; color: var(--text); flex: 1 1 200px; min-width: 0; text-wrap: pretty }
.ib__ratestops { display: flex; gap: 8px; flex-wrap: wrap }
/* 44px: a thumb-sized target, the chips here being the small size. */
.ib__ratestop { white-space: nowrap; min-height: 44px }

/* Split: a slider per option, its share as a figure; the track fills to it. */
.ib__splits { display: flex; flex-direction: column; gap: 14px }
.ib__split { display: flex; flex-direction: column; gap: 8px }
.ib__splithead { display: flex; align-items: baseline; gap: 12px }
.ib__share { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text) }
.ib__slider {
  --v: 50%;
  width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.ib__slider::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(to right, var(--ink) var(--v), #E4E4E4 var(--v));
}
.ib__slider::-moz-range-track { height: 8px; border-radius: 4px; background: #E4E4E4 }
.ib__slider::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--ink) }
.ib__slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--ink);
}
.ib__slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink) }
.ib__slider:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 6px }

/* ---------------------------------------------------------------------------
   Your business, as the interview builds it (app/interview-profile.js)
   ---------------------------------------------------------------------------
   Live: the conversation on the left, the profile on the right, pinned while
   the conversation scrolls. Under 1024px it sits above the conversation,
   folded to its heading. Review and done: one centred column, the profile
   on its own (done keeps the heading and Open Today above it). */
.build__grid {
  display: grid; grid-template-columns: minmax(0, 620px) minmax(300px, 380px);
  gap: 40px; align-items: start; justify-content: center;
}
.build__main { display: flex; flex-direction: column; gap: 26px; min-width: 0 }
.build__side { position: sticky; top: 24px; min-width: 0; view-transition-name: build-profile }
@media (max-width: 1023px) {
  .build__grid { grid-template-columns: minmax(0, 620px); gap: 20px }
  .build__side { order: -1; position: static }
}
.build__grid[data-mode="review"], .build__grid[data-mode="done"] { grid-template-columns: minmax(0, 680px); gap: 20px }
.build__grid[data-mode="review"] .build__side, .build__grid[data-mode="done"] .build__side { position: static }
.build__grid[data-mode="review"] .build__side { order: -1 }
/* Review: only the foot stays, for an error and Try again. */
.build__grid[data-mode="review"] .build__main > :not(:last-child) { display: none }
.build__grid[data-mode="done"] .build__lines { display: none }
::view-transition-group(build-profile) { animation-duration: .45s; animation-timing-function: cubic-bezier(.22, .8, .28, 1) }

.prof {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--card);
}
.prof__head { display: flex; align-items: center; gap: 10px }
.prof__title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 17px; font-weight: 600; color: var(--text); text-wrap: balance;
}
/* Focused by script when the review opens, so it can be read from there. */
.prof__title:focus:not(:focus-visible) { outline: none }
.prof__title .ms { font-size: 20px; color: var(--muted) }
.prof__count, .prof__n {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 1px 8px; border-radius: var(--r-pill); color: var(--muted);
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.prof__toggle { margin-left: auto; display: none }
@media (max-width: 1023px) {
  .prof__toggle { display: inline-flex }
  .prof[data-open="false"] .prof__sections, .prof[data-open="false"] .prof__empty { display: none }
}
/* Folded on a phone: the newest line, one line long. Wide screens never fold. */
.prof__latest {
  display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: -4px;
  font-size: 13px; color: var(--muted); animation: profNew 2.4s ease-out both; border-radius: 8px;
}
.prof__latest .ms { font-size: 16px; color: var(--ob-accent) }
.prof__latest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.prof__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
/* Not shown: on a wide screen, once opened, or with nothing new. */
.prof__latest[data-shown="false"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
@media (min-width: 1024px) { .prof__latest { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap } }
.prof__empty { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted) }
.prof__empty .ms { font-size: 17px }

.prof__sections { display: flex; flex-direction: column }
.prof--live .prof__sections {
  max-height: calc(100dvh - 200px); overflow-y: auto; overscroll-behavior: contain;
  /* A quiet scrollbar: the panel is read, not worked in. */
  scrollbar-width: thin; scrollbar-color: #D4D4D4 transparent;
}
.prof__section { padding: 14px 0; border-top: 1px solid #EDEDED }
.prof__section:first-child { border-top: none; padding-top: 2px }
.prof__sectiontitle {
  display: flex; align-items: center; gap: 7px; margin: 0 0 8px;
  font-size: 13px; font-weight: 600; color: var(--text); text-wrap: balance;
}
.prof__sectiontitle .ms { font-size: 17px; color: var(--muted) }
.prof__lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px }
.prof__line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 6px 8px; margin: 0 -8px; border-radius: 10px;
}
/* Takes what the flag leaves, so the flag stays beside it even on a phone. */
.prof__value { flex: 1 1 0; min-width: 0; font-size: 14px; line-height: 1.45; color: var(--text); text-wrap: pretty }
/* A short setup answer carries its label above it (the Label role). */
.prof__label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 1px }
.setupconfirm[aria-busy="true"] .ms { animation: cdSpin 1.1s linear infinite }
@media (prefers-reduced-motion: reduce) { .setupconfirm[aria-busy="true"] .ms { animation: none } }
/* Just noted: a wash that fades, so the owner sees where it landed. */
.prof__line[data-new="true"] { animation: profNew 2.4s ease-out both }
@keyframes profNew {
  0% { background: color-mix(in srgb, var(--ob-accent) 30%, transparent); transform: translateY(4px); opacity: 0 }
  12% { transform: none; opacity: 1 }
  100% { background: transparent }
}
@media (prefers-reduced-motion: reduce) {
  .prof__line[data-new="true"] { animation: none; background: color-mix(in srgb, var(--ob-accent) 14%, transparent) }
  ::view-transition-group(build-profile) { animation: none }
}

/* Review: each line can be marked wrong; a marked one is struck through in
   coral, with a box under it for what's right. */
/* Quiet until wanted: a line of flags all outlined reads as a form to fill. */
.prof__flag { flex: 0 0 auto; min-height: 36px }
.prof__flag:not([aria-pressed="true"]) { border-color: transparent; background: transparent; color: var(--muted) }
.prof__flag:not([aria-pressed="true"]):hover, .prof__flag:not([aria-pressed="true"]):focus-visible { border-color: var(--line); color: var(--text) }
.prof__hint { display: flex; align-items: center; gap: 6px; margin-top: -6px; font-size: 12.5px; font-weight: 500; color: var(--muted) }
.prof__hint .ms { font-size: 16px }
/* The decision stays in reach however long the profile is. */
.prof--review .prof__foot {
  position: sticky; bottom: 0; margin: 0 -20px -18px; padding: 12px 20px 16px;
  background: var(--card); border-top: 1px solid #EDEDED; border-radius: 0 0 18px 18px;
}
.prof__flag[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: var(--on-coral) }
.prof__line[data-wrong="true"] .prof__value { text-decoration: line-through; text-decoration-color: var(--coral); color: var(--muted) }
.prof__fix { flex-basis: 100%; height: 42px }
.prof__foot { display: flex; justify-content: flex-end; padding-top: 4px }
.prof__foot .setupconfirm { margin-left: 0 }
