/* web/hud/chat_box.css
   The chat box (web/hud/chat_box.js): chat in the game window's font, size, colour and Line
   width, under the game window or beside it at the right, the input line and the bar running
   under both, in the centre's grid (web/hud/centre_grid.css). Settings' Channels topic sets
   data-chat-at (box), data-chat-box (under, beside) and data-chat-box-size on the page
   (web/hud/display_options.js). Small, Medium or Large is its height under, a share of the
   column's height left, or its width beside, in letters -- the room box's sizes
   (web/hud/room_box.css).
   Lines past the box scroll inside it. Under, it narrows with the game window while the Stage
   is open; beside, it tucks away while the Stage is open and while it slides, as the room box at
   a side does. A phone layout never shows it. Its lines are laid out as the
   game window's are (web/screen.css). */

:root { --cbx-fr: 40fr; --cbx-cols: 56; }
:root[data-chat-box-size="small"] { --cbx-fr: 28fr; --cbx-cols: 44; }
:root[data-chat-box-size="large"] { --cbx-fr: 55fr; --cbx-cols: 70; }

#chatbox {
  font-family: var(--mono); font-size: var(--mono-size);
  --line-height: 1.5; line-height: var(--line-height);
  white-space: pre-wrap; word-break: break-word;
  color: var(--ink); background: var(--bg);
  overflow-y: auto; padding: 12px 18px; box-sizing: border-box;
  min-height: 0; min-width: 0; scrollbar-color: #444 transparent;
}
#chatbox[hidden], :root[data-phone] #chatbox, :root:not([data-chat-at="box"]) #chatbox { display: none; }
#chatbox > .col { max-width: var(--wrap); }

/* Under: a split between the game window and the input line, taking its size's share of the
   height. */
:root:not([data-phone])[data-chat-at="box"]:not([data-chat-box="beside"]) #centre:has(> #chatbox:not([hidden])) {
  --grid-under: minmax(0, var(--cbx-fr));
}
:root:not([data-phone])[data-chat-at="box"]:not([data-chat-box="beside"]) #centre > #chatbox {
  grid-row: 4; grid-column: 2;
  border-top: 1px solid var(--line);
  margin-left: var(--beside-left, 0px); margin-right: var(--beside-right, 0px);
}
#centre.sliding > #chatbox { transition: margin var(--stage-ms) var(--stage-ease); }

/* Beside: a column at the game window's right, from its tabs down to the input line. */
:root:not([data-phone])[data-chat-at="box"][data-chat-box="beside"] #centre > #chatbox {
  grid-row: 2 / 5; grid-column: 3;
  width: calc(var(--cbx-cols) * 1ch + 36px);
  border-left: 1px solid var(--line);
}
:root:not([data-phone])[data-chat-at="box"][data-chat-box="beside"] #centre:is(.staged, .sliding) > #chatbox { display: none; }
