/* shell/library.css — the Assets tab of the left panel (a component library, like Figma's), see assets/js/library.js
   and inc/library.php. The Layers tab is in layers.css. */

/* Tabs at the top of the panel */
.dba-panel__tabs {
	display: flex;
	flex: none;
	align-items: center;
	gap: 1.25rem;
	padding: 0 0.5rem 0.875rem;
	border-bottom: 1px solid var(--dba-line);
}

.dba-panel__tab {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--dba-muted);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

.dba-panel__tab:hover,
.dba-panel__tab.is-on {
	color: var(--dba-ink);
}

.dba-panel__lib,
.dba-panel__fold {
	width: 1.75rem;
	height: 1.75rem;
	color: var(--dba-muted);
}

.dba-panel__lib {
	margin-left: auto;
}

.dba-panel__tabs {
	gap: 1.25rem;
}

.dba-panel__lib + .dba-panel__fold {
	margin-left: -0.75rem; /* the two icons sit close together */
}

.dba-panel__lib .dba-icon,
.dba-panel__fold .dba-icon {
	width: 1.125rem;
	height: 1.125rem;
}

.dba-panel__lib:hover,
.dba-panel__fold:hover {
	color: var(--dba-ink);
}

.dba-panel__tabs + .dba-pane {
	padding-top: 0.875rem;
}

/* The two panes share the panel's height */
.dba-pane {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.dba-pane[hidden] {
	display: none;
}

.dba-panel__tabs + .dba-pane--assets {
	padding-top: 1.5rem; /* room above the search bar */
	padding-bottom: 1rem;
}

/* Search row stays put; the groups scroll under it */
.dba-assets__top {
	display: flex;
	flex: none;
	align-items: center;
	gap: 0.375rem;
	margin: 0 0.25rem;
}

.dba-assets__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.dba-assets__filter {
	flex: none;
	width: 2rem;
	height: 2rem;
	color: var(--dba-muted);
}

.dba-assets__filter:hover,
.dba-assets__filter[aria-expanded="true"] {
	color: var(--dba-ink);
}

.dba-assets__filter.is-active {
	color: var(--dba-accent);
}

.dba-assets__filter.is-active::before {
	content: "";
	position: absolute;
	top: 0.25rem;
	right: 0.25rem;
	width: 0.4rem;
	height: 0.4rem;
	border-radius: 50%;
	background: var(--dba-accent);
}

.dba-assets__filter .dba-icon {
	width: 1.125rem;
	height: 1.125rem;
}

.dba-assets__filters {
	display: flex;
	flex: none;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin: 0.75rem 0.25rem 0;
}

.dba-assets__filters[hidden] {
	display: none;
}

.dba-filterchip {
	padding: 0.25rem 0.6rem;
	border: 1px solid var(--dba-line);
	border-radius: 999px;
	background: transparent;
	color: var(--dba-ink-soft);
	font: inherit;
	font-size: 0.75rem;
	cursor: pointer;
}

.dba-filterchip:hover {
	color: var(--dba-ink);
}

.dba-filterchip.is-on {
	border-color: var(--dba-accent);
	background: var(--dba-accent-soft);
	color: var(--dba-accent);
	font-weight: 600;
}

/* Search */
.dba-assets__search {
	display: flex;
	flex: 1;
	min-width: 0;
	align-items: center;
	gap: 0.5rem;
	padding: 0 0.625rem;
	border: 1px solid transparent;
	border-radius: var(--dba-radius-s);
	background: var(--dba-canvas);
	color: var(--dba-muted);
}

.dba-assets__search:focus-within {
	border-color: var(--dba-accent);
}

.dba-assets__search .dba-icon {
	flex: none;
	width: 1.0625rem;
	height: 1.0625rem;
}

.dba-assets__search input {
	flex: 1;
	min-width: 0;
	padding: 0.55rem 0;
	border: 0;
	background: transparent;
	color: var(--dba-ink);
	font: inherit;
	font-size: 0.875rem;
	outline: none;
}

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

/* Breadcrumb: back arrow, "Created in this file", open group */
.dba-assets__crumb {
	display: flex;
	flex: none;
	align-items: center;
	gap: 0.25rem;
	margin: 0.875rem 0.25rem 0.625rem;
	color: var(--dba-ink);
	font-size: 0.875rem;
	font-weight: 600;
}

.dba-assets__back {
	display: grid;
	place-items: center;
	width: 1.25rem;
	height: 1.25rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--dba-ink);
	cursor: pointer;
}

.dba-assets__back[disabled] {
	color: var(--dba-line-strong, var(--dba-muted));
	opacity: 0.45;
	cursor: default;
}

.dba-assets__back .dba-icon {
	width: 1.125rem;
	height: 1.125rem;
}

.dba-assets__root {
	flex: none;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.8125rem;
	white-space: nowrap;
	cursor: pointer;
}

.dba-assets__sep {
	color: var(--dba-muted);
	font-weight: 400;
}

.dba-assets__cur {
	min-width: 0;
	overflow: hidden;
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.dba-pane--assets.is-open .dba-assets__root,
.dba-pane--assets.is-open .dba-assets__sep {
	display: none;
}

.dba-pane--assets.is-open .dba-assets__cur {
	font-size: 0.8125rem;
}

.dba-assets__crumb [hidden] {
	display: none;
}

/* Groups */
.dba-assets__groups {
	margin: 0;
	padding: 0;
	list-style: none;
}

.dba-group {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding: 0.375rem 0.25rem;
	border: 0;
	border-radius: var(--dba-radius-s);
	background: transparent;
	color: var(--dba-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.dba-group:hover {
	background: var(--dba-canvas);
}

.dba-group .dba-thumb {
	flex: none;
	width: 3.125rem;
	height: 3.125rem;
}

.dba-group__name {
	flex: 1;
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.dba-group__go {
	flex: none;
	width: 1rem;
	height: 1rem;
	color: var(--dba-muted);
}

/* Assets inside a group */
.dba-assets__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.625rem;
	margin: 0 0.25rem;
}

.dba-assets__grid[hidden] {
	display: none;
}

.dba-asset {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--dba-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.dba-asset .dba-thumb {
	width: 100%;
	height: 4.5rem;
	border: 1px solid transparent;
}

.dba-asset:hover .dba-thumb,
.dba-asset:focus-visible .dba-thumb {
	border-color: var(--dba-accent);
}

.dba-asset__name {
	font-size: 0.75rem;
	line-height: 1.25;
	color: var(--dba-ink-soft);
}

.dba-assets__empty {
	margin: 1rem 0.5rem;
	color: var(--dba-muted);
	font-size: 0.8125rem;
}

.dba-assets__empty[hidden] {
	display: none;
}

/* Search hides the group list and shows every asset that matches */
.dba-pane--assets.is-search .dba-assets__groups,
.dba-pane--assets.is-search .dba-assets__crumb {
	display: none;
}

.dba-pane--assets.is-search .dba-assets__grid:not([hidden]) {
	margin-bottom: 0.625rem;
}

/* ---- Thumbnails: small drawings of each component, three shapes each ---- */
.dba-thumb {
	position: relative;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: 0.375rem;
	background: var(--dba-canvas);
}

.dba-thumb i {
	display: block;
}

:root[data-theme="dark"] .dba-thumb {
	background: color-mix(in srgb, var(--dba-canvas), #fff 7%);
}

/* button: a solid pill */
.dba-thumb--btn i:nth-child(1) {
	width: 62%;
	height: 34%;
	border-radius: 999px;
	background: var(--dba-accent);
}

.dba-thumb--btn i:nth-child(2) {
	position: absolute;
	width: 28%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-accent-ink);
}

.dba-thumb--btn i:nth-child(3),
.dba-thumb--outline i:nth-child(3),
.dba-thumb--submit i:nth-child(3) {
	display: none;
}

/* outline button */
.dba-thumb--outline i:nth-child(1) {
	box-sizing: border-box;
	width: 62%;
	height: 34%;
	border: 1.5px solid var(--dba-ink);
	border-radius: 999px;
	background: var(--dba-surface);
}

.dba-thumb--outline i:nth-child(2) {
	position: absolute;
	width: 28%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-ink);
}

/* availability tag: green dot and a line */
.dba-thumb--tag {
	grid-auto-flow: column;
	gap: 0.3rem;
	justify-content: center;
}

.dba-thumb--tag i:nth-child(1) {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #22a45d;
	box-shadow: 0 0 0 3px rgb(34 164 93 / 0.2);
}

.dba-thumb--tag i:nth-child(2) {
	width: 46%;
	height: 5px;
	border-radius: 3px;
	background: var(--dba-ink-soft);
}

.dba-thumb--tag i:nth-child(3) {
	display: none;
}

/* heading: "Aa" in the display font */
.dba-thumb--heading i:nth-child(1)::before {
	content: "Aa";
	color: var(--dba-ink);
	font-family: var(--dba-font-display);
	font-size: 1.5rem;
	line-height: 1;
}

.dba-thumb--heading i:nth-child(n+2) {
	display: none;
}

/* card: a tinted card with a title line and a picture */
.dba-thumb--card i:nth-child(1) {
	width: 74%;
	height: 68%;
	border: 1px solid var(--dba-line);
	border-radius: 0.3rem;
	background: var(--dba-accent-soft);
}

.dba-thumb--card i:nth-child(2) {
	position: absolute;
	top: 30%;
	left: 22%;
	width: 30%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-ink);
}

.dba-thumb--card i:nth-child(3) {
	position: absolute;
	right: 20%;
	bottom: 24%;
	width: 28%;
	height: 28%;
	border-radius: 0.2rem;
	background: var(--dba-surface);
}

/* portrait: a circle */
.dba-thumb--portrait i:nth-child(1) {
	width: 52%;
	aspect-ratio: 1;
	border: 2px solid var(--dba-surface);
	border-radius: 50%;
	background: var(--dba-accent-soft);
	box-shadow: 0 0 0 1px var(--dba-line);
}

.dba-thumb--portrait i:nth-child(n+2) {
	display: none;
}

/* chips: three small pills */
.dba-thumb--chip {
	grid-auto-flow: column;
	gap: 0.2rem;
	justify-content: center;
}

.dba-thumb--chip i {
	width: 22%;
	height: 22%;
	border: 1px solid var(--dba-line);
	border-radius: 999px;
	background: var(--dba-surface);
}

/* tab: a selected row over two lines */
.dba-thumb--tab {
	align-content: center;
	gap: 0.3rem;
}

.dba-thumb--tab i:nth-child(1) {
	width: 70%;
	height: 26%;
	border-radius: 0.25rem;
	background: var(--dba-accent-soft);
	box-shadow: inset 2px 0 0 var(--dba-accent);
}

.dba-thumb--tab i:nth-child(2),
.dba-thumb--tab i:nth-child(3) {
	width: 60%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-line);
}

/* panel (details): a framed block with lines */
.dba-thumb--panel {
	align-content: center;
	gap: 0.3rem;
}

.dba-thumb--panel i:nth-child(1) {
	width: 34%;
	height: 5px;
	border-radius: 2px;
	background: var(--dba-ink);
}

.dba-thumb--panel i:nth-child(2),
.dba-thumb--panel i:nth-child(3) {
	width: 68%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-line);
}

/* step / small card: a number circle and two lines */
.dba-thumb--step {
	align-content: center;
	gap: 0.3rem;
}

.dba-thumb--step i:nth-child(1) {
	width: 22%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--dba-accent);
}

.dba-thumb--step i:nth-child(2),
.dba-thumb--step i:nth-child(3) {
	width: 52%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-line);
}

/* form field: an outlined box with a short line */
.dba-thumb--field i:nth-child(1) {
	box-sizing: border-box;
	width: 76%;
	height: 34%;
	border: 1.5px solid var(--dba-line);
	border-radius: 0.3rem;
	background: var(--dba-surface);
}

.dba-thumb--field i:nth-child(2) {
	position: absolute;
	left: 18%;
	width: 26%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-muted);
}

.dba-thumb--field i:nth-child(3) {
	display: none;
}

/* submit: a dark pill */
.dba-thumb--submit i:nth-child(1) {
	width: 62%;
	height: 34%;
	border-radius: 999px;
	background: var(--dba-ink);
}

.dba-thumb--submit i:nth-child(2) {
	position: absolute;
	width: 28%;
	height: 4px;
	border-radius: 2px;
	background: var(--dba-surface);
}

/* The thing you jumped to flashes */
.is-flash {
	animation: dba-flash 1.8s ease-out;
}

@keyframes dba-flash {
	0%,
	60% {
		outline: 2px solid var(--dba-accent);
		outline-offset: 4px;
	}

	100% {
		outline: 2px solid transparent;
		outline-offset: 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.is-flash {
		animation: none;
		outline: 2px solid var(--dba-accent);
		outline-offset: 4px;
	}
}
