/*
  Avatar 01 — Foundational Identity 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.
*/

:root {
  --avatar-ring: #ffffff;
  --avatar-online: oklch(0.62 0.17 145);
  --avatar-away: oklch(0.78 0.15 75);
  --avatar-busy: oklch(0.58 0.2 27);
  --avatar-offline: oklch(0.7 0 0);
}

.avatar01 {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.avatar01--xs {
  width: 1.5rem;
  height: 1.5rem;
}
.avatar01--sm {
  width: 2rem;
  height: 2rem;
}
.avatar01--md {
  width: 2.5rem;
  height: 2.5rem;
}
.avatar01--lg {
  width: 3.5rem;
  height: 3.5rem;
}
.avatar01--xl {
  width: 4.5rem;
  height: 4.5rem;
}

.avatar01__face {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 9999px;
  font-weight: 600;
  letter-spacing: -0.01em;
  user-select: none;
}

/* A hairline inner edge keeps light photos from bleeding into white UI. */
.avatar01__face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.avatar01--xs .avatar01__face {
  font-size: 10px;
}
.avatar01--sm .avatar01__face {
  font-size: 0.75rem;
  line-height: 1rem;
}
.avatar01--md .avatar01__face {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.avatar01--lg .avatar01__face {
  font-size: 1.125rem;
  line-height: 1.75rem;
}
.avatar01--xl .avatar01__face {
  font-size: 22px;
}

.avatar01--square .avatar01__face {
  border-radius: 0.75rem;
}
.avatar01--square.avatar01--xs .avatar01__face,
.avatar01--square.avatar01--sm .avatar01__face {
  border-radius: 0.375rem;
}

/* Six quiet tints; a name always lands on the same one (see script.js). */
.avatar01--tint-0 .avatar01__face {
  background-color: oklch(0.93 0.03 250);
  color: oklch(0.38 0.06 250);
}
.avatar01--tint-1 .avatar01__face {
  background-color: oklch(0.93 0.035 160);
  color: oklch(0.38 0.06 160);
}
.avatar01--tint-2 .avatar01__face {
  background-color: oklch(0.93 0.04 70);
  color: oklch(0.42 0.07 60);
}
.avatar01--tint-3 .avatar01__face {
  background-color: oklch(0.93 0.035 20);
  color: oklch(0.42 0.08 25);
}
.avatar01--tint-4 .avatar01__face {
  background-color: oklch(0.93 0.03 300);
  color: oklch(0.4 0.06 300);
}
.avatar01--tint-5 .avatar01__face {
  background-color: oklch(0.94 0 0);
  color: oklch(0.38 0 0);
}

/* Initials sit underneath; the photo fades in over them only once it has
   actually loaded, so a slow or broken image never shows an empty circle. */
.avatar01__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 240ms ease-out;
}

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

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

.avatar01__presence {
  position: absolute;
  right: 0;
  bottom: 0;
  border-radius: 9999px;
  box-shadow: 0 0 0 2px var(--avatar-ring);
}

.avatar01--xs .avatar01__presence {
  width: 0.5rem;
  height: 0.5rem;
  box-shadow: 0 0 0 1.5px var(--avatar-ring);
}
.avatar01--sm .avatar01__presence {
  width: 0.625rem;
  height: 0.625rem;
}
.avatar01--md .avatar01__presence {
  width: 0.75rem;
  height: 0.75rem;
}
.avatar01--lg .avatar01__presence {
  width: 0.875rem;
  height: 0.875rem;
}
.avatar01--xl .avatar01__presence {
  width: 1rem;
  height: 1rem;
  box-shadow: 0 0 0 2.5px var(--avatar-ring);
}

.avatar01--square .avatar01__presence {
  transform: translate(25%, 25%);
}

.avatar01__presence[data-presence="online"] {
  background-color: var(--avatar-online);
}
.avatar01__presence[data-presence="away"] {
  background-color: var(--avatar-away);
}
.avatar01__presence[data-presence="busy"] {
  background-color: var(--avatar-busy);
}

/* Offline is hollow, not just grey, so it doesn't rely on colour alone. */
.avatar01__presence[data-presence="offline"] {
  background-color: var(--avatar-ring);
  box-shadow:
    0 0 0 2px var(--avatar-ring),
    inset 0 0 0 2px var(--avatar-offline);
}

@media (prefers-reduced-motion: reduce) {
  .avatar01__image {
    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,
ul {
  margin: 0;
  padding: 0;
}
ul {
  list-style: none;
}
.avatar01-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.avatar01-layout__card {
  container-type: inline-size;
  width: 100%;
  max-width: 40rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.12);
}
.avatar01-layout__inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
}
.avatar01-layout__identity {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.avatar01-layout__who {
  min-width: 0;
}
.avatar01-layout__name {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: oklch(0.205 0 0);
}
.avatar01-layout__role {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.556 0 0);
}
.avatar01-layout__status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.avatar01-layout__status-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background: oklch(0.62 0.17 145);
}
.avatar01-layout__specs {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid oklch(0.97 0 0);
  padding-top: 1.25rem;
}
.avatar01-layout__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: oklch(0.708 0 0);
}
.avatar01-layout__scale {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 0.625rem;
}
.avatar01-layout__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}
.avatar01-layout__px {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: oklch(0.708 0 0);
}
.avatar01-layout__fallbacks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.625rem;
}
.avatar01-layout__fallback {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.avatar01-layout__caption {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.439 0 0);
}
@media (min-width: 40rem) {
  .avatar01-layout {
    padding: 2rem;
  }
}
@container (min-width: 24rem) {
  .avatar01-layout__scale {
    gap: 1.25rem;
  }
}
@container (min-width: 36rem) {
  .avatar01-layout__inner {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  .avatar01-layout__identity {
    width: 10rem;
    flex-shrink: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .avatar01-layout__specs {
    border-top: 0;
    border-left: 1px solid oklch(0.97 0 0);
    padding-top: 0;
    padding-left: 1.5rem;
  }
}
