/* CSS Reset by Josh W. Comeau */
/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* 2. Remove default margin */
* {
	margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
	html {
		interpolate-size: allow-keywords;
	}
}

body {
	/* 4. Add accessible line-height */
	line-height: 1.5;
	/* 5. Improve text rendering */
	-webkit-font-smoothing: antialiased;
	background-color: var(--color-bg);
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
	font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
	text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
	text-wrap: balance;
}

/* 10. Create a root stacking context */
#root,
#__next {
	isolation: isolate;
}

/* End of CSS reset*/

/* Initial styles */

html[data-theme="dark"] {
	/* Colors (dark mode) */
	--bg-base-primary: #1a1a1a;
	--bg-base-secondary: rgb(78, 78, 78);
	--bg-base-tertiary: rgb(62, 61, 61);
	--bg-base-quaternary: rgb(46, 46, 46);
	--bg-primary: rgb(25, 90, 147);
	--bg-secondary: rgb(26, 71, 111);
	--bg-tertiary: rgb(21, 55, 82);
	--fc-primary: whitesmoke;
	--grid-primary: rgb(209, 207, 207);
	--svg-invert:95%;
}

html[data-theme="light"] {
	/* Colors (light mode) */
	--bg-base-primary: #edebeb;
	--bg-base-secondary: rgb(181, 179, 179);
	--bg-base-tertiary: rgb(153, 152, 152);
	--bg-base-quaternary: rgb(123, 123, 123);
	--bg-primary: rgb(215, 73, 73);
	--bg-secondary: rgb(190, 54, 54);
	--bg-tertiary: rgb(161, 48, 48);
	--fc-primary: rgb(0, 0, 0);
	--grid-primary: rgb(57, 57, 57);
	--svg-invert:0%;
}

#app-shell {
	position: relative;

	width: 100%;
	min-width: 320px;
	max-width: 1920px;
	min-height: 100dvh;

	padding: clamp(6rem, 12vh, 15rem) 0;

	margin: 0 auto;

	background-color: var(--bg-base-primary);
}

#fixed-hud {
	position: fixed;
	display: flex;
	inset: 0;

	width: 100%;
	max-width: 1600px;
	padding: clamp(0.5rem, 1vw, 2rem);
	margin: 0 auto;

	z-index: 100;
	pointer-events: none;
}

/* End of initial styles */

/* Absolute / Fixed Elements */
#title {
	display: flex;
	justify-content: center;
	align-items: center;

	width: clamp(8.5rem, 19vw, 20rem);
	height: calc(2vw + 3.2rem);
	box-shadow: 0.45rem 0.45rem var(--bg-secondary),
		0.9rem 0.9rem 0 var(--bg-tertiary);

	font-size: clamp(1.3rem, 2.3vw, 3rem);
	font-weight: 550;
	font-family: "Doto";

	background-color: var(--bg-primary);
	color: whitesmoke;
}

#tools {
	display: grid;
	overflow: hidden;
	align-self: start;

	width: clamp(3.8rem, 5vw, 18rem);
	grid-template-rows: auto auto;
	box-shadow: -0.45rem 0.45rem var(--bg-base-tertiary),
		-0.9rem 0.9rem 0 var(--bg-base-quaternary);
	margin-left: auto;

	background-color: var(--bg-base-secondary);
	pointer-events: auto;
}

#tools-drawer{
	display:grid;

	transition: grid-template-rows 0.15s ease-in-out;
	grid-template-rows: 0fr;
}

#tools-drawer.tools-drawer-opened{
	grid-template-rows: 1fr;
}

#tools-drawer-content{
	overflow:hidden;
}

.tool-btn {
	display: grid;
	place-items: center;

	width:100%;
	box-sizing: border-box;
	padding: 20%;

	cursor:pointer;
}

.tool-btn img{
	filter:invert(var(--svg-invert));
}

#open-btn {
	background-color: var(--bg-base-secondary) !important;
}

#tool-color >*{
	grid-area: 1 / 1;
}

#tool-color-fill{
	background-color: #000000;
	border-radius: 50%;
	width:70%;
	aspect-ratio:1;
	z-index:1;
}

#tool-color img{
	z-index:0;
}

#tools input{
	width:100%;
	height:100%;
	inset:0;
	z-index:2;
	opacity:0;
	cursor:pointer;
}

/* End of Absolute / Fixed Elements */

/* Grid */

#grid {
	display: grid;
	justify-content: center;
	align-content: center;

	width: clamp(2rem, 93vw, 35rem);
	min-height: 19rem;
	max-height: 80dvh;
	padding: clamp(3rem, 12%, 5rem);
	margin: 0 auto;
	gap: 0;

	border: var(--grid-primary) 0.2rem solid;
	overflow:scroll;
}

.grid-item {
	aspect-ratio: 1;
	background-color: var(--grid-primary);

	user-select: none;
	touch-action: none;
	-webkit-user-select: none; /* For Safari */
}

/* End of Grid */

/* Debug */

*,
*::before,
*::after {
	/* outline: 2px solid lime; */
	/* background: hsl(0 100% 50% / .1); */
}

/* End of Debug */
