/* Your AI chip and live status band (P04). Values come from the mockup via
   intake/TOKENS.md; every colour is a token from tokens-portal.css, so the
   toggle and the device setting both work. Markup: _shared/puzl_live.html. */

/* One state shows at a time: data-state on the root names it, data-show on a
   child lists the states it belongs to. */
[data-ai-chip] [data-show],
[data-live-band] [data-show] { display: none; }
[data-ai-chip][data-state="off"] [data-show~="off"],
[data-ai-chip][data-state="checking"] [data-show~="checking"],
[data-ai-chip][data-state="live"] [data-show~="live"],
[data-ai-chip][data-state="reconnect"] [data-show~="reconnect"],
[data-live-band][data-state="off"] [data-show~="off"],
[data-live-band][data-state="checking"] [data-show~="checking"],
[data-live-band][data-state="live"] [data-show~="live"],
[data-live-band][data-state="reconnect"] [data-show~="reconnect"] { display: revert; }
[data-ai-chip] [hidden],
[data-live-band] [hidden] { display: none !important; }

/* Chip */
.ai-chip { display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 8px;
  border-radius: var(--r-pill); text-decoration: none; font-weight: 700; font-size: 15px;
  border: 1.5px solid transparent; color: var(--sage-ink); background: var(--sage); white-space: nowrap; }
.ai-chip .lbl { color: var(--ink-soft); font-weight: 600; }
.ai-chip[data-state="off"],
.ai-chip[data-state="reconnect"] { background: var(--marigold-tint); color: var(--ink); border-color: var(--marigold); }
.ai-chip[data-state="checking"] { background: var(--inset); color: var(--ink); border-color: var(--line); }
.live-word { font-size: 12px; font-weight: 800; letter-spacing: .02em; background: var(--success);
  color: var(--on-success); border-radius: var(--r-pill); padding: 2px 8px; }
.reconnect-word { font-size: 12px; font-weight: 800; letter-spacing: .02em; background: var(--ink);
  color: var(--paper); border-radius: var(--r-pill); padding: 2px 8px; }

/* Dot. The ring is a pseudo-element, so reduced motion (tokens-portal.css)
   stops it and the dot stays. Only a live dot rings. */
.ai-chip .dot, .liveband .dot { position: relative; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-muted); flex: none; }
.liveband .dot.big { width: 16px; height: 16px; }
[data-state="live"] > .dot { background: var(--success); }
[data-state="live"] > .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--success); opacity: 0; animation: ping var(--dur-ping) ease-out infinite; }
[data-state="live"] > .dot.big::after { inset: -7px; border-width: 3px; }

/* Band */
.liveband { background: var(--sage); color: var(--sage-ink); border-radius: var(--r-lg); padding: 28px 30px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; }
/* .lb-title: components.css sets every h2 upper-case with .1em tracking, and
   portal-shell.css's `.pg h2:not(.fr-h2)` (specificity 0,2,1) forces 20px/800.
   Two classes here win over both. */
.liveband h2.lb-title { font-family: var(--font); font-size: 30px; font-weight: 900; line-height: 1.15;
  letter-spacing: -.02em; text-transform: none; color: var(--sage-ink); margin: 0; }
.liveband p { margin: 6px 0 0; color: var(--sage-ink); opacity: .9; }
/* Scoped to the live state: an unscoped rule ties the [data-show] hide rule
   above on specificity and wins by order, so an off band read "Connected by you". */
.liveband[data-state="live"] .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.liveband .meta > span { background: var(--sage-chip); border-radius: var(--r-pill); padding: 4px 11px;
  font-size: 14px; font-weight: 600; white-space: nowrap; }
.liveband.slim { padding: 18px 22px; }
.liveband.slim h2.lb-title { font-size: 21px; }
.liveband[data-state="off"],
.liveband[data-state="reconnect"] { background: var(--marigold-tint); color: var(--ink); }
.liveband[data-state="checking"] { background: var(--inset); color: var(--ink); }
.liveband[data-state="off"] h2.lb-title, .liveband[data-state="off"] p,
.liveband[data-state="reconnect"] h2.lb-title, .liveband[data-state="reconnect"] p,
.liveband[data-state="checking"] h2.lb-title, .liveband[data-state="checking"] p { color: var(--ink); }
.liveband .acts { display: flex; gap: 10px; flex-wrap: wrap; }

.lb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700;
  font-size: 16px; line-height: 1; text-decoration: none; border: 0; cursor: pointer;
  border-radius: var(--r-pill); padding: 14px 24px; white-space: nowrap; }
.lb-btn-primary { background: var(--cobalt-fill); color: var(--btn-primary-fg); }
.lb-btn-primary:hover { background: var(--btn-primary-hover-bg); }
.lb-btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.lb-btn-ghost:hover { background: var(--ink); color: var(--paper); }
.lb-btn-sm { font-size: 15px; padding: 10px 18px; }

@media (max-width: 900px) {
  .ai-chip .lbl { display: none; }
  .liveband { grid-template-columns: auto 1fr; }
  .liveband > .acts { grid-column: 1 / -1; }
}

/* Reduced motion: the dot stays, the ring stops. Same selector as the rule
   that starts it, because tokens-portal.css's broader .dot::after rule loses
   to it on specificity. */
@media (prefers-reduced-motion: reduce) {
  [data-state="live"] > .dot::after { animation: none; }
}
