/*
  Avatar 08 — Collaboration Stack — standalone HTML/CSS/JS.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.

  Designed for a dark editor toolbar: set --avatar08-surface to your
  toolbar colour so the rings cut cleanly between overlapping faces.
*/

:root {
  --collab-surface: oklch(0.19 0 0);
  --collab-raised: oklch(0.27 0 0);
  --collab-fg: oklch(0.97 0 0);
  --collab-muted: oklch(0.72 0 0);
  --collab-accent: #39ff14;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}

/* The editor the stack sits in: file bar, canvas and live cursors. */
.avatar08-file {
  width: 100%;
  max-width: 40rem;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--collab-surface);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 20px 48px -18px rgba(0, 0, 0, 0.4);
}

.avatar08-file p {
  margin: 0;
}

.avatar08-file__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
}

.avatar08-file__meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.625rem;
}

.avatar08-file__text {
  min-width: 0;
}

.avatar08-file__icon {
  display: flex;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--collab-raised);
  color: #ffffff;
}

.avatar08-file__icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.avatar08-file__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #ffffff;
}

.avatar08-file__sub {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--collab-muted);
}

.avatar08-file__right {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.avatar08-file__share {
  display: flex;
  height: 2rem;
  flex-shrink: 0;
  align-items: center;
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: oklch(0.205 0 0);
  text-decoration: none;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar08-file__share:hover {
  background: oklch(0.922 0 0);
}

.avatar08-file__share:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.avatar08-file__canvas {
  position: relative;
  height: 14rem;
  overflow: hidden;
  background-color: oklch(0.965 0 0);
  background-image: radial-gradient(oklch(0.86 0 0) 1px, transparent 1px);
  background-size: 16px 16px;
}

.avatar08-file__page {
  position: absolute;
  top: 1.25rem;
  right: 8%;
  bottom: 0;
  left: 8%;
  border-radius: 0.5rem 0.5rem 0 0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.avatar08-file__page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0;
}

.avatar08-file__logo {
  height: 0.5rem;
  width: 4rem;
  border-radius: 9999px;
  background: oklch(0.205 0 0);
}

.avatar08-file__nav {
  display: flex;
  gap: 0.5rem;
}

.avatar08-file__nav span {
  height: 0.375rem;
  width: 2rem;
  border-radius: 9999px;
  background: oklch(0.922 0 0);
}

.avatar08-file__hero,
.avatar08-file__cols {
  margin: 0 1.25rem;
  border-radius: 0.375rem;
  padding: 0.5rem;
  transition: box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar08-file__hero {
  margin-top: 1rem;
}

.avatar08-file__hero span {
  display: block;
}

.avatar08-file__hero-title {
  height: 0.75rem;
  width: 60%;
  border-radius: 9999px;
  background: oklch(0.269 0 0);
}

.avatar08-file__hero-sub {
  height: 0.375rem;
  width: 40%;
  margin-top: 0.5rem;
  border-radius: 9999px;
  background: oklch(0.922 0 0);
}

.avatar08-file__cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.avatar08-file__cols span {
  display: block;
  height: 6rem;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.375rem;
}

.avatar08-file__cols span:nth-child(2) {
  border-color: oklch(0.205 0 0);
}

.avatar08-file__hero[data-followed],
.avatar08-file__cols[data-followed] {
  box-shadow: 0 0 0 1.5px var(--collab-accent);
}

.avatar08-file__cursor {
  position: absolute;
  display: flex;
  align-items: flex-start;
  transition:
    left 700ms cubic-bezier(0, 0, 0.2, 1),
    top 700ms cubic-bezier(0, 0, 0.2, 1);
}

.avatar08-file__cursor svg {
  display: block;
  width: 1rem;
  height: 1rem;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.avatar08-file__cursor-label {
  margin-top: 0.75rem;
  margin-left: -0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.375rem;
  font-size: 10px;
  line-height: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  color: #ffffff;
}

.avatar08-file__cursor[data-followed] .avatar08-file__cursor-label {
  box-shadow: 0 0 0 2px var(--collab-accent);
}

@media (min-width: 40rem) {
  body {
    padding: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar08-file__cursor {
    transition: none;
  }
}

.avatar08 {
  --avatar08-surface: var(--collab-surface);
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.avatar08 p,
.avatar08 ul {
  margin: 0;
  padding: 0;
}

.avatar08 ul {
  list-style: none;
}

.avatar08 svg {
  display: block;
}

.avatar08__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar08__group,
.avatar08__stack {
  display: flex;
  align-items: center;
}

/* Arrivals slide in from the right; departures fold away. */
.avatar08__item {
  position: relative;
  display: flex;
  animation: avatar08-join 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.avatar08__item + .avatar08__item {
  margin-left: -6px;
}

.avatar08__item[data-leaving] {
  pointer-events: none;
  animation: avatar08-leave 260ms ease-in both;
}

/* Each face is ringed in its collaborator's cursor colour, with a cut in
   the toolbar colour so overlapping faces stay separate. */
.avatar08__face {
  position: relative;
  display: flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 9999px;
  background-color: var(--collab-raised);
  padding: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--collab-fg);
  user-select: none;
  cursor: pointer;
  outline: none;
  box-shadow:
    0 0 0 2px var(--avatar08-surface),
    0 0 0 3.5px var(--avatar08-color);
  transition:
    box-shadow 200ms ease-out,
    transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.avatar08__face[aria-pressed="true"] {
  box-shadow:
    0 0 0 2px var(--avatar08-surface),
    0 0 0 4px var(--collab-accent);
}

.avatar08__face:hover {
  transform: translateY(-2px);
}

.avatar08__face:focus-visible {
  outline: 2px solid var(--collab-fg);
  outline-offset: 4px;
}

.avatar08__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 240ms ease-out;
}

.avatar08__image[data-loaded] {
  opacity: 1;
}

.avatar08__image[data-failed] {
  display: none;
}

.avatar08__more {
  display: flex;
  height: 2rem;
  min-width: 2rem;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  border-radius: 9999px;
  background-color: var(--collab-raised);
  padding: 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--collab-fg);
}

.avatar08__more[hidden] {
  display: none;
}

.avatar08__following {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  background-color: var(--collab-raised);
  padding: 0.25rem 0.25rem 0.25rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--collab-muted);
  animation: avatar08-fade 200ms ease-out both;
}

.avatar08__following[hidden] {
  display: none;
}

.avatar08__following-dot {
  width: 0.375rem;
  height: 0.375rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background-color: var(--collab-accent);
}

.avatar08__following-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar08__following-name {
  font-weight: 500;
  color: var(--collab-fg);
}

.avatar08__activity {
  display: none;
}

.avatar08__stop {
  display: flex;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: none;
  padding: 0;
  color: var(--collab-muted);
  cursor: pointer;
  outline: none;
  transition:
    color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar08__stop:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--collab-fg);
}

.avatar08__stop:focus-visible {
  outline: 2px solid var(--collab-accent);
}

.avatar08__stop svg {
  width: 0.75rem;
  height: 0.75rem;
}

@keyframes avatar08-join {
  from {
    opacity: 0;
    transform: translateX(10px) scale(0.6);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes avatar08-leave {
  to {
    opacity: 0;
    margin-right: -32px;
    transform: scale(0.6);
  }
}

@keyframes avatar08-fade {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
}

@media (min-width: 40rem) {
  .avatar08__activity {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar08__item,
  .avatar08__item[data-leaving],
  .avatar08__following {
    animation-duration: 1ms;
  }
  .avatar08__face,
  .avatar08__image {
    transition: none;
  }
  .avatar08__face:hover {
    transform: none;
  }
}
