/* /gallery — public avatar gallery.
 *
 * Standalone styles. Lives alongside the global /style.css but does not
 * depend on the .explore-* tokens; this lets us tune the page independently
 * if the discover layout drifts.
 */

html:has(body.gallery-page) {
	height: auto;
	overflow: auto;
}

body.gallery-page {
	display: block;
	width: 100%;
	min-height: calc(100vh - var(--header-h, 64px));
	height: auto;
	overflow: visible;
	background:
		radial-gradient(
			ellipse 80% 50% at 50% -10%,
			rgba(255, 255, 255, 0.09),
			transparent 60%
		),
		radial-gradient(
			ellipse 60% 40% at 90% 30%,
			rgba(236, 72, 153, 0.12),
			transparent 60%
		),
		#050505;
	color: #fff;
	padding: 0;
}

.gallery-main {
	max-width: 1280px;
	margin: 0 auto;
	padding: var(--space-xl, 32px) var(--space-lg, 24px) var(--space-2xl, 48px);
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.gallery-hero {
	text-align: center;
	padding: clamp(40px, 6vw, 96px) 0 clamp(24px, 4vw, 48px);
}
.gallery-hero-inner {
	max-width: 760px;
	margin: 0 auto;
}
.gallery-hero-chips {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-bottom: 24px;
}
.gallery-hero-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 99px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.gallery-hero-chip--link {
	text-decoration: none;
	background: transparent;
	border-color: rgba(255, 255, 255, 0.18);
	color: rgba(255, 255, 255, 0.78);
	transition:
		border-color var(--duration-fast) var(--ease-standard),
		color var(--duration-fast) var(--ease-standard),
		background var(--duration-fast) var(--ease-standard);
}
.gallery-hero-chip--link:hover,
.gallery-hero-chip--link:focus-visible {
	border-color: rgba(255, 255, 255, 0.4);
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
}
.gallery-hero-dot {
	width: 7px;
	height: 7px;
	border-radius: 99px;
	background: #ffffff;
	box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
}

.gallery-title {
	font-family: 'Space Grotesk', system-ui, sans-serif;
	font-size: clamp(2.2rem, 5vw, 3.6rem);
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.05;
	margin: 0 0 14px;
	color: #fff;
	background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0.72) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}
.gallery-sub {
	max-width: 560px;
	margin: 0 auto;
	color: rgba(255, 255, 255, 0.62);
	font-size: 15px;
	line-height: 1.6;
}

.gallery-hero-ctas {
	display: flex;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 28px;
}
.gallery-hero-btn {
	display: inline-flex;
	align-items: center;
	padding: 10px 20px;
	border-radius: 99px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: rgba(255, 255, 255, 0.05);
	color: rgba(255, 255, 255, 0.9);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.gallery-hero-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}
.gallery-hero-btn--primary {
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
	border-color: transparent;
	color: #000000;
}
.gallery-hero-btn--primary:hover {
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
	color: #fff;
}

.gallery-stats {
	display: flex;
	justify-content: center;
	gap: clamp(20px, 4vw, 56px);
	margin-top: 36px;
}
.gallery-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}
.gallery-stat-value {
	font-family: 'Space Grotesk', system-ui, sans-serif;
	font-size: clamp(1.5rem, 3vw, 2.1rem);
	font-weight: 700;
	color: #fff;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}
.gallery-stat-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.45);
}

/* ── Controls ────────────────────────────────────────────────────────── */
.gallery-controls {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 24px 0 28px;
}
.gallery-controls-top {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
}
.gallery-sort-select {
	display: flex;
	align-items: center;
	gap: 8px;
	color: rgba(255, 255, 255, 0.55);
	font-size: 13px;
}
.gallery-sort-select select {
	padding: 12px 12px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	color: #fff;
	font: inherit;
	font-size: 14px;
	outline: none;
	cursor: pointer;
	transition: border-color var(--duration-fast) var(--ease-standard);
}
.gallery-sort-select select:focus {
	border-color: rgba(165, 180, 252, 0.55);
}

.gallery-search {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1;
	min-width: 220px;
	max-width: 520px;
}
.gallery-search-icon {
	position: absolute;
	left: 16px;
	width: 18px;
	height: 18px;
	color: rgba(255, 255, 255, 0.45);
	pointer-events: none;
}
.gallery-search input[type='search'] {
	width: 100%;
	padding: 14px 44px 14px 44px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	color: #fff;
	font-size: 15px;
	font-family: inherit;
	outline: none;
	transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.gallery-search input[type='search']::placeholder {
	color: rgba(255, 255, 255, 0.4);
}
.gallery-search input[type='search']:focus {
	border-color: rgba(165, 180, 252, 0.55);
	background: rgba(255, 255, 255, 0.06);
}
.gallery-search input[type='search']::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}
.gallery-search-clear {
	position: absolute;
	right: 10px;
	width: 26px;
	height: 26px;
	border-radius: 99px;
	border: 0;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.75);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.gallery-search-clear:hover {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
}

.gallery-tag-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
}
.gallery-tag-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.45);
}
.gallery-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-width: 900px;
	justify-content: center;
}
.gallery-tag {
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(255, 255, 255, 0.03);
	color: rgba(255, 255, 255, 0.78);
	border-radius: 99px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	transition:
		background var(--duration-fast) var(--ease-standard),
		border-color var(--duration-fast) var(--ease-standard),
		color var(--duration-fast) var(--ease-standard);
}
.gallery-tag:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
}
.gallery-tag.is-active {
	background: rgba(165, 180, 252, 0.18);
	border-color: rgba(165, 180, 252, 0.6);
	color: #fff;
}
.gallery-tag:focus-visible {
	outline: 2px solid rgba(165, 180, 252, 0.9);
	outline-offset: 2px;
}

/* Popular-search chips: a tag chip that also previews the query's top result. */
.gallery-pop {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	/* Vertical padding trades against the 18px thumbnail so a popular-search chip
	   is exactly as tall as the category and rig chips sitting beside it. */
	padding: 4px 12px;
}
/* Pull the thumbnail into the chip's left padding so a chip with imagery and one
   without still line up on the same baseline grid. */
.gallery-pop-thumb {
	width: 18px;
	height: 18px;
	margin-left: -6px;
	border-radius: 99px;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.06);
	flex: none;
}
.gallery-pop-count {
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	color: rgba(255, 255, 255, 0.45);
}
.gallery-pop.is-active .gallery-pop-count {
	color: rgba(255, 255, 255, 0.75);
}

/* ── Grid ────────────────────────────────────────────────────────────── */
.gallery-grid-wrap {
	min-height: 200px;
	position: relative;
}
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 18px;
}

.gallery-card {
	position: relative;
	background: var(--surface-1, rgba(255, 255, 255, 0.025));
	border: 1px solid var(--stroke, rgba(255, 255, 255, 0.08));
	border-radius: var(--radius-card, 14px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition:
		transform var(--duration-fast) var(--ease-standard),
		border-color var(--duration-fast) var(--ease-standard),
		background var(--duration-fast) var(--ease-standard),
		box-shadow var(--duration-fast) var(--ease-standard);
}
.gallery-card:hover {
	transform: translateY(-2px);
	border-color: var(--stroke-strong, rgba(255, 255, 255, 0.14));
	background: var(--surface-2, rgba(255, 255, 255, 0.04));
	box-shadow: var(--shadow-3, 0 8px 32px rgba(0, 0, 0, 0.50));
}

.gallery-card-thumb {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background:
		radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.09), transparent 60%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.25));
	text-decoration: none;
	color: inherit;
}
.gallery-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--duration-slow) var(--ease-standard);
}
.gallery-card:hover .gallery-card-thumb img {
	transform: scale(1.04);
}
.gallery-card-ph {
	font-size: 56px;
	opacity: 0.55;
	filter: grayscale(0.2);
}
.gallery-card-3dpill {
	position: absolute;
	top: 10px;
	right: 10px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 4px 8px;
	border-radius: 99px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.18);
}
/* Rig classifier badge — top-left, opposite the 3D pill. */
.gallery-card-rig {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 1;
}
.rig-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 4px 8px;
	border-radius: 99px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
}
.rig-badge--rigged {
	background: rgba(34, 197, 94, 0.28);
	border-color: rgba(74, 222, 128, 0.55);
}
.rig-badge--static {
	background: rgba(0, 0, 0, 0.5);
	color: rgba(255, 255, 255, 0.82);
}
.rig-badge-joints {
	font-weight: 600;
	opacity: 0.85;
}

.gallery-card-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%) scale(0.85);
	width: 52px;
	height: 52px;
	border-radius: 99px;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
	opacity: 0;
	transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
	pointer-events: none;
}
.gallery-card:hover .gallery-card-play {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.gallery-card-mv {
	width: 100%;
	height: 100%;
	display: block;
	background: transparent;
	pointer-events: none;
	--poster-color: transparent;
	--progress-bar-color: rgba(255, 255, 255, 0.4);
	--progress-bar-height: 2px;
}
.gallery-card-body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px 16px 16px;
	flex: 1;
}
.gallery-card-name {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	letter-spacing: -0.005em;
	line-height: 1.25;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}
.gallery-card-name a {
	color: inherit;
	text-decoration: none;
}
.gallery-card-name a:hover {
	color: rgba(165, 180, 252, 1);
}
.gallery-card-desc {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.6);
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.gallery-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.gallery-card-tag {
	font-size: 11px;
	font-weight: 500;
	padding: 3px 8px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.06);
}
.gallery-card-foot {
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding-top: 8px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	/* Above .forge-card-stretch so Remix/View stay clickable. */
	position: relative;
	z-index: 2;
}
/* Stretched primary card action (renderForgeCard in gallery.js): a real <a>
   covering the card instead of role="button" on the card itself, so the
   footer's own controls are not nested inside an interactive element. */
.forge-card-stretch {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}
.forge-card-stretch:focus-visible {
	outline: 2px solid var(--accent, #fff);
	outline-offset: -2px;
}
.gallery-card-meta {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.45);
	font-variant-numeric: tabular-nums;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}
.gallery-card-dot {
	opacity: 0.5;
}
.gallery-card-fork {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 1px 6px;
	border-radius: 6px;
	background: rgba(153, 69, 255, 0.14);
	color: rgba(184, 138, 255, 0.95);
	font-size: 10px;
	font-weight: 600;
	white-space: nowrap;
}
.gallery-card-actions {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 6px;
}
.gallery-card-btn {
	font-size: 12px;
	font-weight: 600;
	padding: 6px 10px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(255, 255, 255, 0.04);
	color: rgba(255, 255, 255, 0.85);
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	transition:
		background var(--duration-fast) var(--ease-standard),
		border-color var(--duration-fast) var(--ease-standard),
		color var(--duration-fast) var(--ease-standard);
}
.gallery-card-btn:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.24);
	color: #fff;
}
.gallery-card-btn--ghost {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.7);
}
.gallery-card-btn--ghost:hover {
	background: rgba(255, 255, 255, 0.07);
	border-color: rgba(255, 255, 255, 0.22);
	color: #fff;
}
.gallery-card-btn--primary {
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
	border-color: transparent;
	color: #000000;
}
.gallery-card-btn--primary:hover {
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
	color: #fff;
}

/* ── Skeleton ────────────────────────────────────────────────────────── */
.gallery-card--skel {
	pointer-events: none;
}
.gallery-card--skel .gallery-card-thumb,
.gallery-card--skel .gallery-card-name,
.gallery-card--skel .gallery-card-desc,
.gallery-card--skel .gallery-card-tags {
	background: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0.04) 0%,
		rgba(255, 255, 255, 0.08) 50%,
		rgba(255, 255, 255, 0.04) 100%
	);
	background-size: 200% 100%;
	animation: gallery-shimmer 1.4s linear infinite;
	color: transparent;
	border-radius: 6px;
}
.gallery-card--skel .gallery-card-thumb {
	aspect-ratio: 1 / 1;
	border-radius: 0;
}
.gallery-card--skel .gallery-card-name {
	height: 14px;
	width: 70%;
}
.gallery-card--skel .gallery-card-desc {
	height: 28px;
	width: 100%;
}
.gallery-card--skel .gallery-card-tags {
	height: 18px;
	width: 60%;
}
@keyframes gallery-shimmer {
	from {
		background-position: 200% 0;
	}
	to {
		background-position: -200% 0;
	}
}

/* ── Status / empty / error ─────────────────────────────────────────── */
.gallery-status {
	min-height: 24px;
	margin-top: 24px;
	text-align: center;
	color: rgba(255, 255, 255, 0.5);
	font-size: 14px;
}
.gallery-empty {
	max-width: 460px;
	margin: 48px auto 24px;
	text-align: center;
	padding: 32px;
	border: 1px dashed rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.02);
}
.gallery-empty-art {
	font-size: 36px;
	margin-bottom: 10px;
	opacity: 0.75;
}
.gallery-empty h3 {
	margin: 0 0 6px;
	font-family: 'Space Grotesk', system-ui, sans-serif;
	font-size: 18px;
	color: #fff;
}
.gallery-empty p {
	margin: 0 0 14px;
	font-size: 13.5px;
	color: rgba(255, 255, 255, 0.6);
	line-height: 1.55;
}
.gallery-clear-filters {
	display: inline-flex;
	padding: 8px 14px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: rgba(255, 255, 255, 0.05);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	margin-right: 8px;
	transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.gallery-clear-filters:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.32);
}
.gallery-empty .gallery-clear-cta {
	display: inline-flex;
	padding: 8px 14px;
	border-radius: 10px;
	border: 0;
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
	color: #000000;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: filter var(--duration-fast) var(--ease-standard);
}
.gallery-empty .gallery-clear-cta:hover {
	filter: brightness(1.1);
}
.gallery-empty .gallery-clear-cta + .gallery-clear-cta {
	margin-left: 8px;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.18);
}
.gallery-empty .gallery-clear-cta + .gallery-clear-cta:hover {
	filter: none;
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.32);
}
.gallery-error {
	color: #fca5a5;
	padding: 16px;
	border: 1px solid rgba(220, 38, 38, 0.3);
	background: rgba(220, 38, 38, 0.08);
	border-radius: 10px;
	max-width: 560px;
	margin: 16px auto;
	text-align: center;
}

/* ── Load more ──────────────────────────────────────────────────────── */
.gallery-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}
.gallery-load-more {
	padding: 12px 24px;
	border-radius: 99px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: rgba(255, 255, 255, 0.04);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.gallery-load-more:hover {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.34);
}

.gallery-sentinel {
	height: 1px;
	width: 100%;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
	.gallery-main {
		padding: 16px 14px 36px;
	}
	.gallery-hero {
		padding: 24px 0 16px;
	}
	.gallery-stats {
		gap: 24px;
	}
	.gallery-hero-ctas {
		gap: 8px;
	}
	.gallery-hero-btn {
		font-size: 13px;
		padding: 11px 16px;
		min-height: 44px;
	}
	.gallery-controls-top {
		flex-direction: column;
		align-items: stretch;
	}
	.gallery-search {
		max-width: 100%;
	}
	/* 16px inputs prevent iOS Safari auto-zoom on focus. */
	.gallery-search input[type='search'] {
		font-size: 16px;
	}
	.gallery-search-clear {
		width: 30px;
		height: 30px;
		font-size: 20px;
	}
	.gallery-sort-select {
		justify-content: center;
	}
	.gallery-sort-select select {
		flex: 1;
		font-size: 16px;
		padding: 13px 12px;
	}
	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 12px;
	}
	.gallery-card-body {
		padding: 10px 12px 12px;
		gap: 6px;
	}
	.gallery-card-name {
		font-size: 14px;
	}
	.gallery-card-desc {
		display: none;
	}
	/* Stack date over actions so a narrow 2-col card never crowds the footer. */
	.gallery-card-foot {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
		padding-top: 8px;
	}
	/* Three actions (Embed / Use / Animate) never fit one row of a half-width
	   card, and a plain flex row cannot shrink a button below its label, so the
	   last one used to be clipped mid-word past the card's edge. A grid wraps
	   them onto as many rows as the card is wide enough for, each one a full
	   tap target. */
	.gallery-card-actions {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
		gap: 8px;
	}
	/* Full-width, comfortably tappable action buttons on phones. */
	.gallery-card-actions .gallery-card-btn {
		min-width: 0;
		justify-content: center;
		min-height: 40px;
		font-size: 12px;
		padding: 8px 8px;
	}
	/* Empty state: lighter padding + wrapping, full-width CTAs on phones. */
	.gallery-empty {
		padding: 24px 18px;
		margin: 32px auto 20px;
	}
	.gallery-empty .gallery-clear-filters,
	.gallery-empty .gallery-clear-cta {
		display: inline-flex;
		justify-content: center;
		min-height: 44px;
		align-items: center;
		margin: 6px 4px 0;
	}
}

/* Extra-small phones (<=360px): keep two comfortable columns, never overflow. */
@media (max-width: 360px) {
	.gallery-main {
		padding: 16px 12px 36px;
	}
	.gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}
}


/* =============================================================================
   From the Forge — section divider + card overrides
   Cards use the same .gallery-card base, so hover/border/shadow all inherit.
   Only the thumb and identity pieces need overrides.
   ============================================================================= */

/* Section wrapper */
.gallery-forge-section {
	margin-top: clamp(40px, 6vw, 72px);
	padding-top: clamp(32px, 5vw, 56px);
	border-top: 1px solid rgba(255, 255, 255, 0.07);
	position: relative;
}

/* Section header row */
.gallery-forge-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}
.gallery-forge-title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
}
.gallery-forge-icon {
	width: 22px;
	height: 22px;
	flex: none;
	opacity: 0.6;
}
.gallery-forge-title {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--ink, #fff);
	margin: 0;
	letter-spacing: -0.015em;
}
.gallery-forge-count {
	font-size: 0.7rem;
	font-weight: 600;
	font-family: var(--font-mono, monospace);
	padding: 3px 10px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.14);
	color: rgba(255, 255, 255, 0.65);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}
.gallery-forge-sub {
	font-size: 0.85rem;
	color: var(--ink-dim, rgba(255,255,255,0.5));
	margin: 0;
	max-width: 56ch;
	line-height: 1.5;
}
.gallery-forge-cta {
	flex: none;
	font-size: 0.825rem;
	font-weight: 700;
	color: #000;
	text-decoration: none;
	white-space: nowrap;
	border: 1px solid transparent;
	border-radius: 99px;
	padding: 9px 20px;
	background: #fff;
	transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast), box-shadow var(--duration-fast), opacity var(--duration-fast);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-shadow: 0 2px 16px rgba(255, 255, 255, 0.12);
	letter-spacing: -0.01em;
}
.gallery-forge-cta:hover {
	background: #f0f0f0;
	color: #000;
	box-shadow: 0 4px 24px rgba(255, 255, 255, 0.18);
	opacity: 0.92;
}
.gallery-forge-cta:focus-visible {
	outline: 2px solid rgba(165, 180, 252, 0.7);
	outline-offset: 2px;
}

/* Grid — matches the main gallery's column width exactly */
.gallery-forge-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px;
}

/* Forge card thumb: don't override the gallery's default radial gradient bg
   for image cards; for no-image cards we set style.background inline so
   the gradient shows through regardless. */
.forge-card .gallery-card-thumb {
	overflow: hidden;
}
/* Placeholder for cards with no preview image —
   centered cube icon with accent color on the gradient bg */
.forge-card-ph {
	width: 60px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.28);
	color: rgba(255, 255, 255, 0.9);
	font-size: 0;
	/* override inherited .gallery-card-ph opacity */
	opacity: 1;
	filter: none;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
	transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard);
}
.forge-card:hover .forge-card-ph {
	transform: scale(1.08);
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.forge-card-ph svg {
	width: 28px;
	height: 28px;
	opacity: 1;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}
/* Prompt-only pill variant — amber tint to distinguish from "3D" badge */
.forge-card-prompt-pill {
	background: rgba(251, 191, 36, 0.15);
	border-color: rgba(251, 191, 36, 0.3);
	color: rgba(251, 191, 36, 0.9);
}
/* Image cards: scale on hover like regular gallery */
.forge-card:hover .gallery-card-thumb img {
	transform: scale(1.04);
}
/* Prompt-only cards: slightly dimmer so they read as "in progress" */
.forge-card--no-model {
	opacity: 0.88;
}
.forge-card--no-model:hover {
	opacity: 1;
}
/* Card name: 2-line clamp so longer prompts don't explode the card */
.forge-card .gallery-card-name {
	font-size: 13.5px;
	-webkit-line-clamp: 2;
	line-height: 1.4;
}
/* Tags: slightly smaller than avatar tags */
.forge-card .gallery-card-tag {
	font-size: 10px;
	padding: 2px 7px;
}

@media (max-width: 744px) {
	.gallery-forge-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
}
@media (max-width: 640px) {
	.gallery-forge-head {
		flex-direction: column;
		gap: 0.5rem;
	}
	.gallery-forge-cta {
		margin-top: 0;
		align-self: flex-start;
	}
	.gallery-forge-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 360px) {
	.gallery-forge-grid {
		gap: 10px;
	}
}

/* ── Category filter chips ───────────────────────────────────── */
.gallery-cat-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-top: 0.75rem;
}
.gallery-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

/* ── Equip modal — accessory-to-avatar picker ────────────────── */
.equip-modal-body {
	padding: 1rem 1.25rem 1.5rem;
}
.equip-modal-loading,
.equip-modal-hint {
	color: var(--tws-muted, #888);
	font-size: 0.9rem;
	padding: 0.75rem 0;
}
.equip-modal-error { color: var(--tws-danger, #f55); }
.equip-signin-btn {
	display: inline-block;
	margin-top: 0.75rem;
}
.equip-avatar-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	max-height: 360px;
	overflow-y: auto;
}
.equip-avatar-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.75rem;
	border-radius: 10px;
	background: var(--tws-surface-2, rgba(255,255,255,0.05));
	border: 1px solid transparent;
	text-decoration: none;
	color: inherit;
	transition: border-color var(--duration-fast), background var(--duration-fast);
}
.equip-avatar-row:hover {
	border-color: var(--tws-accent, #6366f1);
	background: var(--tws-surface-hover, rgba(155,93,255,0.08));
}
.equip-avatar-thumb {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: cover;
	background: var(--tws-surface-2, #1a1a1a);
	flex-shrink: 0;
}
.equip-avatar-name {
	flex: 1;
	font-weight: 500;
	font-size: 0.9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.equip-avatar-cta {
	font-size: 0.8rem;
	color: var(--tws-accent, #6366f1);
	font-weight: 600;
	flex-shrink: 0;
}

/* ── "Surprise me" instant avatar ─────────────────────────────────────────
 * One-click reveal modal (public/gallery/surprise.js). Dark glass panel on a
 * per-avatar tinted stage; matches the gallery's near-black + pink/purple accent.
 */
.surprise-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: grid;
	place-items: center;
	padding: 20px;
	opacity: 0;
	transition: opacity var(--duration-base) var(--ease-standard);
}
.surprise-modal.is-open { opacity: 1; }
/* Guarantee the hidden attribute wins over the display set on state classes
 * below, independent of whether tokens.css (its global [hidden] guard) is loaded. */
.surprise-modal [hidden] { display: none !important; }
.surprise-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(3, 3, 6, 0.72);
}
.surprise-panel {
	position: relative;
	width: min(440px, 100%);
	max-height: calc(100vh - 40px);
	overflow: auto;
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding: 22px;
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: linear-gradient(180deg, rgba(22, 22, 28, 0.92), rgba(12, 12, 16, 0.94));
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.4);
	transform: translateY(10px) scale(0.98);
	transition: transform var(--duration-base) cubic-bezier(0.2, 0.9, 0.3, 1);
}
.surprise-modal.is-open .surprise-panel { transform: none; }
.surprise-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	border-radius: 6px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.05);
	color: #cfcfd6;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.surprise-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.surprise-close:focus-visible { outline: 2px solid rgba(236, 72, 153, 0.7); outline-offset: 2px; }

.surprise-stage {
	--surprise-hue: 280;
	position: relative;
	aspect-ratio: 4 / 5;
	border-radius: 16px;
	overflow: hidden;
	background:
		radial-gradient(ellipse 90% 70% at 50% 34%,
			hsl(var(--surprise-hue) 34% 16%),
			hsl(var(--surprise-hue) 44% 6%));
	transition: background var(--duration-slow) var(--ease-standard);
}
.surprise-viewer {
	width: 100%;
	height: 100%;
	--poster-color: transparent;
	background: transparent;
	opacity: 0;
	animation: surprise-fade-in 0.5s ease forwards;
}
@keyframes surprise-fade-in { to { opacity: 1; } }

.surprise-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
}
.surprise-orb {
	width: 46px;
	height: 46px;
	border-radius: 6px;
	background: conic-gradient(from 0deg, rgba(236, 72, 153, 0), rgba(236, 72, 153, 0.9), rgba(155, 93, 255, 0.9), rgba(236, 72, 153, 0));
	mask: radial-gradient(closest-side, transparent 62%, #000 64%);
	-webkit-mask: radial-gradient(closest-side, transparent 62%, #000 64%);
	animation: surprise-spin 0.9s linear infinite;
}
@keyframes surprise-spin { to { transform: rotate(360deg); } }
.surprise-loading-text {
	margin: 0;
	font-size: 0.82rem;
	color: rgba(255, 255, 255, 0.62);
	letter-spacing: 0.01em;
}
.surprise-error {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
	text-align: center;
}
.surprise-error p { margin: 0; color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; }

.surprise-meta { text-align: center; }
.surprise-eyebrow {
	font-family: var(--font-mono, 'JetBrains Mono', monospace);
	font-size: 0.66rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(236, 72, 153, 0.85);
}
.surprise-name {
	margin: 6px 0 4px;
	font-size: 1.5rem;
	font-weight: 600;
	font-family: 'Space Grotesk', system-ui, sans-serif;
	color: #fff;
	letter-spacing: -0.01em;
}
.surprise-tags {
	margin: 0;
	font-size: 0.76rem;
	color: rgba(255, 255, 255, 0.5);
}
.surprise-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.surprise-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: 0.88rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	border: 1px solid transparent;
	transition: transform var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
}
.surprise-btn:active { transform: translateY(1px); }
.surprise-btn:disabled { opacity: 0.55; cursor: default; }
.surprise-btn:focus-visible { outline: 2px solid rgba(236, 72, 153, 0.7); outline-offset: 2px; }
.surprise-btn--ghost {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.12);
	color: #eaeaf0;
}
.surprise-btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.surprise-btn--primary {
	background: linear-gradient(135deg, #22d3ee, #6366f1);
	color: #fff;
	box-shadow: 0 6px 20px rgba(236, 72, 153, 0.28);
}
.surprise-btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.surprise-share {
	align-self: center;
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.45);
	font-size: 0.76rem;
	font-family: inherit;
	cursor: pointer;
	padding: 2px 6px;
	transition: color var(--duration-fast) var(--ease-standard);
}
.surprise-share:hover { color: rgba(255, 255, 255, 0.8); }
.surprise-share:focus-visible { outline: 2px solid rgba(236, 72, 153, 0.7); outline-offset: 2px; border-radius: 6px; }

/* The hero "Surprise me" CTA gets the accent gradient so it reads as primary. */
.gallery-hero-btn--surprise {
	background: linear-gradient(135deg, #22d3ee, #6366f1);
	border-color: transparent;
	color: #fff;
	box-shadow: 0 6px 20px rgba(236, 72, 153, 0.26);
}
.gallery-hero-btn--surprise:hover { filter: brightness(1.06); }

@media (prefers-reduced-motion: reduce) {
	.surprise-modal, .surprise-panel, .surprise-viewer { transition: none; animation: none; }
	.surprise-orb { animation-duration: 2s; }
	.surprise-viewer { opacity: 1; }
}
@media (max-width: 480px) {
	.surprise-panel { padding: 18px; gap: 14px; }
	.surprise-name { font-size: 1.3rem; }
}

/* ── Interactive states (QB-07) ────────────────────────────────────────────
   The sort select already had its border-color transition and nothing ever
   changed the border, so the transition had no trigger. */
.gallery-sort-select select:hover {
	border-color: var(--stroke-strong);
}
