/* feed.css — Live Ops terminal well (§5) and the fleet roster cards (§6).
   Owns: #feed / .feed-* / .live-dot / #roster / .bot-*. Nothing else. */

#feed,
#roster {
  /* Local dim tone. --fg-faint is correct for hairlines but lands at ~3.3:1 as text on
     --bg-sunken, so timestamps and stat strips use this instead and clear 4.5:1. */
  --feed-dim: #808790;
}

/* ------------------------------------------------------------------ the well */

.feed-well {
  margin: 22px 0 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  overflow: hidden;
}

.feed-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--feed-dim);
}

.feed-title {
  color: var(--fg);
  font-weight: 700;
}

.feed-approvals {
  margin-left: auto;
  color: var(--feed-dim);
  white-space: nowrap;
  transition: color 180ms ease;
}

.feed-approvals[data-pending] {
  color: var(--warn);
}

.feed-status {
  color: var(--feed-dim);
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.live-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(111, 211, 160, 0.45);
  animation: feed-pulse 2.4s ease-out infinite;
}

@keyframes feed-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(111, 211, 160, 0.45);
    opacity: 1;
  }
  70% {
    box-shadow: 0 0 0 6px rgba(111, 211, 160, 0);
    opacity: 0.75;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(111, 211, 160, 0);
    opacity: 1;
  }
}

/* ------------------------------------------------------------------ the rows */

.feed-list {
  max-height: 352px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.feed-list::-webkit-scrollbar {
  width: 8px;
}

.feed-list::-webkit-scrollbar-track {
  background: transparent;
}

.feed-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.feed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 4px 14px;
  font-size: 13px;
  line-height: 1.5;
  transition: opacity 180ms ease, transform 180ms ease;
}

.feed-row:nth-child(even) {
  background: rgba(232, 230, 227, 0.014);
}

.feed-row.is-entering {
  opacity: 0;
  transform: translateY(-8px);
}

.feed-row > time {
  flex: none;
  color: var(--feed-dim);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.feed-row .who {
  flex: none;
  min-width: 48px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.feed-row .what {
  flex: 1 1 220px;
  min-width: 0;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}

.feed-row .tag {
  flex: none;
  padding: 1px 6px;
  border: 1px solid rgba(216, 166, 87, 0.34);
  border-radius: 3px;
  background: rgba(216, 166, 87, 0.08);
  color: var(--warn);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ roster */

/* Scoped through #roster / #feed so these win over the essay's generic `#essay h3`
   and `#essay p` rules, which otherwise size the cards like body copy. */

#roster.roster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 8px;
}

#roster .bot-card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 14px 13px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

/* 3 + 2, second row centred under the first */
#roster .bot-card:nth-child(4) {
  grid-column: 2 / span 2;
}

#roster .bot-card:nth-child(5) {
  grid-column: 4 / span 2;
}

/* blob.png has no alpha channel, its backdrop is the page tone and would otherwise show
   as a darker square on the raised card. `lighten` against the card background erases
   that square exactly, and leaves the white blob and its slit eyes intact. */
#roster .bot-avatar {
  width: 44px;
  height: 44px;
  display: block;
  margin: 0 0 2px;
  mix-blend-mode: lighten;
}

/* Per-bot tint. A trace of sepia gives hue-rotate something to act on, otherwise a white
   blob rotates to the same white. Kept low on purpose: the blob stays essentially white. */
#roster .bot-card[data-bot="ATLAS"] .bot-avatar {
  filter: sepia(0.15) hue-rotate(75deg) saturate(1.35);
}
#roster .bot-card[data-bot="ORIN"] .bot-avatar {
  filter: sepia(0.15) hue-rotate(155deg) saturate(1.35);
}
#roster .bot-card[data-bot="VEGA"] .bot-avatar {
  filter: sepia(0.15) hue-rotate(230deg) saturate(1.35);
}
#roster .bot-card[data-bot="JUNO"] .bot-avatar {
  filter: sepia(0.15) hue-rotate(340deg) saturate(1.35);
}
#roster .bot-card[data-bot="MIRA"] .bot-avatar {
  filter: sepia(0.15) hue-rotate(300deg) saturate(1.35);
}

#roster .bot-name {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  color: var(--fg);
}

#roster .bot-role {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

#roster .bot-desc {
  margin: 3px 0 0;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.45;
  color: var(--fg-dim);
}

#roster .bot-stats {
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--feed-dim);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

#roster .bot-status {
  align-self: flex-start;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--feed-dim);
  white-space: nowrap;
}

#roster .bot-status[data-status="on-shift"] {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(111, 211, 160, 0.07);
}

#roster .bot-status[data-status="deep-work"] {
  color: var(--fg-dim);
}

#roster .bot-status[data-status="approval"] {
  color: var(--warn);
  border-color: rgba(216, 166, 87, 0.34);
  background: rgba(216, 166, 87, 0.07);
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  #roster.roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #roster .bot-card,
  #roster .bot-card:nth-child(4),
  #roster .bot-card:nth-child(5) {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  #roster.roster {
    grid-template-columns: minmax(0, 1fr);
  }
  .feed-head {
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 6px;
  }
  .feed-approvals {
    margin-left: auto;
  }
  .feed-status {
    padding-left: 0;
    border-left: 0;
    flex-basis: 100%;
  }
  .feed-row {
    padding: 5px 12px;
    font-size: 12px;
    gap: 3px 8px;
  }
  .feed-row .what {
    flex-basis: 100%;
  }
  .feed-list {
    max-height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
  .feed-row {
    transition: opacity 180ms ease;
  }
  .feed-row.is-entering {
    transform: none;
  }
}
