/**
 * Theme showcase — Shopify Templates
 *
 * Alternating panels: a tinted canvas with the desktop and mobile screenshots
 * on one side, the sell on the other. Loaded only on the front page and only
 * when the section is enabled.
 *
 * Contract with themes.js:
 *   [data-mt-themes]           section root
 *   .mt-thm__panel.is-in       panel revealed
 *   .mt-thm__row.is-open       highlight expanded
 *   [data-mt-depth]            parallax layer, strength in the attribute
 *
 * 1. Head
 * 2. Panel shell
 * 3. Canvas & devices
 * 4. Body, accordion, actions
 * 5. Reveal & responsive
 */

/* ==========================================================================
   1. Head
   ========================================================================== */

:is(.mt-main,:where(.mt-block)) .mt-thm {
	background: var(--mt-bg-cream);
	overflow: clip;
}

.mt-thm__head {
	display: grid;
	gap: 26px;
	margin-bottom: clamp(36px, 4vw, 60px);
}

.mt-thm__head .mt-lede {
	max-width: 56ch;
}

.mt-thm__head-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

/* ==========================================================================
   2. Panel shell
   ========================================================================== */

.mt-thm__list {
	display: flex;
	flex-direction: column;
	gap: clamp(20px, 2.6vw, 34px);
}

.mt-thm__panel {
	--mt-thm-wash: linear-gradient(150deg, #eef5d8 0%, #dcecb8 100%);
	--mt-thm-chip: rgba(18, 55, 42, 0.07);

	position: relative;
	display: grid;
	gap: clamp(24px, 3vw, 48px);
	padding: clamp(16px, 1.6vw, 22px);
	border: 1px solid rgba(18, 55, 42, 0.12);
	border-radius: clamp(24px, 2.6vw, 36px);
	background: #fff;
	overflow: hidden;
	transition: border-color 0.45s ease, box-shadow 0.5s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__panel:hover {
	border-color: rgba(18, 55, 42, 0.28);
	box-shadow: 0 40px 70px -50px rgba(18, 55, 42, 0.5);
}

.mt-thm__panel--sage { --mt-thm-wash: linear-gradient(150deg, #dfeee6 0%, #c6e0d3 100%); }
.mt-thm__panel--sand { --mt-thm-wash: linear-gradient(150deg, #f5ecdc 0%, #eadfc4 100%); }
.mt-thm__panel--mist { --mt-thm-wash: linear-gradient(150deg, #e4ecf3 0%, #ccdae8 100%); }

/* ==========================================================================
   3. Canvas & devices
   ========================================================================== */

.mt-thm__canvas {
	position: relative;
	border-radius: clamp(18px, 2vw, 26px);
	background: var(--mt-thm-wash);
	overflow: hidden;
	aspect-ratio: 16 / 12;
	min-height: 280px;
}

/* A slow-turning sheen so the canvas is never a flat block of colour. */
.mt-thm__wash {
	position: absolute;
	inset: -30%;
	background:
		radial-gradient(closest-side, rgba(255, 255, 255, 0.85), transparent 70%),
		conic-gradient(from 210deg, rgba(255, 255, 255, 0.5), transparent 40%, rgba(255, 255, 255, 0.35));
	opacity: 0.55;
	animation: mt-thm-turn 30s linear infinite;
	pointer-events: none;
}

@keyframes mt-thm-turn {
	to { transform: rotate(360deg); }
}

.mt-thm__device {
	position: absolute;
	margin: 0;
	border-radius: 12px;
	background: #fff;
	overflow: hidden;
	box-shadow: 0 30px 60px -32px rgba(18, 55, 42, 0.55);
	will-change: transform;
}

.mt-thm__shot,
.mt-thm__device .mt-ph {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 0;
}

/* Desktop screenshot: a browser-ish frame, tilted a touch. */
.mt-thm__device--desk {
	left: 8%;
	top: 12%;
	width: 78%;
	aspect-ratio: 1400 / 1000;
	transform: rotate(-1.2deg);
	transition: transform 0.7s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__panel:hover .mt-thm__device--desk {
	transform: rotate(-0.4deg) translateY(-6px);
}

.mt-thm__bar {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 8px 12px;
	background: #fff;
	border-bottom: 1px solid rgba(18, 55, 42, 0.08);
}

.mt-thm__bar i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: rgba(18, 55, 42, 0.16);
}

/* Mobile screenshot: overlaps the desktop frame, lower right. */
.mt-thm__device--phone {
	right: 5%;
	bottom: 8%;
	width: 30%;
	aspect-ratio: 9 / 17;
	border-radius: 22px;
	border: 5px solid #fff;
	transform: rotate(2deg);
	transition: transform 0.7s cubic-bezier(0.33, 0.8, 0.4, 1);
	z-index: 2;
}

.mt-thm__panel:hover .mt-thm__device--phone {
	transform: rotate(0.8deg) translateY(-10px);
}

.mt-thm__niche {
	position: absolute;
	left: 18px;
	top: 18px;
	z-index: 3;
	padding: 7px 14px;
	border-radius: 999px;
	background: var(--mt-dark);
	color: #fff;
	font-family: var(--mt-font-body);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
}

/* ==========================================================================
   4. Body, accordion, actions
   ========================================================================== */

.mt-thm__body {
	display: flex;
	flex-direction: column;
	padding: clamp(8px, 1.4vw, 22px) clamp(8px, 1.6vw, 26px) clamp(14px, 1.6vw, 24px);
}

.mt-thm__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.mt-thm__name {
	margin: 0;
	font-size: clamp(24px, 2.6vw, 34px);
	font-weight: 700;
	letter-spacing: -1px;
	color: var(--mt-ink);
}

.mt-thm__rating {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 13px;
	border-radius: 999px;
	background: var(--mt-thm-chip);
	font-family: var(--mt-font-body);
	font-size: 13px;
	font-weight: 600;
	color: var(--mt-dark);
	white-space: nowrap;
}

.mt-thm__rating svg {
	width: 14px;
	height: 14px;
	color: #f0a028;
}

.mt-thm__text {
	margin: 16px 0 0;
	max-width: 52ch;
	font-family: var(--mt-font-body);
	font-size: 15.5px;
	line-height: 1.62;
	color: var(--mt-muted);
}

/* Accordion of highlights */
.mt-thm__acc {
	margin-top: 24px;
	border-top: 1px solid rgba(18, 55, 42, 0.1);
}

.mt-thm__row {
	border-bottom: 1px solid rgba(18, 55, 42, 0.1);
}

.mt-thm__row-head {
	margin: 0;
	font-size: inherit;
}

.mt-thm__row-btn {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 15px 2px;
	border: 0;
	background: none;
	color: var(--mt-ink);
	font-family: inherit;
	font-size: 16.5px;
	font-weight: 700;
	letter-spacing: -0.3px;
	text-align: left;
	cursor: pointer;
	transition: color 0.3s ease;
}

.mt-thm__dot {
	width: 9px;
	height: 9px;
	flex: none;
	border-radius: 50%;
	background: rgba(18, 55, 42, 0.18);
	transition: background 0.35s ease, transform 0.45s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__row.is-open .mt-thm__dot {
	background: var(--mt-lime);
	transform: scale(1.25);
}

.mt-thm__row-label {
	flex: 1;
}

.mt-thm__row-sign {
	position: relative;
	width: 26px;
	height: 26px;
	flex: none;
	border-radius: 50%;
	border: 1px solid rgba(18, 55, 42, 0.18);
	transition: background 0.35s ease, border-color 0.35s ease, transform 0.5s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__row-sign::before,
.mt-thm__row-sign::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: var(--mt-dark);
	border-radius: 2px;
	transform: translate(-50%, -50%);
	transition: transform 0.45s cubic-bezier(0.33, 0.8, 0.4, 1), background 0.35s ease;
}

.mt-thm__row-sign::before {
	width: 10px;
	height: 1.6px;
}

.mt-thm__row-sign::after {
	width: 1.6px;
	height: 10px;
}

.mt-thm__row.is-open .mt-thm__row-sign {
	background: var(--mt-dark);
	border-color: var(--mt-dark);
	transform: rotate(180deg);
}

.mt-thm__row.is-open .mt-thm__row-sign::before {
	background: #fff;
}

.mt-thm__row.is-open .mt-thm__row-sign::after {
	transform: translate(-50%, -50%) scaleY(0);
	background: #fff;
}

/* Panels open with a grid-rows transition — no height measuring in JS. */
.mt-thm__acc.is-enhanced .mt-thm__row-panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.5s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__acc.is-enhanced .mt-thm__row.is-open .mt-thm__row-panel {
	grid-template-rows: 1fr;
}

.mt-thm__acc.is-enhanced .mt-thm__row-panel > div {
	overflow: hidden;
}

.mt-thm__row-panel p {
	margin: 0;
	padding: 0 40px 18px 21px;
	font-family: var(--mt-font-body);
	font-size: 15px;
	line-height: 1.6;
	color: var(--mt-muted);
}

.mt-thm__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px;
	margin-top: auto;
	padding-top: 26px;
}

.mt-thm__demo {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--mt-font-body);
	font-size: 15px;
	font-weight: 600;
	color: var(--mt-dark);
	text-decoration: none;
}

.mt-thm__demo svg {
	width: 15px;
	height: 15px;
	transition: transform 0.45s cubic-bezier(0.33, 0.8, 0.4, 1);
}

.mt-thm__demo:hover svg {
	transform: translate(3px, -3px);
}

/* ==========================================================================
   5. Reveal & responsive
   ========================================================================== */

.mt-thm.is-ready .mt-thm__panel {
	opacity: 0;
	transform: translate3d(0, 36px, 0);
}

.mt-thm.is-ready .mt-thm__panel.is-in {
	opacity: 1;
	transform: none;
}

.mt-no-anim .mt-thm .mt-thm__panel {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.mt-thm.is-ready .mt-thm__panel {
		opacity: 1;
		transform: none;
	}

	.mt-thm__wash,
	.mt-thm__device {
		animation: none;
		transition: none;
	}
}

@media (min-width: 980px) {
	.mt-thm__head {
		grid-template-columns: 1fr auto;
		align-items: end;
	}

	.mt-thm__panel {
		grid-template-columns: 1.05fr 0.95fr;
		align-items: stretch;
	}

	/* Alternate the canvas side so the eye zig-zags down the section. */
	.mt-thm__panel:nth-child(even) .mt-thm__canvas {
		order: 2;
	}

	.mt-thm__canvas {
		aspect-ratio: auto;
		min-height: 440px;
	}
}

/* When no mobile screenshot is set the desktop frame takes the whole canvas
   instead of leaving an empty phone-shaped hole. */
.mt-thm__canvas.is-single .mt-thm__device--desk {
	left: 7%;
	top: 50%;
	width: 86%;
	transform: translateY(-50%) rotate(-1deg);
}

.mt-thm__panel:hover .mt-thm__canvas.is-single .mt-thm__device--desk {
	transform: translateY(calc(-50% - 6px)) rotate(-0.3deg);
}

/* ==========================================================================
   Catalogue archive
   --------------------------------------------------------------------------
   The archive reuses the showcase panels, so it only needs a header and the
   surrounding rhythm.
   ========================================================================== */

.mt-tharch {
	background: var(--mt-bg-cream);
	padding: clamp(28px, 5vw, 64px) var(--mt-gutter) clamp(48px, 7vw, 100px);
}

.mt-tharch__head {
	margin-bottom: clamp(28px, 4vw, 52px);
}

.mt-tharch .mt-h2 {
	max-width: 22ch;
	font-size: clamp(30px, 4.4vw, 50px);
	letter-spacing: -1.6px;
}

.mt-tharch .mt-lede {
	max-width: 60ch;
}

.mt-tharch__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 26px;
}

.mt-tharch .mt-thm__name a {
	color: inherit;
	text-decoration: none;
}

.mt-tharch .mt-thm__name a:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.mt-tharch .mt-pagination {
	margin-top: clamp(28px, 4vw, 48px);
}

@media (max-width: 640px) {
	.mt-tharch__filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: 6px;
		scrollbar-width: none;
	}

	.mt-tharch__filters::-webkit-scrollbar {
		display: none;
	}
}
