/*!
 * Motif icon browser · shortcodes · pack cards (contract v2 §2).
 * Brand tokens come from assets/core/tokens.css (--motif-*); the fallbacks below keep this file standalone.
 * Fonts are the theme's: --motif-font-body / --motif-font-display / --motif-font-mono default to inherit.
 */

:where(:root) {
	--mb-paper: var(--motif-paper, #ffffff);
	--mb-mist: var(--motif-mist, #f3f5f0);
	--mb-ink: var(--motif-ink, #0b0c0e);
	--mb-ink-soft: var(--motif-ink-soft, #4a4d52);
	--mb-ink-quiet: var(--motif-ink-quiet, #62666d);
	--mb-line: var(--motif-line, #e3e6df);
	--mb-forest: var(--motif-forest, #0e3b33);
	--mb-forest-hover: var(--motif-forest-hover, #0a2e28);
	--mb-lime: var(--motif-lime, #d4f55b);
	--mb-lime-soft: var(--motif-lime-soft, #edfbba);
	--mb-hover: #eaede6;
	--mb-body: var(--motif-font-body, inherit);
	--mb-display: var(--motif-font-display, inherit);
	--mb-mono: var(--motif-font-mono, inherit);
	--mb-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--mb-motion: 200ms;
}

:where(.motif-browser, .motif-drawer, .motif-newest) {
	--motif-icon-color: var(--mb-ink);
	--motif-icon-accent: var(--mb-lime);
}

/* themes style bare elements; keep the components self-contained */
.motif-browser button:focus:not(:focus-visible),
.motif-drawer button:focus:not(:focus-visible),
.motif-browser select:focus:not(:focus-visible) {
	outline: none;
}

.motif-browser button,
.motif-drawer button {
	min-width: 0;
	min-height: 0;
	box-shadow: none;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.motif-browser input.motif-input,
.motif-browser select.motif-select,
.motif-drawer select.motif-select {
	max-width: none;
	margin: 0;
	box-shadow: none;
	line-height: 1.2;
}

.motif-browser input.motif-browser__search {
	height: 52px;
	padding: 0 21px;
	font-size: 16px;
}

.motif-browser input.motif-input--hex {
	height: 32px;
	padding: 0 8px;
	font-size: 13px;
}

html.motif-noscroll {
	overflow: hidden;
}

/* ------------------------------------------------------------------ shared controls */

:where(.motif-browser, .motif-drawer, .motif-packs, .motif-newest) :where(button, input, select, textarea) {
	font-family: var(--mb-body);
	letter-spacing: normal;
	text-transform: none;
}

.motif-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	height: 44px;
	padding: 0 21px;
	margin: 0;
	border: 1px solid transparent;
	border-radius: 8px;
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--mb-motion) var(--mb-ease), border-color var(--mb-motion) var(--mb-ease), color var(--mb-motion) var(--mb-ease);
}

.motif-btn--primary {
	background: var(--mb-forest);
	color: #ffffff;
}

.motif-btn--primary:hover {
	background: var(--mb-forest-hover);
	color: #ffffff;
}

.motif-btn--secondary {
	background: var(--mb-paper);
	border-color: var(--mb-line);
	color: var(--mb-ink);
}

.motif-btn--secondary:hover {
	border-color: var(--mb-ink-quiet);
	color: var(--mb-ink);
}

.motif-btn--ghost {
	height: 36px;
	padding: 0 13px;
	background: transparent;
	color: var(--mb-ink);
	font-size: 14px;
}

.motif-btn--ghost:hover {
	background: var(--mb-mist);
}

.motif-btn--small {
	height: 36px;
	padding: 0 13px;
	font-size: 14px;
}

.motif-btn[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

.motif-btn:disabled,
.motif-btn[disabled] {
	opacity: 0.4;
	cursor: default;
	pointer-events: none;
}

.motif-btn:focus-visible,
.motif-link:focus-visible,
.motif-tab:focus-visible,
.motif-seg__item:focus-visible,
.motif-tag--button:focus-visible,
.motif-swatch:focus-visible,
.motif-select:focus-visible,
.motif-input:focus-visible,
.pack-card__link:focus-visible {
	outline: 2px solid var(--mb-forest);
	outline-offset: 2px;
}

.motif-link {
	display: inline;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
	text-decoration: none;
	cursor: pointer;
}

.motif-link:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.motif-input,
.motif-select {
	box-sizing: border-box;
	height: 44px;
	margin: 0;
	padding: 0 13px;
	border: 1px solid var(--mb-line);
	border-radius: 8px;
	background: var(--mb-paper);
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.2;
	transition: border-color var(--mb-motion) var(--mb-ease);
}

.motif-input:hover,
.motif-select:hover {
	border-color: #c9cdc4;
}

.motif-input:focus,
.motif-select:focus {
	border-color: var(--mb-forest);
	outline: none;
}

.motif-select {
	width: 100%;
	padding-right: 34px;
	-webkit-appearance: none;
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--mb-ink-soft) 50%), linear-gradient(135deg, var(--mb-ink-soft) 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	cursor: pointer;
}

.motif-select--small {
	width: auto;
	height: 36px;
	font-size: 14px;
}

.motif-kicker {
	margin: 0 0 13px;
	color: var(--mb-ink-quiet);
	font-family: var(--mb-mono);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.motif-label {
	display: block;
	margin: 0;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
}

.motif-tag {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	height: 26px;
	padding: 0 8px;
	border: 0;
	border-radius: 5px;
	background: var(--mb-mist);
	color: var(--mb-ink-soft);
	font-family: var(--mb-body);
	font-size: 13px;
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
}

.motif-tag--button {
	cursor: pointer;
	transition: background-color var(--mb-motion) var(--mb-ease);
}

.motif-tag--button:hover {
	background: var(--mb-hover);
	color: var(--mb-ink);
}

.motif-tag--free {
	height: 22px;
	margin-left: 8px;
	background: var(--mb-lime-soft);
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
}

.motif-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

/* ------------------------------------------------------------------ browser layout */

.motif-browser {
	position: relative;
	box-sizing: border-box;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.6;
	text-align: left;
}

.motif-browser *,
.motif-drawer * {
	box-sizing: border-box;
}

.motif-browser__top {
	position: sticky;
	top: var(--motif-sticky-offset, 0px);
	z-index: 5;
	padding: 13px 0 0;
	background: var(--motif-browser-bg, var(--mb-paper));
}

.motif-browser__searchrow {
	display: flex;
	gap: 8px;
}

.motif-browser__search {
	flex: 1 1 auto;
	min-width: 0;
	height: 52px;
	padding: 0 21px;
	font-size: 16px;
}

.motif-browser__search::placeholder {
	color: var(--mb-ink-quiet);
}

.motif-browser__search::-webkit-search-cancel-button {
	cursor: pointer;
}

.motif-browser__filters-toggle {
	display: none;
	height: 52px;
}

.motif-browser__tabsrow {
	margin-top: 8px;
	border-bottom: 1px solid var(--mb-line);
}

.motif-tabs {
	display: flex;
	gap: 21px;
	overflow-x: auto;
	scrollbar-width: none;
}

.motif-tabs::-webkit-scrollbar {
	display: none;
}

.motif-tabs.is-overflowing {
	-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
	mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
}

.motif-tabs.is-overflowing.is-end {
	-webkit-mask-image: none;
	mask-image: none;
}

.motif-tab {
	position: relative;
	flex: 0 0 auto;
	height: 48px;
	padding: 0 2px;
	margin: 0;
	border: 0;
	background: none;
	color: var(--mb-ink-quiet);
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: color var(--mb-motion) var(--mb-ease);
}

.motif-tab:hover {
	color: var(--mb-ink);
}

.motif-tab[aria-selected="true"] {
	color: var(--mb-ink);
}

.motif-tab::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 2px;
	border-radius: 2px;
	background: transparent;
	transition: background-color var(--mb-motion) var(--mb-ease);
}

.motif-tab[aria-selected="true"]::after {
	background: var(--mb-forest);
}

.motif-tab:focus-visible {
	outline-offset: -2px;
}

.motif-browser:not(.is-drafts) .motif-tab--draft {
	display: none;
}

.motif-tab__tag {
	display: inline-block;
	margin-left: 5px;
	padding: 2px 5px;
	border-radius: 5px;
	background: var(--mb-mist);
	color: var(--mb-ink-soft);
	font-size: 11px;
	font-weight: 500;
	line-height: 1.2;
	vertical-align: 1px;
}

.motif-browser__tabsrow {
	display: flex;
	align-items: center;
	gap: 21px;
}

.motif-browser__tabsrow .motif-tabs {
	flex: 1 1 auto;
	min-width: 0;
}

.motif-browser__drafts {
	flex: 0 0 auto;
	color: var(--mb-ink-quiet);
	font-size: 13px;
	white-space: nowrap;
}

.motif-browser__drafts[aria-pressed="true"] {
	color: var(--mb-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.motif-browser__body {
	display: grid;
	grid-template-columns: 248px minmax(0, 1fr);
	gap: 34px;
	align-items: start;
	padding-top: 21px;
}

.motif-browser__main {
	min-width: 0;
}

.motif-browser__bar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 13px;
	min-height: 24px;
	margin-bottom: 13px;
}

.motif-browser__count {
	margin: 0;
	color: var(--mb-ink-quiet);
	font-size: 14px;
}

.motif-browser__count strong {
	color: var(--mb-ink);
	font-weight: 500;
}

.motif-browser__notice {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 13px;
	padding: 34px;
	margin-bottom: 21px;
	border-radius: 13px;
	background: var(--mb-mist);
}

.motif-browser__notice[hidden] {
	display: none;
}

.motif-browser__notice p {
	margin: 0;
	color: var(--mb-ink);
	font-size: 16px;
}

/* ------------------------------------------------------------------ side panel */

.motif-side {
	position: sticky;
	top: calc(var(--motif-sticky-offset, 0px) + var(--motif-sticky, 120px) + 21px);
	display: flex;
	flex-direction: column;
	gap: 34px;
	max-height: calc(100vh - var(--motif-sticky-offset, 0px) - var(--motif-sticky, 120px) - 34px);
	overflow-y: auto;
	scrollbar-width: thin;
	padding: 0 2px 13px;
}

.motif-side__section {
	display: flex;
	flex-direction: column;
	gap: 21px;
}

.motif-side__section > .motif-kicker {
	margin-bottom: -8px;
}

.motif-side__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: -8px;
}

.motif-side__head .motif-kicker {
	margin: 0;
}

.motif-side__done {
	display: none;
}

.motif-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.motif-field[hidden] {
	display: none;
}

.motif-field__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
}

.motif-field__value {
	color: var(--mb-ink-quiet);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
}

.motif-swatches {
	display: flex;
	align-items: center;
	gap: 8px;
}

.motif-swatch {
	position: relative;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(11, 12, 14, 0.12);
	border-radius: 8px;
	background: var(--swatch, #ffffff);
	cursor: pointer;
}

.motif-swatch[aria-pressed="true"],
.motif-swatch--picker.is-active {
	box-shadow: 0 0 0 2px var(--mb-paper), 0 0 0 4px var(--mb-forest);
}

.motif-swatch--picker {
	overflow: hidden;
	border: 3px solid transparent;
	-webkit-appearance: none;
	appearance: none;
	background: linear-gradient(var(--swatch-custom, #ffffff), var(--swatch-custom, #ffffff)) padding-box,
		conic-gradient(from 90deg, #e8705f, #f2c94c, #8fc06a, #5b8def, #a77be0, #e8705f) border-box;
}

.motif-swatch--picker::-webkit-color-swatch-wrapper {
	padding: 0;
	opacity: 0;
}

.motif-swatch--picker::-moz-color-swatch {
	opacity: 0;
}

.motif-input--hex {
	flex: 1 1 auto;
	width: 0;
	min-width: 64px;
	max-width: 96px;
	height: 32px;
	padding: 0 8px;
	font-family: var(--mb-mono);
	font-size: 13px;
	font-weight: 400;
	line-height: 1;
	text-transform: lowercase;
}

.motif-range {
	width: 100%;
	height: 24px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.motif-range::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 2px;
	background: var(--mb-line);
}

.motif-range::-moz-range-track {
	height: 4px;
	border-radius: 2px;
	background: var(--mb-line);
}

.motif-range::-webkit-slider-thumb {
	width: 20px;
	height: 20px;
	margin-top: -8px;
	border: 2px solid var(--mb-paper);
	border-radius: 50%;
	background: var(--mb-forest);
	box-shadow: 0 0 0 1px var(--mb-forest);
	-webkit-appearance: none;
	appearance: none;
}

.motif-range::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 2px solid var(--mb-paper);
	border-radius: 50%;
	background: var(--mb-forest);
	box-shadow: 0 0 0 1px var(--mb-forest);
}

.motif-range:focus-visible {
	outline: none;
}

.motif-range:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 1px var(--mb-forest), 0 0 0 5px var(--mb-lime-soft);
}

.motif-check {
	position: relative;
	display: flex;
	align-items: center;
	gap: 13px;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	cursor: pointer;
}

.motif-check__input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.motif-check__box {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border: 1px solid #c9cdc4;
	border-radius: 5px;
	background: var(--mb-paper);
	transition: background-color var(--mb-motion) var(--mb-ease), border-color var(--mb-motion) var(--mb-ease);
}

.motif-check__input:checked + .motif-check__box {
	border-color: var(--mb-forest);
	background: var(--mb-forest) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

.motif-check__input:focus-visible + .motif-check__box {
	outline: 2px solid var(--mb-forest);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ grid */

.motif-grid {
	position: relative;
	min-height: 240px;
	outline: none;
}

.motif-grid__canvas {
	position: relative;
	width: 100%;
}

.motif-grid__row {
	position: absolute;
	top: 0;
	left: 0;
	display: grid;
	grid-template-columns: repeat(var(--motif-cols, 9), var(--motif-col, 100px));
	column-gap: var(--motif-gap, 8px);
	contain: layout style;
}

.motif-grid__skeleton {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 13px;
}

.motif-skel {
	aspect-ratio: 1 / 0.8;
	border-radius: 13px;
	background: var(--mb-mist);
	animation: motif-pulse 1.4s var(--mb-ease) infinite alternate;
}

@keyframes motif-pulse {
	from { opacity: 1; }
	to { opacity: 0.5; }
}

.motif-tile {
	min-width: 0;
	contain: layout style;
	outline: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.motif-tile__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: var(--motif-media, 96px);
	border-radius: 13px;
	background: transparent;
	transition: background-color var(--mb-motion) var(--mb-ease), box-shadow var(--mb-motion) var(--mb-ease);
}

.motif-tile:hover .motif-tile__media {
	background: var(--mb-mist);
}

.motif-tile:focus-visible .motif-tile__media {
	box-shadow: inset 0 0 0 2px var(--mb-forest);
}

.motif-tile.is-selected .motif-tile__media {
	background: var(--mb-mist);
	box-shadow: inset 0 0 0 2px var(--mb-forest);
}

.motif-tile__name {
	overflow: hidden;
	padding: 3px 5px 0;
	color: var(--mb-ink-soft);
	font-family: var(--mb-body);
	font-size: 13px;
	font-weight: 400;
	line-height: 22px;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.motif-tile:hover .motif-tile__name,
.motif-tile.is-selected .motif-tile__name {
	color: var(--mb-ink);
}

.motif-tile__tag {
	position: absolute;
	top: 8px;
	left: 8px;
	padding: 3px 6px;
	border-radius: 5px;
	background: var(--mb-lime-soft);
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 11px;
	font-weight: 500;
	line-height: 1;
	pointer-events: none;
}

/* inline SVG (free icons): colours from CSS, so colour changes never re-render */
.motif-svg {
	display: block;
	flex: 0 0 auto;
	overflow: visible;
	color: var(--motif-icon-color);
}

.motif-svg [data-motif="accent"],
.motif-svg [data-motif="tint"] {
	color: var(--motif-icon-accent);
}

/* sprite masks (locked icons, §9.9) */
.motif-mask {
	position: relative;
	display: block;
	flex: 0 0 auto;
}

.motif-mask__layer {
	position: absolute;
	inset: 0;
	background-color: var(--motif-icon-color);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-mode: alpha;
	mask-mode: alpha;
}

.motif-mask__layer--accent {
	background-color: var(--motif-icon-accent);
}

[data-px-mode="exact"] .motif-mask__layer,
[data-px-mode="up"] .motif-mask__layer {
	image-rendering: pixelated;
}

.motif-mask.is-pending {
	border-radius: 5px;
	background: var(--mb-mist);
}

.motif-browser.is-switching .motif-grid__canvas {
	opacity: 0.4;
	transition: opacity 120ms linear;
}

/* ------------------------------------------------------------------ narrow layouts */

.motif-browser--narrow .motif-browser__filters-toggle {
	display: inline-flex;
}

.motif-browser--narrow .motif-browser__body {
	display: block;
	padding-top: 13px;
}

.motif-browser--narrow .motif-side {
	position: fixed;
	top: auto;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100001;
	gap: 34px;
	max-height: min(86vh, 720px);
	padding: 21px 21px calc(21px + env(safe-area-inset-bottom, 0px));
	border-radius: 13px 13px 0 0;
	background: var(--mb-paper);
	box-shadow: 0 -8px 34px rgba(11, 12, 14, 0.14);
	transform: translateY(105%);
	visibility: hidden;
	transition: transform var(--mb-motion) var(--mb-ease), visibility 0s linear var(--mb-motion);
}

.motif-browser--narrow.is-sheet-open .motif-side {
	transform: none;
	visibility: visible;
	transition: transform var(--mb-motion) var(--mb-ease), visibility 0s;
}

.motif-browser--narrow .motif-side__done {
	display: inline-flex;
	flex: 0 0 auto;
	width: 100%;
	background: var(--mb-forest);
	color: #ffffff;
	border-color: var(--mb-forest);
}

.motif-browser__scrim {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(11, 12, 14, 0.32);
}

.motif-browser__scrim[hidden] {
	display: none;
}

.motif-browser--compact .motif-browser__search {
	height: 48px;
	padding: 0 13px;
}

.motif-browser--compact .motif-browser__filters-toggle {
	height: 48px;
	padding: 0 13px;
}

.motif-browser--compact .motif-tabs {
	gap: 13px;
}

.motif-browser--compact .motif-tab {
	height: 44px;
	font-size: 14px;
}

.motif-browser--compact .motif-tile__media {
	border-radius: 8px;
}

.motif-browser--compact .motif-tile__name {
	padding: 0 2px;
	font-size: 12px;
	line-height: 22px;
}

.motif-grid[data-tag="compact"] .motif-tile__tag {
	top: 5px;
	left: 5px;
	padding: 2px 4px;
	font-size: 10px;
}

/* ------------------------------------------------------------------ drawer */

.motif-drawer {
	position: fixed;
	inset: 0;
	z-index: 100010;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.6;
}

.motif-drawer[hidden] {
	display: none;
}

.motif-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(11, 12, 14, 0.42);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity var(--mb-motion) var(--mb-ease);
}

/* centred modal: preview and details on the left, code and downloads on the right */
.motif-drawer__panel {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
	width: min(1000px, calc(100vw - 48px));
	max-height: min(720px, calc(100vh - 48px));
	max-height: min(720px, calc(100dvh - 48px));
	overflow: hidden;
	border-radius: 20px;
	background: var(--mb-paper);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 32px 80px rgba(11, 12, 14, 0.28), 0 4px 16px rgba(11, 12, 14, 0.08);
	outline: none;
	opacity: 0;
	transform: translate(-50%, calc(-50% + 12px)) scale(0.98);
	transition: transform var(--mb-motion) var(--mb-ease), opacity var(--mb-motion) var(--mb-ease);
}

.motif-drawer.is-open .motif-drawer__backdrop {
	opacity: 1;
}

.motif-drawer.is-open .motif-drawer__panel {
	opacity: 1;
	transform: translate(-50%, -50%);
}

.motif-modal__aside {
	display: flex;
	flex-direction: column;
	gap: 21px;
	min-height: 0;
	padding: 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-right: 1px solid var(--mb-line);
	background: var(--mb-mist);
}

.motif-modal__main {
	display: flex;
	flex-direction: column;
	gap: 21px;
	min-width: 0;
	min-height: 0;
	padding: 20px 24px 24px 28px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.motif-modal__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 13px;
}

.motif-modal__nav {
	display: flex;
	flex: 0 0 auto;
	gap: 4px;
	margin: -4px -8px 0 0;
}

.motif-drawer .motif-modal__icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--mb-ink-soft);
	cursor: pointer;
	transition: background-color var(--mb-motion) var(--mb-ease), color var(--mb-motion) var(--mb-ease);
}

.motif-drawer .motif-modal__icon-btn:hover:not(:disabled) {
	background: var(--mb-mist);
	color: var(--mb-ink);
}

.motif-drawer .motif-modal__icon-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

.motif-drawer .motif-modal__icon-btn:focus-visible {
	outline: 2px solid var(--mb-forest);
	outline-offset: 1px;
}

.motif-drawer__preview {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	border: 1px solid var(--mb-line);
	border-radius: 16px;
	background-color: var(--mb-paper);
	background-image: radial-gradient(circle, rgba(11, 12, 14, 0.07) 1px, transparent 1.2px);
	background-size: 16px 16px;
	background-position: center;
}

.motif-drawer__art {
	display: flex;
	align-items: center;
	justify-content: center;
}

.motif-drawer__head {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.motif-drawer__title {
	margin: 0;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 24px;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.motif-drawer__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	color: var(--mb-ink-quiet);
	font-size: 14px;
}

.motif-drawer__id {
	padding: 0;
	margin-right: 5px;
	background: none;
	color: var(--mb-ink-soft);
	font-family: var(--mb-mono);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
}

.motif-drawer__section {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.motif-drawer__section .motif-kicker {
	margin: 0;
}

/* ------------------------------------------------------------------ code block */

.motif-code {
	--code-bg: #0e1012;
	--code-line: rgba(255, 255, 255, 0.08);
	--code-ink: #e6e8e3;
	--code-quiet: #8a8f87;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	border-radius: 14px;
	background: var(--code-bg);
	color: var(--code-ink);
}

.motif-code__bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 6px 6px 8px;
	border-bottom: 1px solid var(--code-line);
}

.motif-code__tabs {
	display: flex;
	flex: 1 1 auto;
	gap: 2px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
	mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}

.motif-code__tabs::-webkit-scrollbar {
	display: none;
}

.motif-drawer .motif-code__tab {
	flex: 0 0 auto;
	height: 30px;
	padding: 0 10px;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--code-quiet);
	font-family: var(--mb-body);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: background-color var(--mb-motion) var(--mb-ease), color var(--mb-motion) var(--mb-ease);
}

.motif-drawer .motif-code__tab:hover {
	color: var(--code-ink);
}

.motif-drawer .motif-code__tab[aria-selected="true"] {
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
}

.motif-drawer .motif-code__tab:focus-visible,
.motif-drawer .motif-code__copy:focus-visible,
.motif-code__pre:focus-visible {
	outline: 2px solid var(--mb-lime);
	outline-offset: -2px;
}

.motif-drawer .motif-code__copy {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 0 12px 0 10px;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: var(--mb-lime);
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: filter var(--mb-motion) var(--mb-ease);
}

.motif-drawer .motif-code__copy:hover {
	filter: brightness(0.95);
}

.motif-drawer .motif-code__copy.is-done {
	background: #ffffff;
}

.motif-code__copy-icon {
	display: inline-flex;
}

.motif-code__pre {
	flex: 1 1 auto;
	max-height: 300px;
	min-height: 168px;
	padding: 14px 16px 16px;
	margin: 0;
	overflow: auto;
	background: transparent;
	color: var(--code-ink);
	font-family: var(--mb-mono, ui-monospace), ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12.5px;
	line-height: 1.7;
	white-space: pre;
	tab-size: 2;
	scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
	scrollbar-width: thin;
}

.motif-code[data-format="datauri"] .motif-code__pre,
.motif-code[data-format="css"] .motif-code__pre {
	white-space: pre-wrap;
	word-break: break-all;
}

.motif-code[aria-busy="true"] .motif-code__text {
	opacity: 0.35;
}

.motif-code__text {
	display: block;
	padding: 0;
	background: none;
	color: inherit;
	font: inherit;
	transition: opacity 120ms linear;
}

.motif-code .tk-t {
	color: #d4f55b;
}

.motif-code .tk-a {
	color: #9fc3ff;
}

.motif-code .tk-s {
	color: #f2c58c;
}

.motif-code__hint {
	min-height: 1em;
	margin: 0;
	color: var(--mb-ink-quiet);
	font-size: 13px;
	line-height: 1.4;
}

.motif-code__hint:empty {
	display: none;
}

.motif-dl {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.motif-dl__png {
	display: flex;
	flex: 1 1 280px;
	gap: 8px;
	min-width: 0;
}

.motif-dl__png .motif-select {
	flex: 1 1 0;
	min-width: 0;
	height: 36px;
}

.motif-drawer__actions {
	display: flex;
	flex-direction: column;
	gap: 21px;
}

.motif-drawer__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.motif-drawer__row + .motif-drawer__row {
	margin-top: 8px;
}

.motif-drawer__row .motif-btn--primary {
	width: 100%;
}

.motif-drawer__row--png {
	flex-wrap: nowrap;
}

.motif-drawer__row--png .motif-select {
	flex: 1 1 0;
	min-width: 0;
	height: 44px;
}

.motif-drawer__row--png .motif-btn {
	flex: 0 0 auto;
}

.motif-copy {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.motif-seg {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.motif-seg__item {
	height: 36px;
	padding: 0 13px;
	margin: 0;
	border: 1px solid var(--mb-line);
	border-radius: 8px;
	background: var(--mb-paper);
	color: var(--mb-ink-soft);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: border-color var(--mb-motion) var(--mb-ease), background-color var(--mb-motion) var(--mb-ease);
}

.motif-seg__item:hover {
	border-color: var(--mb-ink-quiet);
	color: var(--mb-ink);
}

.motif-seg__item[aria-checked="true"] {
	border-color: var(--mb-forest);
	background: var(--mb-forest);
	color: #ffffff;
}

.motif-unlock {
	display: flex;
	flex-direction: column;
	gap: 13px;
	padding: 21px;
	border-radius: 13px;
	background: var(--mb-lime-soft);
}

.motif-unlock__title {
	margin: 0;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 18px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: normal;
}

.motif-unlock__text {
	margin: 0;
	color: var(--mb-ink-soft);
	font-size: 15px;
}

.motif-unlock__cta {
	width: 100%;
}

.motif-unlock__prices {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 5px 13px;
	margin: 0;
	color: var(--mb-ink-soft);
	font-size: 14px;
}

.motif-unlock__prices strong {
	color: var(--mb-ink);
	font-weight: 500;
}

@media (max-width: 759px) {
	/* bottom sheet: title bar, preview strip, then code and downloads */
	.motif-drawer__panel {
		top: auto;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		width: 100%;
		height: auto;
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
		overflow-y: auto;
		overscroll-behavior: contain;
		border-radius: 20px 20px 0 0;
		transform: translateY(24px);
	}

	.motif-drawer.is-open .motif-drawer__panel {
		transform: none;
	}

	.motif-modal__main {
		display: contents;
	}

	.motif-modal__top {
		position: sticky;
		top: 0;
		z-index: 1;
		order: 0;
		padding: 16px 12px 12px 16px;
		border-bottom: 1px solid var(--mb-line);
		background: var(--mb-paper);
	}

	.motif-modal__nav {
		margin: -4px 0 0;
	}

	.motif-modal__aside {
		display: grid;
		order: 1;
		grid-template-columns: 112px minmax(0, 1fr);
		align-items: start;
		gap: 16px;
		flex: 0 0 auto;
		padding: 16px;
		overflow: visible;
		border-right: 0;
		border-bottom: 1px solid var(--mb-line);
	}

	.motif-modal__aside > .motif-drawer__section:nth-child(3) {
		grid-column: 1 / -1;
	}

	.motif-modal__main > :not(.motif-modal__top) {
		order: 2;
		flex: 0 0 auto;
		margin: 16px 16px 0;
	}

	.motif-modal__main > :last-child {
		margin-bottom: 32px;
	}

	.motif-drawer__title {
		font-size: 20px;
	}

	.motif-code__pre {
		max-height: 240px;
	}
}

/* ------------------------------------------------------------------ toast */

.motif-toast {
	position: fixed;
	bottom: 21px;
	left: 50%;
	z-index: 100020;
	max-width: calc(100vw - 42px);
	padding: 13px 21px;
	border-radius: 8px;
	background: var(--mb-forest);
	color: #ffffff;
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 8px);
	transition: opacity var(--mb-motion) var(--mb-ease), transform var(--mb-motion) var(--mb-ease);
}

.motif-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

.motif-toast--error {
	background: var(--mb-ink);
}

/* ------------------------------------------------------------------ [motif_icon] */

.motif-icon {
	display: inline-block;
	flex: 0 0 auto;
	vertical-align: -0.125em;
	line-height: 0;
}

.motif-icon svg {
	display: block;
}

.motif-icon--masked {
	position: relative;
	color: inherit;
}

.motif-icon--masked .motif-icon__layer {
	position: absolute;
	inset: 0;
	background-color: var(--motif-icon-color, currentColor);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

.motif-icon--masked .motif-icon__layer--accent {
	background-color: var(--motif-icon-accent, currentColor);
}

/* ------------------------------------------------------------------ [motif_pack_grid] (Airbnb cards) */

.motif-packs {
	display: grid;
	grid-template-columns: repeat(var(--motif-pack-cols, 4), minmax(0, 1fr));
	gap: 34px 21px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1024px) {
	.motif-packs {
		grid-template-columns: repeat(min(3, var(--motif-pack-cols, 4)), minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.motif-packs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 21px 13px;
	}
}

.motif-packs .pack-card {
	position: relative;
	min-width: 0;
	margin: 0;
	color: var(--mb-ink);
	font-family: var(--mb-body);
}

.motif-packs .pack-card__link,
.motif-packs .pack-card__link:hover {
	display: block;
	border-radius: 13px;
	color: inherit;
	text-decoration: none;
}

.motif-packs .pack-card__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: 13px;
	background: var(--tint, var(--mb-mist));
}

.motif-packs .pack-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 400ms var(--mb-ease);
}

.motif-packs .pack-card__link:hover .pack-card__media img {
	transform: scale(1.02);
}

.motif-packs .pack-card__badge {
	position: absolute;
	top: 13px;
	left: 13px;
	padding: 5px 8px;
	border-radius: 5px;
	background: #ffffff;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
	box-shadow: 0 1px 3px rgba(11, 12, 14, 0.08);
}

.motif-packs .pack-card__title {
	margin: 13px 0 0;
	color: var(--mb-ink);
	font-family: var(--mb-body);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: normal;
}

.motif-packs .pack-card__meta {
	margin: 2px 0 0;
	color: var(--mb-ink-quiet);
	font-family: var(--mb-body);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
}

.motif-packs .pack-card__price {
	margin: 5px 0 0;
	color: var(--mb-ink-soft);
	font-family: var(--mb-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.4;
}

.motif-packs .pack-card__price strong {
	color: var(--mb-ink);
	font-weight: 500;
}

/* ------------------------------------------------------------------ [motif_newest] */

.motif-newest {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 13px 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.motif-newest__item {
	margin: 0;
}

.motif-newest .motif-newest__link,
.motif-newest .motif-newest__link:hover {
	display: block;
	border-radius: 13px;
	color: var(--mb-ink-soft);
	text-decoration: none;
}

.motif-newest__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 5 / 4;
	border-radius: 13px;
	background: var(--mb-mist);
	transition: background-color var(--mb-motion) var(--mb-ease);
}

.motif-newest__link:hover .motif-newest__media {
	background: var(--mb-hover);
}

.motif-newest__link:focus-visible {
	outline: 2px solid var(--mb-forest);
	outline-offset: 2px;
}

.motif-newest__name {
	display: block;
	overflow: hidden;
	padding: 3px 5px 0;
	font-family: var(--mb-body);
	font-size: 13px;
	font-weight: 400;
	line-height: 22px;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.motif-newest .motif-icon {
	color: var(--motif-icon-color, var(--mb-ink));
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
	.motif-browser *,
	.motif-drawer *,
	.motif-toast,
	.motif-packs * {
		transition: none !important;
		animation: none !important;
	}
}

/* hidden always wins over component display values */
:where(.motif-browser, .motif-drawer) [hidden] {
	display: none !important;
}

/* server-rendered placeholder until browser.js takes over */
.motif-browser__ssr-search {
	height: 52px;
	margin-top: 13px;
	border: 1px solid var(--mb-line);
	border-radius: 8px;
}

.motif-browser__ssr-tabs {
	height: 48px;
	margin: 8px 0 21px;
	border-bottom: 1px solid var(--mb-line);
}

.motif-browser__noscript {
	margin: 21px 0;
	color: var(--mb-ink-soft);
}
