/* Certant Flat — chatbots page local rules. Tokens only, prefix .pg-chatbots-. */

/* flat.css styles no <pre>; the embed snippet must keep its line breaks and scroll rather than wrap.
   font-family is set because the UA stylesheet defaults <pre> to monospace, and this system carries one family. */
.pg-chatbots-code { white-space: pre; overflow-x: auto; font-size: var(--fs-sm); line-height: var(--lh-relaxed); color: var(--paper); margin: 0; font-family: inherit; }

/* The old snippet sat on a charcoal slab with white text; the flat system has no `.tint--ink`, so
   the ink token stands the card on the dark ground directly - the silhouette alone reads "code"
   even set in the body face (monospace is a DESIGN.md decision for flat/pages/blog.css only). */
.pg-chatbots-code-slab { background: var(--ink); }

/* the transcript builds over ~2.4s; without a floor the two columns jump as bubbles land. */
.pg-chatbots-thread { min-height: 240px; }

/* Bubbles stage in one at a time; flat.css has no entry animation and the transcript is the page's
   argument. Opacity only — the old page also translated 6px, which is the banned float. */
.pg-chatbots-in { animation: pg-chatbots-in 0.22s var(--ease) both; }
@keyframes pg-chatbots-in { from { opacity: 0; } }

/* The typing indicator. The old page bounced three dots (vs-bounce, 1.2s, delays 0/0.15/0.3s);
   the bounce is a translate, so the flat equivalent keeps the cadence and cycles opacity only. */
.pg-chatbots-typing { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: middle; }
.pg-chatbots-typing span {
  width: 5px; height: 5px; border-radius: var(--r-pill); background: var(--fg-3); opacity: 0.3;
  animation: pg-chatbots-typing 1.2s var(--ease) infinite;
}
.pg-chatbots-typing span:nth-child(2) { animation-delay: 0.15s; }
.pg-chatbots-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pg-chatbots-typing { 0%, 70%, 100% { opacity: 0.3; } 35% { opacity: 1; } }

/* Answer bubbles default to cloud, and cloud on a pink or blue tint reads muddy; the system's
   pairing is paper on a tint (architecture.html's detail card is the same move, inverted).
   Scoped to the comparison stage only. The hero widget's bubbles no longer sit directly on the
   blue tint panel — they sit inside a paper device shell (.pg-chatbots-widget__shell) — so
   forcing paper here too would erase them against it. Cloud on paper is the system's pairing,
   and flat.css's own .viz-bubble--answer default (background: var(--bg-tint)) already gives
   the hero that without an override. */
.pg-chatbots-stage .viz-bubble--answer { background: var(--paper); }

/* The citation chips carry chip--paper, which now matches the bubble ground above (both
   var(--paper)) and disappears — the whole page's argument rides on these being legible.
   Ground them on cloud instead, the same tone the unsure-state chip already lands on inside
   a hued panel, and let them wrap: flat.css sets nowrap, but the longest citation string is
   wider than the bubble at narrow widths and would otherwise overhang the rounded corner.
   The fill alone is only 1.2:1 against the paper bubble, so the pill also takes a hairline
   edge (the chip has no border in flat.css) rather than relying on the fill to read as a pill.
   Scoped to the stage only, not the hero: the hero's .answer__cites sits beside the bubble on
   the blue tint panel, not nested inside it, so its chip--paper already reads correctly there
   (paper on tint, the system default) — widening this rule to the hero would put a cloud chip
   back on a blue tint, the exact muddy pairing this rule exists to avoid. */
.pg-chatbots-stage .viz-bubble--answer .answer__cites .chip {
  --_bg: var(--bg-tint);
  border: 1px solid var(--line);
  white-space: normal;
}

@media (max-width: 720px) {
  /* Wrapped citation chips take a second line on narrow columns, so the good thread grows
     once when its answer lands; hold that height too rather than only the desktop floor. */
  .pg-chatbots-thread { min-height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-chatbots-in { animation: none; }
  .pg-chatbots-typing span { animation: none; opacity: 0.55; }
}


/* ==========================================================================
   The hero widget — a real-looking embedded chat, not a floating Q&A.
   ========================================================================== */

/* The widget is a device, not a card: its zones own their own padding
   (rules below), and the fixed height is what makes the transcript scroll
   rather than push the hero section long. --pad restated at sp-5 so the
   outer blue frame keeps its margin regardless of .tint--panel/.viz-frame--hero
   cascade order in flat.css. */
.pg-chatbots-widget { --pad: var(--sp-5); }
.pg-chatbots-widget__shell {
  --pad: 0;
  display: flex;
  flex-direction: column;
  /* 520px left the cited answer's <mark> and its citation chips scrolled
     above the scroll box entirely when the widget loads bottom-anchored
     (a 336px scroll viewport against a 648px transcript). 650px keeps the
     bottom-anchor behaviour but grows the scroll viewport enough that the
     cited answer, the follow-up question and the "can't find that" answer
     all land inside it, with the cited bubble's top clearing the 24px mask
     fade rather than sitting under it. */
  height: 650px;
  overflow: hidden;
  border-radius: var(--r-panel);
}

/* The head is a three-part row — mark, identity, Example chip — and the
   identity block absorbs the slack so the chip stays pinned right. */
.pg-chatbots-widget__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); }
.pg-chatbots-widget__id { flex: 1; min-width: 0; }

/* flat.css's .tile is 70% white (--tile-bg), tuned to sit on a hued tint
   block, where it reads as a lightened disc of that hue. This tile sits on
   the paper shell instead, where 70% white is invisible and only the bare
   glyph shows. Give it the cloud ground it would get for free inside a
   tint block, the same ground §03 and §04's tiles already sit on — do not
   widen this selector to those tiles, they are correct as they are. */
.pg-chatbots-widget__head .tile { background: var(--bg-tint); }

/* The tabs sit in the head's own gutter; no hairline divider, per the
   Whitespace-Not-Rules Rule. */
.pg-chatbots-widget__tabs { padding: 0 var(--sp-4) var(--sp-3); }

/* flat.css's .tab has no explicit `display`, trusting <button>'s own
   inline-block default; these two tabs are decorative <span>s (the plan's
   tab decision), which default to inline. An inline box cannot host a
   block-level Lucide <svg> and its following text on one line — the icon
   drops to its own line above the label. Row the two exactly as .btn does. */
.pg-chatbots-widget__tabs .tab { display: inline-flex; align-items: center; gap: 6px; }

/* .tint .tab:not([aria-selected="true"]) (flat.css) keys off aria-selected,
   but this radiogroup-style pair carries aria-checked, so that rule matches
   BOTH tabs regardless of state and paints them paper — invisible on this
   shell, which is paper itself. Cloud is the correct resting ground here,
   and .tab[aria-checked="true"] needs restating at equal specificity, later
   in the cascade, to win back the selected tab's ink pill from that same
   flat.css rule. */
.pg-chatbots-widget__tabs .tab:not([aria-checked="true"]) { background: var(--bg-tint); }
.pg-chatbots-widget__tabs .tab[aria-checked="true"] { background: var(--ink); color: var(--on-solid); font-weight: var(--fw-semibold); }

/* The top edge fade is a mask, not a shadow (Zero-Shadow Rule). The mask
   colour is a transparency ramp, not a design colour, so no token exists for
   it — "black" here only shapes the mask's alpha channel, it paints nothing. */
.pg-chatbots-widget__scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--sp-4) var(--sp-3);
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 24px);
  mask-image: linear-gradient(to bottom, transparent 0, black 24px);
}

/* .viz-chat is not used here: it centres its content and fills its height,
   which is the opposite of a transcript that starts at the top and scrolls. */
.pg-chatbots-widget__msgs { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); }

/* flat.css's 88% bubble width is tuned to the wider stand-alone .viz-chat
   frame; inside this narrower shell a user bubble needs to clearly not
   reach the far edge. viz-bubble--user already carries align-self: flex-end
   globally — restated here so the widget's own rule set is self-explaining. */
.pg-chatbots-widget .viz-bubble { max-width: 84%; }
.pg-chatbots-widget .viz-bubble--user { align-self: flex-end; }

/* The date separator is the one centred thing in the widget, which is what
   makes it read as a separator rather than a message. */
.pg-chatbots-widget__marker { align-self: center; }

/* The status row is a left-aligned icon plus text where a bot bubble would
   sit; the icon does not spin — the brief's shimmer, rendered flat. */
.pg-chatbots-widget__status { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* shadcn's Message footer zone: timestamp plus the copy action. This is
   the default for controls that sit directly on the paper shell (the
   composer's paperclip below); the footer and copy button inside a bot
   bubble sit on a cloud tint instead (viz-bubble--answer's own background)
   and are lifted to Ink 2 further down, per the Ink-3-On-White Rule. */
.pg-chatbots-widget__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  font-size: var(--fs-micro);
  color: var(--fg-3);
}

/* flat.css has no bare icon button; this is the smallest thing that reads
   as a button without becoming a pill. */
.pg-chatbots-widget__copy, .pg-chatbots-widget__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  border-radius: var(--r-control);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
/* bg-tint (cloud) is invisible as a hover fill on the copy button: it sits
   on a bot bubble that is already cloud (.viz-bubble--answer's own default
   background). bg-sunken is the system's actual "one tone step darker"
   hover/pressed shade (DESIGN.md: "Cloud Deep is the pressed / hover /
   sunken step") and reads on both grounds this control appears on — the
   cloud bubble and the paper composer row. */
.pg-chatbots-widget__copy:hover, .pg-chatbots-widget__icon:hover { background: var(--bg-sunken); color: var(--fg-2); }

/* The footer and copy button above default to fg-3, which is only legal
   on white (the Ink-3-On-White Rule). Inside a bot bubble they sit on
   cloud (viz-bubble--answer's own background), so they take Ink 2 here;
   the composer's paperclip sits on the paper shell and keeps fg-3 above. */
.pg-chatbots-widget .viz-bubble--answer .pg-chatbots-widget__foot,
.pg-chatbots-widget .viz-bubble--answer .pg-chatbots-widget__copy {
  color: var(--fg-2);
}

/* The input stays the page's one rectangular anchor at 8px. */
.pg-chatbots-widget__composer { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-4); }
.pg-chatbots-widget__composer .input { flex: 1; min-width: 0; }

/* An icon-only pill does not need the 20px text padding .btn--sm gives it. */
.pg-chatbots-widget__send { padding-inline: 12px; }

/* The hero bubbles resolve to flat.css's own .viz-bubble--answer default
   (background: var(--bg-tint), i.e. cloud — see the line-35 edit above), not
   paper. A default .chip is cloud too, so a citation chip or the "No
   matching data" chip sitting inside a bot bubble here would be the exact
   same colour as the bubble it sits on and vanish, the same failure the
   comparison stage's citation-chip rule above already exists to prevent.
   Paper is the correct contrast against a cloud bubble (it is what the
   Example chip already gets for free, sitting on this shell's paper head). */
.pg-chatbots-widget .viz-bubble--answer .chip { --_bg: var(--paper); }

@media (max-width: 900px) {
  .pg-chatbots-widget__shell { height: 460px; }
}

@media (max-width: 480px) {
  /* At 390 the hero stacks: the pills and meta line sit above the widget
     in source order, so the widget's height cannot push them below the
     fold. A shrunk 420px shell was tried and left only one message
     visible, against the brief's "longer so you can see multiple
     messages"; 520px still left the cited answer's <mark> scrolled
     entirely above the scroll box (narrower bubbles wrap to more lines,
     so the 390 transcript runs taller than the 1280 one). 730px is the
     smallest height at which the bottom-anchored load still clears the
     cited bubble's top past the mask fade, so the mark, the follow-up
     question and the final answer all land inside the scroll box. */
  .pg-chatbots-widget__shell { height: 730px; }
  .pg-chatbots-widget__head, .pg-chatbots-widget__scroll, .pg-chatbots-widget__composer { padding-inline: var(--sp-3); }
  .pg-chatbots-widget .viz-bubble { max-width: 92%; }
}

/* == 2026-09-29: features as rows, and a comparison that reads at a glance == */

/* Three features were three equal columns directly above a three-column use-case grid.
   Each is now a row: copy on one side, its demonstration on a panel on the other.
   .stack's 12px gap is for blocks inside a panel; rows of copy and figure need section air. */
.pg-chatbots-features { display: flex; flex-direction: column; gap: var(--sp-8); }
/* Outside a .showcase the tile's 70% white ground vanishes on the page; give it cloud. */
.pg-chatbots-features .tile { background: var(--bg-tint); }
/* The middle row puts its figure on the left. The copy stays first in the source so a phone
   and a screen reader meet the heading before the demonstration. */
@media (min-width: 801px) { .pg-chatbots-flip > :first-child { order: 2; } }
/* The answer bubble is cloud, which disappears on a cloud panel; here it takes paper.
   The chat is content-height in this panel, not the 100% of a fixed pillar card. */
.pg-chatbots-lang .viz-bubble--answer { background: var(--paper); }
.pg-chatbots-lang .viz-chat { height: auto; padding: 0; }
/* The ink slab is the figure itself, so it takes the panel's radius and padding. */
.pg-chatbots-features .pg-chatbots-code-slab { border-radius: var(--r-panel); --pad: var(--sp-6); }

/* Comparison table (a .table--stack). Both answer columns looked alike, so each cell leads
   with a mark, a cross or a tick, and the Certant column takes ink text. */
.pg-chatbots-vs td { position: relative; padding-left: 40px; }
.pg-chatbots-vs td .icon { position: absolute; left: 12px; top: 16px; width: 16px; height: 16px; color: var(--fg-2); }
.pg-chatbots-vs__us { color: var(--fg-1); font-weight: var(--fw-medium); }
.pg-chatbots-vs td.pg-chatbots-vs__us .icon { color: var(--green); }
@media (max-width: 700px) {
  .pg-chatbots-vs td { padding-left: 28px; }
  .pg-chatbots-vs td .icon { left: 0; top: 8px; }
}
