/* The call: pictures to choose from, the circle that brings more, the row of choices. */

/* a line and some air: above it pictures to choose from, below it the wall */
.call {
  padding: 0 0 var(--s6);
  margin-bottom: var(--s6);
  border-bottom: 1px solid var(--material-edge);
}

.call-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--wall-gap);
  width: 100%;
}

.call.is-empty .call-tray {
  display: none;
}

.call-tile {
  flex: none;
  height: clamp(170px, 30vh, 420px); /* one size, however many: more pictures are more rows */
  max-width: 100%;
  width: auto;
  cursor: pointer;
}

.call-tile.is-new {
  animation: call-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.call-tile.is-chosen {
  animation: call-chosen 220ms ease-in both;
}

.call-tile.is-going {
  animation: call-going 220ms ease-in both;
}

@keyframes call-in {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes call-chosen {
  to {
    opacity: 0;
    transform: translateY(46px) scale(0.5);
  }
}

@keyframes call-going {
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* ── the bar: fixed at the top of the wall; everything beneath it may change ── */

.call-bar {
  position: sticky;
  top: calc(var(--safe-top) + var(--s2));
  z-index: var(--z-bar);
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: fit-content;
  max-width: min(100%, 980px);
  min-height: 56px;
  margin: 0 auto var(--s3);
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-chip);
  background: var(--material);
  border: 1px solid var(--material-edge);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}

/* one circle, the size of its neighbours; it breathes, so it reads as the one to press */
.call-more,
.call-side {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.call-more {
  color: var(--ink);
  border-color: var(--accent);
  animation: call-breathe 2.4s ease-in-out infinite;
}

.call-more.is-held {
  animation-duration: 0.45s;
}

.call-more:disabled {
  animation: none;
  opacity: 0.35;
}

@keyframes call-breathe {
  0%,
  100% {
    transform: scale(0.82);
  }
  50% {
    transform: scale(1.12);
  }
}

.call-more svg,
.call-side svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms ease-out;
}

.call-side:active {
  background: rgba(255, 255, 255, 0.08);
}

.call-side:disabled {
  opacity: 0.3;
}

/* the arrow points down while the pictures are out, and turns when they are put away */
.call-bar .call-side:last-of-type svg {
  transform: rotate(180deg);
}

.call-bar.is-folded .call-side:last-of-type svg {
  transform: none;
}

/* ── the choices, in the bar ─────────────────────────────────────────────── */

.call-strip {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  margin-left: var(--s2);
  padding: 4px var(--s1);
  overflow-x: auto;
  scrollbar-width: none;
}

.call-strip[hidden] {
  display: none;
}

.call-pick {
  position: relative;
  flex: none;
  animation: call-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.call-chosen {
  display: block;
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1 !important; /* the tile carries its picture's own ratio inline */
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--material-edge);
  cursor: pointer;
}

.call-drop {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ground-raised);
  border: 1px solid var(--material-edge);
  color: var(--ink-soft);
}

.call-drop svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

/* where a mouse hovers, the x waits for it */
@media (hover: hover) {
  .call-drop {
    opacity: 0;
    transition: opacity 120ms ease-out;
  }
  .call-pick:hover .call-drop,
  .call-drop:focus-visible {
    opacity: 1;
  }
}

.call-again {
  flex: none;
  margin: 0 var(--s1);
}

.call-again[hidden] {
  display: none;
}

/* ── the bare opener: the wall waits for the first choice ────────────────── */

.wall.is-bare .wall-grid {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.wall.is-bare .call-bar {
  margin-top: 34vh;
}

.wall-grid {
  transition: opacity 400ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .call-tile.is-new,
  .call-tile.is-chosen,
  .call-tile.is-going,
  .call-pick,
  .call-more {
    animation: none;
  }
}

/* on a phone three or four pictures share a row */
@media (max-width: 759px) {
  .call-tile {
    height: clamp(120px, 20vh, 200px);
  }
}
