/* Button atom. Sizes m (48) and s (40); kinds primary and secondary; hover shows a hard shadow. */
@layer components {
  .button {
    --button-bg: var(--color-action-primary-background);
    --button-color: var(--color-action-primary-text);
    --button-border: var(--color-action-primary-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    min-block-size: var(--component-control-height-m);
    padding: 0 var(--component-button-padding-x-m);
    border: var(--border-width-thick) solid var(--button-border);
    border-radius: var(--component-button-radius);
    background-color: var(--button-bg);
    color: var(--button-color);
    font-family: var(--font-family-base), system-ui, sans-serif;
    font-weight: var(--font-weight-bold);
    font-size: var(--type-label-m-size);
    line-height: var(--type-label-m-line-height);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-hover-media);
  }

  .button:hover {
    color: var(--button-color);
  }

  .button--secondary {
    --button-bg: var(--color-action-secondary-background);
  }

  .button--s {
    min-block-size: var(--component-control-height-s);
    padding-inline: var(--component-button-padding-x-s);
  }

  .button__label {
    min-width: 0;
  }

  .button .icon {
    flex: none;
  }

  @media (hover: hover), (any-hover: hover) {
    .button:hover:not([aria-disabled='true'], :disabled) {
      transition: var(--transition-hover-media-in);
      box-shadow: 4px 4px 0 var(--color-shadow-hover-action);
      transform: translate(-2px, -2px);
    }
  }

  .button:active:not([aria-disabled='true'], :disabled) {
    box-shadow: none;
    transform: none;
  }

  .button[aria-disabled='true'],
  .button:disabled {
    background-color: var(--color-action-disabled-background);
    border-color: var(--color-action-disabled-border);
    color: var(--color-action-disabled-text);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
  }

  /* Dark section: the hover shadow would vanish, use the light beige of the media shadow. */
  [data-bg='inverse'] .button:hover:not([aria-disabled='true'], :disabled) {
    box-shadow: 4px 4px 0 var(--color-shadow-hover-media);
  }

  @media (prefers-reduced-motion: reduce) {
    .button:hover:not([aria-disabled='true'], :disabled) {
      transform: none;
    }
  }
}
