/* pages/chat.css — /chat/ (SPEC §5.12).
 *
 * A list beside a record, like Contacts and Mail: the conversations on the
 * left, the open one on the right. No page-top, no visible head, and NO FAB
 * here (K6): the composer owns the bottom-right corner, so --fabreach is 0
 * (app.css). Everything is drawn from the m3.css components:
 *   - the search bar (.split__search = .m3-search),
 *   - New conversation, an outlined M button (.m3-btn--outlined.m3-btn--m),
 *   - the rows, standard one-line list items (.m3-list-item); the open one is
 *     aria-current="true", the grey step,
 *   - the composer (.m3-composer) with a filled icon button for Send,
 *   - the "not kept" warning, a .notice.
 * The bubbles and the model wait (.bubble*, .thinking) are app.css's, shared
 * with the assistant panel. The conversation's title band is the record head
 * of §4.7 (app.css): the region's own colour, with the skirt that fades what
 * scrolls under it.
 *
 * PAGE-SCOPE RULE (§1.1, test_design check 9): every selector starts with a
 * class this file owns — `.convos*`, `.convo*`, `.chat*` — or with
 * [data-page="chat"]. All eleven page files load on every page.
 */

/* ── The list column ─────────────────────────────────────────────────────── */

/* The scroller (a VERTICAL fade, listed in app.css). It fills the column
   below the search bar; the column's own heights come from the split grid. */
.convos { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.convos__new { padding: 0; }
.convos__new > .m3-btn { width: 100%; margin-bottom: 8px; }
/* The button is as wide as the scroller and sits on its top edge, so an outer
   ring is clipped on three sides: it takes the inner offset (§2.14). */
.convos__new > .m3-btn:focus-visible { outline-offset: var(--app-focus-offset-inner); }

/* A conversation: a one-line item (56). The title is the headline (body-large,
   ellipsis); the date "16 Sep" is trailing supporting text (label-small,
   tabular). smoke-chat reads `cursor: pointer` as "the stylesheet applied". */
.convo { cursor: pointer; }
.convo__when { font-variant-numeric: tabular-nums; }

/* ── The record ──────────────────────────────────────────────────────────── */

/* The detail is NOT the scroller here: the thread is, so the composer stays
   put at the bottom. (It is therefore out of app.css's BOTTOM fade list.) */
[data-page="chat"] .split__detail:has(> .chat) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 16px;
}
/* The shell's Back (≤839px) is inserted before the record; in this column it
   keeps its own width. */
[data-page="chat"] .split__detail > .reading__back { align-self: flex-start; flex: none; }

.chat { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* The conversation's title band: the record head of §4.7 (sticky, the
   region's own colour — app.css). Headline-small, emphasized, in the brand face: the same
   type as every other record head (.card-detail__head h2, Mail's subject is a
   long sentence too), so a conversation's name reads as the record's name and
   not as a list label. §5.12 said title-medium; the final review overruled it
   for consistency with §3.28/§4.7. */
.chat__title {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-ref-typeface-brand);
  font-size: var(--md-sys-typescale-headline-small-size);
  line-height: var(--md-sys-typescale-headline-small-line-height);
  font-weight: var(--md-sys-typescale-emphasized-headline-small-weight);
  font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond);
  overflow-wrap: anywhere;
}

/* The thread: the record's one scroller (VERTICAL fade, listed in app.css).
   Its content keeps the 760px measure the page has always had, centred, so a
   wide window reads like Gemini rather than a line across the screen; the
   scroller itself stays full width so the wheel works anywhere over it. */
.chat__thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px max(0px, calc((100% - 760px) / 2));
}

/* "This conversation will not be kept": the notice look (m3.css), in the
   same measure as the thread and the composer. */
.chat__warn { flex: none; width: 100%; max-width: 760px; margin-inline: auto; }
.chat__warn code { overflow-wrap: anywhere; }

/* The composer: the M3 composer pill (m3.css .m3-composer, 56, #282A2C) with
   Send as a filled S icon button. Same measure, centred. */
.chat__composer { flex: none; max-width: 760px; margin-inline: auto; }
/* One focus ring on screen (§2.14): the pill carries the ring while the TEXT
   has focus; with Send focused, Send's own ring is the one. */
.chat__composer:focus-within:not(:has(> input:focus)) { outline: none; }

/* ── One pane at a time (≤839px) ─────────────────────────────────────────── */

@media (max-width: 839px) {
  /* The card's own padding is the margin here, as on every record. */
  [data-page="chat"] .split__detail:has(> .chat) { padding: 0; }
  /* The composer runs edge to edge of the pane body, which clips (overflow:
     hidden), so an outer ring would lose its sides and bottom: the ring is
     drawn inside instead (§2.14's inner offset for a clipped control).
     ⚠️ (0,3,0), NOT `.chat__composer:focus-within` (0,2,0): m3.css draws the
     ring with `.m3-composer:is(:has(> …:focus), …)`, which weighs (0,2,1), so
     the lighter rule never applied and the ring's bottom edge was cut off by
     the pane (measured at 412px: offset +2px, 2026-10-01). */
  .chat__composer.m3-composer:focus-within { outline-offset: var(--app-focus-offset-inner); }
  /* The rule above sets display: flex at the same weight as the shell's
     list-mode `.content:not(.is-reading) .split__detail { display: none; }`
     and later in the cascade, so the list-mode hiding is restated, heavier. */
  [data-page="chat"]:is(.content:not(.is-reading) *) .split__detail { display: none; }
  /* No reading region at this width: the thread lies on the card, which is the
     colour an answer's code well has everywhere else (app.css, .bubble--md). So
     here the well is the step ABOVE its ground, not the one below. */
  [data-page="chat"] .bubble--md { --_well: var(--md-sys-color-surface-container-low); }
  /* …and a tool's chip one step above the card (app.css, .toolrow). The
     thread, not [data-page="chat"]: the assistant's host carries that too. */
  .chat__thread .toolrow { --_chip: var(--md-sys-color-surface-container-high); }
}
/* …and in a half of a split, which is the same one pane (app.css, READING
   MODE): the four rules again. The third is the PANE's here — the two halves
   are not in the list or the record together — and weighs more than the rule
   it restates, which it must: it is there to beat `display: flex`, above. */
[data-page="chat"] .split__detail:has(> .chat):where(.content.is-split *) { padding: 0; }
.chat__composer.m3-composer:focus-within:where(.content.is-split *) { outline-offset: var(--app-focus-offset-inner); }
[data-page="chat"]:is(.content.is-split .pane:not(.is-reading)) .split__detail { display: none; }
[data-page="chat"] .bubble--md:where(.content.is-split *) { --_well: var(--md-sys-color-surface-container-low); }
.chat__thread .toolrow:where(.content.is-split *) { --_chip: var(--md-sys-color-surface-container-high); }
