/*
 * crew-feed.css — design tokens + styling for the data-driven crew findings-feed (U4).
 *
 * Extracted from web/demo.html (the house style: the :root tokens and the
 * .agent / .msg / .ping pattern). This is the reusable beat-2 component's stylesheet;
 * the reel (U5) and try-it (U7) load it alongside crew-feed.js.
 *
 * Mobile-first: a single streaming feed, not a 7-panel grid.
 */

/* ---- TripCrew design tokens (the canonical home) -----------------------
 * Warm sand + ink, one clay accent, pine secondary. Defined here because
 * crew-feed.css loads first and every other component stylesheet reuses
 * these. See companies/tripcrew/DESIGN.md for the full spec.
 *
 * Legacy aliases (--paper/--card/--accent/--accent2) are kept mapped to the
 * new palette so existing rules and inline styles resolve to warm values
 * without a full rename pass.
 */
:root {
  /* Fonts */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Surfaces + ink */
  --bg: #f7f1e7;
  --surface: #fffbf4;
  --surface-sunken: #f1e9db;
  --ink: #2b2722;
  --ink-2: #5c554b;
  --muted: #8a8175;
  --line: #e6ddcd;

  /* Accents */
  --clay: #c5613a;
  --clay-deep: #a44e2d;
  --clay-tint: #f6e3d8;
  --pine: #1f6f54;
  --pine-tint: #e3efe9;
  --gold: #b07d18;
  --danger: #b23b2b;

  /* Soft warm shadows (ink-brown alpha, never black) */
  --shadow-card: 0 1px 2px rgba(43, 39, 34, 0.04), 0 8px 24px rgba(43, 39, 34, 0.06);
  --shadow-lift: 0 12px 32px rgba(43, 39, 34, 0.1);

  /* Legacy aliases → new palette (so old rules stay warm) */
  --paper: var(--bg);
  --card: var(--surface);
  --accent: var(--clay);
  --accent-d: var(--clay-deep);
  --accent2: var(--gold);
  --soft: var(--pine-tint);
}

/* ---- Crew chip row (AI agents, read job-first, lit when active) ---------- */

/* A muted section eyebrow so first-time viewers read the chips as AI agents. */
.crew-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0 8px;
}

.crew {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
/* Each chip is an icon-led vertical stack: bot glyph + JOB (primary, uppercase) over the persona
 * NAME (small, muted subtitle). The job is the thing you read first; the name is the subtitle. */
.agent {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 11px;
  opacity: 0.5;
  transition: 0.35s;
}
.agent-bot {
  font-size: 15px;
  line-height: 1;
  filter: grayscale(0.5);
  transition: 0.35s;
}
.agent-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.agent-job {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink);
}
.agent-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.agent .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c7c3b8;
  transition: 0.35s;
}
/* Live: this agent is acting right now — brighten the chip + warm the job + clay dot/glyph. */
.agent.live {
  opacity: 1;
  border-color: var(--clay);
  background: var(--clay-tint);
}
.agent.live .agent-job {
  color: var(--clay-deep);
}
.agent.live .agent-bot {
  filter: none;
}
.agent.live .dot {
  background: var(--clay);
  box-shadow: 0 0 0 4px rgba(197, 97, 58, 0.16);
}
/* Done: this agent already acted — full opacity, pine dot + tiny check, even after it stops
 * being live (issue #17). The scroll-driven highlight still tracks the active agent via .live. */
.agent.done {
  opacity: 1;
  border-color: #cfe0d6;
}
.agent.done .agent-bot {
  filter: none;
}
.agent.done .dot {
  background: var(--pine);
}
.agent.done .dot::after,
.agent.done::after {
  content: '✓';
  margin-left: 1px;
  font-size: 11px;
  font-weight: 800;
  color: var(--pine);
}
.agent.done .dot::after {
  content: none;
}
/* Active beats the done mark: a live agent reads clay (working now), not pine (finished). */
.agent.live.done {
  border-color: var(--clay);
}
.agent.live.done .dot {
  background: var(--clay);
}
.agent.live.done::after {
  color: var(--clay-deep);
}

/* ---- The streaming feed ------------------------------------------------- */

/* The fixed-height scroll window (issue #15). Streaming cards fill this window instead of
 * growing the page; it auto-follows the newest card to the bottom while the beat plays and
 * stays scrollable afterward so the viewer can scroll back through the whole run. Sized to sit
 * comfortably above the fold. A soft top/bottom mask hints there's more above/below. */
.feed-scroll {
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* room so the soft fade + a hint of the next card read without clipping the scrollbar */
  padding: 2px 4px 2px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.feed-scroll::-webkit-scrollbar {
  width: 7px;
}
.feed-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 230px;
}

/* finding (default) */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.4s;
  border-left: 3px solid var(--pine);
  background: var(--surface);
  border-radius: 0 12px 12px 0;
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
}
.msg.show {
  opacity: 1;
  transform: none;
}
/* warn — a risk the crew caught (e.g. the reseller-scam flag) */
.msg.warn {
  border-left-color: var(--clay);
  background: var(--clay-tint);
}
/* flag — a decision/change the crew is surfacing */
.msg.flag {
  border-left-color: var(--gold);
  background: #f7eed6;
}
/* handoff — work passing between personas; rendered as a connector card */
.msg.handoff {
  border-left-color: var(--muted);
  border-left-style: dashed;
  background: #f4f3ef;
}

/* Role-forward byline: "🤖 Flights · Skip" — glyph, then the JOB (the meaning), then the name. */
.who {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
}
.who-bot {
  font-size: 13px;
  line-height: 1;
  align-self: center;
}
.who-job {
  font-weight: 800;
  color: var(--ink);
}
.who-sep {
  color: var(--muted);
}
.who-name {
  font-weight: 500;
  color: var(--muted);
}
.msg p {
  margin: 3px 0 0;
  font-size: 14.5px;
  line-height: 1.4;
}

/* The from -> to connector that makes a handoff read as work passing along. Job-forward on both
 * sides, matching the chips: the JOB is big, the persona name small beneath. */
.handoff-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.handoff-link .arrow {
  color: var(--clay);
  font-weight: 700;
  font-size: 14px;
}
.handoff-link .from,
.handoff-link .to {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  background: var(--surface-sunken);
  border-radius: 10px;
  padding: 4px 10px;
}
.handoff-link .ho-job {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.handoff-link .ho-name {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}
.handoff-link .to {
  background: var(--clay-tint);
}
.handoff-link .to .ho-job {
  color: var(--clay-deep);
}

/* ---- Artifact: the agent's result + a book/view action (issue #7) ------- */
/* "the agent did a thing, here's the result + book/view it". Tasteful, mobile-first: a
 * compact result line with a small action chip that wraps below it on narrow screens. */
.artifact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.artifact-result {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.artifact-result::before {
  content: '✓';
  margin-right: 6px;
  font-weight: 800;
  color: var(--pine);
}
.artifact-action {
  margin-left: auto;
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  color: var(--clay-deep);
  background: var(--clay-tint);
  border-radius: 999px;
  padding: 4px 12px;
  transition: 0.15s;
}
.artifact-action:hover {
  background: #f0d3c2;
}

/* ---- Inline ping card, folded into the feed flow (issue #17) ------------ */
/* A phone ping rendered as a small card INSIDE the auto-scrolling feed (not in the separate
 * phone panel that falls below the fold on mobile). Reads as a notification — dark surface like
 * the phone's screen, a "Phone" tag — so it's clearly the device pinging, mid-stream. */
.feed-ping {
  border-radius: 12px;
  background: #231d16;
  border: 1px solid #3a2e22;
  padding: 11px 13px 12px;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(6px);
  transition: 0.4s;
}
.feed-ping.show {
  opacity: 1;
  transform: none;
}
.feed-ping-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #c8895f;
  margin-bottom: 5px;
}
.feed-ping-h {
  font-size: 13px;
  font-weight: 700;
  color: #e3946d;
  line-height: 1.3;
}
.feed-ping-b {
  font-size: 12.5px;
  color: #e4d8c5;
  margin-top: 3px;
  line-height: 1.4;
}

/* ---- Phone + pings (the buzz furniture) -------------------------------- */

.phone {
  justify-self: center;
  width: 248px;
  height: 430px;
  border-radius: 34px;
  background: #231d16;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(43, 39, 34, 0.22);
}
.screen {
  background: #1c1813;
  border-radius: 24px;
  height: 100%;
  padding: 16px 12px;
  color: #f2e9da;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.screen .time {
  font-size: 12px;
  color: #c8a87f;
  text-align: center;
}
.ping {
  background: #2a221a;
  border-radius: 14px;
  padding: 11px 12px;
  opacity: 0;
  transform: scale(0.96);
  transition: 0.4s;
}
.ping.show {
  opacity: 1;
  transform: none;
}
.ping .h {
  font-size: 13px;
  font-weight: 700;
  color: #e3946d;
}
.ping .b {
  font-size: 12.5px;
  color: #e4d8c5;
  margin-top: 3px;
  line-height: 1.35;
}
