/*
  Avatar 03 — Avatar Group — 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.
*/

:root {
  --pile-fg: oklch(0.2 0 0);
  --pile-muted: oklch(0.5 0 0);
  --pile-line: oklch(0.92 0 0);
  --pile-soft: oklch(0.965 0 0);
}

.avatar03 {
  container-type: inline-size;
  width: 100%;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.avatar03 ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.avatar03 p {
  margin: 0;
}

.avatar03__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.avatar03__stack {
  display: flex;
  align-items: center;
}

/* Faces overlap by default and fan out while the pointer or keyboard focus
   is on the group, so each one can be read and reached. */
.avatar03__item {
  position: relative;
  z-index: var(--avatar03-z, auto);
  display: flex;
  border-radius: 9999px;
  box-shadow: 0 0 0 2px #ffffff;
  transition:
    margin 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.avatar03__item + .avatar03__item {
  margin-left: -10px;
}

.avatar03__stack:hover .avatar03__item + .avatar03__item,
.avatar03__stack:focus-within .avatar03__item + .avatar03__item {
  margin-left: -2px;
}

.avatar03__item:hover,
.avatar03__item:focus-within {
  z-index: 10;
  transform: translateY(-3px);
}

.avatar03__link {
  border-radius: 9999px;
  outline: none;
}

.avatar03__link:focus-visible {
  outline: 2px solid var(--pile-fg);
  outline-offset: 2px;
}

.avatar03__face {
  position: relative;
  display: flex;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 9999px;
  background-color: oklch(0.93 0.02 250);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: oklch(0.38 0.05 250);
  user-select: none;
}

.avatar03__face--list {
  width: 2rem;
  height: 2rem;
  font-size: 11px;
  line-height: 1.5;
}

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

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

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

.avatar03__count {
  display: flex;
  height: 2.25rem;
  min-width: 2.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid var(--pile-line);
  border-radius: 9999px;
  background-color: #ffffff;
  padding: 0 0.625rem;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--pile-fg);
  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),
    border-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar03__count:hover {
  background-color: var(--pile-soft);
}

.avatar03__count[aria-expanded="true"] {
  border-color: var(--pile-fg);
  background-color: var(--pile-fg);
  color: #ffffff;
}

.avatar03__count:focus-visible {
  outline: 2px solid var(--pile-fg);
  outline-offset: 2px;
}

.avatar03__count svg {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar03__count[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.avatar03__caption {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--pile-muted);
}

.avatar03__caption strong {
  font-weight: 500;
  color: var(--pile-fg);
}

/* The count button's number follows how many faces actually fit. */
@container (max-width: 27.999rem) {
  .avatar03__item[data-narrow-hidden] {
    display: none;
  }
  .avatar03__count-wide {
    display: none;
  }
}

@container (min-width: 28rem) {
  .avatar03__count-narrow {
    display: none;
  }
  .avatar03__count[data-narrow-only] {
    display: none;
  }
}

/* The full list opens in place, so nothing overlaps or gets clipped. */
.avatar03__panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 280ms;
}

.avatar03__panel[data-open] {
  grid-template-rows: 1fr;
  visibility: visible;
}

.avatar03__clip {
  min-height: 0;
  overflow: hidden;
}

.avatar03__list {
  display: grid;
  gap: 0.25rem 1rem;
  margin-top: 0.75rem !important;
  border-top: 1px solid var(--pile-line);
  padding-top: 0.75rem !important;
}

@container (min-width: 28rem) {
  .avatar03__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (min-width: 36rem) {
  .avatar03__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.avatar03__person {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.625rem;
  margin: 0 -0.5rem;
  border-radius: 0.5rem;
  padding: 0.375rem 0.5rem;
  color: inherit;
  text-decoration: none;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar03__person:hover {
  background-color: var(--pile-soft);
}

.avatar03__person:focus-visible {
  outline: 2px solid var(--pile-fg);
}

.avatar03__person-text {
  min-width: 0;
}

.avatar03__person-name,
.avatar03__person-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar03__person-name {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--pile-fg);
}

.avatar03__person-role {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--pile-muted);
}

@media (prefers-reduced-motion: reduce) {
  .avatar03__item,
  .avatar03__panel,
  .avatar03__image,
  .avatar03__count svg {
    transition: none;
  }
  .avatar03__item:hover,
  .avatar03__item:focus-within {
    transform: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
p {
  margin: 0;
}
.avatar03-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.avatar03-layout__card {
  width: 100%;
  max-width: 40rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  padding: 1.25rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.12);
}
.avatar03-layout__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.avatar03-layout__title-wrap {
  min-width: 0;
}
.avatar03-layout__eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: oklch(0.708 0 0);
}
.avatar03-layout__title {
  margin-top: 0.125rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: oklch(0.205 0 0);
}
.avatar03-layout__due {
  padding-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: oklch(0.556 0 0);
}
.avatar03-layout__progress {
  height: 0.25rem;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 9999px;
  background: oklch(0.97 0 0);
}
.avatar03-layout__progress span {
  display: block;
  width: 64%;
  height: 100%;
  border-radius: 9999px;
  background: oklch(0.205 0 0);
}
.avatar03-layout__members {
  margin-top: 1rem;
}
@media (min-width: 40rem) {
  .avatar03-layout {
    padding: 2rem;
  }
  .avatar03-layout__card {
    padding: 1.5rem;
  }
}
