/**
 * Portfolio Terminal Styles
 */

/* Terminal Container */
#terminal-view {
	background: #0d1117;
	color: #c9d1d9;
	font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
	font-size: 14px;
	line-height: 1.5;
}

#terminal {
	height: 100%;
	width: 100%;
	padding: 16px;
	overflow-y: auto;
}

/* Output Area */
#terminal-output {
	white-space: pre-wrap;
	word-wrap: break-word;
}

.output-line {
	min-height: 1.5em;
}

.output-line.typing::after {
	content: '▋';
	animation: blink 1s step-end infinite;
}

/* Cursor styles based on settings */
#terminal[data-cursor-style='underline'] .output-line.typing::after {
	content: '_';
}

#terminal[data-cursor-style='bar'] .output-line.typing::after {
	content: '│';
}

/* No cursor blink */
#terminal.no-cursor-blink .output-line.typing::after {
	animation: none;
}

/* Input Line */
#terminal-input-line {
	display: flex;
	align-items: center;
	margin-top: 4px;
}

#terminal-input-line.hidden {
	display: none;
}

#terminal-prompt {
	color: #c9d1d9;
	margin-right: 8px;
	white-space: nowrap;
}

#input-wrapper {
	flex: 1;
	position: relative;
}

#terminal-input {
	width: 100%;
	background: transparent;
	border: none;
	outline: none;
	color: #c9d1d9;
	font-family: inherit;
	font-size: inherit;
	caret-color: #58a6ff;
}

#terminal-input::placeholder {
	color: #484f58;
}

/* Tab Completion Dropdown */
#tab-completion {
	position: absolute;
	bottom: 100%;
	left: 0;
	background: #161b22;
	border: 1px solid #30363d;
	border-radius: 6px;
	max-height: 200px;
	overflow-y: auto;
	z-index: 100;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#tab-completion.hidden {
	display: none;
}

.completion-item {
	padding: 6px 12px;
	cursor: pointer;
	white-space: nowrap;
}

.completion-item:hover,
.completion-item.selected {
	background: #21262d;
	color: #58a6ff;
}

/* ANSI Color Classes */
.bold {
	font-weight: bold;
}

.red {
	color: #f85149;
}

.green {
	color: #7ee787;
}

.yellow {
	color: #e3b341;
}

.blue {
	color: #58a6ff;
}

.magenta {
	color: #bc8cff;
}

.cyan {
	color: #39c5cf;
}

.white {
	color: #ffffff;
}

/* Background colors */
.bg-black {
	background: #0d1117;
}

.bg-red {
	background: #f85149;
	color: #0d1117;
}

.bg-green {
	background: #7ee787;
	color: #0d1117;
}

.bg-yellow {
	background: #e3b341;
	color: #0d1117;
}

.bg-blue {
	background: #58a6ff;
	color: #0d1117;
}

.bg-magenta {
	background: #bc8cff;
	color: #0d1117;
}

.bg-cyan {
	background: #39c5cf;
	color: #0d1117;
}

.bg-white {
	background: #ffffff;
	color: #0d1117;
}

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

/* Scrollbar Styling */
#terminal::-webkit-scrollbar {
	width: 8px;
}

#terminal::-webkit-scrollbar-track {
	background: #0d1117;
}

#terminal::-webkit-scrollbar-thumb {
	background: #30363d;
	border-radius: 4px;
}

#terminal::-webkit-scrollbar-thumb:hover {
	background: #484f58;
}

/* Selection */
#terminal-view ::selection {
	background: #264f78;
	color: #ffffff;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
	#terminal {
		font-size: 12px;
		padding: 12px;
	}

	#terminal-input-line {
		flex-wrap: wrap;
	}

	#terminal-prompt {
		font-size: 11px;
	}
}

/* bricks: the game drawn as text (public/portfolio-bricks.js) */
.bricks {
	position: relative;
	white-space: pre;
	line-height: 1.5;
	user-select: none;
	-webkit-user-select: none;
	/* Dragging moves the paddle rather than scrolling the page */
	touch-action: none;
	outline: none;
	cursor: default;
}

/* Drawn over the text on its character grid: bricks with exact edges, and the
   ball and paddle moved with transforms, so they glide rather than jump a
   character at a time */
/* A brick is its row's colour (--brick) with a lit top edge and a shaded bottom,
   so it reads as a raised tile */
.bricks-brick {
	position: absolute;
	border-radius: 3px;
	background: var(--brick);
	box-shadow:
		inset 0 2px 0 rgba(255, 255, 255, 0.4),
		inset 0 -2px 0 rgba(0, 0, 0, 0.3);
	transition:
		transform 0.18s ease-in,
		opacity 0.18s ease-in;
}

/* Steel takes two hits: brushed grey, with a crack after the first */
.bricks-brick.steel {
	background: linear-gradient(180deg, #d0d7de, #8c959f);
}

.bricks-brick.cracked::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(115deg, transparent 44%, rgba(13, 17, 23, 0.7) 46%, rgba(13, 17, 23, 0.7) 50%, transparent 52%);
}

.bricks-brick.broken {
	transform: scale(0.3) rotate(10deg);
	opacity: 0;
}

.bricks-ball,
.bricks-paddle {
	position: absolute;
	top: 0;
	left: 0;
	will-change: transform;
	pointer-events: none;
}

/* The ball, and the balls left in the status line, are the same round light */
.bricks-ball,
.bricks-life {
	width: var(--ball);
	height: var(--ball);
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}

.bricks-life {
	display: inline-block;
	margin-right: 5px;
	vertical-align: -0.1em;
}

@media (prefers-reduced-motion: reduce) {
	.bricks-brick {
		transition: none;
	}
}

.bricks-paddle {
	border-radius: 3px;
	background: #39c5cf;
}

.bricks .dim {
	color: #6e7681;
}

.bricks-key {
	padding: 0;
	border: 0;
	background: none;
	color: #58a6ff;
	font: inherit;
	cursor: pointer;
}

.bricks-key:hover {
	text-decoration: underline;
}

/* Links in output */
#terminal-output a {
	color: #58a6ff;
	text-decoration: none;
}

#terminal-output a:hover {
	text-decoration: underline;
}
