Dough Git

clove/web

src/lib/styles/search.css

back to src/lib/styles

/* src/lib/styles/search.css
 * DASL-1.2 — (c) Clove Twilight
 */

/* Header button */

.search-trigger {
	display: inline-flex;
	gap: 0.5rem;
	align-items: center;
	height: 2.25rem;
	padding: 0 0.6rem;
	border: 1px solid var(--line);
	border-radius: 0.6rem;
	background: var(--raised);
	color: var(--muted);
	font: inherit;
	font-size: 0.9rem;
	cursor: pointer;
}

.search-trigger:hover {
	border-color: var(--accent);
	color: var(--text);
}

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

.search-dialog kbd,
.search-trigger kbd {
	padding: 0.05rem 0.35rem;
	border: 1px solid var(--line);
	border-radius: 0.3rem;
	font-family: inherit;
	font-size: 0.75rem;
	line-height: 1.4;
}

/* Touch screens have no keyboard shortcut to show */
@media (max-width: 52rem), (pointer: coarse) {
	.search-shortcut {
		display: none;
	}

	.search-trigger {
		justify-content: center;
		width: 2.25rem;
		padding: 0;
	}
}

/* Palette */

.search-dialog {
	width: min(38rem, calc(100% - 2rem));
	max-height: min(32rem, calc(100% - 6rem));
	margin: 12vh auto auto;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 0.9rem;
	background: var(--bg);
	color: var(--text);
	/* Lives inside header nav, so undo its smaller text */
	font-size: 1rem;
	box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 60%);
}

.search-dialog::backdrop {
	background: rgb(0 0 0 / 55%);
	backdrop-filter: blur(2px);
}

.search-dialog[open] {
	animation: search-in 0.15s ease-out;
}

@keyframes search-in {
	from {
		opacity: 0;
		transform: translateY(-0.5rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.search-dialog[open] {
		animation: none;
	}
}

.search-box {
	display: flex;
	flex-direction: column;
	max-height: inherit;
}

.search-field {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var(--line);
}

.search-field-icon {
	width: 1.2rem;
	height: 1.2rem;
	flex-shrink: 0;
	color: var(--muted);
}

.search-field input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: 0;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 1.05rem;
}

.search-field input::-webkit-search-cancel-button {
	display: none;
}

.search-esc {
	color: var(--muted);
}

.search-note {
	margin: 0;
	padding: 1.25rem 1rem;
	color: var(--muted);
	text-align: center;
}

.search-results {
	flex: 1;
	margin: 0;
	padding: 0.4rem;
	overflow-y: auto;
	list-style: none;
}

.search-results:empty {
	display: none;
}

.search-result {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding: 0.55rem 0.7rem;
	border-radius: 0.55rem;
	color: var(--text);
	font-size: inherit;
	text-decoration: none;
}

.search-result.active {
	background: var(--accent-dim);
	color: #fff;
}

.search-kind {
	flex-shrink: 0;
	width: 4.2rem;
	color: var(--muted);
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.search-result.active .search-kind {
	color: var(--accent);
}

.search-text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.search-title,
.search-sub {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.search-sub {
	color: var(--muted);
	font-size: 0.82rem;
}

.search-external {
	color: var(--muted);
}

.search-help {
	display: flex;
	gap: 1rem;
	justify-content: flex-end;
	margin: 0;
	padding: 0.55rem 1rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.78rem;
}

.search-help kbd {
	margin-right: 0.2rem;
}

@media (pointer: coarse) {
	.search-help,
	.search-esc {
		display: none;
	}
}