@charset "UTF-8";

/**
 * buttons.css 1.3.0 (wip)
 * Author: hybrid.
 * Type: core
 *
 * Button styles — .buttons a, .button, button, input[type=submit].
 * Nav-specific styles defined in navigations.css.
 * Form submit styles shared with forms.css via --button-* tokens.
 *
 * Sections
 * CONFIG     — button tokens
 * ANIMATIONS — button transitions
 * BUTTONS    — default, active and focus, sizes, hover (visuals on the element)
 * ANIMATED   — pointer to the optional buttons-animated.css (no code)
 * VARIATIONS — icons, in content
 *
 * Tokens
 * --button-text-color
 * --button-line-height
 * --button-background-color
 * --button-hover-text-color
 * --button-hover-background-color
 * --button-border-width
 * --button-border-color
 * --button-hover-border-color
 * --button-text-transform
 * --button-letter-spacing   optional, not declared (fallback: inherit)
 * --button-font-size
 * --button-font-weight
 * --button-padding-x
 * --button-padding-y
 * --button-radius
 * --button-focus-color
 *
 * Classes
 * .active (persistent state), .hover (touch)
 * .large, .small (on .nav, .buttons, .button or button: sets --button-font-size,
 *   inherited by the buttons inside)
 * .outline: tokens only (--button-border-width, --button-hover-border-color,
 *           --button-background-color), defined outside the core
 *
 * Dependencies
 * --font-size                     defined in reset.css
 * --font-weight-bold               defined in fonts.css
 * --focus-outline-width/-color     defined in reset.css (focus-visible)
 * --text-color, --background-color defined in colors.css (fallback provided)
 * --stroke-width                   defined in the core tokens (fallback provided)
 * --nav-anchor-gap                 defined in navigations.css
 * --nav-anchor-transition          defined in navigations.css
 *
 * Note
 * The BUTTONS block uses selector LISTS (comma), not :is() or :where(), to group
 * `:where(.buttons) a` / .button / button / input[type=submit]. A list keeps the native
 * specificity of each branch: `button` stays weak (0,0,1) and never threatens
 * third-party buttons (e.g. vLite). `:where(.buttons) a` has no specificity: core rules
 * stay overridable by the project, and ties with reset.css `a { padding: 0 }` and
 * navigations.css `:where(nav, .nav) a` are settled by load order.
 *
 * :is() takes the MAX and :where() ZERO of their arguments: mixing them with a bare
 * `button` breaks that balance one way or the other. `:where(.buttons) a` does not
 * depend on the wrapper element (nav, .nav, div) and has no specificity of its own:
 * anchor rules of navigations.css are also wrapped in :where(), so the tie is settled
 * by load order (reset.css, navigations.css, then buttons.css).
 *
 * .active is a persistent state independent of hover support: defined once, outside
 * media queries. :focus-visible (keyboard) takes the same look, plus the outline of FOCUS. The @media (hover: ...) blocks only handle real interaction:
 * :hover (mouse) and .hover (JS class, touch equivalent).
 *
 * Visuals: background and border live on the element itself, no pseudo-element
 * (::before and ::after are free for modules and projects). Border is an inset
 * box-shadow (no layout impact, no padding compensation): width and colors are
 * tokens, states redeclare the full box-shadow. `outline` is reserved for
 * :focus-visible (reset.css, transparent at rest = forced-colors fallback), the focus
 * state below only sets its color and offset, outside the button. A button.link / .links button
 * keeps the outline of reset.css (navigations.css). Effects (fill, slide, scale): see buttons-animated.css or write them
 * in project CSS.
 *
 * Owner of the submit background: buttons.css (forms.css sets none on submit).
 */



/* ================================================================================================== */
/* ============================================= CONFIG ============================================= */
/* ================================================================================================== */


/* ============================== DEFAULT ============================== */

:root {
	--button-text-color: var(--background-color, #FFF);
	--button-background-color: var(--text-color, #000);
	--button-hover-text-color: var(--text-color, #000);
	--button-hover-background-color: var(--background-color, #FFF);

	--button-border-width: 0px;
	--button-border-color: currentColor;
	--button-hover-border-color: currentColor;

	--button-font-size: calc(var(--font-size, 1rem) * .75);
	--button-font-weight: var(--font-weight-bold, bold);
	--button-line-height: 1;
	--button-text-transform: none;

	--button-padding-x: 1.5em;
	--button-padding-y: 1em;

	--button-radius: 0px;

	--button-focus-color: var(--text-color, currentColor); /* drawn outside the button: the button own text color would vanish on the page */
}



/* ====================================================================================================== */
/* ============================================= ANIMATIONS ============================================= */
/* ====================================================================================================== */

:where(.button),
button,
input[type=submit] { transition: var(--nav-anchor-transition); }

:where(.button)::before, :where(.button)::after,
button::before, button::after,
:where(.button) *,
button * { transition: inherit; }



/* =================================================================================================== */
/* ============================================= BUTTONS ============================================= */
/* =================================================================================================== */


/* ============================== DEFAULT ============================== */

/**
 * .buttons 			— button group wrapper (nav, .nav or any element)
 * a.button    			— anchor styled as button
 * button      			— button (form, collapsible, etc.)
 * input[type=submit] 	— form submit
 */


:where(.buttons) a,
.button,
button,
input[type=submit] {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--nav-anchor-gap);
	font-size: var(--button-font-size);
	line-height: var(--button-line-height);
	font-weight: var(--button-font-weight);
	letter-spacing: var(--button-letter-spacing, inherit);
	text-transform: var(--button-text-transform);
	text-decoration: none;
	white-space: nowrap;
	width: auto;
	padding-inline: var(--button-padding-x);
	padding-block: var(--button-padding-y);
	color: var(--button-text-color);
	background: var(--button-background-color);
	box-shadow: inset 0 0 0 var(--button-border-width) var(--button-border-color);
	border: 0;
	border-radius: var(--button-radius);
}

:where(.buttons) a *,
.button *,
button *,
input[type=submit] * { margin: 0; }

:where(.buttons) * + * { margin-top: 0; }


/* ============================== ACTIVE ============================== */

/* .active and :focus-visible share the hover look. The outline of FOCUS below stays the strong marker */
:where(.buttons) a.active,
:where(.buttons) a:focus-visible,
.button.active,
.button:focus-visible,
button.active,
button:focus-visible,
input[type=submit].active,
input[type=submit]:focus-visible {
	color: var(--button-hover-text-color);
	background: var(--button-hover-background-color);
	box-shadow: inset 0 0 0 var(--button-border-width) var(--button-hover-border-color);
}


/* ============================== FOCUS ============================== */

/* Buttons only: a button.link (or inside .links) keeps the outline of reset.css, like a nav anchor */
:where(.buttons) a:focus-visible,
.button:focus-visible,
button:not(.link, .links button):focus-visible,
input[type=submit]:focus-visible {
	--focus-outline-offset: var(--stroke-width, .125rem); /* outside the button, read by the reset.css rule */
	outline-color: var(--button-focus-color);
}


/* ============================== SIZES ============================== */

:where(.nav, .buttons, .button, button).large { --button-font-size: calc(var(--font-size, 1rem) * 1); }
:where(.nav, .buttons, .button, button).small { --button-font-size: calc(var(--font-size, 1rem) * .625); }


/* ============================== HOVER ============================== */

@media (hover: hover) {
	:where(.buttons) a:hover,
	.button:hover,
	button:hover,
	input[type=submit]:hover {
		color: var(--button-hover-text-color);
		background: var(--button-hover-background-color);
		box-shadow: inset 0 0 0 var(--button-border-width) var(--button-hover-border-color);
	}
}
@media (hover: none) {
	:where(.buttons) a.hover,
	.button.hover,
	button.hover,
	input[type=submit].hover {
		color: var(--button-hover-text-color);
		background: var(--button-hover-background-color);
		box-shadow: inset 0 0 0 var(--button-border-width) var(--button-hover-border-color);
	}
}



/* ==================================================================================================== */
/* ============================================= ANIMATED ============================================= */
/* ==================================================================================================== */

/**
 * Not in the core. Optional file: buttons-animated.css (load after buttons.css).
 * Adding .animated to a button moves its background and border to ::after,
 * so the fill can be animated (scale, slide, wipe) without moving the text.
 * Without that file, ::before and ::after are free for modules and projects.
 */



/* ====================================================================================================== */
/* ============================================= VARIATIONS ============================================= */
/* ====================================================================================================== */


/* ============================== ICONS ============================== */

[class^="icon-"].button {
	aspect-ratio: 1/1;
	height: auto;
}


/* ============================== IN CONTENT ============================== */

:where(h1, h2, h3, h4, h5, h6, p) .button { margin-top: 0; }