/* ─────────────────────────────────────────────────────────────
 * Melaaura — Product Showcase block  ( melaaura/product-showcase )
 * Front-end styles.
 *
 * An editorial product insert designed to sit BETWEEN paragraphs in a
 * post. It reads as a considered break in the text — hairline rules top
 * and bottom, a quiet label, and a grid of portrait cards — never as an
 * advertisement dropped into the page.
 *
 * All media is object-fit:cover per the standing Melaaura image rule.
 * ───────────────────────────────────────────────────────────── */

.mela-ps {
	--ps-ink:          #1c1a17;
	--ps-muted:        #8a8377;
	--ps-rule:         rgba(28, 26, 23, .14);
	--ps-rule-strong:  rgba(28, 26, 23, .40);
	--ps-frame:        #f4f2ef;
	--ps-gap:          1.75rem;
	--ps-cols:         3;
	--ps-ratio:        1 / 1;

	clear: both;
	margin: 3.75rem 0;
	padding: 2.25rem 0 2.5rem;
	border-top: 1px solid var(--ps-rule);
	border-bottom: 1px solid var(--ps-rule);
	color: var(--ps-ink);
	font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* ── Head ─────────────────────────────────────────────────── */

/* No justify-content here on purpose. Elementor injects a stray
 * <span class="elementor-menu-anchor"> as the first child of this
 * container, and space-between would treat it as a real flex item and
 * shove the heading to the right. Children flow from the left; the
 * optional link pushes itself over with margin-left:auto instead. */
.mela-ps__head {
	display: flex;
	align-items: baseline;
	gap: 1.5rem;
	margin: 0 0 1.75rem;
}

.mela-ps__head > .elementor-menu-anchor { display: none; }

.mela-ps__title {
	margin: 0 !important;
	padding: 0;
	font-family: inherit !important;
	font-size: .72rem !important;
	font-weight: 500 !important;
	font-style: normal !important;
	letter-spacing: .18em;
	text-transform: uppercase;
	line-height: 1.4 !important;
	color: var(--ps-muted) !important;
}

.mela-ps__all {
	flex: none;
	margin-left: auto;
	font-size: .72rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--ps-muted);
	border-bottom: 1px solid transparent;
	transition: color .3s ease, border-color .3s ease;
}

.mela-ps__all:hover {
	color: var(--ps-ink);
	border-bottom-color: var(--ps-rule-strong);
}

/* ── Grid ─────────────────────────────────────────────────── */

.mela-ps__list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.mela-ps__list > li { margin: 0; padding: 0; }
.mela-ps__list > li::before { content: none !important; }

.mela-ps--grid .mela-ps__list {
	display: grid;
	grid-template-columns: repeat(var(--ps-cols), minmax(0, 1fr));
	gap: var(--ps-gap);
}

/* ── Row (horizontal, snapping) ───────────────────────────── */

.mela-ps--row .mela-ps__list {
	display: flex;
	gap: var(--ps-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-bottom: .25rem !important;
}

.mela-ps--row .mela-ps__list::-webkit-scrollbar { display: none; }

.mela-ps--row .mela-ps__list > li {
	flex: 0 0 calc((100% - (var(--ps-cols) - 1) * var(--ps-gap)) / var(--ps-cols));
	scroll-snap-align: start;
}

/* ── Card ─────────────────────────────────────────────────── */

/* Cards are flex columns so that the call-to-action sits on a shared
 * baseline across a row even when one product name wraps to two lines. */
.mela-ps__item { display: flex; }

.mela-ps__card {
	display: flex;
	flex-direction: column;
	width: 100%;
	text-decoration: none !important;
	color: inherit;
	box-shadow: none !important;
}

.mela-ps__media {
	display: block;
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--ps-ratio);
	background: var(--ps-frame);
}

/* Standing rule: fill the frame, never letterbox. */
.mela-ps__media img,
.mela-ps__img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	object-position: center;
	display: block;
	margin: 0 !important;
	border-radius: 0 !important;
	transition: transform 1.1s cubic-bezier(.22, .61, .36, 1);
	will-change: transform;
}

.mela-ps__card:hover .mela-ps__img { transform: scale(1.045); }

.mela-ps__media--empty::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(135deg, transparent 47%, var(--ps-rule) 47%, var(--ps-rule) 53%, transparent 53%);
	opacity: .5;
}

/* ── Meta ─────────────────────────────────────────────────── */

.mela-ps__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	flex: 1;
	padding: .95rem 0 0;
}

.mela-ps__brand {
	display: block;
	font-size: .66rem;
	font-weight: 400;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--ps-muted);
	margin-bottom: .4rem;
}

/* The whole card is a link, so there is no call-to-action label by
 * default. The hover affordance is a hairline drawn under the product
 * name -- text-decoration rather than a positioned ::after so it tracks
 * the text correctly when a long name wraps to two lines. */
.mela-ps__name {
	display: block;
	font-size: .95rem;
	font-weight: 500;
	letter-spacing: .005em;
	line-height: 1.35;
	color: var(--ps-ink);
	text-decoration: underline 1px transparent;
	text-underline-offset: .28em;
	transition: text-decoration-color .4s ease;
}

.mela-ps__card:hover .mela-ps__name { text-decoration-color: var(--ps-rule-strong); }

.mela-ps__line {
	display: block;
	margin-top: .3rem;
	font-size: .78rem;
	font-weight: 300;
	line-height: 1.45;
	color: var(--ps-muted);
}

.mela-ps__cue {
	display: inline-block;
	margin-top: auto;
	padding-top: .7rem;
	font-size: .66rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--ps-ink);
	position: relative;
	padding-bottom: 3px;
}

.mela-ps__cue::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 1px;
	background: var(--ps-rule-strong);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}

.mela-ps__card:hover .mela-ps__cue::after { transform: scaleX(1); }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1024px) {
	.mela-ps { --ps-gap: 1.35rem; }
	.mela-ps--grid.mela-ps--c4 .mela-ps__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.mela-ps--row.mela-ps--c4 { --ps-cols: 3; }
}

@media (max-width: 782px) {
	.mela-ps { margin: 2.75rem 0; padding: 1.75rem 0 2rem; --ps-gap: 1.1rem; }
	.mela-ps--grid .mela-ps__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mela-ps--row { --ps-cols: 2; }
	.mela-ps__head { margin-bottom: 1.35rem; }
}

@media (max-width: 480px) {
	.mela-ps--row { --ps-cols: 1.35; }
	.mela-ps__name { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
	.mela-ps__img,
	.mela-ps__cue::after { transition: none; }
	.mela-ps__card:hover .mela-ps__img { transform: none; }
}
