/*
  Avatar 05 — Editable Profile 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 {
  --edit-fg: oklch(0.18 0 0);
  --edit-muted: oklch(0.5 0 0);
  --edit-line: oklch(0.9 0 0);
  --edit-soft: oklch(0.965 0 0);
  --edit-error: oklch(0.52 0.19 27);
  --edit-accent: #39ff14;
}

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

.avatar05 p {
  margin: 0;
}

.avatar05 svg {
  display: block;
}

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

.avatar05__layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.avatar05__frame {
  position: relative;
  width: 6rem;
  height: 6rem;
  flex-shrink: 0;
}

/* The photo itself is the button. */
.avatar05__trigger {
  position: relative;
  display: flex;
  width: 6rem;
  height: 6rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 9999px;
  background-color: oklch(0.93 0.03 300);
  padding: 0;
  font-family: inherit;
  font-size: 28px;
  font-weight: 600;
  color: oklch(0.4 0.06 300);
  cursor: pointer;
  outline: none;
}

.avatar05__trigger:focus-visible {
  outline: 2px solid var(--edit-fg);
  outline-offset: 6px;
}

.avatar05__trigger[aria-disabled="true"] {
  cursor: progress;
}

.avatar05__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: avatar05-fade 240ms ease-out both;
}

.avatar05__image[hidden] {
  display: none;
}

.avatar05__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background-color: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.avatar05__trigger:hover .avatar05__overlay,
.avatar05__trigger:focus-visible .avatar05__overlay,
.avatar05[data-status="uploading"] .avatar05__overlay {
  opacity: 1;
}

.avatar05__change,
.avatar05__percent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.avatar05__change svg {
  width: 1.25rem;
  height: 1.25rem;
}

.avatar05__change span {
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}

.avatar05__percent {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.avatar05__change[hidden],
.avatar05__percent[hidden] {
  display: none;
}

.avatar05__ring {
  position: absolute;
  inset: -0.25rem;
  width: 6.5rem;
  height: 6.5rem;
  pointer-events: none;
  transform: rotate(-90deg);
  transition: opacity 400ms ease-out;
}

.avatar05[data-status="idle"] .avatar05__ring,
.avatar05[data-status="error"] .avatar05__ring {
  opacity: 0;
}

.avatar05__track {
  stroke: var(--edit-soft);
}

.avatar05__progress {
  stroke: var(--edit-fg);
  transition:
    stroke-dashoffset 200ms linear,
    stroke 300ms ease-out;
}

.avatar05[data-status="success"] .avatar05__progress {
  stroke: var(--edit-accent);
}

.avatar05__badge {
  position: absolute;
  right: 0.125rem;
  bottom: 0.125rem;
  display: flex;
  width: 1.75rem;
  height: 1.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  pointer-events: none;
  box-shadow: 0 0 0 3px #ffffff;
}

.avatar05__badge svg {
  width: 0.875rem;
  height: 0.875rem;
}

.avatar05__badge--edit {
  border: 1px solid var(--edit-line);
  background-color: #ffffff;
  color: var(--edit-fg);
}

.avatar05__badge--done {
  background-color: var(--edit-fg);
  color: var(--edit-accent);
  animation: avatar05-pop 320ms cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.avatar05__badge[hidden] {
  display: none;
}

.avatar05__text {
  min-width: 0;
}

.avatar05__title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--edit-fg);
}

.avatar05__help {
  margin-top: 0.125rem !important;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--edit-muted);
}

.avatar05__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.avatar05__primary,
.avatar05__remove {
  display: flex;
  height: 2.25rem;
  align-items: center;
  border-radius: 0.5rem;
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  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);
}

.avatar05__primary {
  border: 0;
  background-color: var(--edit-fg);
  color: #ffffff;
}

.avatar05__primary:hover {
  background-color: oklch(0.3 0 0);
}

.avatar05__primary[aria-disabled="true"] {
  cursor: progress;
  background-color: var(--edit-soft);
  color: var(--edit-muted);
}

.avatar05__remove {
  border: 1px solid var(--edit-line);
  background-color: #ffffff;
  color: var(--edit-fg);
}

.avatar05__remove:hover {
  background-color: var(--edit-soft);
}

.avatar05__remove[aria-disabled="true"] {
  cursor: default;
  color: oklch(0.7 0 0);
}

.avatar05__remove[aria-disabled="true"]:hover {
  background-color: #ffffff;
}

.avatar05__primary:focus-visible,
.avatar05__remove:focus-visible {
  outline: 2px solid var(--edit-fg);
  outline-offset: 2px;
}

.avatar05__status {
  min-height: 1rem;
  margin-top: 0.5rem !important;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--edit-muted);
}

.avatar05[data-status="error"] .avatar05__status {
  color: var(--edit-error);
}

@container (min-width: 20rem) {
  .avatar05__layout {
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    text-align: left;
  }
  .avatar05__actions {
    justify-content: flex-start;
  }
}

@keyframes avatar05-pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes avatar05-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar05__overlay,
  .avatar05__progress,
  .avatar05__ring {
    transition: none;
  }
  .avatar05__badge--done,
  .avatar05__image {
    animation: 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;
}
.avatar05-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.avatar05-layout__card {
  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);
}
.avatar05-layout__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  border-bottom: 1px solid oklch(0.97 0 0);
  padding: 0.875rem 1.25rem;
}
.avatar05-layout__heading {
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.avatar05-layout__sample {
  min-height: 2rem;
  margin: -0.25rem 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.439 0 0);
  text-decoration: underline;
  text-decoration-color: oklch(0.87 0 0);
  text-underline-offset: 3px;
  cursor: pointer;
  outline: none;
}
.avatar05-layout__sample:hover {
  color: oklch(0.205 0 0);
}
.avatar05-layout__sample:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
}
.avatar05-layout__sample:disabled {
  cursor: progress;
  opacity: 0.6;
}
.avatar05-layout__body {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
}
.avatar05-layout__fields {
  display: grid;
  gap: 0.75rem;
}
.avatar05-layout__label {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.439 0 0);
}
.avatar05-layout__input {
  width: 100%;
  height: 2.25rem;
  margin-top: 0.25rem;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.5rem;
  background: transparent;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.205 0 0);
  outline: none;
}
.avatar05-layout__input:focus-visible {
  border-color: oklch(0.205 0 0);
  box-shadow: 0 0 0 2px oklch(0.205 0 0 / 0.1);
}
@media (min-width: 40rem) {
  .avatar05-layout {
    padding: 2rem;
  }
  .avatar05-layout__head {
    padding: 0.875rem 1.5rem;
  }
  .avatar05-layout__body {
    grid-template-columns: minmax(0, 1fr) 14rem;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
  }
}
