/* ==========================================================================
   Prompt Cards — frontend
   Shared chrome: section, header, filter chips, card, pagination.
   Layout geometry lives in styles/{style}/style.css.
   ========================================================================== */

.pc-section {
	--pc-accent:      #6366f1;
	--pc-accent-2:    #ec4899;
	--pc-title:       #0f172a;
	--pc-meta:        #64748b;
	--pc-card-bg:     #ffffff;
	--pc-surface:     transparent;
	--pc-radius:      18px;
	--pc-gap:         18px;
	--pc-cols:        4;
	--pc-col-w:       240px;

	/* One column track: never narrower than --pc-col-w, never more than
	   --pc-cols across. This is what makes the wall responsive without a
	   single breakpoint — it drops a column instead of squeezing. */
	--pc-track-w: max(
		var(--pc-col-w),
		calc((100% - (var(--pc-cols) - 1) * var(--pc-gap)) / var(--pc-cols))
	);

	--pc-track:       #f1f2f5;
	--pc-line:        rgba(15, 23, 42, .08);
	--pc-shadow:      0 1px 2px rgba(15, 23, 42, .05), 0 10px 28px -14px rgba(15, 23, 42, .28);
	--pc-shadow-lift: 0 2px 6px rgba(15, 23, 42, .07), 0 22px 44px -18px rgba(15, 23, 42, .42);
	--pc-ease:        cubic-bezier(.2, .7, .3, 1);

	max-width: 1400px;
	margin: 40px auto;
	padding: 8px 20px 32px;
	background: var(--pc-surface);
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--pc-title);
}

.pc-section *,
.pc-section *::before,
.pc-section *::after { box-sizing: border-box; }

.pc-section a { text-decoration: none; }

.pc-section :focus-visible {
	outline: 2px solid var(--pc-accent);
	outline-offset: 3px;
	border-radius: 8px;
}

/* Header
   ========================================================================== */
.pc-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 22px;
}

.pc-header-text { flex: 1 1 260px; min-width: 0; }

.pc-section h2.pc-heading {
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	font-size: clamp(24px, 3.2vw, 34px);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -.02em;
	color: var(--pc-title);
}

.pc-title-accent {
	background: linear-gradient(92deg, var(--pc-accent), var(--pc-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: var(--pc-accent);
}

.pc-subheading {
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
	color: var(--pc-meta);
}

.pc-view-all {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 16px;
	border-radius: 999px;
	border: 1px solid var(--pc-line);
	font-size: 14px;
	font-weight: 600;
	color: var(--pc-title);
	background: var(--pc-card-bg);
	transition: transform .2s var(--pc-ease), box-shadow .2s var(--pc-ease);
}
.pc-view-all:hover { transform: translateX(2px); box-shadow: var(--pc-shadow); }

/* Filter bar
   ========================================================================== */
.pc-filterbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 22px;
}

.pc-chips {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
	min-width: 0;
}

/* The sort group reads as one segmented control, the model group as free chips. */
.pc-chips-sort {
	background: var(--pc-track);
	border-radius: 999px;
	padding: 4px;
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
}
.pc-chips-sort::-webkit-scrollbar { display: none; }

.pc-chip {
	--pc-chip: var(--pc-accent);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	border: 1px solid transparent;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	color: var(--pc-meta);
	background: transparent;
	cursor: pointer;
	transition: color .18s var(--pc-ease), background-color .18s var(--pc-ease),
	            border-color .18s var(--pc-ease), box-shadow .18s var(--pc-ease);
}

.pc-chip:hover { color: var(--pc-title); background: var(--pc-track); }

.pc-chips-model .pc-chip.is-active {
	color: var(--pc-title);
	background: var(--pc-card-bg);
	border-color: var(--pc-line);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.pc-chips-sort .pc-chip:hover { background: rgba(255, 255, 255, .55); }
.pc-chips-sort .pc-chip.is-active {
	color: var(--pc-title);
	background: #fff;
	box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.pc-chip-icon {
	width: 16px;
	height: 16px;
	object-fit: contain;
	border-radius: 4px;
	flex: none;
}

.pc-chip-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--pc-chip);
	flex: none;
}

/* Wall wrapper — holds the loading veil
   ========================================================================== */
.pc-wall-wrap { position: relative; min-height: 80px; }

.pc-wall-veil {
	position: absolute;
	inset: 0;
	background: var(--pc-surface, #fff);
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s var(--pc-ease);
}
.pc-section.is-busy .pc-wall-veil { opacity: .62; pointer-events: auto; }
.pc-section.is-busy .pc-masonry { transition: opacity .18s var(--pc-ease); }

/* Card
   ========================================================================== */
.pc-card { position: relative; }

.pc-card-inner {
	display: flex;
	flex-direction: column;
	background: var(--pc-card-bg);
	border-radius: var(--pc-radius);
	transition: transform .28s var(--pc-ease), box-shadow .28s var(--pc-ease);
}

.pc-frame {
	position: relative;
	border-radius: var(--pc-radius);
	overflow: hidden;
	background: #eef0f4;
	box-shadow: var(--pc-shadow);
	transition: box-shadow .28s var(--pc-ease);
}

.pc-media {
	display: block;
	position: relative;
	aspect-ratio: var(--pc-ratio, 1.5);
	width: 100%;
}

.pc-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s var(--pc-ease);
}

.pc-img--placeholder {
	background: linear-gradient(135deg, var(--pc-accent), var(--pc-accent-2));
	opacity: .85;
}

/* Scrim: light at rest so the title stays legible, deeper on hover so the
   action row has something to sit on. */
.pc-veil {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top,
		rgba(2, 6, 23, .74) 0%,
		rgba(2, 6, 23, .32) 26%,
		rgba(2, 6, 23, 0) 52%);
	opacity: .92;
	transition: opacity .28s var(--pc-ease);
}
.pc-card--below .pc-veil { opacity: 0; }

.pc-card:hover .pc-veil,
.pc-card:focus-within .pc-veil { opacity: 1; }

/* Model badge */
.pc-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: calc(100% - 20px);
	padding: 6px 11px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: .01em;
	color: #fff;
	background: rgba(2, 6, 23, .58);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	pointer-events: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pc-badge img { width: 14px; height: 14px; object-fit: contain; border-radius: 3px; flex: none; }
.pc-badge-dot {
	width: 7px; height: 7px; border-radius: 50%; flex: none;
	background: var(--pc-model, var(--pc-accent));
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .28);
}

/* Bottom stack: actions above, title below */
.pc-foot {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	pointer-events: none;
}
.pc-card--below .pc-foot { padding-bottom: 12px; }

.pc-overlay-text { pointer-events: none; }

.pc-section h3.pc-card-title {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.34;
	letter-spacing: -.005em;
	color: #fff;
	text-shadow: 0 1px 12px rgba(2, 6, 23, .45);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pc-card-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 7px;
	font-size: 12px;
	line-height: 1;
	color: rgba(255, 255, 255, .82);
}

.pc-meta-author,
.pc-meta-views {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

.pc-section img.pc-avatar {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	object-fit: cover;
	flex: none;
	box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5);
}

/* Title below the image instead of on it */
.pc-below-text {
	padding: 12px 4px 2px;
}
.pc-card--below .pc-below-text .pc-card-title {
	color: var(--pc-title);
	text-shadow: none;
}
.pc-card--below .pc-below-text .pc-card-meta { color: var(--pc-meta); }
.pc-card--below .pc-below-text .pc-avatar { box-shadow: 0 0 0 1.5px rgba(15, 23, 42, .1); }

/* Action row — revealed on hover, always on for touch */
.pc-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .22s var(--pc-ease), transform .22s var(--pc-ease);
}
.pc-card:hover .pc-actions,
.pc-card:focus-within .pc-actions { opacity: 1; transform: none; }

.pc-actions > * { pointer-events: auto; }

.pc-section button.pc-btn-prompt,
.pc-section button.pc-btn-like {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 13px;
	border: 0;
	border-radius: 999px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	color: var(--pc-title);
	background: rgba(255, 255, 255, .94);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow: 0 2px 10px rgba(2, 6, 23, .22);
	transition: transform .16s var(--pc-ease), background-color .16s var(--pc-ease), color .16s var(--pc-ease);
}
.pc-section button.pc-btn-prompt:hover,
.pc-section button.pc-btn-like:hover { transform: translateY(-1px); background: #fff; }

.pc-section button.pc-btn-prompt.is-copied {
	color: #fff;
	background: var(--pc-accent);
}

.pc-btn-like { margin-left: auto; }
.pc-btn-like svg { transition: transform .2s var(--pc-ease); }
.pc-section button.pc-btn-like.is-liked { color: #e11d48; }
.pc-section button.pc-btn-like.is-liked svg { fill: currentColor; stroke: currentColor; transform: scale(1.08); }

/* Hover treatments (set by the style) */
.pc-hover-lift .pc-card:hover .pc-card-inner { transform: translateY(-5px); }
.pc-hover-lift .pc-card:hover .pc-frame { box-shadow: var(--pc-shadow-lift); }
.pc-hover-zoom .pc-card:hover .pc-img { transform: scale(1.055); }

/* Newly loaded cards */
.pc-card.pc-fresh {
	animation: pc-rise .42s var(--pc-ease) both;
}
@keyframes pc-rise {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

/* Pagination / load more
   ========================================================================== */
.pc-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 32px;
}
.pc-page-item .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--pc-meta);
	background: var(--pc-track);
}
.pc-page-item .page-numbers.current {
	color: #fff;
	background: var(--pc-accent);
}
.pc-page-item a.page-numbers:hover { color: var(--pc-title); }

.pc-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 34px;
}

.pc-section button.pc-more-btn {
	padding: 13px 28px;
	border: 1px solid var(--pc-line);
	border-radius: 999px;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--pc-title);
	background: var(--pc-card-bg);
	cursor: pointer;
	transition: transform .18s var(--pc-ease), box-shadow .18s var(--pc-ease), opacity .18s;
}
.pc-section button.pc-more-btn:hover { transform: translateY(-2px); box-shadow: var(--pc-shadow); }
.pc-section button.pc-more-btn[disabled] { opacity: .5; cursor: default; transform: none; }

.pc-spinner { display: none; gap: 5px; }
.pc-spinner.is-on { display: flex; }
.pc-spinner span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pc-accent);
	animation: pc-bounce 1s infinite ease-in-out;
}
.pc-spinner span:nth-child(2) { animation-delay: .14s; }
.pc-spinner span:nth-child(3) { animation-delay: .28s; }
@keyframes pc-bounce {
	0%, 80%, 100% { transform: scale(.6); opacity: .45; }
	40%           { transform: scale(1);  opacity: 1; }
}

/* Empty state
   ========================================================================== */
.pc-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 56px 20px;
	border: 1px dashed var(--pc-line);
	border-radius: var(--pc-radius);
	color: var(--pc-meta);
	text-align: center;
}
.pc-empty p { margin: 0; font-size: 15px; }

/* Touch: no hover state to rely on, so keep the controls visible
   ========================================================================== */
@media (hover: none) {
	.pc-actions { opacity: 1; transform: none; }
	.pc-btn-prompt .pc-btn-label { display: none; }
	.pc-btn-prompt { padding: 8px 10px; }
}

@media (max-width: 600px) {
	.pc-section { padding: 4px 14px 24px; margin: 24px auto; }
	.pc-filterbar { gap: 10px; }
	.pc-chips-model { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.pc-chips-model::-webkit-scrollbar { display: none; }
	.pc-chip { padding: 8px 13px; font-size: 13px; }
	.pc-section h3.pc-card-title { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.pc-section *,
	.pc-section *::before,
	.pc-section *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
