/* The swipe deck and the editor sheet.
 *
 * Only `transform` and `opacity` are animated anywhere in this file. The card
 * follows the thumb at 60fps because the drag writes a transform string and
 * nothing else — no width, no top/left, no re-layout. */

/* ---- Deck --------------------------------------------------------------- */

#feed-deck-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  padding: 4px 16px 8px;
}

#feed-deck {
  position: absolute;
  inset: 4px 16px 8px;
}

/* The undo pill needs its own strip. Overlapping it onto the card hid the
   footer (char count, agent-note button) exactly when Artur might want to
   check what he just threw away. */
#feed-deck-wrap.has-undo #feed-deck { bottom: 70px; }

.card {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* The whole point of the deck: the browser must not treat a horizontal drag
   * as a scroll gesture, or the card stutters and Safari's back-swipe fires. */
  touch-action: pan-y;
  will-change: transform;
  transform-origin: 50% 120%;
  user-select: none;
  -webkit-user-select: none;
}

/* Cards below the top one. Rendered, not faked: they hold real content, so
 * the next draft is already laid out when the top card leaves. */
.card[data-depth="1"] { transform: translateY(10px) scale(0.955); }
.card[data-depth="2"] { transform: translateY(20px) scale(0.91); }
.card[data-depth="1"], .card[data-depth="2"] { filter: brightness(0.8); }
.card[data-depth="1"] .card-body, .card[data-depth="2"] .card-body { opacity: 0.5; }
.card[data-depth]:not([data-depth="0"]) { pointer-events: none; }

.card.settling { transition: transform 0.34s var(--ease-out); }
.card.leaving { transition: transform 0.32s ease-out, opacity 0.32s ease-out; }

.card-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.card-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: color-mix(in srgb, var(--acct-color, var(--accent)) 26%, var(--surface-3));
  border: 1px solid color-mix(in srgb, var(--acct-color, var(--accent)) 55%, transparent);
  flex: none;
}

.card-head-text { min-width: 0; flex: 1; }
.card-account {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px;
  font-size: 1.02rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px calc(12px);
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--text-dim);
}
.card-foot .spacer { flex: 1; }

.card-note-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 18%, var(--surface-3));
  color: var(--warn);
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-comment-flag {
  color: var(--accent);
  font-weight: 700;
}

/* Over the platform limit: this post cannot go out as it stands. */
.card-over { color: var(--reject); font-weight: 700; }
/* Brand-voice violations (em-dash, hashtag/emoji count). Not fatal, so it is a
   glyph rather than a sentence — the editor spells them out. */
.card-warn { color: var(--warn); font-size: 0.95rem; }

/* Like / reject tint. Two overlays instead of one so the colour never has to
 * be recomputed mid-drag — only their opacity changes. */
.card-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: flex-start;
  /* Clears the 60px card header so the stamp never lands on the account name. */
  padding: 76px 24px 24px;
  border-radius: inherit;
}
.card-overlay.like {
  background: linear-gradient(200deg, color-mix(in srgb, var(--like) 42%, transparent), transparent 62%);
  justify-content: flex-start;
}
.card-overlay.reject {
  background: linear-gradient(160deg, color-mix(in srgb, var(--reject) 42%, transparent), transparent 62%);
  justify-content: flex-end;
}
.card-overlay.edit {
  background: linear-gradient(0deg, color-mix(in srgb, var(--edit) 40%, transparent), transparent 62%);
  align-items: flex-end;
  justify-content: center;
}

.stamp {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 12px;
  border: 3px solid currentColor;
}
.card-overlay.like .stamp { color: var(--like); transform: rotate(-14deg); }
.card-overlay.reject .stamp { color: var(--reject); transform: rotate(14deg); }
.card-overlay.edit .stamp { color: var(--edit); font-size: 1.1rem; border-width: 2px; }

/* ---- Action bar --------------------------------------------------------- */

.feed-actions {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px 12px;
}

.fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.4);
  transition: transform 0.12s var(--ease-out), background 0.15s ease;
}
.fab:active { transform: scale(0.9); }
.fab[disabled] { opacity: 0.35; pointer-events: none; }
.fab-small { width: 48px; height: 48px; font-size: 1.1rem; }
.fab-reject { color: var(--reject); border-color: color-mix(in srgb, var(--reject) 45%, transparent); }
.fab-like { color: var(--like); border-color: color-mix(in srgb, var(--like) 45%, transparent); }
.fab-reject:active { background: var(--reject-dim); }
.fab-like:active { background: var(--like-dim); }

/* ---- Undo --------------------------------------------------------------- */

.undo-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(96px + var(--safe-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  font-size: 0.88rem;
  animation: toast-in 0.2s var(--ease-out);
}
.undo-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo-bar button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---- Empty state agent runners ------------------------------------------ */

.empty-agents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  max-width: 340px;
}

/* ---- Editor sheet ------------------------------------------------------- */

.editor-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.agent-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface-2));
  border-left: 3px solid var(--warn);
}
.agent-note-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warn);
  margin-bottom: 4px;
}
.agent-note p { font-size: 0.9rem; color: var(--text-mid); white-space: pre-wrap; }

.revision-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.revision-list::-webkit-scrollbar { display: none; }
.revision-chip {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-mid);
  font-size: 0.82rem;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}
.revision-chip[aria-current="true"] { border-color: var(--accent); color: var(--text); }
.revision-chip small { color: var(--text-dim); font-size: 0.68rem; }

#editor-text {
  min-height: 180px;
  font-size: 16px;
  line-height: 1.55;
  background: var(--surface-2);
}

.editor-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.editor-meter .count {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--text-dim);
  min-width: 92px;
}
.editor-meter .count.over { color: var(--reject); font-weight: 700; }
.editor-meter .count.near { color: var(--warn); }
.meter-track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transform-origin: left;
  transition: width 0.18s ease, background 0.18s ease;
}
.meter-fill.near { background: var(--warn); }
.meter-fill.over { background: var(--reject); }

.warnings { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warnings li {
  font-size: 0.84rem;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-radius: 10px;
  padding: 8px 12px;
}
.warnings li.hard { color: var(--reject); background: color-mix(in srgb, var(--reject) 12%, transparent); }

/* ---- Comments ----------------------------------------------------------- */

.comment-list { display: flex; flex-direction: column; gap: 8px; }

.comment {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.comment.addressed { border-left: 3px solid var(--like); }
.comment.pending { border-left: 3px solid var(--warn); }
.comment p { font-size: 0.92rem; white-space: pre-wrap; }
.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.comment-status { font-weight: 700; }
.comment.addressed .comment-status { color: var(--like); }
.comment.pending .comment-status { color: var(--warn); }

.comment-compose { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.comment-compose textarea { background: var(--surface-2); }
