
#projects {
	display: grid;
	position: relative;

	grid-template-columns: repeat(3, 1fr);
	gap: 5px;

	padding: 3px;

	perspective: 800px;

	transition: background-color 2s;
}

#projects > #gamespace {
	height: 0;
	grid-column: span 3;

	transition: height 2s;
}

#projects.active > #gamespace {
	height: 6em;
	grid-column: span 3;
}

#projects.active {
	background-color: black;
}

#projects.active .brick {
	animation: flip 1s;
	animation-fill-mode: both;
}

@keyframes flip {
	to {
		transform: rotateY(180deg);
	}
}

@keyframes unflip {
	from {
		transform: rotateY(180deg);
	}
	to {
		transform: rotateY(0deg);
	}
}

#projects .brick {
	position: relative;
	visibility: visible;

	height: 6em;

	transform-style: preserve-3d;

	animation: unflip 1s;
	animation-fill-mode: both;
}

#projects .brick .front {
	border: none;

	background-color: black;
	background-size: 100%;
	background-repeat: no-repeat;

	cursor: pointer;

	transition: background-size 500ms;
}

#projects .brick .front, #projects .brick .front::before, #projects .brick .back, #projects .brick .back::before {
	backface-visibility: hidden;
}

#projects .brick .front::before {
	content: attr(alt);

	position: absolute;
	left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);

	padding: 5px;

	color: var(--main-color);
	background-color: rgba(0, 0, 0, 0.75);

	border-radius: 6px;

	white-space: nowrap;

	transition: font-size 500ms, background-color 500ms;
}

#projects .brick .front:hover, #projects .brick .front:focus {
	background-size: 120%;
}

#projects .brick .front:hover::before, #projects .brick .front:focus::before {
	font-size: 1.5em;
	background-color: black;
}

#projects .brick .front {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

#projects .brick .back {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;

	background-color: red;

	transform: rotateY(180deg);
}

#projects .brick[broken="true"] .back {
	position: absolute;
	top: 0;
	left: 0;
	width: calc(100% - 9px);
	height: calc(100% - 9px);

	border: 4px dashed rgba(255, 255, 255, 0.089);
	background-color: transparent !important;

	transform: rotateY(180deg);
}

dialog {
	max-width: 70vw;
	min-width: 40vw;

	max-height: 90vh;
	min-height: 30vh;

	font-size: 1.1em;

	color: var(--main-color);
	background: var(--background-color);
	
	border: 10px solid black;
	box-shadow: 10px 10px 2px black;
	outline-width: 3px;
}

dialog #dialogbody {
	padding: 10px;
	margin-bottom: calc(5em + 10px);
}

dialog h3 a::after {
	content: "___";
	mask: url("/asset/newtab.svg") center no-repeat;
	background: var(--accent-color-two);
	margin: 2px;
}

dialog form {
	position: absolute;

	bottom: 0px;
	left: 0px;
	width: calc(100% - 20px);
	height: 5em;

	padding: 10px;

	background: var(--accent-color-one);
}

dialog form button {
	width: min(350px, 100%);
	height: 100%;

	color: var(--main-color);
	background: var(--background-color);

	border: 3px solid black;
	outline-width: 3px;

	transition: background-color 300ms, color 300ms;
}

dialog form button:hover {
	color: var(--accent-color-one);
	background: var(--main-color);
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.25);
}

#breakoutbutton {
	margin-top: auto;
	margin-bottom: auto;

	color: var(--background-color);
	background-color: var(--main-color);

	border: none;
	font-size: 1.1em;
	text-decoration: none;
	padding: 5px;
	cursor: pointer;
}

#breakoutbutton:hover {
	background-color: var(--accent-color-one);
}

#breakoutbutton.active {
	background-color: var(--accent-color-two);
	cursor: not-allowed;
}

#bcanvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;

	opacity: 0;

	transition: opacity 1s;
}

#projects.active #bcanvas {
	opacity: 1;
}
