@layer components {
  /* Pins a keep, like the star on a Basecamp project: a plain shape, light until it's pinned, then gold. Each
     surface mixes its own ink into its own color, so the star sits on sand cards and on every keep color alike:
     a little ink at rest, more while the card is under the pointer, more still on the star itself */
  .star {
    --star-ink: var(--color-ink);
    --star-surface: var(--color-card);
    --star-ink-amount: 12%;
    --star-color: color-mix(in srgb, var(--star-ink) var(--star-ink-amount), var(--star-surface));

    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--star-color);
    transition: color 150ms ease, scale 160ms var(--ease-out-expo);

    .icon {
      width: 24px;
      height: 24px;
      stroke-width: 2;
    }

    @media (hover: hover) and (pointer: fine) {
      &:hover {
        --star-ink-amount: 60%;
      }
    }

    /* Gives a little under the finger, so a tap feels heard */
    &:active {
      scale: 0.88;
    }

    @media (prefers-reduced-motion: reduce) {
      transition: none;

      &:active {
        scale: none;
      }
    }
  }

  @media (hover: hover) and (pointer: fine) {
    .keep:hover .star:not(:hover) {
      --star-ink-amount: 40%;
    }
  }

  .star--pinned {
    --star-color: var(--color-star);
  }

  /* On the keep's own color, lighter or darker with it */
  .keep-bar .star {
    --star-ink: var(--tint-ink);
    --star-surface: var(--tint);

    &:not(:hover) {
      --star-ink-amount: 28%;
    }
  }
}
