/* Fonts */
@font-face {
	font-family: 'IBMVGA8x16';
	src: url('../fonts/Web437_IBM_VGA_8x16.woff') format('woff');
	font-weight: normal;
	font-style: normal;
}

@font-face {
	font-family: 'IBMVGA8x16-2x';
	src: url('../fonts/Web437_IBM_VGA_8x16-2x.woff') format('woff');
	font-weight: normal;
	font-style: normal;
}

/* Base */
* {
	font-family: 'IBMVGA8x16', 'Consolas', monospace;
	image-rendering: pixelated;
}

html {
	-webkit-text-size-adjust: 100%;
	-moz-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

:root {
	/*--accent-color: #0f0;
  --accent-rgb: 0, 255, 0;
  */
	--accent-color: #b2b2b2;
	--accent-rgb: 178, 178, 178;
	--transition-speed: 0.2s;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	background-color: #000;
	color: #b2b2b2;
	/*font-family: 'Courier New', Courier, monospace;*/
	display: flex;
	justify-content: center;
	align-items: center;
	overflow: hidden;
}

/* Terminal styles */
#console-stack {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.window {
	min-width: 200px;
	position: relative;
	z-index: 1;
	width: 640px;
	height: 480px;
	background-color: #000;
	border: 2px solid var(--accent-color);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: border-color var(--transition-speed) ease;
}

canvas#pixels {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	transform-style: preserve-3d;
	will-change: transform;
	perspective: 800px;
}

.window::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	background: repeating-linear-gradient(
		to bottom,
		rgba(var(--accent-rgb), 0.04),
		rgba(var(--accent-rgb), 0.04) 2px,
		transparent 2px,
		transparent 5px
	);
}

#terminal {
	flex-grow: 1;
	overflow-y: auto;
	line-height: 1.5;
	margin-bottom: 0.5rem;
}

.welcome {
	line-height: 1;
}

div#output {
	white-space: pre-wrap;
}

.shake {
	animation: shake 0.4s ease;
}

::-webkit-scrollbar {
	width: 6px;
}

::-webkit-scrollbar-thumb {
	background-color: var(--accent-color);
	transition: background-color var(--transition-speed) ease;
}

/* Input */
#input-line {
	display: flex;
	align-items: center;
	cursor: text;
}

#prompt {
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	margin-right: 0.5rem;
	color: var(--accent-color);
	flex-shrink: 0;
	transition: color var(--transition-speed) ease;
}

#cursor {
	position: absolute;
	color: var(--accent-color);
	pointer-events: none;
	z-index: 0;
	visibility: hidden;
	vertical-align: top;
	transition: color var(--transition-speed) ease;
}

#cursor.block-cursor {
	width: 8px;
	height: 1em;
	background: var(--accent-color);
	color: transparent;
	content: '';
}

#input-wrapper {
	position: relative;
	display: inline-block;
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

#user-input {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	outline: none;
	color: #ccc;
	font-family: inherit;
	font-size: inherit;
	caret-color: transparent;
	position: relative;
	z-index: 1;
	white-space: pre;
	overflow: visible;
	width: auto;
	user-select: text;
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
}

/* Keyboard */
#keyboard {
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	display: none;
	flex-direction: column;
	width: 100%;
	gap: 6px;
	padding: 12px;
	background: #000;
	border: 2px solid rgb(var(--accent-rgb));
	font-family: inherit;
	box-sizing: border-box;
	transform: translateY(0%) scale(0.95);
	will-change: transform, opacity;
}

#keyboard .row {
	display: flex;
	gap: 6px;
	flex-wrap: nowrap;
	justify-content: space-between;
}

#keyboard .row:nth-child(1) {
	grid-template-columns: repeat(10, 1fr);
}

#keyboard .row:nth-child(2) {
	grid-template-columns: repeat(10, 1fr);
}

#keyboard .row:nth-child(3) {
	grid-template-columns: 1.5fr repeat(9, 1fr) 1.5fr;
}

#keyboard .row:nth-child(4) {
	grid-template-columns: repeat(8, 1fr);
}

#keyboard .row:nth-child(5) {
	grid-template-columns: 3fr 1.5fr;
}

.key {
	height: 38px;
	width: 43px;
	background: black;
	border: 1px solid rgba(var(--accent-rgb), 0.5);
	color: rgba(var(--accent-rgb), 0.8);
	font-size: 14px;
	padding: 10px 14px;
	text-align: center;
	cursor: pointer;
	user-select: none;
	transition: background var(--transition-speed), filter var(--transition-speed),
		box-shadow var(--transition-speed), border-color var(--transition-speed),
		color var(--transition-speed);
	min-width: 42px;
}

.key:hover {
	background: rgba(var(--accent-rgb), 0.1);
	color: rgba(var(--accent-rgb), 1);
}

.key.wide {
	width: 100px;
}

.key.extra-wide {
	width: 100%;
	text-align: center;
}

.key.active {
	background: rgba(var(--accent-rgb), 0.15);
	animation: textPhase 1.2s ease-in-out infinite;
}

.key.flash {
	animation: flash 0.3s ease;
}

#keyboard-trigger {
	width: 100%;
	height: 40px;
	border: 2px solid rgb(var(--accent-rgb));
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(var(--accent-rgb), 0.7);
	box-sizing: border-box;
	cursor: pointer;
	user-select: none;
	font-family: inherit;
	font-size: 20px;
	transition: background var(--transition-speed), filter var(--transition-speed),
		box-shadow var(--transition-speed), border-color var(--transition-speed),
		color var(--transition-speed);
}

#keyboard-trigger:hover {
	background: rgba(var(--accent-rgb), 0.1);
	color: rgba(var(--accent-rgb), 1);
}

/* Boot */
#boot-ui {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: flex-start;
	width: 100%;
	height: 100%;
	padding: 1rem;
	gap: 24px;
}

#boot-ui.accent-stripes::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	background: repeating-linear-gradient(
		to bottom,
		rgba(var(--accent-rgb), 0.04),
		rgba(var(--accent-rgb), 0.04) 2px,
		transparent 2px,
		transparent 5px
	);
}

#boot-text {
	color: var(--accent-color);
	font-size: 1rem;
	text-align: left;
	white-space: pre-wrap;
	max-width: 90vw;
}

#boot-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 1);
	z-index: 5;
	display: flex;
	justify-content: center;
	align-items: center;
	/*transition: opacity 0.5s ease;*/
}

#boot-overlay.hidden {
	opacity: 0;
	pointer-events: none;
}

#power-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: black;
	border: 2px dashed var(--accent-color);
	color: var(--accent-color);
	font-size: 1.5rem;
	text-transform: uppercase;
	cursor: pointer;
	z-index: 2;
	transition: all 0s !important;
	letter-spacing: 1.2px;
	box-shadow: inset 0 0 0 1px #000;
	padding: 6px;
	line-height: 1.8;
}

#power-button:hover {
	text-shadow: 0 0 6px var(--accent-color);
	filter: brightness(1.3);
	border-style: solid;
}

#power-button {
	opacity: 1;
	transition: opacity 0.4s ease;
}

#power-button.hidden {
	opacity: 0;
	pointer-events: none;
}

#skip-boot {
	position: absolute;
	bottom: 2rem;
	right: 1rem;
	opacity: 0.2;
	background: none;
	border: 1px solid #aaa;
	color: #aaa;
	padding: 0.25rem 0.75rem;
	font-size: 0.9rem;
	cursor: pointer;
	z-index: 5;
	transition: color 0.2s, border-color 0.2s;
}

#skip-boot:hover {
	color: white;
	border-color: white;
	opacity: 1;
}

/* Mobile Responsiveness WiP ;p
@media (max-width: 768px) {
	#console-stack {
		width: 100vw;
		height: 100vh;
		max-width: 100vw;
		max-height: 75vh;
		transform: translate(-50%, -50%);
		box-sizing: border-box;
		padding: 25px;
	}
	.window {
		width: 100%;
		height: 100%;
		max-height: 50vh;
		min-height: 50vh;
	}
	#keyboard-trigger {
		width: 100%;
	}
} 
*/

@media (max-width: 480px) {
	#console-stack {
		transform: translate(-50%, -50%) scale(0.5);
		transform-origin: center center;
		font-size: 150%;
	}
}

@media (min-width: 481px) and (max-width: 768px) {
	#console-stack {
		transform: translate(-50%, -50%) scale(0.5);
		transform-origin: center center;
		font-size: 150%;
	}
}

@media (min-width: 769px) and (max-width: 1024px) {
	#console-stack {
		transform: translate(-50%, -50%) scale(0.75);
		transform-origin: center center;
		font-size: 150%;
	}
}

/* Anims */
@keyframes blink {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0;
	}
}

@keyframes shake {
	0%,
	100% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(-4px);
	}
	50% {
		transform: translateX(4px);
	}
	75% {
		transform: translateX(-4px);
	}
}

@keyframes pulse {
	0% {
		box-shadow: 0 0 4px rgba(var(--accent-rgb), 0.4);
	}
	50% {
		box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
	}
	100% {
		box-shadow: 0 0 4px rgba(var(--accent-rgb), 0.4);
	}
}

@keyframes flash {
	0% {
		background-color: rgba(var(--accent-rgb), 0.3);
	}
	50% {
		background-color: rgba(var(--accent-rgb), 0.1);
	}
	100% {
		background-color: transparent;
	}
}

@keyframes textPhase {
	0%,
	100% {
		color: rgba(var(--accent-rgb), 1);
	}
	50% {
		color: rgba(var(--accent-rgb), 0.5);
	}
}
