/**
 * StockWP — Spotlight search overlay (Ctrl+K / topbar)
 * Loaded site-wide — not only on home.
 */

.swp-spotlight[hidden] {
	display: none !important;
}

.swp-spotlight {
	position: fixed;
	inset: 0;
	z-index: 200000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 10vh 1rem 2rem;
}

.swp-spotlight__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 12, 0.55);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.swp-spotlight__panel {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(100%, 36rem);
	max-height: min(72vh, 560px);
	overflow: hidden;
	border: 1px solid var(--swp-border);
	border-radius: 16px;
	background: var(--swp-bg-elevated);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	animation: swp-spotlight-panel-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes swp-spotlight-panel-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* PC Ctrl+K — centered */
.swp-spotlight[data-mode="center"] {
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.swp-spotlight[data-mode="center"] .swp-spotlight__panel {
	width: min(100%, 38rem);
	max-height: min(78vh, 580px);
}

/* PC click — expand in-place from the search bar (Magnific) */
.swp-spotlight[data-mode="anchor"] {
	padding: 0;
	align-items: flex-start;
	justify-content: flex-start;
}

.swp-spotlight[data-mode="anchor"] .swp-spotlight__panel {
	position: fixed;
	margin: 0;
	border-radius: 16px;
	overflow: hidden;
	animation: swp-spotlight-expand-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.swp-spotlight[data-mode="anchor"] .swp-spotlight__search {
	border-bottom-color: var(--swp-border);
	background: var(--swp-bg-elevated);
}

.swp-spotlight[data-mode="anchor"] .swp-spotlight__body {
	max-height: 24rem;
}

.swp-spotlight[data-mode="anchor"] .swp-spotlight__footer {
	display: flex;
}

/* Hide the static trigger while the live panel sits on top of it */
.swp-spotlight-trigger.is-spotlight-morphed,
.swp-topbar-search.is-spotlight-morphed {
	visibility: hidden;
	pointer-events: none;
}

@keyframes swp-spotlight-expand-in {
	from {
		opacity: 0.85;
		transform: scaleY(0.92);
		transform-origin: top center;
	}
	to {
		opacity: 1;
		transform: scaleY(1);
		transform-origin: top center;
	}
}

/* Mobile — fullscreen */
.swp-spotlight[data-mode="mobile"] {
	padding: 0;
	align-items: stretch;
	justify-content: stretch;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__backdrop {
	background: var(--swp-bg);
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__panel {
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
	animation: none;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__footer {
	display: none;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__kbd,
.swp-spotlight[data-mode="mobile"] .swp-spotlight__search-icon {
	display: none;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__back {
	display: inline-flex;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__search {
	padding: 0.85rem 1rem;
	padding-top: max(0.85rem, env(safe-area-inset-top));
}

.swp-spotlight__back {
	display: none;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 10px;
	background: transparent;
	color: var(--swp-text);
	cursor: pointer;
}

.swp-spotlight__back svg {
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.swp-spotlight__back:hover {
	background: var(--swp-bg-muted);
}

.swp-spotlight__search {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--swp-border);
}

.swp-spotlight__search-icon {
	display: inline-flex;
	color: var(--swp-text-muted);
}

.swp-spotlight__search-icon svg {
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.swp-spotlight__input {
	flex: 1;
	min-width: 0;
	height: 36px;
	border: none;
	background: transparent;
	color: var(--swp-text);
	font-family: var(--swp-font);
	font-size: 1rem;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.swp-spotlight__input::placeholder {
	color: var(--swp-text-muted);
}

.swp-spotlight__clear {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 999px;
	background: var(--swp-bg-muted);
	color: var(--swp-text-muted);
	cursor: pointer;
}

.swp-spotlight__clear[hidden] {
	display: none !important;
}

.swp-spotlight__clear:hover {
	background: var(--swp-border-strong);
	color: var(--swp-text);
}

.swp-spotlight__clear svg {
	stroke: currentColor;
	fill: none;
	stroke-width: 1.9;
	stroke-linecap: round;
}

.swp-spotlight[data-mode="mobile"] .swp-spotlight__clear {
	width: 32px;
	height: 32px;
}

.swp-spotlight__kbd {
	display: none;
	padding: 0.15rem 0.4rem;
	color: var(--swp-text-muted);
	font-size: 0.7rem;
	font-weight: 500;
}

@media (min-width: 640px) {
	.swp-spotlight__kbd {
		display: inline-block;
	}
}

.swp-spotlight__body {
	flex: 1;
	overflow: auto;
	padding: 0.65rem 0.5rem;
}

.swp-spotlight__heading {
	margin: 0.35rem 0.65rem 0.45rem;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--swp-text-muted);
}

.swp-spotlight__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.swp-spotlight__item {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	width: 100%;
	min-height: 48px;
	padding: 0.45rem 0.65rem;
	border: none;
	border-radius: 10px;
	background: transparent;
	color: var(--swp-text);
	font-family: var(--swp-font);
	font-size: 13px;
	font-weight: 500;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.swp-spotlight__item:hover,
.swp-spotlight__item.is-active {
	background: var(--swp-bg-muted);
	color: var(--swp-text);
}

.swp-spotlight__item-icon {
	display: inline-flex;
	flex: 0 0 40px;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	overflow: hidden;
	border-radius: 8px;
	background: var(--swp-bg);
	border: 1px solid var(--swp-border);
	color: var(--swp-text-muted);
}

.swp-spotlight__item-icon.has-thumb {
	border: none;
	background: transparent;
}

.swp-spotlight__item-icon img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border-radius: 8px;
	object-fit: cover;
}

.swp-spotlight__item-icon svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.swp-spotlight__item-text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 0.12rem;
}

.swp-spotlight__item-label {
	display: block;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
	color: var(--swp-text);
}

/* Suggestions: label is direct child (no text wrapper) */
.swp-spotlight__item > .swp-spotlight__item-label {
	flex: 1 1 auto;
	width: auto;
}

.swp-spotlight__item-version {
	display: block;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.25;
	color: var(--swp-text-muted);
}

.swp-spotlight__item-meta {
	flex: 0 0 auto;
	max-width: 35%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--swp-accent);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.25;
}

.swp-spotlight__empty {
	margin: 0.75rem 0.65rem;
	color: var(--swp-text-muted);
	font-size: 0.85rem;
}

.swp-spotlight__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.1rem;
	padding: 0.55rem 1rem;
	border-top: 1px solid var(--swp-border);
	color: var(--swp-text-muted);
	font-size: 0.7rem;
}

.swp-spotlight__footer kbd {
	display: inline-block;
	margin-right: 0.15rem;
	padding: 0.05rem 0.3rem;
	border-radius: 4px;
	border: 1px solid var(--swp-border);
	background: var(--swp-bg);
	font-family: var(--swp-font);
	font-size: 0.65rem;
}

body.swp-spotlight-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.swp-spotlight__panel {
		animation: none;
	}
}
