/* ==========================================================================
   CHAT: the conversation and the characters (2026-09-28)

   Ian, 2026-09-28: "The AI chat feels a bit overwhelming and you can't really
   see what it's saying. Tom Brady should still have a text box around him."
   "What's going on with the character images? They're all shrunken and look
   weird. Each character should have their own color so you can designate
   them." And, standing: no ball, no orb and no mark beside Limi's name.

   Linked right after css/fullstop.css, and scoped like it: every rule sits
   under :root[data-look="fullstop"]. The messages are built in js/app.js
   (makeBubble, buildGuestBubble, pushUserBubble), the roster in js/cast.js,
   the colours are chosen in js/guests.js. demo/stub/verify-chat.mjs measures
   all of it in the three lights, on a phone and a laptop.

   The chat, in short:
   - Every line is in a box. Yours sit on the right, filled. Limi's are on the
     left in a plain surface box with a hairline, and never carry a mark. A
     character's box, name and badge wear that character's colour: a tinted
     surface, a coloured edge, the name in the colour. Body text is always
     the page's own ink, never the colour.
   - A line is about 60 characters at most, and the speaker is named once per
     turn: lines in a row from one speaker (js/app.js joinRun marks them
     .msg-cont) sit 4px apart under one name; a new speaker starts 16px down.
   - Calm: no glow, no gradient, no glass on content, nothing that flashes.

   The character colours: seven hues at one OKLCH lightness (L 0.78, chroma
   up to 0.12 in the dark lights; L 0.48, chroma up to 0.13 on Day's paper),
   placed clear of the three hues the app keeps for meaning: steel blue (kept,
   h 234), ember (late and stern, h 38) and sand gold (the one primary action,
   h 81). Hues: crimson 12, magenta 342, violet 308, indigo 276, teal 184,
   green 146, olive 113. Measured (demo/stub/verify-chat.mjs): each name at
   least 4.5:1 on its tinted box, each edge at least 3:1 on the page and on
   its box, each badge glyph at least 4.5:1 on its tile, in every light.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. The character colours
   -------------------------------------------------------------------------- */
:root[data-look="fullstop"] {
  --ch-crimson: #fa96a3;
  --ch-magenta: #ec98cd;
  --ch-violet:  #cda2f3;
  --ch-indigo:  #a4b1fd;
  --ch-teal:    #45d0c0;
  --ch-green:   #83cc88;
  --ch-olive:   #b8c060;
  --ch-tint-mix: 10%;   /* a character's box: this much colour in the surface */
  --ch-edge-mix: 62%;   /* its edge */
  --ch-tile-mix: 22%;   /* the tile behind their badge's glyph */
  --ch-tile-base: var(--fs-s2);
}
:root[data-look="fullstop"][data-theme="light"] {
  --ch-crimson: #98374a;
  --ch-magenta: #8d3b72;
  --ch-violet:  #724695;
  --ch-indigo:  #4b54a5;
  --ch-teal:    #0a6c63;
  --ch-green:   #1c702b;
  --ch-olive:   #5e6308;
  --ch-tint-mix: 7%;
  --ch-edge-mix: 76%;
  --ch-tile-mix: 13%;
  --ch-tile-base: var(--fs-s1);
}
/* A guest with no colour (one no longer on the roster, replayed from the
   past) is drawn in the page's quiet ink: still a box, still named. */
:root[data-look="fullstop"] :is(.guest-msg, .cast-row, .fs-guest-target) { --ch: var(--fs-t2); }
/* Same weight as the line above, and later, so a colour always wins. */
:root[data-look="fullstop"] [data-hue="crimson"] { --ch: var(--ch-crimson); }
:root[data-look="fullstop"] [data-hue="magenta"] { --ch: var(--ch-magenta); }
:root[data-look="fullstop"] [data-hue="violet"]  { --ch: var(--ch-violet); }
:root[data-look="fullstop"] [data-hue="indigo"]  { --ch: var(--ch-indigo); }
:root[data-look="fullstop"] [data-hue="teal"]    { --ch: var(--ch-teal); }
:root[data-look="fullstop"] [data-hue="green"]   { --ch: var(--ch-green); }
:root[data-look="fullstop"] [data-hue="olive"]   { --ch: var(--ch-olive); }

/* --------------------------------------------------------------------------
   2. The conversation
   -------------------------------------------------------------------------- */
:root[data-look="fullstop"] .limi-feed,
:root[data-look="fullstop"].unified-shell .limi-feed {
  padding: 8px 0 24px;
}
/* Every line is a box. */
:root[data-look="fullstop"] .limi-msg,
:root[data-look="fullstop"] .guest-msg,
:root[data-look="fullstop"] .user-msg {
  box-sizing: border-box;
  margin: 16px 0 0;
  padding: 10px 16px 12px;
  border: 0;
  border-radius: 18px;
  font-size: 17px;   /* so a box's em is its words' em (the 60-character measure) */
  overflow-wrap: anywhere;
}
:root[data-look="fullstop"] .limi-feed > :first-child { margin-top: 0; }
/* Theirs on the left, a little short of the far side so the sides read. */
:root[data-look="fullstop"] .limi-msg,
:root[data-look="fullstop"] .guest-msg {
  align-self: flex-start;
  width: fit-content;
  max-width: min(100% - 28px, 26em + 32px);
}
/* Limi: a plain surface and a hairline. No mark, ever. */
:root[data-look="fullstop"] .limi-msg {
  background: var(--fs-s1);
  box-shadow: inset 0 0 0 1px var(--fs-line);
}
/* A character: their colour in the surface, on the edge and in the name. */
:root[data-look="fullstop"] .guest-msg,
:root[data-look="fullstop"] .limi-msg[data-hue] {
  background: color-mix(in srgb, var(--ch) var(--ch-tint-mix), var(--fs-s1));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ch) var(--ch-edge-mix), var(--fs-s1));
}
/* Yours: on the right, filled, no name (the side says who). */
:root[data-look="fullstop"] .user-msg {
  align-self: flex-end;
  width: fit-content;
  max-width: min(100% - 48px, 26em + 32px);
  padding: 10px 16px;
  background: var(--fs-s2);
  box-shadow: none;
}
:root[data-look="fullstop"][data-theme="light"] .user-msg { background: var(--fs-s3); }

/* The words: about 60 characters to a line, in the page's own ink. */
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg, .user-msg) p {
  max-width: 26em;
  margin: 0;
  font-size: 17px;
  line-height: 24px;
  color: var(--fs-t1);
}

/* The name, once per turn. */
:root[data-look="fullstop"] .msg-head,
:root[data-look="fullstop"] .guest-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
}
:root[data-look="fullstop"] .limi-msg .who,
:root[data-look="fullstop"] .guest-name {
  font-size: 13px;
  line-height: 18px;
  font-weight: 640;
  letter-spacing: 0;
  text-transform: none;
}
:root[data-look="fullstop"] .limi-msg .who { color: var(--fs-t2); }
:root[data-look="fullstop"] .limi-msg.tone-firm .who { color: var(--fs-t1); }
:root[data-look="fullstop"] .limi-msg.tone-stern .who { color: var(--fs-stern); }
:root[data-look="fullstop"] .guest-name,
:root[data-look="fullstop"] .limi-msg[data-hue] .who { color: var(--ch); }
:root[data-look="fullstop"] .limi-msg[data-hue].tone-stern .who { color: var(--fs-stern); }

/* A character's badge: their glyph, crisp and centred on a tile of their
   colour. Squares, like the logo's full stop. */
:root[data-look="fullstop"] .guest-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ch) var(--ch-tile-mix), var(--ch-tile-base));
  color: var(--ch);
  font: 700 11px/1 var(--fs-font);
  letter-spacing: 0.02em;
}
:root[data-look="fullstop"] .guest-badge > [data-icon] { display: grid; place-items: center; width: 22px; height: 22px; }
:root[data-look="fullstop"] .guest-badge .gicon { display: block; width: 22px; height: 22px; }
:root[data-look="fullstop"] :is(.guest-badge, .cast-badge) .gicon { --gi-hi: var(--ch); --gi-lo: var(--ch); color: var(--ch); }
:root[data-look="fullstop"] :is(.guest-badge, .cast-badge) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

/* A run: lines in a row from one speaker read as one turn. The first is
   named; the rest sit close under it with their joined corners tucked. */
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg, .user-msg).msg-cont { margin-top: 4px; }
:root[data-look="fullstop"] .limi-msg + .limi-msg { margin-top: 16px; }
:root[data-look="fullstop"] .limi-msg + .limi-msg.msg-cont { margin-top: 4px; }
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg).msg-cont :is(.msg-head, .guest-head) { display: none; }
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg).msg-cont { border-top-left-radius: 6px; }
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg):has(+ .msg-cont) { border-bottom-left-radius: 6px; }
:root[data-look="fullstop"] .user-msg.msg-cont { border-top-right-radius: 6px; }
:root[data-look="fullstop"] .user-msg:has(+ .msg-cont) { border-bottom-right-radius: 6px; }
/* ...unless Limi's tone steps up mid-turn: then her name comes back with it. */
:root[data-look="fullstop"] .limi-msg:not(.tone-stern) + .limi-msg.msg-cont.tone-stern .msg-head,
:root[data-look="fullstop"] .limi-msg:not(.tone-firm):not(.tone-stern) + .limi-msg.msg-cont.tone-firm .msg-head { display: flex; }

/* Thinking: the three small squares, in a character's own colour. */
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg) .typing { display: inline-flex; gap: 5px; padding: 8px 0; }
:root[data-look="fullstop"] :is(.limi-msg, .guest-msg) .typing i { background: var(--fs-t2); }
:root[data-look="fullstop"] .guest-msg .typing i { background: var(--ch); }

/* "Tom Brady will answer", above the composer (js/app.js, updateTargetPill):
   in that character's colour once the pill carries data-hue. */
:root[data-look="fullstop"] .fs-guest-target[data-hue] {
  background: color-mix(in srgb, var(--ch) var(--ch-tint-mix), var(--fs-s1));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ch) var(--ch-edge-mix), var(--fs-s1));
  color: var(--fs-t1);
}
:root[data-look="fullstop"] .fs-guest-target[data-hue] .gicon { --gi-hi: var(--ch); --gi-lo: var(--ch); }

/* --------------------------------------------------------------------------
   3. Settings > Your characters (js/cast.js)
   One grid for every row, so the tiles, the names and the buttons line up.
   Limi's row is her name alone: no badge, no mark.
   -------------------------------------------------------------------------- */
:root[data-look="fullstop"] .cast-list { container-type: inline-size; }
:root[data-look="fullstop"] .cast-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "badge names acts";
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  min-height: 64px;
  padding: 10px 12px;
}
:root[data-look="fullstop"] .cast-row.cast-limi {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "names acts";
  padding-left: 16px;
}
:root[data-look="fullstop"] .cast-badge {
  grid-area: badge;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ch) var(--ch-tile-mix), var(--ch-tile-base));
  box-shadow: none;
  color: var(--ch);
  font: 700 15px/1 var(--fs-font);
  letter-spacing: 0.02em;
}
:root[data-look="fullstop"] .cast-badge > [data-icon],
:root[data-look="fullstop"] .cast-badge > .gicon,
:root[data-look="fullstop"] .cast-badge .gicon { display: block; width: 30px; height: 30px; }
:root[data-look="fullstop"] .cast-badge > [data-icon] { display: grid; place-items: center; }
:root[data-look="fullstop"] .cast-names { grid-area: names; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
:root[data-look="fullstop"] .cast-names b {
  font-size: 17px;
  line-height: 22px;
  font-weight: 620;
  color: var(--fs-t1);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
:root[data-look="fullstop"] .cast-names small { font-size: 13px; line-height: 18px; color: var(--fs-t2); }
:root[data-look="fullstop"] .cast-acts {
  grid-area: acts;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
/* The row's buttons are quiet: the one gold action on this screen is not
   theirs, and ember means late. */
:root[data-look="fullstop"] .cast-acts .cast-act {
  position: relative;
  min-width: 44px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--fs-line-strong);
  color: var(--fs-t1);
  font: 560 13px/18px var(--fs-font);
  cursor: pointer;
}
:root[data-look="fullstop"] .cast-acts .cast-act.primary,
:root[data-look="fullstop"] .cast-acts .cast-act.danger { color: var(--fs-t1); border: 0; }
:root[data-look="fullstop"] .cast-acts .cast-act.danger { font-size: 15px; }
@media (hover: hover) and (pointer: fine) {
  :root[data-look="fullstop"] .cast-acts .cast-act:hover { background: var(--fs-s2); }
  :root[data-look="fullstop"] .cast-row.active .cast-acts .cast-act:hover { background: var(--fs-s1); }
}
/* On touch the paint stays 36px and css/styles.css pads each button to 54px
   tall (search "cast-act"); min-width above keeps the narrow one wide enough. */
/* In a narrow list (a phone, or the Settings sheet on a laptop), the buttons
   go under the name, so a name is never cut short. */
@container (max-width: 420px) {
  :root[data-look="fullstop"] .cast-row:not(.cast-limi) {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "badge names" ". acts";
  }
  :root[data-look="fullstop"] .cast-row:not(.cast-limi) .cast-acts { flex-wrap: wrap; }
}
:root[data-look="fullstop"] .cast-key {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--fs-t2);
}

/* --------------------------------------------------------------------------
   4. Windows Contrast themes drop fills and shadows: every box keeps an edge.
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
  :root[data-look="fullstop"] :is(.limi-msg, .guest-msg, .user-msg) { border: 1px solid CanvasText; }
  :root[data-look="fullstop"] :is(.guest-badge, .cast-badge) { border: 1px solid CanvasText; }
  :root[data-look="fullstop"] :is(.guest-badge, .cast-badge) .gicon { --gi-hi: CanvasText; --gi-lo: CanvasText; }
}
