@use "../base/color";
@use "../base/var";
@use "../base/text";

[part~="wy-poll"] {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var.default(--wy-gap-sm);
  box-sizing: border-box;
  width: 100%;
}

[part~="wy-poll-form"] {
  display: flex;
  flex-direction: column;
  gap: var.default(--wy-gap);

  &:empty {
    display: none;
  }
}

[part~="wy-poll-option"] {
  --wy-component-color: #{color.token(--wy-on-surface)};
  display: flex;
  align-items: center;
  clip-path: border-box;
  overflow: hidden;
  position: relative;
  background-color: #{color.token(--wy-surface-layer-lowest)};
  border: var.default(--wy-border-outline) solid #{color.token(--wy-outline-variant)};
  border-radius: var.default(--wy-border-radius-sm);
  padding: var.default(--wy-padding-sm) var.default(--wy-padding);
  cursor: pointer;
  gap: var.default(--wy-gap-sm);

  > :not([part~="wy-poll-meter"]) {
    z-index: 1;
  }
}

// [part~="wy-poll-option-active"] {
// }

[part="wy-poll-image"] {
  display: flex;
  height: calc(var.default(--wy-button-size) * .6); // 2.5rem * 0.6 = 24px
  width: calc(var.default(--wy-button-size) * .6);  
  padding: 0;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

[part~="wy-poll-title"] {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  color: var(--wy-component-color);
  font-size: var.default(--wy-item-title-font-size);
  font-weight: var.default(--wy-item-title-font-weight);
  align-content: center;
  @include text.truncate;
}

[part~="wy-poll-amount"] {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  // Same width as a small icon button, so the badge centers on the same axis as the reaction and menu icons
  // in the rows below and above: those sit 8px (the button padding) in from the edge the option's padding is.
  min-width: calc(var.default(--wy-button-size) * .6);
}

[part~="wy-poll-meter"] {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background-color: #{color.token(--wy-surface-container)};
}
