/* UI polish — avatars, subtle motion, quieter hierarchy */

.avatar {
  position: relative;
  overflow: hidden;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ja-startup-jade), var(--ja-boundless-blue));
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid var(--surface);
  letter-spacing: -.02em;
}

.avatar.sm { width: 28px; height: 28px; font-size: 10px; border-width: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; border-width: 3px; }
.avatar.sq { border-radius: 10px; width: 28px; height: 28px; font-size: 10px; }

.avatar.has-photo {
  background: var(--sunken);
  padding: 0;
}

.avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar {
  margin-left: -8px;
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Soft stagger for lists — calm, not busy */
.stack > .list-card,
.stack > .card,
.msg-list .item,
.pipe-col .card,
.grid-2 > .card,
.grid-3 > .card,
.grid-3 > .media-card {
  animation: soft-in .45s cubic-bezier(.2,.8,.2,1) both;
}
.stack > .list-card:nth-child(1),
.stack > .card:nth-child(1),
.msg-list .item:nth-child(1) { animation-delay: .02s; }
.stack > .list-card:nth-child(2),
.stack > .card:nth-child(2),
.msg-list .item:nth-child(2) { animation-delay: .06s; }
.stack > .list-card:nth-child(3),
.stack > .card:nth-child(3),
.msg-list .item:nth-child(3) { animation-delay: .1s; }
.stack > .list-card:nth-child(4),
.stack > .card:nth-child(4),
.msg-list .item:nth-child(4) { animation-delay: .14s; }
.stack > .list-card:nth-child(5),
.stack > .card:nth-child(5),
.msg-list .item:nth-child(5) { animation-delay: .18s; }
.stack > .list-card:nth-child(n+6),
.msg-list .item:nth-child(n+6) { animation-delay: .2s; }

@keyframes soft-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

[data-theme="spark"] .msg-list .item {
  transition: transform .18s ease, background .18s ease;
}
[data-theme="spark"] .msg-list .item:hover {
  transform: translateX(4px);
}

/* Quieter chrome */
.viewport { padding-top: 18px; }

.card {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.list-card .meta h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pathway timeline */
.timeline {
  position: relative;
  padding-left: 22px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--line));
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  padding: 0 0 18px 8px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.timeline-item:hover::before {
  background: var(--accent);
}

/* Impact map dots */
.map-stage {
  position: relative;
  min-height: 300px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--ja-optimistic-ice) 50%, transparent), transparent 55%),
    var(--sunken);
}
.map-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  animation: map-pulse 2.8s ease-out infinite;
  cursor: pointer;
}
.map-dot:nth-child(2) { animation-delay: .4s; background: var(--ja-leadership-lime); }
.map-dot:nth-child(3) { animation-delay: .8s; background: var(--ja-empowered-yellow); }
.map-dot:nth-child(4) { animation-delay: 1.2s; background: var(--ja-startup-jade); }
.map-dot:nth-child(5) { animation-delay: .2s; }
@keyframes map-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70% { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Ticket polish */
.ticket-card {
  position: relative;
  overflow: hidden;
}
.ticket-card::after {
  content: "";
  position: absolute;
  left: -12px;
  right: -12px;
  top: 58%;
  border-top: 2px dashed var(--line);
}
.ticket-stub {
  padding-top: 28px;
}

/* Endorsement stars */
.endorsement-bar {
  display: flex;
  gap: 3px;
  color: var(--ja-empowered-yellow);
  font-size: 14px;
}

/* Match explain rings */
.explain-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.explain-row:last-child { border-bottom: 0; }

/* Empty / skeleton shimmer (subtle) */
.shimmer {
  background: linear-gradient(90deg, var(--sunken), var(--surface), var(--sunken));
  background-size: 200% 100%;
  animation: shimmer 1.6s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* Focus-visible polish */
.list-card:focus-visible,
.media-card:focus-visible,
.bento-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header avatar */
.app-header .avatar {
  width: 36px;
  height: 36px;
  transition: transform .15s ease;
}
.app-header .avatar:hover { transform: scale(1.05); }

/* Story cards with photo */
.story-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.story-card .cover {
  aspect-ratio: 16/10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--sunken);
}
.story-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.story-card:hover .cover img { transform: scale(1.04); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .stack > .list-card,
  .stack > .card,
  .msg-list .item,
  .map-dot,
  .shimmer,
  .story-card .cover img {
    animation: none !important;
    transition: none !important;
  }
}
