@property --songbird-bezel-x {
  syntax: '<length-percentage>';
  inherits: false;
  initial-value: 0%;
}

@property --songbird-bezel-y {
  syntax: '<length-percentage>';
  inherits: false;
  initial-value: 0%;
}

@property --songbird-bezel-strength {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

@keyframes songbird-gold-bezel {
  0% {
    --songbird-bezel-x: var(--songbird-bezel-curve);
    --songbird-bezel-y: 0%;
    --songbird-bezel-strength: 0;
  }
  14% { --songbird-bezel-strength: 1; }
  55% {
    --songbird-bezel-x: calc(100% - var(--songbird-bezel-curve));
    --songbird-bezel-y: 0%;
  }
  63% {
    --songbird-bezel-x: calc(100% - var(--songbird-bezel-curve) * 0.3);
    --songbird-bezel-y: 14%;
  }
  71% {
    --songbird-bezel-x: 100%;
    --songbird-bezel-y: 50%;
    --songbird-bezel-strength: 1;
  }
  79% {
    --songbird-bezel-x: calc(100% - var(--songbird-bezel-curve) * 0.3);
    --songbird-bezel-y: 86%;
  }
  87% {
    --songbird-bezel-x: calc(100% - var(--songbird-bezel-curve));
    --songbird-bezel-y: 100%;
  }
  100% {
    --songbird-bezel-x: calc(76% - var(--songbird-bezel-curve));
    --songbird-bezel-y: 100%;
    --songbird-bezel-strength: 0;
  }
}

/* The finish belongs on the lead shopping, purchase and customer form actions. */
body.songbird :is(
  .button.cream,
  .sb-empty .button,
  .return-to-shop .button,
  .add-main,
  .single_add_to_cart_button,
  #hymn-overlay .quick-sheet .button[data-action='add-product'],
  #hymn-overlay .cart-sheet .bag-footer > .button,
  .checkout-button,
  .hymn-contact-actions .button,
  #place_order,
  .woocommerce-form-login__submit,
  .woocommerce-form-register__submit,
  .woocommerce-ResetPassword button[type='submit'],
  .woocommerce-EditAccountForm button[name='save_account_details'],
  .track_order button[type='submit'],
  .sb-contact .button
) {
  --songbird-bezel-fill: #102c22;
  --songbird-bezel-ink: #f7eedb;
  --songbird-bezel-edge: linear-gradient(155deg, #f1d4a0 6%, #c69c59 58%, #e1b979 93%);
  --songbird-bezel-curve: min(22px, 22%);
  --songbird-bezel-border: transparent;
  --songbird-bezel-shadow: none;
  --songbird-bezel-background:
    linear-gradient(var(--songbird-bezel-fill), var(--songbird-bezel-fill)) padding-box,
    radial-gradient(
      circle 54px at var(--songbird-bezel-x, 0%) var(--songbird-bezel-y, 0%),
      rgb(255 250 226 / var(--songbird-bezel-strength, 0)) 6%,
      rgb(255 239 184 / var(--songbird-bezel-strength, 0)) 24%,
      rgb(255 218 148 / calc(var(--songbird-bezel-strength, 0) * 0.75)) 49%,
      transparent
    ) border-box,
    var(--songbird-bezel-edge) border-box;
  border: 1px solid var(--songbird-bezel-border);
  border-radius: 999px;
  background: var(--songbird-bezel-background);
  color: var(--songbird-bezel-ink);
  transition-property: opacity, box-shadow, text-decoration-color;

  &:is(:disabled, [aria-disabled='true'], .disabled) {
    --songbird-bezel-fill: #34483e;
    --songbird-bezel-ink: #f1e4cc;
    cursor: not-allowed;
  }

  @media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
    &:not(:disabled, [aria-disabled='true'], .disabled, .loading) {
      @media (hover: hover) and (pointer: fine) {
        &:hover { animation: songbird-gold-bezel 900ms linear both; }
      }
      &:focus-visible { animation: songbird-gold-bezel 900ms linear both; }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    &:is(:hover, :focus-visible):not(:disabled, [aria-disabled='true'], .disabled, .loading) {
      --songbird-bezel-edge: linear-gradient(#f9d99e, #f9d99e);
    }
  }

  @media (forced-colors: active) {
    --songbird-bezel-border: ButtonText;
  }
}

body.songbird .sb-banner-copy .button > .ico {
  display: block;
  flex: 0 0 auto;
  color: #e2bb79;
}
