/*
  Avatar 04 — Role and Permission Avatar — 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.
*/

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

:root {
  --role-fg: oklch(0.18 0 0);
  --role-muted: oklch(0.5 0 0);
  --role-line: oklch(0.91 0 0);
  --role-soft: oklch(0.965 0 0);
  --role-accent: #39ff14;
}

.avatar04 {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--role-line);
  border-radius: 1rem;
  background-color: #ffffff;
  padding: 1.25rem 0.75rem 1rem;
  text-align: center;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

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

.avatar04 ul {
  list-style: none;
}

.avatar04 svg {
  display: block;
}

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

.avatar04__frame {
  position: relative;
  padding-bottom: 0.75rem;
}

.avatar04__face {
  position: relative;
  display: flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1rem;
  background-color: oklch(0.93 0.02 250);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: oklch(0.38 0.05 250);
  user-select: none;
}

/* Invited but not joined: a dashed outline instead of a photo. */
.avatar04--pending .avatar04__face {
  border: 1.5px dashed oklch(0.75 0 0);
  background-color: #ffffff;
  color: var(--role-muted);
}

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

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

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

/* The role plate sits across the avatar's lower edge and opens the details. */
.avatar04__plate {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: flex;
  height: 1.5rem;
  align-items: center;
  gap: 0.25rem;
  border: 0;
  border-radius: 9999px;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 0 2px #ffffff;
  outline: none;
  transform: translateX(-50%);
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar04__plate:hover {
  transform: translate(-50%, -1px);
}

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

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

.avatar04--owner .avatar04__plate {
  background-color: var(--role-fg);
  color: #ffffff;
}
.avatar04--admin .avatar04__plate {
  background-color: oklch(0.36 0 0);
  color: #ffffff;
}
.avatar04--editor .avatar04__plate {
  border: 1px solid var(--role-line);
  background-color: #ffffff;
  color: var(--role-fg);
}
.avatar04--viewer .avatar04__plate {
  background-color: var(--role-soft);
  color: var(--role-muted);
}

.avatar04__crown {
  fill: var(--role-accent);
}

.avatar04__name,
.avatar04__title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar04__name {
  margin-top: 0.5rem !important;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--role-fg);
}

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

.avatar04__access {
  width: 100%;
  margin-top: 0.75rem;
}

.avatar04__ladder {
  display: flex;
  gap: 0.25rem;
}

.avatar04__step {
  height: 0.25rem;
  flex: 1;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--role-soft);
}

/* Capability steps fill one after another when a tile first appears. */
.avatar04__step-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background-color: var(--role-fg);
  transform-origin: left;
  animation: avatar04-fill 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--avatar04-i) * 70ms);
}

.avatar04__step-fill--accent {
  background-color: var(--role-accent);
}

.avatar04__summary {
  margin-top: 0.375rem !important;
  font-size: 11px;
  line-height: 1rem;
  color: var(--role-muted);
}

.avatar04__details {
  display: grid;
  width: 100%;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 260ms;
}

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

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

.avatar04__caps {
  margin-top: 0.75rem !important;
  border-top: 1px solid var(--role-line);
  padding-top: 0.75rem !important;
  text-align: left;
}

.avatar04__cap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
  color: var(--role-muted);
}

.avatar04__cap + .avatar04__cap {
  margin-top: 0.25rem;
}

.avatar04__cap svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.avatar04__cap[data-allowed] {
  color: var(--role-fg);
}

.avatar04__cap:not([data-allowed]) .avatar04__cap-text {
  text-decoration: line-through;
  text-decoration-color: var(--role-line);
}

@keyframes avatar04-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar04__step-fill {
    animation: none;
  }
  .avatar04__details,
  .avatar04__image,
  .avatar04__plate {
    transition: 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;
}
.avatar04-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.avatar04-layout__page {
  container-type: inline-size;
  width: 100%;
  max-width: 40rem;
}
.avatar04-layout__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.avatar04-layout__heading {
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.avatar04-layout__seats {
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: oklch(0.556 0 0);
}
.avatar04-layout__invite {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  margin: -0.25rem 0;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.269 0 0);
  text-decoration: none;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.avatar04-layout__invite:hover {
  background: oklch(0.985 0 0);
}
.avatar04-layout__invite:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
  outline-offset: 2px;
}
.avatar04-layout__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 40rem) {
  .avatar04-layout {
    padding: 2rem;
  }
}
@container (min-width: 36rem) {
  .avatar04-layout__tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
