/* Rozmowa on a phone in WhatsApp's shapes (task #258, ADR 0282), at a phone's width: linked
   before phone.css, which stays the last stylesheet. Quartio's own colours, type and icons. */

/* The history column's own button: the clock beside a computer's column, the arrow back to the
   list on a phone. */
.history-toggle .history-back { display: none; }
.chat-new-fab { display: none; }

@media (max-width: 760px) {
  /* The list of conversations is the start: the whole screen, no shade; a conversation is the
     screen over it. */
  /* (Only while open: closed it keeps the drawer's width, so a wider window opens the column
     from there and nothing beside it reflows.) */
  .history.open { width: 100%; flex-basis: 100%; }
  .history .history-inner { width: 100%; padding: 12px 12px 0; border-right: 0; }
  .history-heading { display: none; }
  .history.open ~ .history-shade { visibility: hidden; opacity: 0; }
  .chat-layout:has(> .history.open) > :not(.history) { visibility: hidden; }
  .history .history-search { padding: 0 14px; min-height: 44px; border-radius: 22px; background: var(--surface); }
  /* (The list scrolls to the line over Archiwum, its last row clear of the round button.) */
  .history-items { margin-top: 8px; padding-bottom: 72px; }
  .history-group { margin: 12px 10px 4px; }
  /* A row as a messenger's, a size under a computer's touch sizes (task #277): a round mark, the
     name in its size, a thumb's height. */
  .history-row { min-height: 56px; gap: 12px; padding: 8px 44px 8px 8px; font-size: 15px; border-radius: 10px; }
  .history-row > .icon { width: 40px; height: 40px; padding: 11px; border-radius: 50%; background: var(--sage); }
  /* (A new shared row is sage itself: its mark stands out in the paper's colour.) */
  .history-item--shared.is-new .history-row > .icon { background: var(--surface); }
  /* The foot with Archiwum, and the selection's bar over it, one finger's row (task #277): the
     column has no padding under it here, so the bar lies at its very bottom, its words and
     buttons on one line (a longer sentence grows it upwards, as at a computer). */
  .history { --column-foot: 56px; }
  .history .history-archive-link { padding: 0 8px; }
  .history-select { left: 12px; right: 12px; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 5px 0 5px 8px; }
  .history-select-words { flex: 1 1 auto; }
  .history-select-actions { margin-top: 0; }
  /* The round button for a new conversation, over the list's foot on the right: clear of the
     line over Archiwum, which stays whole for a tap (task #277). */
  .chat-new-fab { display: grid; place-items: center; position: absolute; right: 16px; bottom: calc(var(--column-foot) + 14px); z-index: 3; width: 52px; height: 52px; border-radius: 15px; background: var(--ink); color: var(--surface); box-shadow: 0 6px 20px var(--q-shadow-deep); }
  .chat-new-fab .icon { width: 22px; height: 22px; }
  .chat-new-fab:active { transform: scale(.95); }
  .history:not(.open) .chat-new-fab, .history.selecting .chat-new-fab { display: none; }
  /* (Over the list the header names the list: who reads the conversation under it is not said.) */
  .workspace:has(.chat-layout > .history.open) .topbar .share-slot { display: none; }
  /* Over the list the header's clock is the way back to it, an arrow; on the list it is gone. */
  .history-toggle .icon:not(.history-back) { display: none; }
  .history-toggle .history-back { display: block; }
  .history-toggle[aria-expanded=true] { display: none; }
  .history-toggle.has-news[aria-expanded=false]::after { top: 8px; right: 8px; }
}

/* A conversation as a messenger's: the person's words in a green bubble at the right, Quartio's
   answer at the left with no box, as on a computer (task #281), the column's width (a widget in
   it keeps its room; who wrote it at its top), the time
   at the foot of each (the answer's at the left, as on a computer); the box at the foot, a round field with "+" in it and a round send button beside
   it, growing with the text. A new conversation is the same screen, empty: its heading small in
   the middle, its starters as chips over the box. */
@media (max-width: 760px) {
  .chat-view { padding: 0 10px; }
  .messages { gap: 10px; padding: 14px 2px 12px; }
  .message-row--user .message-bubble { max-width: 86%; padding: 8px 12px 6px; border-radius: 14px 4px 14px 14px; }
  .message-row--assistant .message-heading { gap: 6px; margin: 0 0 6px; font-size: 13px; }
  .message-row--assistant .message-heading .symbol { width: 18px; height: 18px; }
  .message-meta, .message-row--user .message-meta { margin-top: 4px; }
  .message-text, .message-row--assistant .message-text { font-size: 15.5px; line-height: 1.6; }
  /* (A quote's or a code block's Kopiuj keeps within its line.) */
  .message-text .block-copy { margin-top: 1px; margin-bottom: 1px; }

  .chat-view .composer-wrap { display: flex; flex-direction: column; padding: 6px 0 10px; }
  .chat-view .composer { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: end; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .chat-view .composer:focus-within { box-shadow: none; }
  .chat-view .composer textarea { grid-column: 1; grid-row: 1; min-height: 48px; max-height: 140px; padding: 12px 16px 12px 50px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); line-height: 1.4; }
  .chat-view .composer textarea:focus { border-color: var(--control); }
  /* The files put on the box: a closed box of their own over the round field. */
  .chat-view .file-chips:not(:empty) { max-height: 177px; margin-bottom: 6px; border-bottom: 1px solid var(--control); border-radius: 14px; }
  /* (Its border closed underneath takes a pixel: the tray's rows keep their room.) */
  .chat-view .file-chips:has(.file-chip--card) { max-height: 264px; }
  /* (Empty, its placeholder keeps the one line, not under the field's foot; a textarea draws no
     ellipsis, so a phone's placeholder is a short one, task #278.) */
  .chat-view .composer textarea:placeholder-shown { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-view .composer .attach-button { grid-column: 1; grid-row: 1; justify-self: start; align-self: end; position: relative; z-index: 1; width: 44px; height: 44px; margin: 0 0 2px 3px; }
  .chat-view .composer .stop-button { grid-column: 2; grid-row: 1; width: 48px; height: 48px; border-radius: 50%; }
  .chat-view .composer .send-button { grid-column: 3; grid-row: 1; width: 48px; height: 48px; border-radius: 50%; }

  .chat-view.empty::before { flex: 1 1 0px; }
  .chat-view.empty::after { flex: 0 0 0px; min-height: 0; }
  .chat-view.empty .conversation, .chat-view.empty .composer-wrap { max-width: none; }
  .welcome { margin: 0 auto 20px; }
  .welcome h1 { font-size: 34px; line-height: 1.15; letter-spacing: -1px; }
  /* (The chips wrap, each whole on the screen: a strip that scrolls sideways cut its last one at
     the screen's edge, task #278.) */
  .chat-view.empty .chat-starters { order: -1; justify-content: flex-start; gap: 8px; margin: 0 0 10px; }
  .chat-view.empty .chat-offers { margin-bottom: 8px; }
  .chat-view.empty .chat-suggestion { border-radius: 18px; text-align: left; }
  /* (With the keyboard open the heading goes. Where the wrapped chips still leave no room for
     the box above the keyboard (`fit-starters.js`), each group is a strip of one-line chips
     scrolled sideways.) */
  html.keyboard .chat-view.empty .welcome { display: none; }
  .chat-view.empty.chips-strip .chat-starters { flex-wrap: nowrap; margin: 0 -10px 8px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
  .chat-view.empty.chips-strip .chat-suggestion { flex: 0 0 auto; white-space: nowrap; }
}
