/* Chats per song, in Riff's header (js/chatbar.js; getting-to-know-you-and-progress.md §5, item 22; "Alive Jam mockups"
   screens 37 and 38). Nick's side. The chat's name opens Your chats, the i what this chat carries, and New chat starts
   another. They sit after Riff's voice in the header band (chat-layout.css), and their panels open at the top of the
   chat. In the chat's own look: starlight on glass, Geist for anything you tap, Newsreader for a heading. */

/* ---------- the keys ---------- */
.cb-keys {
  display: none;
}

body[data-state="riff"] .convo-tools .cb-keys {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  height: 32px;
  min-width: 0;
  margin-right: auto;
  padding-left: 6px;
}

/* Riff's voice gives its "push to the left" to the keys after it. */
body[data-state="riff"] .convo-tools.has-chats .convo-voice {
  margin-right: 0;
}

.cb-key {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: color-mix(in srgb, var(--starlight) 78%, transparent);
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  transition: border-color var(--t) ease, color var(--t) ease, background-color var(--t) ease;
}

.cb-key .ic {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The chat's name, which opens the list: it gives way first when the band is narrow. */
.cb-chats {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 240px;
}

.cb-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-i {
  width: 32px;
  padding: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
}

.cb-key[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--starlight) 46%, transparent);
  background-color: var(--lift);
  color: var(--starlight);
}

@media (hover: hover) {
  .cb-key:hover {
    border-color: var(--starlight);
    color: var(--starlight);
  }
}

/* ---------- phones: thumbs' size, and Riff's voice as its icon (its name is still its name) ---------- */
@media (max-width: 639px) {
  .cb-key {
    height: 40px;
    min-width: 40px;
  }

  .cb-i,
  .cb-new {
    width: 40px;
    padding: 0;
  }

  .cb-new-w {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body[data-state="riff"] .convo-tools.has-chats .convo-voice {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  body[data-state="riff"] .convo-tools.has-chats .convo-voice span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body[data-state="riff"] .convo-tools .cb-keys {
    gap: 2px;
    height: 40px;
    padding-left: 2px;
  }
}

/* ---------- docked to the side (or beside the song builder), the chat is narrow: the same, at the desktop's size ---------- */
@media (min-width: 1100px) {
  body[data-state="riff"]:is([data-chat-side], [data-song-open]):not([data-chat-fold]) .convo-tools.has-chats .convo-voice,
  body[data-state="riff"]:is([data-chat-side], [data-song-open]):not([data-chat-fold]) .cb-new {
    justify-content: center;
    width: 32px;
    padding: 0;
  }

  body[data-state="riff"]:is([data-chat-side], [data-song-open]):not([data-chat-fold]) .convo-tools.has-chats .convo-voice span,
  body[data-state="riff"]:is([data-chat-side], [data-song-open]):not([data-chat-fold]) .cb-new-w {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- the panels: Your chats, and what this chat carries ---------- */
.cb-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--hair-hi);
  border-radius: 16px;
  background: color-mix(in srgb, var(--space) 70%, var(--panel));
}

.cb-panel[hidden] {
  display: none;
}

.cb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cb-h {
  margin: 0;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
}

.cb-newchat.chip {
  min-height: 44px;
  padding: 0 16px 0 12px;
  color: var(--starlight);
  font-size: 14px;
}

.cb-newchat .ic,
.cb-x .ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.cb-x {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--dust);
}

.cb-gh {
  margin: 6px 0 0;
  color: var(--dust);
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}

.cb-rows {
  display: flex;
  flex-direction: column;
  margin: 6px 0 0;
  padding: 2px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  list-style: none;
}

.cb-rows li + li {
  border-top: 1px solid var(--line);
}

.cb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 10px 0;
  color: var(--starlight);
  font: inherit;
  text-align: left;
}

.cb-row-words {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.35;
}

.cb-row-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
}

.cb-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #CDEBCA;
}

.cb-row-l {
  overflow: hidden;
  color: color-mix(in srgb, var(--starlight) 66%, transparent);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cb-row-w {
  flex: none;
  color: color-mix(in srgb, var(--starlight) 66%, transparent);
  font-size: 12px;
}

@media (hover: hover) {
  .cb-row:hover .cb-row-t {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

.cb-empty,
.cb-note,
.cb-soft {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--starlight) 66%, transparent);
  font-size: 12.5px;
  line-height: 1.45;
}

.cb-note {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--hair-hi);
}

.cb-p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.cb-p strong,
.cb-items strong {
  font-weight: 600;
}

.cb-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
}

.cb-items li::marker {
  color: var(--dust);
}

.cb-items .text-btn {
  min-height: 44px;
  padding: 0 2px;
  color: var(--starlight);
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cb-star {
  list-style: none;
  margin-left: -18px;
}

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

/* ---------- Talk about this song, under the song's name in the song builder (js/songdrawer.js) ---------- */
.sb-talk {
  align-self: flex-start;
  gap: 6px;
}

/* With room, it sits on the title's row, at its end; Play the song, the key, Undo, Redo and Versions keep the row under
   it. With room for one row, it's the bubble alone, after Rename (its name is still its name). */
@container sb (min-width: 700px) {
  .sb-top .sb-titlerow {
    flex: 1 1 calc(100% - 210px);
  }

  .sb-talk {
    flex: none;
    order: 1;
    align-self: center;
  }
}

@container sb (min-width: 1040px) {
  .sb-talk {
    order: 2;
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .sb-talk-w {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- the Menu's foot: New chat and Your chats ---------- */
.rc-menu-chat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- round 6's follow-up (6.7): Make it a song's chat, a song deleted, Riff's offer, Earlier in General ---------- */
.cb-has-move {
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
}

.cb-move.text-btn {
  align-self: flex-start;
  min-height: 44px;
  margin-top: -8px;
  padding: 0 2px;
  color: var(--starlight);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cb-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cb-acts .cb-move.text-btn {
  margin-top: 0;
}

.cb-row-gone {
  align-self: flex-start;
  margin: 1px 0;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: color-mix(in srgb, var(--starlight) 72%, transparent);
  font-size: 11.5px;
  line-height: 1.5;
}

.cb-pick .cb-acts .chip {
  min-height: 44px;
}

/* Riff's offer to take General's talk to a song's chat: Yes and No under his words. */
.rc-move {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.45;
}

.rc-move .chip {
  min-height: 44px;
  padding: 0 16px;
  border-color: var(--hair-hi);
  color: var(--starlight);
  font-family: var(--ui);
  font-size: 14px;
}

/* Yes is the way the offer leans: the solid one. */
.rc-move .chip[data-rc="moveyes"] {
  border-color: var(--starlight);
  background: var(--starlight);
  color: var(--space);
  font-weight: 600;
}

.rc-move-said {
  margin: 8px 0 0;
  color: color-mix(in srgb, var(--starlight) 66%, transparent);
  font-family: var(--ui);
  font-size: 12.5px;
}

/* Earlier in General, at the top of the chat. */
.rc-earlier {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--hair-hi);
}

.rc-earlier-btn.text-btn {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 2px;
  color: var(--starlight);
  font-family: var(--ui);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rc-earlier-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rc-earlier-list[hidden] {
  display: none;
}

.rc-earlier-note {
  margin: 0;
  color: color-mix(in srgb, var(--starlight) 66%, transparent);
  font-family: var(--ui);
  font-size: 12.5px;
}
