/* Shop This That – Products block
   Colors and fonts come from Products > Settings (printed as CSS variables). */

.stt-products {
	--stt-gap: 24px;
	--stt-row-gap: 40px;
	--stt-text: inherit;
	--stt-font-title: var(--stt-title-font, var(--wp--preset--font-family--heading, inherit));
	--stt-font-number: var(--stt-number-font, var(--stt-font-title));
	margin-block: 2rem;
	color: var(--stt-text);
}
.stt-products *,
.stt-products *::before,
.stt-products *::after { box-sizing: border-box; }
.stt-products a { text-decoration: none; color: inherit; box-shadow: none; }
.stt-products p { margin: 0; }

/* ---------- Images ---------- */
.stt-media { position: relative; display: block; line-height: 0; }
.stt-media img,
.stt-img { display: block; width: 100%; height: auto; max-width: 100%; margin: 0 auto; }
.stt-shape-square .stt-grid .stt-media,
.stt-shape-portrait .stt-grid .stt-media { position: relative; overflow: hidden; }
.stt-shape-square .stt-grid .stt-media { aspect-ratio: 1 / 1; }
.stt-shape-portrait .stt-grid .stt-media { aspect-ratio: 4 / 5; }
.stt-shape-square .stt-grid .stt-media img,
.stt-shape-portrait .stt-grid .stt-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stt-noimg { display: block; aspect-ratio: 1 / 1; background: #f3f1ed; }

.stt-soldout {
	position: absolute; top: 8px; left: 8px;
	background: rgba(255, 255, 255, .92); color: #1a1a1a;
	font-size: 11px; line-height: 1; letter-spacing: .08em; text-transform: uppercase;
	padding: 5px 8px;
}
.stt-media:has(.stt-soldout) img { opacity: .55; }

/* ---------- Shared text ---------- */
.stt-title {
	font-family: var(--stt-font-title);
	font-weight: 400;
	font-size: 1.6rem;
	line-height: 1.15;
	margin: 0;
}
.stt-label { font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.stt-price { font-size: .95rem; }
.stt-price-was { opacity: .7; margin-left: .25em; }
.stt-desc { font-size: .95rem; line-height: 1.55; }
.stt-desc p + p { margin-top: .6em; }

.stt-btn {
	display: inline-block;
	font-family: var(--stt-font-title);
	font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
	font-size: .9rem; line-height: 1; text-align: center;
	padding: .85em 1.8em;
	border: 1px solid var(--stt-button-bg, #2f3338);
	border-radius: var(--stt-btn-radius, 3px);
	transition: opacity .15s;
}
.stt-products .stt-btn { background: var(--stt-btn-fill, var(--stt-button-bg, #2f3338)); color: var(--stt-btn-color, #fff); }
.stt-products a.stt-btn:hover,
.stt-framed:hover .stt-btn { opacity: .85; }
.stt-btn-wrap { display: block; }
/* Button looks chosen per block */
.stt-bs-outline .stt-btn { background: transparent; color: var(--stt-taupe, #6b5d4f); border-color: var(--stt-taupe, #6b5d4f); }
.stt-bs-outline a.stt-btn:hover, .stt-bs-outline .stt-framed:hover .stt-btn { background: var(--stt-taupe, #6b5d4f); color: #fff; opacity: 1; }
.stt-bs-taupe .stt-btn { background: var(--stt-taupe, #6b5d4f); color: #fff; border-color: var(--stt-taupe, #6b5d4f); }
.stt-bs-black .stt-btn { background: #000; color: #fff; border-color: #000; }
.stt-layout-cards .stt-btn-wrap { margin-top: .5rem; }
.stt-framed .stt-btn-wrap { margin-top: .6rem; }
.stt-framed .stt-btn { font-size: .8rem; padding: .75em 1.4em; }
.stt-numbered .stt-btn-wrap { margin-top: .4rem; }

/* ---------- Grids (image grid, cards, framed) ---------- */
.stt-grid {
	display: grid;
	grid-template-columns: repeat(var(--stt-cols, 3), minmax(0, 1fr));
	gap: var(--stt-row-gap) var(--stt-gap);
	align-items: start;
}
.stt-layout-grid .stt-grid { align-items: center; }

/* Image + title + price */
.stt-products { --stt-ts: 1; }
.stt-ts-small { --stt-ts: .85; }
.stt-ts-large { --stt-ts: 1.25; }
.stt-layout-cards .stt-title { font-size: calc(1.2rem * var(--stt-ts)); }
.stt-layout-cards .stt-card { text-align: center; }
.stt-layout-cards .stt-card-body { display: flex; flex-direction: column; gap: .5rem; padding-top: 1.75rem; }
.stt-layout-cards .stt-desc { text-align: left; }

/* Framed card */
.stt-layout-framed .stt-grid { align-items: stretch; }
.stt-layout-framed .stt-tile { display: flex; }
.stt-framed {
	display: flex; flex-direction: column; width: 100%;
	border: 1px solid var(--stt-border, #1a1a1a);
	padding: 1rem 1rem 1.25rem;
}
.stt-framed .stt-media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; margin-bottom: 1rem; overflow: hidden; }
.stt-framed .stt-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stt-framed .stt-card-body { margin-top: auto; display: flex; flex-direction: column; gap: .35rem; padding-top: .5rem; }
.stt-framed { align-items: center; text-align: center; }
.stt-framed .stt-card-body { align-items: center; width: 100%; }
.stt-framed .stt-btn-wrap { display: flex; justify-content: center; }
.stt-framed .stt-title { color: var(--stt-accent, #9a8455); font-size: calc(1.15rem * var(--stt-ts)); line-height: 1.2; }
.stt-frames-gold .stt-framed { border-color: var(--stt-accent, #9a8455); }
/* Touching frames: neighbours share one line instead of two */
.stt-frames-touch .stt-grid { gap: 0; }
.stt-frames-touch .stt-framed { margin: 0 -1px -1px 0; box-sizing: border-box; }

/* ---------- Feature rows ---------- */
.stt-feature-list { display: flex; flex-direction: column; gap: 3.5rem; }
.stt-feature { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; }
.stt-feature-text { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: 520px; margin: 0 auto; }
.stt-feature .stt-title { font-size: calc(1.9rem * var(--stt-ts)); }
.stt-feature .stt-media img { max-height: 560px; width: auto; }
.stt-feature.stt-img-left .stt-media { order: -1; }
/* Image wrappers hug the image so the "Sold out" label sits on the photo's corner */
.stt-feature .stt-media,
.stt-num-cell .stt-media { width: fit-content; max-width: 100%; margin-inline: auto; }

/* ---------- Numbered favorites ---------- */
.stt-numbered {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	border-top: 1px solid var(--stt-border, #1a1a1a);
	border-left: 1px solid var(--stt-border, #1a1a1a);
}
.stt-num-cell {
	border-right: 1px solid var(--stt-border, #1a1a1a);
	border-bottom: 1px solid var(--stt-border, #1a1a1a);
	padding: 1.5rem 1.75rem 2rem;
	display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
	text-align: center;
}
.stt-num-text { display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 100%; }
.stt-num { font-family: var(--stt-font-number); font-weight: 700; font-size: 3.25rem; line-height: 1; }
.stt-numbered .stt-title { color: var(--stt-accent, #9a8455); font-size: 1.1rem; font-weight: 700; }
.stt-numbered .stt-desc { font-size: .85rem; }
.stt-num-cell .stt-media { margin-top: auto; }
.stt-num-cell .stt-media img { max-height: 340px; width: auto; }
.stt-num-cell.stt-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 2rem; padding: 2rem 2.5rem; }
.stt-num-cell.stt-wide .stt-num-text { flex: 1 1 55%; }
.stt-num-cell.stt-wide .stt-media { flex: 0 1 auto; max-width: 42%; margin: 0 auto; }
.stt-more {
	background: none; border: 0; padding: 0; cursor: pointer;
	font: inherit; font-size: .8rem; text-decoration: underline; color: inherit;
}

/* ---------- Phones ---------- */
@media (max-width: 600px) {
	.stt-products { --stt-gap: 12px; --stt-row-gap: 24px; }
	.stt-grid { grid-template-columns: repeat(var(--stt-cols-m, 2), minmax(0, 1fr)); }
	.stt-title { font-size: 1.2rem; }
	.stt-layout-cards .stt-title { font-size: calc(1rem * var(--stt-ts)); }
	.stt-layout-cards .stt-card-body { padding-top: .9rem; gap: .35rem; }
	.stt-price, .stt-desc { font-size: .85rem; }
	.stt-framed { padding: .6rem .6rem .8rem; }
	.stt-framed .stt-title { font-size: calc(.95rem * var(--stt-ts)); }
	.stt-frames-touch .stt-grid { gap: 0; }
	/* Buttons in side-by-side items stretch to the item width */
	.stt-grid .stt-btn { display: block; width: 100%; font-size: .72rem; padding: .8em .5em; }
	.stt-m-keep .stt-numbered .stt-btn,
	.stt-m-compact .stt-numbered .stt-btn { font-size: .72rem; padding: .8em 1.2em; }

	.stt-feature-list { gap: 2.5rem; }
	.stt-feature { grid-template-columns: 1fr; gap: 1.25rem; }
	.stt-feature .stt-media { order: -1; }
	.stt-feature .stt-media img { max-height: 420px; }
	.stt-feature .stt-title { font-size: calc(1.5rem * var(--stt-ts)); }

	/* Numbered: "stack" = one per row */
	.stt-m-stack .stt-numbered { grid-template-columns: 1fr; }
	.stt-m-stack .stt-num-cell.stt-wide { flex-direction: column; }
	.stt-m-stack .stt-num-cell.stt-wide .stt-media { order: 2; }

	/* Numbered: "keep" and "compact" = same 2 + 1 rhythm as desktop, scaled down */
	.stt-m-keep .stt-num-cell,
	.stt-m-compact .stt-num-cell { padding: .9rem .7rem 1.1rem; gap: .8rem; }
	.stt-m-keep .stt-num,
	.stt-m-compact .stt-num { font-size: 2.2rem; }
	.stt-m-keep .stt-numbered .stt-title,
	.stt-m-compact .stt-numbered .stt-title { font-size: .95rem; }
	.stt-m-keep .stt-numbered .stt-desc,
	.stt-m-compact .stt-numbered .stt-desc { font-size: .78rem; line-height: 1.45; }
	.stt-m-keep .stt-num-cell .stt-media img,
	.stt-m-compact .stt-num-cell .stt-media img { max-height: 220px; }
	.stt-m-keep .stt-num-cell.stt-wide,
	.stt-m-compact .stt-num-cell.stt-wide { gap: .9rem; padding: 1rem .9rem; }
	.stt-m-keep .stt-num-cell.stt-wide .stt-media img,
	.stt-m-compact .stt-num-cell.stt-wide .stt-media img { max-height: 170px; }

	/* Compact: descriptions in side-by-side items show 3 lines + "more" */
	.stt-m-compact .stt-num-cell:not(.stt-wide) .stt-desc {
		display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
	}
	.stt-m-compact .stt-num-cell:not(.stt-wide) .stt-desc p { display: inline; }
	.stt-m-compact .stt-num-cell.is-open .stt-desc { display: block; -webkit-line-clamp: unset; overflow: visible; }
	.stt-m-compact .stt-num-cell.is-open .stt-desc p { display: block; }
}
