/* The emoji and sticker picker (/design-system#expression_picker): the emoji picker's shell, WhatsApp's tab bar at the bottom. */
.ds-expression-picker {
  --expression-picker-panel: min(22rem, calc(100dvh - 16px - 3.25rem));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  inline-size: min(calc(8 * 2.25rem + 2 * var(--ds-space-2) + 2px), calc(100vw - 16px));
  overflow: hidden;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-xl);
  background: var(--ds-bg-pure);
  color: var(--ds-text);
  outline: none;
}
.ds-expression-picker[hidden],
.ds-expression-picker__panel[hidden] { display: none; }
.ds-expression-picker.ds-floating { z-index: var(--ds-z-overlay); }
.ds-expression-picker :where(button, input) { --hover-size: 0; }

.ds-expression-picker__panel { display: flex; flex-direction: column; min-block-size: 0; outline: none; }
.ds-expression-picker--tabs .ds-expression-picker__panel { block-size: var(--expression-picker-panel); }
.ds-expression-picker .ds-emoji-picker {
  flex: 1 1 auto;
  inline-size: auto;
  max-block-size: none;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.ds-expression-picker--tabs .ds-emoji-picker__scroll { flex: 1 1 auto; }

.ds-expression-picker__bar { display: flex; justify-content: center; padding: var(--ds-space-1) var(--ds-space-2) var(--ds-space-2); }
/* The segmented control (#tabs) at its compact size: no rail padding, the chosen cell filled edge to edge, 28 px. */
.ds-expression-picker__tabs {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-full);
}
.ds-expression-picker__tab {
  display: grid;
  place-items: center;
  inline-size: 48px;
  block-size: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--ds-radius-full);
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out), color var(--ds-duration-fast) var(--ds-ease-out);
}
.ds-expression-picker__tab:hover { background: var(--ds-hover); color: var(--ds-text); }
.ds-expression-picker__tab[aria-selected="true"] { background: var(--ds-fill); color: var(--ds-text); }
.ds-expression-picker__tab:focus-visible { outline: 2px solid var(--ds-focus-ring); outline-offset: 0; }

.ds-sticker-panel { display: flex; flex-direction: column; flex: 1 1 auto; min-block-size: 0; }
.ds-sticker-panel__scroll {
  flex: 1 1 auto;
  min-block-size: 0;
  padding: var(--ds-space-1) var(--ds-space-2) var(--ds-space-2);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ds-sticker-panel__title {
  margin: 0;
  padding: var(--ds-space-2) var(--ds-space-1) var(--ds-space-1);
  color: var(--ds-text-muted);
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-weight-semibold);
}
.ds-sticker-panel__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--ds-space-1); }
/* The title's place while the list loads: a soft bar the size of the word. */
.ds-sticker-panel__placeholder {
  border-radius: var(--ds-radius-full);
  background: var(--ds-fill);
  color: transparent;
}
.ds-sticker-panel__empty {
  margin: 0;
  padding: var(--ds-space-3) var(--ds-space-2);
  color: var(--ds-text-muted);
  font-size: var(--ds-font-size-sm);
  text-align: center;
  text-wrap: pretty;
}
.ds-sticker-panel__item { position: relative; }
.ds-sticker-panel__share {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-end: 2px;
  display: grid;
  place-items: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--ds-radius-full);
  background: var(--ds-bg-pure);
  color: var(--ds-text-muted);
  cursor: pointer;
  opacity: 0;
}
.ds-sticker-panel__item:is(:hover, :focus-within) .ds-sticker-panel__share { opacity: 1; }
.ds-sticker-panel__share:hover { color: var(--ds-text); }
.ds-sticker-panel__share[aria-pressed="true"] { opacity: 1; background: var(--ds-cta); color: var(--ds-on-cta); }
.ds-sticker-panel__share:focus-visible { opacity: 1; outline: 2px solid var(--ds-focus-ring); outline-offset: 0; }

.ds-sticker-tile {
  display: grid;
  place-items: center;
  inline-size: 100%;
  aspect-ratio: 1;
  padding: var(--ds-space-1);
  border: 0;
  border-radius: var(--ds-radius-lg);
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out);
}
.ds-sticker-tile:hover { background: var(--ds-fill); }
.ds-sticker-tile:focus-visible { outline: 2px solid var(--ds-focus-ring); outline-offset: -2px; }
.ds-sticker-tile:disabled { cursor: progress; opacity: 0.5; }
/* The preview and the sticker share the tile's one cell, so neither moves the square when it lands. */
.ds-sticker-tile__img,
.ds-sticker-tile__preview {
  grid-area: 1 / 1;
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  transition: opacity var(--ds-duration-slow) var(--ds-ease-out);
}
.ds-sticker-tile__preview { filter: blur(1px); }
.ds-sticker-tile:not([data-loading]) .ds-sticker-tile__preview { opacity: 0; }

/* Loading: the square on the quiet fill and the preview when it has one. The sticker is never hidden by opacity,
   which would keep a lazy picture from loading at all; it fades in once it arrives. */
.ds-sticker-tile[data-loading] { background: var(--ds-fill); cursor: progress; }
.ds-sticker-tile[data-loading]::after {
  content: "";
  grid-area: 1 / 1;
  inline-size: 14px;
  block-size: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--ds-text-muted) 25%, transparent);
  border-block-start-color: var(--ds-text-muted);
  opacity: 0;
}

/* The placeholder breathes, and the spinner shows only on a tile still loading after a moment: a quick one never blinks. */
@media (prefers-reduced-motion: no-preference) {
  .ds-sticker-tile[data-loading] { animation: ds-sticker-tile-breathe 1.6s ease-in-out infinite; }
  .ds-sticker-tile[data-loading]::after { animation: cs-spin 0.8s linear infinite, ds-sticker-tile-spinner 0s linear 400ms forwards; }
  .ds-sticker-tile[data-arrived] .ds-sticker-tile__img { animation: ds-sticker-tile-in var(--ds-duration-slow) var(--ds-ease-out); }

  @keyframes ds-sticker-tile-breathe { 50% { background-color: var(--ds-fill-hover); } }
  @keyframes ds-sticker-tile-spinner { to { opacity: 0.7; } }
  @keyframes ds-sticker-tile-in { from { opacity: 0; } }
}
.ds-sticker-tile--create {
  align-content: center;
  gap: 2px;
  background: var(--ds-fill);
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-weight-medium);
}
.ds-sticker-tile--create:hover { background: var(--ds-fill-hover); color: var(--ds-text); }
.ds-sticker-tile--create[aria-busy="true"] { cursor: progress; opacity: 0.5; pointer-events: none; }

/* v5: the menu's skin; the bar is the dry segmented control, the chosen tab the panel on the quiet fill. */
:where(html[data-visual="v5"]) .ds-expression-picker { border-color: var(--ds-menu-border); background: var(--ds-menu-bg); }
:where(html[data-visual="v5"]) .ds-expression-picker__tabs { border: 0; background: var(--ds-fill); }
:where(html[data-visual="v5"]) .ds-expression-picker__tab { color: var(--ds-text-secondary); }
:where(html[data-visual="v5"]) .ds-expression-picker__tab:hover { background: var(--ds-fill-hover); }
:where(html[data-visual="v5"]) .ds-expression-picker__tab[aria-selected="true"] { background: var(--ds-bg-pure); color: var(--ds-text); }
