
@st-namespace 'ReactionButton-st-css';
@st-import [ createFont ] from '../../../common/formatters.st.js';
@st-import [ sr-only ] from '../../../common/mixins.st.css';
@st-import TextButton from '../../TextButton/TextButton.st.css';

.root {
  -st-states: defaultReaction(enum(heart, thumbsup)), active, animate, visibleTrigger;
  display: flex;
}

.reactionButton {
  -st-extends: TextButton;
  display: flex;
}

.reactionButton,
.popoverTrigger {
  align-items: center;
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  cursor: pointer;
}

.root:not(:visibleTrigger) .popoverTrigger {
  -st-mixin: sr-only();
}

:global(#SITE_CONTAINER.focus-ring-active) .root:visibleTrigger .popoverTrigger {
  display: flex;
}

.reactionButton,
.reactionButton:mobile {
  -st-mixin: createFont(null, 'Body-M', '{ "line-height": "24px", "size": "16px" }');
}

/* override the default TextButton behavior */
.reactionButton::prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(1em * 24 / 16);
  height: calc(1em * 24 / 16);
  margin-inline-end: 4px;
}

/* override the default TextButton behavior */
.reactionButton::prefix::after {
  width: 0;
  height: 0;
}

.reactionButton::prefix svg {
  flex: 1;
  margin: 0;
  height: 100%;
}

.root:active .reactionButton::prefix svg {
  flex-basis: 1em;
  flex-grow: 0;
  flex-shrink: 0;
}

.root:active:defaultReaction(heart) .animation {
  color: #F5592D;
}

.root:active:defaultReaction(thumbsup) .animation {
  color: #FFCD00;
}

.root:active:animate .reactionButton::prefix svg {
  animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.320, 1.275) both;
}

@keyframes pop {
  0% {
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
  }
  100% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
}

/* st-namespace-reference="../../../../../src/components/Reactions/ReactionButton/ReactionButton.st.css" */
    