/* The avatar to assign: a minimal assignee picker on a white page. Ink faces drawn with a hairline, one empty seat
   with a dashed ring, and a single accent: the ring that draws round the face once it has landed. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #141414;           /* the faces, the initials, the name */
  --muted: #8b8881;         /* the label, the role, the empty seat */
  --ghost: #bdb9b1;         /* a name shown before it is chosen */
  --rule: #e6e3dc;          /* the hairline between the seat and the team */
  --face: #ffffff;          /* the inside of a face in the row */
  --seated: #ffffff;        /* the initials of the face in the seat */
  --accent: #2b45ff;        /* the ring round the chosen face, the focus ring */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Bricolage Grotesque Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

/* the picker: everything inside is placed by the script, in pixels, from the sizes in script.js */
.assign {
  --seat: 56px;
  position: relative;
  width: 300px;
  height: 162px;
  max-width: 100%;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------------------------------------------------------------- the seat */
.seat {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--seat) + 20px);
  height: calc(var(--seat) + 20px);
  transition: transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}

/* a dragged face near the seat: the ring opens a little to take it and darkens */
.seat.is-near {
  transform: scale(1.06);
}

.seat__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.seat__ring circle {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.seat__dash {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 1.6 5.4;
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.seat.is-near .seat__dash {
  stroke: var(--ink);
}

.seat__solid {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke-width 0.2s ease;
}

/* the face in the seat with the focus of the keys: its ring grows thicker instead of a second ring */
.seat.is-focus .seat__solid {
  stroke-width: 3;
}

.seat__plus {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.25;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- the name */
.who {
  position: absolute;
  left: calc(var(--seat) + 38px);
  right: 0;
  top: calc((var(--seat) + 20px) / 2);
  transform: translateY(-50%);
  display: grid;
  gap: 3px;
}

.who__label {
  font-size: 12px;
  font-variation-settings: 'wght' 480, 'wdth' 100;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.who__name {
  position: relative;
  display: block;
  height: 28px;
  font-size: 23px;
  line-height: 28px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* one word of the name: the old one slips out on top of the new one while it comes in */
.word {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

.ch {
  display: inline-block;
  white-space: pre;
  font-variation-settings: 'wght' var(--w, 600), 'wdth' var(--d, 100);
}

.who__role {
  display: block;
  height: 17px;
  font-size: 13px;
  line-height: 17px;
  font-variation-settings: 'wght' 420, 'wdth' 100;
  color: var(--muted);
  white-space: nowrap;
}

.assign__rule {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

/* ---------------------------------------------------------------- the faces */
.team {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.av {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--seat);
  height: var(--seat);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font: inherit;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.av.is-dragged {
  cursor: grabbing;
}

/* three layers: the button is moved by the script, the body squashes when it lands, the face gives under a press */
.av__body,
.av__face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 50%;
}

.av__face {
  transition: transform 0.22s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.av:active .av__face {
  transform: scale(0.95);
}

.av__shade,
.av__fill,
.av__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.av__shade {
  box-shadow: 0 14px 26px -10px rgba(20, 20, 20, 0.28), 0 2px 6px rgba(20, 20, 20, 0.06);
  opacity: 0;
}

.av__fill {
  background: var(--ink);
  clip-path: circle(0% at 50% 50%);
}

/* the face's outline: thick enough to stay a crisp 1.5 pixels once the face is shrunk into the row */
.av__ring {
  background: var(--face);
  box-shadow: inset 0 0 0 var(--line, 1.9px) var(--ink);
  transition: box-shadow 0.2s ease;
}

.av__ini {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 19px;
  letter-spacing: 0.02em;
  font-variation-settings: 'wght' var(--iw, 560), 'wdth' var(--id, 94);
  color: var(--ink);
}

.av__ini--on {
  color: var(--seated);
}

@media (prefers-reduced-motion: reduce) {
  .seat,
  .av__face {
    transition: none;
  }

  .seat.is-near {
    transform: none;
  }
}

@media (hover: hover) {
  .av:hover {
    --line: 2.6px;
  }
}

.av:focus-visible .av__face {
  box-shadow: 0 0 0 3px var(--page), 0 0 0 5px var(--accent);
}

.av[aria-pressed='true']:focus-visible .av__face,
html[data-using='pointer'] .av:focus-visible .av__face {
  box-shadow: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
