/* The rca_button() buttons (.rca-btn) and the older rounded buttons (.button--rounded). */

/*
 * Button. In PHP, use rca_button() with the class 'rca-btn'. It works on <a> and <button>.
 * Modifiers: rca-btn--arrow (chevron after the text) and rca-btn--back (grey, chevron before the text).
 * A section can set --rca-btn-height and --rca-btn-font-size, for example larger buttons on phones.
 */
.rca-btn {
	--rca-btn-bg: var(--rca-color-green);
	--rca-btn-bg-hover: var(--rca-color-green-dark);

	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: auto;
	height: var(--rca-btn-height, 28px);
	margin: 0;
	padding: 0 18px 1px;
	border: 0;
	border-radius: 4.5px;
	background: var(--rca-btn-bg);
	color: #fff;
	font-family: var(--rca-font);
	font-size: var(--rca-btn-font-size, 12px);
	font-weight: 500;
	line-height: 14px;
	letter-spacing: -0.12px;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	appearance: none;
	transition:
		background-color 150ms var(--rca-ease),
		opacity 200ms var(--rca-ease),
		transform 140ms var(--rca-ease-out);

	/* Resets the global a:hover and button:hover rules (colour, bold text, orange background). */
	&:hover,
	&:focus {
		background: var(--rca-btn-bg);
		color: #fff;
		font-weight: 500;
		text-decoration: none;
	}

	@media (hover: hover) and (pointer: fine) {
		&:not(:disabled):hover {
			background: var(--rca-btn-bg-hover);
		}
	}

	&:active:not(:disabled) {
		transform: scale(0.97);
	}

	&:focus-visible {
		outline: 2px solid var(--rca-color-navy);
		outline-offset: 2px;
	}

	&:disabled {
		opacity: 0.4;
		cursor: default;
	}
}

/* Chevron. Trasandina sits low in its line box, so the chevron moves down 1.5px to centre it on the lowercase letters. */
.rca-btn--arrow::after,
.rca-btn--back::before {
	content: "";
	width: 6px;
	height: 6px;
	border: solid currentColor;
	border-width: 1.5px 1.5px 0 0;
	transform: translate(var(--rca-chevron-shift, 0), 1.5px) rotate(var(--rca-chevron-angle, 45deg));
	transition: transform 200ms var(--rca-ease-out);
}

.rca-btn--arrow::after {
	margin-left: -2px;
}

.rca-btn--back {
	--rca-btn-bg: #aeb1b4;
	--rca-btn-bg-hover: #9a9ea2;

	&::before {
		--rca-chevron-angle: -135deg;
		margin-right: -2px;
	}
}

/* On hover, the chevron moves 2px in the direction it points. */
@media (hover: hover) and (pointer: fine) {
	.rca-btn--arrow:not(:disabled):hover {
		--rca-chevron-shift: 2px;
	}
	.rca-btn--back:not(:disabled):hover {
		--rca-chevron-shift: -2px;
	}
}

.button--rounded {
	text-align: center;
	background: var(--rca-color-cyan);
	border: 0;
	text-transform: none;
	color: #fff;
	padding: 9px 30px;
	border-radius: 30px;
	font-size: 18px;
	line-height: 20px;
	font-weight: normal;
}

.button--rounded:hover {
	background: rgb(151, 203, 24);
	font-weight: normal;
}
