/* The hook list of a carousel in the popover of its hook cell
   (components/hook_list.cljs, docs/design-system.md, The batch). */

.hook-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* While the pair's hooks are written, or when the write failed. */
.hook-list__state {
  margin: 0;
  padding: var(--space-2) 0;
  font-size: var(--text-body);
  color: var(--color-text-muted);
}

/* The write in progress pulses, so the user sees it is alive. The hook
   cell of the batch (css/ui/batch_step.css) pulses with the same frames. */
.hook-list__state--writing {
  animation: hooks-writing-pulse var(--duration-skeleton-pulse) var(--ease-default) infinite;
}

@keyframes hooks-writing-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .hook-list__state--writing {
    animation: none;
  }
}

/* The failed write: the reason over Try again. */
.hook-list__state--failed {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--color-text);
}

/* The delete cross of a hook, in the row's corner slot: a bare muted
   icon in a 24px slot, no box and no fill, ink under the cursor; shown
   under the cursor or the focus on the row, and always on a screen
   without hover. It keeps the row's height. */
.hook-list__row .hook-list__delete {
  width: 24px;
  height: 24px;
  margin: -2px 0;
  color: var(--color-text-muted);
  background: transparent;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default);
}

.hook-list__row .hook-list__delete:hover:not(:disabled) {
  color: var(--color-text);
  background: transparent;
}

.hook-list__row:hover .hook-list__delete,
.hook-list__row:focus-within .hook-list__delete {
  opacity: 1;
}

@media (hover: none) {
  .hook-list__row .hook-list__delete {
    opacity: 1;
  }
}

/* "+ Write your own" turned into its field, Add beside it. */
.hook-list__own {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hook-list__own .input {
  flex: 1;
  min-width: 0;
}

.hook-list__more {
  display: flex;
}
