/*
 * Custom layout cards. Shared by the profile tab and the admin designer so
 * the designer canvas renders exactly what members see.
 */

/* Grid of cards: columns per breakpoint come from the tab's design. */
.umwpuf-posts.umwpuf-layout-custom {
	display: grid;
	grid-template-columns: repeat(var(--umwpuf-columns, 3), minmax(0, 1fr));
	gap: var(--umwpuf-grid-gap, 20px);
	align-items: start;
}
@media (max-width: 900px) {
	.umwpuf-posts.umwpuf-layout-custom { grid-template-columns: repeat(var(--umwpuf-columns-tablet, 2), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.umwpuf-posts.umwpuf-layout-custom { grid-template-columns: repeat(var(--umwpuf-columns-mobile, 1), minmax(0, 1fr)); }
}

/* The card is a size container so rows can react to the card's own width. */
.umwpuf-custom-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	overflow-wrap: anywhere;
	box-sizing: border-box;
	container: umwpuf-card / inline-size;
	transition: transform .18s ease, box-shadow .18s ease;
}
.umwpuf-custom-card *, .umwpuf-custom-card *::before, .umwpuf-custom-card *::after { box-sizing: border-box; }
.umwpuf-hover-lift:hover, .umwpuf-hover-lift:focus-within { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15, 23, 42, .14) !important; }
.umwpuf-hover-glow:hover, .umwpuf-hover-glow:focus-within { box-shadow: 0 0 0 3px rgba(79, 70, 229, .25), 0 10px 28px rgba(15, 23, 42, .1) !important; }

/* Rows and columns */
.umwpuf-row {
	display: grid;
	grid-template-columns: var(--umwpuf-row-cols, minmax(0, 1fr));
	min-width: 0;
}
.umwpuf-col { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.umwpuf-row[style*="align-items:stretch"] > .umwpuf-col { justify-content: space-between; }
/* "Stack when the card is narrow": columns become one when the card is under 420px. */
@container umwpuf-card (max-width: 420px) {
	.umwpuf-row-multi.umwpuf-stack-narrow { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
	.umwpuf-row-multi.umwpuf-stack-mobile { grid-template-columns: minmax(0, 1fr); }
}
/* Designer device simulation (no effect on the frontend). */
.umwpuf-sim-mobile .umwpuf-row-multi.umwpuf-stack-mobile { grid-template-columns: minmax(0, 1fr); }

/* Elements: themes style headings, links and images aggressively; reset inside cards. */
.umwpuf-loop-element { min-width: 0; line-height: 1.5; }
.umwpuf-loop-element a { color: inherit; text-decoration: none; }
.umwpuf-loop-element a:hover { text-decoration: underline; }
.umwpuf-loop-heading { margin: 0 !important; padding: 0; font: inherit !important; line-height: 1.3 !important; color: inherit; letter-spacing: -.01em; }
.umwpuf-loop-label { font-weight: 600; opacity: .8; }
.umwpuf-loop-image, .umwpuf-loop-meta { overflow: hidden; }
.umwpuf-loop-image img, .umwpuf-loop-meta img { display: block; width: 100%; height: auto; max-width: 100%; border-radius: inherit; }
.umwpuf-loop-image a { display: block; border-radius: inherit; }
.umwpuf-has-ratio img, .umwpuf-has-ratio .umwpuf-thumb-placeholder { aspect-ratio: var(--umwpuf-ratio); object-fit: cover; height: auto; }
.umwpuf-loop-image .umwpuf-thumb-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 120px; background: #f1f5f9; color: #a5b4fc; font-size: 40px; border-radius: inherit; }
.umwpuf-loop-avatar img, .umwpuf-avatar { display: block; border-radius: 50%; object-fit: cover; flex: none; }
.umwpuf-loop-taxonomy { display: flex; flex-wrap: wrap; align-items: center; }
.umwpuf-loop-taxonomy[style*="text-align:center"] { justify-content: center; }
.umwpuf-loop-taxonomy[style*="text-align:right"] { justify-content: flex-end; }
.umwpuf-loop-taxonomy a, .umwpuf-loop-taxonomy > span:not(.umwpuf-loop-label) { display: inline-block; border-radius: 99px; background: rgba(100, 116, 139, .12); padding: 3px 10px; font-size: .9em; line-height: 1.5; }
.umwpuf-loop-button a {
	display: inline-flex; align-items: center; justify-content: center;
	padding: .55em 1.1em; border-radius: 8px; text-decoration: none !important;
	background: var(--umwpuf-btn-bg, #1e293b); color: var(--umwpuf-btn-color, #fff) !important;
	transition: filter .15s ease;
}
.umwpuf-loop-button a:hover, .umwpuf-loop-button a:focus-visible { filter: brightness(1.12); }
.umwpuf-loop-divider { width: 100%; height: 0; border: 0; border-top-style: solid; opacity: 1; background: none; }
.umwpuf-loop-spacer { flex: none; }

/* Owner edit action, pinned inside each card. */
.umwpuf-entry-card { position: relative; }
.umwpuf-entry-card .umwpuf-card-edit {
	position: absolute; z-index: 2; top: 10px; right: 10px;
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; border: 1px solid #dbe1ea; border-radius: 50%;
	background: #fff; color: #334155; text-decoration: none; font-size: 18px; line-height: 1;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}
.umwpuf-entry-card .umwpuf-card-edit:hover, .umwpuf-entry-card .umwpuf-card-edit:focus-visible { background: #f1f5f9; color: #1d4ed8; }

@media (prefers-reduced-motion: reduce) {
	.umwpuf-custom-card, .umwpuf-loop-button a { transition: none; }
	.umwpuf-hover-lift:hover, .umwpuf-hover-lift:focus-within { transform: none; }
}
