/* synced from Figma node 8798:3990 · source-hash f127ad58 · edits are overwritten: change Figma or plugins/fundamental-ui-design-ops/component-notes/Button.md */
/* Product Components / Button - the unified pill button (shadcn/ui variants and sizes).
   Needs tokens.css. */

/* Size=default. Figma's symbols include the stroke in the layout: padding is the full
   spacing token and a variant's border adds to it, so outline and destructive are 2
   wider than default, glass 4. */
.fd-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fd-spacing-2);
    box-sizing: border-box;
    height: 44px; /* figma: unbound */
    margin: 0;
    padding: 0 var(--fd-spacing-5);
    border: 0;
    border-radius: var(--fd-radius-full);
    background: transparent;
    font-family: var(--fd-text-v4-product-label-14-family);
    font-size: var(--fd-text-v4-product-label-14-size);
    font-weight: var(--fd-text-v4-product-label-14-weight);
    line-height: var(--fd-text-v4-product-label-14-line-height);
    letter-spacing: var(--fd-text-v4-product-label-14-letter-spacing);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

/* Size=sm: the default's label, a shorter frame and tighter padding */
.fd-button--sm {
    height: 36px; /* figma: unbound */
    padding-inline: var(--fd-spacing-4);
}

/* Size=lg: Aeonik Regular 16 at line height 1.5, which matches no text style */
.fd-button--lg {
    height: 52px; /* figma: unbound */
    padding-inline: var(--fd-spacing-6);
    font-family: var(--fd-primary-font-primary-family);
    font-size: 16px; /* figma: unbound */
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
}

/* Size=xl (hero only): Aeonik Regular 36 at a 44 line height, which matches no text
   style, and icons of 32 */
.fd-button--xl {
    gap: 12px; /* figma: unbound */
    height: 92px; /* figma: unbound */
    padding-inline: 48px; /* figma: unbound */
    font-family: var(--fd-primary-font-primary-family);
    font-size: 36px; /* figma: unbound */
    font-weight: 400;
    line-height: 44px; /* figma: unbound */
    letter-spacing: 0;
}

/* Size=icon-sm, icon, icon-lg: square, icon only */
.fd-button.fd-button--icon-sm {
    width: 36px; /* figma: unbound */
    height: 36px; /* figma: unbound */
    padding: 0;
}

.fd-button.fd-button--icon {
    width: 44px; /* figma: unbound */
    height: 44px; /* figma: unbound */
    padding: 0;
}

.fd-button.fd-button--icon-lg {
    width: 52px; /* figma: unbound */
    height: 52px; /* figma: unbound */
    padding: 0;
}

/* Variant=default: solid primary */
.fd-button--default {
    background: var(--fd-primary);
    color: var(--fd-primary-foreground);
}

/* Variant=outline: a border, no fill */
.fd-button--outline {
    border: var(--fd-border-1) solid var(--fd-archive-border-strong);
    color: var(--fd-foreground);
}

/* Variant=ghost: no chrome */
.fd-button--ghost {
    color: var(--fd-muted-foreground);
}

/* Variant=destructive: destructive text and border, never a red fill */
.fd-button--destructive {
    border: var(--fd-border-1) solid var(--fd-destructive);
    color: var(--fd-destructive);
}

/* Variant=glass: translucent fill, a glass border of 2 (unbound in Figma, equal to
   border/2) and the button blur (effect "Buttons/Button - Default"; never Glass Blur) */
.fd-button--glass {
    border: var(--fd-border-2) solid var(--fd-archive-glass-border);
    background: var(--fd-archive-glass);
    -webkit-backdrop-filter: var(--fd-button-blur);
    backdrop-filter: var(--fd-button-blur);
    color: var(--fd-archive-glass-foreground);
}

/* Variant=link: text only, no padding and no stroke */
.fd-button.fd-button--link {
    padding-inline: 0;
    color: var(--fd-archive-link);
}

/* "NEXUS" inside a string label: always Druk Wide Medium (Brand & Design), from the
   Secondary Font family, at the label's size, line height and letter spacing */
.fd-button__nexus {
    font-family: var(--fd-secondary-font);
    font-weight: 500; /* Secondary Font/secondary-medium ("Medium") */
    text-transform: uppercase;
}

.fd-button__icon {
    display: inline-flex;
    flex: none;
}

/* Icons take the label's colour (currentColor). The Icon set draws Lucide at 16 with a
   border/icon stroke; Lucide draws on a 24-unit grid, so the stroke is scaled by 24/16 */
.fd-button__icon svg {
    width: 16px; /* figma: unbound */
    height: 16px; /* figma: unbound */
    stroke-width: calc(var(--fd-border-icon) * 24 / 16);
}

.fd-button--xl .fd-button__icon svg {
    width: 32px; /* figma: unbound */
    height: 32px; /* figma: unbound */
}

/* State=hover, default: primary-hover fill and a soft Indigo 500 glow */
.fd-button--default:hover:not(:disabled),
.fd-button--default[data-state="hover"]:not(:disabled) {
    background: var(--fd-archive-primary-hover);
    box-shadow: 0 0 24px color-mix(in srgb, var(--fd-earlier-palette-indigo-500) 35%, transparent); /* figma: unbound */
}

/* State=hover, outline and ghost: the muted fill and the button blur */
.fd-button--outline:hover:not(:disabled),
.fd-button--outline[data-state="hover"]:not(:disabled),
.fd-button--ghost:hover:not(:disabled),
.fd-button--ghost[data-state="hover"]:not(:disabled) {
    background: var(--fd-muted);
    -webkit-backdrop-filter: var(--fd-button-blur);
    backdrop-filter: var(--fd-button-blur);
}

/* Ghost's label and icon turn from muted-foreground to foreground */
.fd-button--ghost:hover:not(:disabled),
.fd-button--ghost[data-state="hover"]:not(:disabled) {
    color: var(--fd-foreground);
}

/* State=hover, destructive: Figma's "Wash", the destructive colour at 10% over the whole
   pill, border included */
.fd-button--destructive:hover:not(:disabled),
.fd-button--destructive[data-state="hover"]:not(:disabled) {
    background: color-mix(in srgb, var(--fd-destructive) 10%, transparent);
}

/* State=hover, glass: the glass-hover fill and effect "Buttons/Button - Hover", an inner
   highlight */
.fd-button--glass:hover:not(:disabled),
.fd-button--glass[data-state="hover"]:not(:disabled) {
    background: var(--fd-archive-glass-hover);
    box-shadow: var(--fd-button-glow-hover);
}

/* State=hover, link: an underline in the link colour, 1 under the label (border/2 thick at xl) */
.fd-button--link:hover:not(:disabled) .fd-button__label,
.fd-button--link[data-state="hover"]:not(:disabled) .fd-button__label {
    padding-bottom: 1px; /* figma: unbound */
    border-bottom: var(--fd-border-1) solid var(--fd-archive-link);
}

.fd-button--link.fd-button--xl:hover:not(:disabled) .fd-button__label,
.fd-button--link.fd-button--xl[data-state="hover"]:not(:disabled) .fd-button__label {
    border-bottom-width: var(--fd-border-2);
}

.fd-button:focus-visible {
    outline: var(--fd-border-2) solid var(--fd-focus-ring-color);
    outline-offset: var(--fd-focus-ring-offset);
}

/* Disabled is not a variant in Figma: the whole button dims and shows no hover */
.fd-button:disabled {
    opacity: var(--fd-disabled-opacity);
    cursor: not-allowed;
}
