@import url("./units.css");

:root {
	--hue: 0;
	--primary: hsl(var(--hue), 75%, 45%);
	--primary-low: hsl(var(--hue), 75%, 40%);

	--green: hsl(113, 79%, 30%);
	--purple: hsl(273, 76%, 30%);

	--bg-surface: hsl(0, 0%, 100%);
	--bg-surface-low: hsl(0, 0%, 95%);
	--bg-surface-lower: hsl(0, 0%, 90%);
	--bg-surface-lowest: hsl(0, 0%, 85%);

	--border-radius-1: var(--u-2);
	--border-radius-2: var(--u-4);

	--text-primary: hsl(0, 0%, 0%);
	--text-invert: hsl(0, 0%, 100%);
}

* {
	margin: 0;
	padding: 0;
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--primary: hsl(var(--hue), 75%, 55%);
		--primary-low: hsl(var(--hue), 75%, 50%);

		--bg-surface: hsl(214, 12%, 10%);
		--bg-surface-low: hsl(214, 12%, 14%);
		--bg-surface-lower: hsl(214, 12%, 16%);
		--bg-surface-lowest: hsl(214, 12%, 18%);

		--text-primary: #ffffff;
		--text-invert: #ffffff;
	}
}

*::selection {
	background: var(--primary);
	color: var(--text-primary);
}

/* typography */

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--primary);
}

un {
	display: inline-block;
	text-decoration: underline;
	text-decoration-color: var(--primary);
	font-weight: 500;
	white-space: initial;
}

code,
pre {
	padding: 0.2rem;
	font-family: monospace;
	background: var(--bg-surface-lower);
	border-radius: var(--border-radius-1);
	box-shadow: 0 1px 1px var(--bg-surface-lowest);
	text-shadow: 0 1px var(--bg-surface);
}

pre {
	white-space: pre;
}

p,
span,
h1,
h2,
h3,
h4,
h5,
h6 {
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: initial;
}

ul {
	padding-left: 2.5rem;
}

li {
	padding-left: 1rem;
}

/* base */

body {
	height: 100vh;
	color: var(--text-primary);
	background: var(--bg-surface);
}

main {
	background: var(--bg-surface);
	max-width: 80ch;
	padding: 3em 1em;
	line-height: 1.5;
	margin: auto;
}

/* input */

input,
textarea,
[contenteditable="true"] {
	padding: 0.8rem;
	background: var(--bg-surface-low);
	transition: all 0.15s;
	outline: none;
	border: none;
	text-overflow: ellipsis;
}

input.match-button,
textarea.match-button,
[contenteditable="true"].match-button {
	padding: 0.4rem 0.8rem;
}

input:hover,
textarea:hover,
[contenteditable="true"]:hover {
	background: var(--bg-surface-lower);
}

input::placeholder,
textarea::placeholder {
	color: var(--text-primary);
}

input.errored,
textarea.errored,
[contenteditable="true"].errored {
	box-shadow: inset 0 0 0 2px var(--primary); /* inset border */
	animation: blink 0.5s ease-in-out 0s running;
}

@media (prefers-color-scheme: dark) {
	input,
	textarea,
	[contenteditable="true"] {
		color: var(--text-invert);
	}
}

.form-label {
	user-select: none;
	color: var(--primary-low);
	margin-bottom: var(--u-2);
	font-style: italic;
}

/* button */

button,
input[type="button"] {
	background: var(--primary);
	color: var(--text-invert);
	transition: all 0.15s;
	width: max-content;
	padding: 0.4rem 0.8rem;
	outline: none;
	border: none;
	cursor: pointer;
	font-weight: 600;
	display: flex;
	justify-content: center;
	align-items: center;
}

button:hover,
input[type="button"]:hover {
	background: var(--primary-low);
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
}

button.round {
	border-radius: var(--border-radius-1);
}

button.secondary {
	--border-size: 2px;
	background: var(--bg-surface);
	box-shadow: inset 0 0 0 var(--border-size) var(--primary); /* inset border */
	color: var(--text-primary);
}

button.secondary:hover {
	background: var(--primary-low);
	color: var(--text-invert);
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
}

button:disabled {
	opacity: 50%;
}

a {
	color: var(--primary);
	font-weight: 600;
	text-decoration: none;
}

a:hover {
	color: var(--primary-low);
	background: var(--primary);
	color: var(--text-invert);
}

a.doNotAddHover\!:hover {
	background: transparent;
}

/* card */

card {
	display: block;
	padding: 0.8rem;
	border: solid 1px var(--bg-surface-lower);
}

/* nav */

nav {
	/* position: fixed; */
	width: 100%;
	border-bottom: solid 1px var(--bg-surface-lower);
	display: flex;
	align-items: center;
	height: max-content;
	gap: var(--u-2);
	justify-content: space-between;
	flex-wrap: wrap;
}

nav button {
	height: 100%;
}

nav button:nth-child(1) {
	/* home button */
	width: var(--u-20); /* square */
	height: var(--u-20);
}

nav div:nth-child(1) {
	/* left */
	display: inherit;
	gap: inherit;
	align-items: inherit;
	height: inherit;
}

nav div:nth-child(2) {
	/* right */
	padding: 0 0.6rem;
	display: inherit;
	gap: inherit;
}

/* details element */

details {
	padding: 0.8rem;
	width: 100%;
	background: var(--bg-surface-low);
	border-radius: var(--border-radius-2);
}

details summary {
	display: flex;
	align-items: center;
	gap: var(--u-4);
	font-weight: 700;
	transition: all 0.15s;
	cursor: pointer;
	user-select: none;
}

details[open] summary {
	margin-bottom: var(--u-4);
	padding-bottom: var(--u-4);
	border-bottom: solid 1px var(--primary);
	color: var(--primary);
}

/* misc */

svg {
	fill: currentColor;
}

/* animations */

@keyframes blink {
	0% {
		opacity: 25%;
	}

	50% {
		opacity: 100%;
	}

	100% {
		opacity: 25%;
	}
}

@keyframes blinkAndTransform {
	0% {
		opacity: 25%;
		transform: scale(1);
	}

	50% {
		opacity: 100%;
		transform: scale(1.1);
	}

	100% {
		opacity: 25%;
		transform: scale(1);
	}
}
