<main>
	<button>Click me to toggle my styles</button>
</main>
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@700&display=swap');

:root {
	--primaryColour: hsla(4, 99%, 66%, 1);
	--secondaryColour: hsla(155, 61%, 51%, 1);
	--secondaryBackgroundColour: hsla(343, 6%, 21%, 1);
	--backgroundColour: hsla(207, 100%, 96%, 1);
}

* {
	box-sizing: border-box;
}

main {
	display: grid;
	place-content: center;
	min-height: 100vh;
	background-color: var(--backgroundColour);
	padding: 3em 5em;
}

button {
	font-family: 'Atkinson Hyperlegible', sans-serif;
	letter-spacing: -0.5px;
	font-size: 3rem;
	color: var(--primaryColour);
	background-color: var(--secondaryBackgroundColour);
	text-align: center;
	padding: 0.5em .75em;
	max-width: var(--maxWidth, 550px);
	cursor: pointer;
	border: 5px solid #000;
	transition: .25s ease-in-out background-color, .25s ease-in-out color, 1s cubic-bezier(0.68, -0.6, 0.32, 1.6) max-width;
}

button:hover {
	background-color: #000;
}

.add-styles {
	color: var(--secondaryColour, lightgreen);
}

@media (max-width: 425px) {
	button {
		font-size: 2.5rem;
	}
}
const button = document.querySelector("button");

button.addEventListener("click", (e) => {
  // button.classList.toggle("add-styles");
	if (button.style.getPropertyValue("--primaryColour")){
		button.style.removeProperty('--primaryColour');
		button.style.removeProperty('--maxWidth');
	} else {
		button.style.setProperty("--primaryColour", "hotpink");	
		button.style.setProperty("--maxWidth", "700px");		
	}
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.