/*
 * JITS button: shortcode [jits_button] and Elementor “Button” widget.
 *
 * Colors come from CSS variables set in the theme (Appearance > Customize >
 * Buttons): --button-{style}-bg / -text / -border / -hover-bg. The fallbacks are
 * the defaults, so the button also works without the theme.
 */

.jits-button {
    --jits-button-bg: var(--button-primary-bg, #163cdb);
    --jits-button-text: var(--button-primary-text, #ffffff);
    --jits-button-border: var(--button-primary-border, #ffffff);
    --jits-button-hover-bg: var(--button-primary-hover-bg, #2f55f0);

    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: var(--jits-button-width, auto);
    min-height: 3rem;
    padding: 0.625rem 2.5rem;
    border: 1px solid var(--jits-button-bg);
    border-radius: 6px;
    background: var(--jits-button-bg);
    color: var(--jits-button-text);
    font-family: inherit;
    font-size: 1.125rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.jits-button--secondary {
    --jits-button-bg: var(--button-secondary-bg, #ffffff);
    --jits-button-text: var(--button-secondary-text, #0e1b57);
    --jits-button-border: var(--button-secondary-border, #0e1b57);
    --jits-button-hover-bg: var(--button-secondary-hover-bg, #e6e9f5);
}

.jits-button--danger {
    --jits-button-bg: var(--button-danger-bg, #ff1a1a);
    --jits-button-text: var(--button-danger-text, #ffffff);
    --jits-button-border: var(--button-danger-border, #ffffff);
    --jits-button-hover-bg: var(--button-danger-hover-bg, #e00000);
}

.jits-button--bold {
    font-weight: 700;
}
.jits-button--normal {
    font-weight: 400;
}
.jits-button--thin {
    font-weight: 300;
}

/* Solid (default) and outline: hover background. */
a.jits-button:hover,
a.jits-button:focus-visible {
    border-color: var(--jits-button-hover-bg);
    background: var(--jits-button-hover-bg);
    color: var(--jits-button-text);
}

/* Outline: background + border in the “border” color. */
.jits-button--outline,
a.jits-button--outline:hover,
a.jits-button--outline:focus-visible {
    border-color: var(--jits-button-border);
}

/* Transparent outline: no background, text and border in the “border” color; filled on hover. */
.jits-button--transparent {
    border-color: var(--jits-button-border);
    background: transparent;
    color: var(--jits-button-border);
}

a.jits-button--transparent:hover,
a.jits-button--transparent:focus-visible {
    border-color: var(--jits-button-border);
    background: var(--jits-button-border);
    color: var(--jits-button-bg);
}

a.jits-button:focus-visible {
    outline: 2px solid var(--jits-button-border);
    outline-offset: 3px;
}

/* Icon on the left: Iconify SVG (currentColor) or image. */
.jits-button__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    /* Fixed 1em box: an <img> carries its intrinsic width/height attributes, which
       would otherwise inflate the flex box (automatic minimum size). */
    width: 1em;
    height: 1em;
    font-size: 1.1em;
    line-height: 1;
}

.jits-button__icon svg,
.jits-button__icon img {
    display: block;
    flex: none;
    width: 1em;
    height: 1em;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}
