:root {
	--ci-primary: var(--spark-color-primary, #09857c);
	--ci-primary-strong: var(--pst-color-secondary, #16cfb1);
	--ci-surface: var(--spark-color-page-background, #ffffff);
	--ci-panel: var(--spark-color-highlight-background, #f7f7f8);
	--ci-text: var(--pst-color-text-base, #1f2933);
	--ci-muted: var(--pst-color-text-muted, #5b6673);
	--ci-border: var(--pst-color-border, #d3dbe6);
	--ci-focus: var(--pst-color-secondary, #16cfb1);
	--ci-shadow: rgba(18, 36, 56, 0.12);
}

html[data-theme='dark'] {
	--ci-primary-strong: var(--pst-color-secondary, #5400c0);
	--ci-shadow: rgba(0, 0, 0, 0.35);
}

.component-index-container,
.component-index-container * {
	box-sizing: border-box;
}

.component-index-container {
	width: min(1200px, 100%);
	margin: 0 auto;
	padding: 16px;
	display: grid;
	gap: 16px;
	background: var(--ci-surface);
	color: var(--ci-text);
	position: relative;
	isolation: isolate;
}

.component-index-container h1 {
	margin: 0;
	font-size: 1.85rem;
	font-weight: 400;
	color: var(--ci-primary);
}

.component-index-filters {
	display: grid;
	gap: 12px;
	align-items: start;
	position: relative;
	z-index: 20;
}

.filter-group {
	display: grid;
	gap: 8px;
}

.component-filter-dropdown-row {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	align-items: stretch;
	position: relative;
}

.component-filter-dropdown {
	z-index: 30;
	display: flex;
	align-items: stretch;
	padding-bottom: 4px;
}

.component-filter-row-button {
	border: 1px solid var(--ci-primary);
	padding: 8px 12px;
	border-radius: 0;
	font: inherit;
	line-height: 1.2;
	height: 100%;
}

.component-filter-trigger {
	background: var(--ci-primary);
	color: #ffffff;
}

.component-filter-row-button:hover,
.component-filter-row-button:focus-visible {
	outline: none;
}

.component-filter-trigger:hover,
.component-filter-trigger:focus-visible,
.component-filter-dropdown--open .component-filter-trigger {
	background: var(--ci-primary-strong);
	border-color: var(--ci-primary-strong);
}

.component-filter-dropdown--open {
	padding-bottom: 0;
}

.component-filter-dropdown--open .component-filter-trigger {
	position: relative;
	z-index: 110;
	margin-bottom: 0;
	border-bottom-color: var(--ci-focus);
}

.component-filter-dropdown--open .component-filter-trigger::after {
	content: "";
	position: absolute;
	left: -1px;
	right: -1px;
	bottom: -1px;
	height: 2px;
	background: var(--ci-focus);
}

.component-filter-clear-action {
	margin-left: auto;
	background: transparent;
	color: var(--ci-primary);
	margin-bottom: 0;
}

.component-filter-clear-action:hover,
.component-filter-clear-action:focus-visible {
	background: var(--ci-panel);
	border-color: var(--ci-primary-strong);
}

.component-filter-options {
	position: absolute;
	z-index: 100;
	top: calc(100% - 1px);
	left: -1px;
	width: calc(100% + 2px);
	max-width: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 12px 14px;
	border: 1px solid var(--ci-primary-strong);
	border-top: 2px solid var(--ci-focus);
	border-radius: 0;
	background: var(--ci-surface);
	box-shadow: 0 8px 18px var(--ci-shadow);
}

.component-filter-options--multi-column {
	display: grid;
	grid-template-columns: repeat(var(--filter-columns, 2), 1fr);
	gap: 2px 16px;
	column-gap: 16px;
}

.component-filter-options--multi-column .component-filter-mode-control {
	grid-column: 1 / -1;
}

.component-filter-options[hidden] {
	display: none;
}

.component-filter-mode-control {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 0 8px 10px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--ci-border);
}

.component-filter-mode-toggle {
	display: flex;
	align-items: stretch;
	position: relative;
	justify-self: end;
	border: 1px solid var(--ci-primary);
	border-radius: 0;
	overflow: hidden;
	background: color-mix(in srgb, var(--ci-primary) 8%, var(--ci-surface));
}

.component-filter-mode-toggle::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 1px;
	background: color-mix(in srgb, var(--ci-primary) 35%, var(--ci-surface));
	pointer-events: none;
}

.component-filter-mode-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 0;
	min-width: 56px;
	padding: 4px 14px;
	border: none;
	background: transparent;
	color: var(--ci-primary);
	font: inherit;
	font-size: 0.82rem;
	cursor: pointer;
	line-height: 1.2;
	transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.component-filter-mode-btn--active {
	background: var(--ci-primary);
	color: #ffffff;
	border-radius: 0;
	box-shadow: inset 0 -1px 0 color-mix(in srgb, #000000 18%, transparent);
}

.component-filter-mode-btn:hover:not(.component-filter-mode-btn--active),
.component-filter-mode-btn:focus-visible:not(.component-filter-mode-btn--active) {
	background: color-mix(in srgb, var(--ci-primary) 16%, transparent);
	outline: none;
}

.component-filter-mode-helper {
	margin: 0;
	padding: 0;
	font-size: 0.78rem;
	color: var(--ci-muted);
	line-height: 1.4;
	font-style: italic;
	min-width: 0;
	white-space: normal;
}

.component-filter-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 8px;
	cursor: pointer;
}

.component-filter-option:hover {
	background: var(--ci-panel);
}

.component-filter-option input {
	margin: 0;
	margin-top: 0.15rem;
	accent-color: var(--ci-primary-strong);
}

.component-filter-option span {
	color: var(--ci-text);
	font-size: 0.95rem;
}

.filter-actions {
	display: flex;
}

.filter-actions:empty {
	display: none;
}

.component-sort-control {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	align-self: center;
}

.component-sort-control::after {
	content: "▾";
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-38%);
	font-size: 0.9rem;
	line-height: 1;
	color: var(--ci-muted);
	pointer-events: none;
}

.component-sort-label {
	color: var(--ci-muted);
	font-size: 0.78rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

#componentSearchFilter {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--ci-border);
	border-radius: 0;
	background: var(--ci-surface);
	color: var(--ci-text);
	font: inherit;
}

#componentSearchFilter:focus-visible {
	border-color: var(--ci-primary-strong);
	outline: none;
}

#componentSortOrder {
	min-width: 0;
	padding: 0 13px 1px 0;
	border: 0;
	border-bottom: 1px solid color-mix(in srgb, var(--ci-border) 78%, var(--ci-surface));
	border-radius: 0;
	background: transparent;
	color: var(--ci-muted);
	font: inherit;
	font-size: 0.88rem;
	cursor: pointer;
	appearance: none;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

#componentSortOrder:hover {
	border-bottom-color: color-mix(in srgb, var(--ci-border) 45%, var(--ci-primary));
	color: var(--ci-text);
}

#componentSortOrder:focus-visible {
	border-bottom-color: var(--ci-primary-strong);
	outline: none;
}

.component-index-results-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	position: relative;
	z-index: 1;
}

.component-index-results-summary {
	min-height: 1.5rem;
	color: var(--ci-muted);
	font-size: 0.95rem;
	position: relative;
	z-index: 1;
}

.component-index-components-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	position: relative;
	z-index: 1;
}

.component-item-tile {
	display: block;
	gap: 6px;
	padding: 8px 190px 32px 16px;
	position: relative;
	text-decoration: none;
	color: var(--ci-text);
	border: 1px solid var(--ci-border);
	border-radius: 0;
	background: var(--ci-panel);
	min-height: 100px;
}

.component-item-tile:hover,
.component-item-tile:focus-visible {
	background: color-mix(in srgb, var(--ci-panel) 75%, transparent);
	outline: none;
}

.component-item-title {
	display: inline;
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
}

.component-item-category {
	display: inline;
	margin: 0 0 0 0.5rem;
	font-size: 0.92rem;
	line-height: 1.3;
	color: var(--ci-muted);
}

.component-item-description {
	margin: 8px 0 0;
	font-size: 0.9rem;
	line-height: 1.4;
	color: var(--pst-color-text-muted);
}

.component-item-tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	position: absolute;
	top: 12px;
	right: 16px;
	min-width: 220px;
	max-width: calc(100% - 220px);
}

.component-item-tag {
	padding: 4px 10px;
	border: 1px solid color-mix(in srgb, var(--ci-primary) 28%, var(--ci-border));
	border-radius: 999px;
	font-size: 0.78rem;
	line-height: 1.2;
	letter-spacing: 0.01em;
	color: color-mix(in srgb, var(--ci-primary) 62%, var(--ci-text));
	background: color-mix(in srgb, var(--ci-primary) 9%, var(--ci-surface));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.component-item-read-more {
	position: absolute;
	bottom: 8px;
	right: 16px;
	font-size: 0.8rem;
	font-weight: 400;
	color: var(--ci-muted);
	opacity: 0.65;
	transition: opacity 0.2s ease, color 0.2s ease;
}

.component-item-tile:hover .component-item-read-more,
.component-item-tile:focus-visible .component-item-read-more {
	color: var(--ci-primary);
	opacity: 1;
}

.component-item-tile:hover .component-item-description,
.component-item-tile:focus-visible .component-item-description {
	color: var(--pst-color-text-base);
}

@media (max-width: 768px) {
	.component-index-container {
		padding: 12px;
		gap: 12px;
	}

	.component-index-components-grid {
		grid-template-columns: 1fr;
	}

	.component-item-tags {
		min-width: 0;
		max-width: calc(100% - 32px);
	}

	.component-filter-options {
		left: 0;
		width: 100%;
		padding: 12px;
	}

	.component-filter-options--multi-column {
		grid-template-columns: 1fr;
		gap: 2px;
		column-gap: initial;
	}

	.filter-actions {
		width: 100%;
	}

	.filter-actions button {
		width: 100%;
	}

	.component-index-results-bar {
		flex-wrap: wrap;
		align-items: flex-start;
	}

	.component-sort-control {
		width: 100%;
		justify-content: flex-end;
	}
}

