/**
 * Copyright © Volker Schukai and all contributing authors, 2026. All rights reserved.
 * Node module: @schukai/monster
 *
 * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
 * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
 *
 * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
 * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
 * For more information about purchasing a commercial license, please contact Volker Schukai.
 */

import { addAttributeToken } from "../../dom/attributes.mjs";
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";

export { ButtonStyleSheet };

/**
 * @private
 * @type {CSSStyleSheet}
 */
const ButtonStyleSheet = new CSSStyleSheet();

try {
	ButtonStyleSheet.insertRule(
		`
@layer button {
button{background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1)}.monster-button-primary,button{width:-webkit-fill-available;width:-moz-available;width:stretch;font-size:1rem;font-weight:400;line-height:1.5;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);box-shadow:var(--monster-box-shadow-1);padding:.375rem .75rem;outline:none;background-position:50%;position:relative;overflow:hidden;font-family:var(--monster-font-family),sans-serif;display:flex;align-items:center;justify-content:center;gap:.4rem}.monster-button-primary{color:var(--monster-color-primary-4);background-color:var(--monster-bg-color-primary-4);border-color:var(--monster-bg-color-primary-4)}.monster-button-secondary{border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);color:var(--monster-color-secondary-4);background-color:var(--monster-bg-color-secondary-4);border-color:var(--monster-bg-color-secondary-4)}.monster-button-secondary,.monster-button-tertiary{width:-webkit-fill-available;width:-moz-available;width:stretch;font-size:1rem;font-weight:400;line-height:1.5;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-shadow:var(--monster-box-shadow-1);padding:.375rem .75rem;outline:none;background-position:50%;position:relative;overflow:hidden;font-family:var(--monster-font-family),sans-serif;display:flex;align-items:center;justify-content:center;gap:.4rem}.monster-button-tertiary{border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);color:var(--monster-color-tertiary-4);background-color:var(--monster-bg-color-tertiary-4);border-color:var(--monster-bg-color-tertiary-4)}.monster-button-outline-primary{border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);color:var(--monster-bg-color-primary-4);background-color:var(--monster-color-primary-4);border-color:var(--monster-bg-color-primary-4)}.monster-button-outline-primary,.monster-button-outline-secondary{width:-webkit-fill-available;width:-moz-available;width:stretch;font-size:1rem;font-weight:400;line-height:1.5;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-shadow:var(--monster-box-shadow-1);padding:.375rem .75rem;outline:none;background-position:50%;position:relative;overflow:hidden;font-family:var(--monster-font-family),sans-serif;display:flex;align-items:center;justify-content:center;gap:.4rem}.monster-button-outline-secondary{border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);color:var(--monster-bg-color-secondary-4);background-color:var(--monster-color-secondary-4);border-color:var(--monster-bg-color-secondary-4)}.monster-button-outline-tertiary{width:-webkit-fill-available;width:-moz-available;width:stretch;font-size:1rem;font-weight:400;line-height:1.5;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-width:var(--monster-border-width);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);box-shadow:var(--monster-box-shadow-1);padding:.375rem .75rem;outline:none;background-position:50%;position:relative;overflow:hidden;font-family:var(--monster-font-family),sans-serif;display:flex;align-items:center;justify-content:center;gap:.4rem;color:var(--monster-bg-color-tertiary-4);background-color:var(--monster-color-tertiary-4);border-color:var(--monster-bg-color-tertiary-4)}button:hover{transition:background .8s,color .25s .0833333333s;box-shadow:var(--monster-box-shadow-2)}button:disabled{cursor:not-allowed}button:active{transition:background .8s,color .25s .0833333333s;box-shadow:var(--monster-box-shadow-2);z-index:var(--monster-z-index-outline)}.monster-button-bar,.monster-button-group{display:flex;justify-content:space-between;align-content:center;flex-wrap:nowrap;flex-direction:row;align-items:stretch}.monster-button-group{box-sizing:border-box;gap:0;margin:1rem 0}.monster-button-group>:not(:last-child){margin-right:calc(var(--monster-border-width)*-1)}.monster-button-group :hover{box-shadow:none}button:focus{outline:1px dashed var(--monster-color-selection-4);outline-offset:2px;z-index:var(--monster-z-index-outline)}@media (prefers-color-scheme:light){button:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:2px;z-index:var(--monster-z-index-outline)}}
}`,
		0,
	);
} catch (e) {
	addAttributeToken(
		document.getRootNode().querySelector("html"),
		ATTRIBUTE_ERRORMESSAGE,
		e + "",
	);
}
