/*
 * Mayflower Command Palette — frontend styles.
 *
 * Step 7: hint element + design tokens.
 * Step 8: overlay panel, list, items, section headers, open state.
 */

:root {
	--mcp-accent: #E8490F;
	--mcp-accent-soft: rgba( 232, 73, 15, 0.12 );
	--mcp-ink: #0F172A;
	--mcp-muted: #64748B;
	--mcp-rule: #E8E2D5;
	--mcp-bg-panel: #FFFFFF;
	--mcp-bg-overlay: rgba( 15, 23, 42, 0.45 );
}

/* ------------------------------------------------------------------ */
/* Hint (Step 7)                                                      */
/* ------------------------------------------------------------------ */

.mcp-hint {
	position: fixed;
	bottom: 20px;
	right: 24px;
	z-index: 99998;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: calc( 100vw - 48px );
	margin: 0;
	padding: 8px 12px;
	font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-size: 13px;
	line-height: 1.2;
	color: var( --mcp-ink );
	background: var( --mcp-bg-panel );
	border: 1px solid var( --mcp-rule );
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba( 15, 23, 42, 0.08 );
	cursor: pointer;
	opacity: 0;
	transform: translateY( 8px );
	transition: opacity 400ms ease, transform 400ms ease, box-shadow 120ms ease;
}

.mcp-hint.is-visible {
	opacity: 1;
	transform: translateY( 0 );
}

.mcp-hint:hover {
	box-shadow: 0 4px 14px rgba( 15, 23, 42, 0.12 );
}

.mcp-hint:focus-visible {
	outline: 2px solid var( --mcp-accent );
	outline-offset: 2px;
}

.mcp-hint-text-before,
.mcp-hint-text-after {
	color: var( --mcp-muted );
	white-space: nowrap;
}

.mcp-kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	padding: 2px 6px;
	font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1;
	color: var( --mcp-ink );
	background: #F4F1EA;
	border: 1px solid var( --mcp-rule );
	border-radius: 3px;
}

.mcp-hint-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-left: 4px;
	padding: 0;
	font: inherit;
	font-size: 14px;
	color: var( --mcp-muted );
	background: transparent;
	border: 0;
	border-radius: 3px;
	cursor: pointer;
	transition: color 80ms ease, background 80ms ease;
}

.mcp-hint-close:hover {
	color: var( --mcp-ink );
	background: var( --mcp-accent-soft );
}

.mcp-hint-close:focus-visible {
	outline: 2px solid var( --mcp-accent );
	outline-offset: 1px;
}

/* ------------------------------------------------------------------ */
/* Palette overlay + panel (Step 8)                                   */
/* ------------------------------------------------------------------ */

body.mcp-open {
	overflow: hidden;
}

.mcp-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	background: var( --mcp-bg-overlay );
	opacity: 0;
	transition: opacity 120ms ease;
}

@supports ( backdrop-filter: blur( 4px ) ) {
	.mcp-overlay {
		backdrop-filter: blur( 4px );
	}
}

.mcp-overlay.is-open {
	display: block;
	opacity: 1;
}

.mcp-panel {
	position: fixed;
	top: 20vh;
	left: 50%;
	width: calc( 100% - 32px );
	max-width: 560px;
	transform: translate( -50%, -8px );
	background: var( --mcp-bg-panel );
	border: 1px solid var( --mcp-rule );
	border-radius: 12px;
	box-shadow:
		0 30px 80px rgba( 15, 23, 42, 0.25 ),
		0 10px 30px rgba( 15, 23, 42, 0.12 );
	overflow: hidden;
	opacity: 0;
	transition: opacity 120ms ease, transform 180ms ease;
}

.mcp-overlay.is-open .mcp-panel {
	transform: translate( -50%, 0 );
	opacity: 1;
}

.mcp-input-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border-bottom: 1px solid var( --mcp-rule );
}

.mcp-input-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var( --mcp-muted );
	font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
	font-size: 14px;
}

.mcp-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	font-family: 'Iowan Old Style', 'Newsreader', Georgia, serif;
	font-size: 20px;
	line-height: 1.3;
	color: var( --mcp-ink );
	background: transparent;
	border: 0;
	outline: none;
	box-shadow: none;
}

.mcp-input::placeholder {
	color: var( --mcp-muted );
}

.mcp-list {
	max-height: 60vh;
	margin: 0;
	padding: 6px 0;
	overflow-y: auto;
	list-style: none;
}

.mcp-section-header {
	padding: 10px 18px 4px;
	font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --mcp-muted );
}

.mcp-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 18px;
	font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
	color: var( --mcp-ink );
	cursor: pointer;
	transition: background 80ms ease;
}

.mcp-item:hover,
.mcp-item.active {
	background: var( --mcp-accent-soft );
}

.mcp-item-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
	font-size: 13px;
	font-weight: 600;
	color: #FFFFFF;
	background: linear-gradient( 135deg, #E8490F, #A03209 );
	border-radius: 6px;
	text-transform: uppercase;
}

.mcp-item-text {
	flex: 1 1 auto;
	min-width: 0;
}

.mcp-item-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mcp-item-desc {
	margin-top: 2px;
	font-size: 12px;
	line-height: 1.3;
	color: var( --mcp-muted );
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mcp-item-shortcut {
	flex: 0 0 auto;
	margin-left: 8px;
	padding: 2px 6px;
	font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
	font-size: 12px;
	color: var( --mcp-muted );
	background: #F4F1EA;
	border: 1px solid var( --mcp-rule );
	border-radius: 3px;
}

.mcp-empty {
	padding: 18px;
	font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-size: 13px;
	color: var( --mcp-muted );
	text-align: center;
	list-style: none;
}

/* ------------------------------------------------------------------ */
/* Responsive + reduced-motion                                        */
/* ------------------------------------------------------------------ */

@media ( max-width: 768px ) {
	.mcp-hint {
		display: none;
	}

	.mcp-panel {
		top: 10vh;
		width: calc( 100% - 16px );
	}

	.mcp-input {
		font-size: 18px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.mcp-hint,
	.mcp-hint-close,
	.mcp-overlay,
	.mcp-panel,
	.mcp-item {
		transition-duration: 0ms;
		transition-delay: 0ms;
		animation-duration: 0ms;
		animation-delay: 0ms;
	}

	.mcp-hint,
	.mcp-hint.is-visible {
		transform: none;
	}

	.mcp-panel,
	.mcp-overlay.is-open .mcp-panel {
		transform: translate( -50%, 0 );
	}
}

.mcp-item:focus-visible {
	outline: 2px solid var( --mcp-accent );
	outline-offset: -2px;
}
