/**
 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */

:root {
	color-scheme: light;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	--bg: #fafafa;
	--surface: #fff;
	--surface-hover: #f5f5f5;
	--border: #e5e5e5;
	--border-strong: #d4d4d4;
	--text: #0a0a0a;
	--text-muted: #737373;
	--text-subtle: #a3a3a3;
	--accent: #171717;
	--accent-ring: rgb(23 23 23 / 10%);
	--search-match-background: #e6d3fa;
	--search-match-text: #480090;
	--favorites-surface: #f7f0ff;
	--favorites-border: #d9c2f0;
	--radius-lg: 12px;
	--radius-md: 8px;
	--radius-sm: 6px;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--text);
	font-size: 14px;
}

a {
	color: inherit;
}

::highlight(ckeditor5-manual-search-match) {
	background-color: var(--search-match-background);
	color: var(--search-match-text);
}

/* Application shell. */
.app {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px 80px;
}

.app__header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 32px 0 24px;
	background: linear-gradient(var(--bg) 80%, transparent);
	backdrop-filter: blur(8px);
}

.app__titles {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
}

.app__title {
	margin: 0;
	font-size: clamp(24px, 3vw, 32px);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.app__subtitle {
	margin: 0;
	font-size: 13px;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}

/* Search. */
.app__search {
	display: flex;
	align-items: center;
	height: 44px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	transition: border-color 0.12s, box-shadow 0.12s;
}

.app__search:focus-within {
	border-color: var(--border-strong);
	box-shadow: 0 0 0 4px var(--accent-ring);
}

.app__search-label {
	display: flex;
	align-items: center;
	align-self: stretch;
	flex: 1;
	min-width: 0;
	gap: 10px;
	padding: 0 10px 0 14px;
	cursor: text;
}

.app__search-icon,
.app__search-clear {
	flex-shrink: 0;
	color: var(--text-subtle);
}

.app__search-input {
	flex: 1;
	min-width: 0;
	font: inherit;
	font-size: 14px;
	color: var(--text);
	background: transparent;
	border: 0;
	outline: none;
	padding: 0;
}

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

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

.app__search-clear {
	margin-inline-end: 10px;
	padding: 6px;
	line-height: 0;
	background: none;
	border: 0;
	border-radius: var(--radius-sm);
	cursor: pointer;
}

.app__search-clear:hover {
	color: var(--text);
	background: var(--surface-hover);
}

.app__search:has(.app__search-input:placeholder-shown) .app__search-clear {
	visibility: hidden;
}

/* Catalog content. */
.app__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
	gap: 16px;
	align-items: start;
}

.app__empty {
	grid-column: 1 / -1;
	padding: 64px 24px;
	text-align: center;
	background: var(--surface);
	border: 1px dashed var(--border);
	border-radius: var(--radius-lg);
}

.app__empty-title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
}

.app__empty-hint {
	margin: 0;
	font-size: 13px;
	color: var(--text-muted);
}

/* Package cards. */
.pkg {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	transition: border-color 0.12s;
}

.pkg:hover {
	border-color: var(--border-strong);
}

.pkg__header {
	display: flex;
	align-items: center;
	padding: 12px 6px 12px 16px;
	border-bottom: 1px solid var(--border);
}

.pkg__header > * + * {
	margin-inline-start: 10px;
}

.pkg__name {
	flex: 1;
	min-width: 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pkg__count {
	flex: 0 0 38px;
	text-align: center;
	font-size: 12px;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}

.pkg__favorite,
.pkg__favorites-clear {
	flex-shrink: 0;
	line-height: 0;
	color: var(--text-subtle);
	background: none;
	border: 0;
	border-radius: var(--radius-sm);
	cursor: pointer;
}

/* Favorites card. */
.pkg--favorites,
.pkg--favorites:hover {
	border-color: var(--favorites-border);
}

.pkg--favorites .pkg__header {
	color: var(--search-match-text);
	background: var(--favorites-surface);
}

.pkg--favorites .pkg__name {
	font-family: inherit;
}

.pkg__favorites-icon {
	flex-shrink: 0;
}

.pkg__favorites-icon path,
.pkg__favorite-icon path {
	fill: none;
	stroke: currentColor;
	stroke-linejoin: round;
	stroke-width: 1.5px;
}

.pkg__favorites-icon path,
.favorite--active .pkg__favorite-icon path {
	fill: currentColor;
}

.pkg__favorites-clear {
	padding: 0;
}

.pkg__favorites-clear:hover {
	color: var(--text);
}

.pkg__favorites-clear:not([hidden]) + .pkg__count {
	margin-inline-start: 2px;
}

/* Package contents. */
.pkg__list {
	list-style: none;
	margin: 0;
	padding: 6px;
}

.pkg__favorites-empty {
	padding: 10px 12px;
	font-size: 12px;
	color: var(--text-muted);
}

.pkg__item {
	display: flex;
	align-items: center;
}

.pkg__link {
	display: flex;
	align-items: center;
	flex: 1;
	min-width: 0;
	gap: 12px;
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	text-decoration: none;
	color: inherit;
	transition: background 0.08s;
}

.pkg__link:hover {
	background: var(--surface-hover);
}

.pkg__test-name {
	flex: 1;
	min-width: 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pkg__favorite {
	padding: 11px;
}

.pkg__favorite:hover {
	color: var(--text);
	background: var(--surface-hover);
}

.pkg__favorite.favorite--active {
	color: var(--search-match-text);
}

.pkg__link:focus-visible,
.pkg__favorite:focus-visible,
.pkg__favorites-clear:focus-visible {
	outline: none;
	background: var(--surface-hover);
	box-shadow: inset 0 0 0 2px var(--border-strong);
}

@media (max-width: 600px) {
	.app {
		padding: 0 16px 48px;
	}

	.app__header {
		padding: 20px 0 16px;
	}

	.app__list {
		grid-template-columns: 1fr;
	}
}
