@layer components {
  .community-reactions {
    min-inline-size: 0;
    margin-block-start: var(--space-xs);

    form { margin: 0; }
  }

  /* Like leads; used reactions follow from the most counted down; «…» reveals the rest inline. */
  .community-reaction-row {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    gap: var(--space-2xs) var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
    max-inline-size: 100%;
  }

  .community-reaction-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    max-inline-size: 100%;
  }

  .community-reaction-voters {
    max-inline-size: 100%;
    color: var(--muted);
    font-size: var(--step-00);
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
  }

  /* «…» is part of the strip; opening it lets the unused smilies continue
     the same wrapped row — no separate block. */
  .community-reaction-more,
  .community-reaction-picker {
    display: contents;
  }

  .community-reaction-unused {
    display: none;

    .community-reactions:has(details[open]) & { display: contents; }
  }

  .community-reaction-picker summary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-inline-size: var(--touch);
    min-block-size: var(--touch);
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    touch-action: manipulation;
    list-style: none;

    &::-webkit-details-marker { display: none; }

    &::before { content: "…"; font-size: 1.5em; line-height: 1; }

    &:hover {
      color: var(--paprika);
      background: color-mix(in oklch, var(--paprika) 6%, var(--cream));
      border-radius: var(--radius-s);
    }
  }

  .community-reaction-vote {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2xs);
    min-inline-size: var(--touch);
    min-block-size: var(--touch);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 120ms ease;

    img {
      inline-size: 1.75rem;
      block-size: 1.75rem;
      flex-shrink: 0;
      object-fit: contain;
    }

    .community-reaction-count {
      color: var(--muted);
      font-size: var(--step-00);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
    }

    &:hover { transform: translateY(-0.1rem); }

    &[aria-pressed="true"] {
      img { transform: scale(1.15); }

      .community-reaction-count { color: var(--sage); }
    }

    &:disabled { opacity: 0.6; cursor: wait; }
  }

  @media (prefers-reduced-motion: reduce) {
    .community-reaction-vote { transition: none; }

    .community-reaction-vote:hover,
    .community-reaction-vote[aria-pressed="true"] img { transform: none; }
  }
}
