/* Image-first thermal comfort demonstration — V4 --------------------------
 *
 * The generated seasonal artwork carries the visual explanation. Labels,
 * controls and claims remain in HTML around it so nothing competes with or
 * obscures the ray behaviour.
 */

.ew-section.ew-thermal.ew-demo-scene {
	position: relative;
	padding-block: 0;
}

.ew-thermal [hidden] {
	display: none !important;
}

.ew-thermal__canvas,
.ew-thermal__visual {
	margin: 0;
}

.ew-thermal__base-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ew-thermal__caption {
	position: absolute;
	top: 1rem;
	right: var(--ew-demo-copy-inline, 1.25rem);
	z-index: 2;
	margin: 0;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgb(250 247 242 / 0.82);
}

.ew-thermal__layout {
	position: relative;
	z-index: 2;
	display: grid;
	width: 100%;
	box-sizing: border-box;
	background: var(--ew-green-dark);
}

/* Copy and controls stay in one normal-flow column. */
.ew-thermal .ew-demo-scene__copy {
	position: relative;
	inset: auto;
	bottom: auto;
	width: auto;
	max-height: none;
	padding: clamp(2.25rem, 8vw, 4rem) var(--ew-demo-copy-inline) 1.75rem;
	border: 0;
	border-radius: 0;
	background: var(--ew-green-dark);
	box-shadow: none;
	overflow: visible;
}

.ew-thermal .ew-demo-scene__copy h2 {
	max-width: 16ch;
	font-size: clamp(1.75rem, 6vw, 2.5rem);
	line-height: 1.05;
}

.ew-thermal .ew-demo-scene__copy .ew-lede {
	max-width: 31rem;
	font-size: clamp(1rem, 0.9rem + 0.35vw, 1.2rem);
	line-height: 1.5;
}

.ew-thermal__season {
	display: grid;
	justify-items: start;
	gap: 0.5rem;
	width: min(100%, 38rem);
}

.ew-thermal__season-label {
	font-size: 0.72rem;
	font-weight: 650;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: rgb(250 247 242 / 0.76);
}

.ew-thermal__season-switch {
	display: inline-grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	width: min(100%, 17rem);
	padding: 3px;
	border: 1px solid rgb(250 247 242 / 0.34);
	border-radius: 999px;
	background: rgb(6 23 16 / 0.56);
}

.ew-thermal__season-btn {
	appearance: none;
	min-width: 0;
	min-height: 44px;
	padding: 0.55rem clamp(0.4rem, 2vw, 1rem);
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: rgb(250 247 242 / 0.8);
	font: inherit;
	font-size: 0.86rem;
	font-weight: 650;
	cursor: pointer;
	scroll-margin-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

.ew-thermal__season-btn[aria-pressed="true"] {
	background: var(--ew-brand-orange);
	color: #13261b;
}

/* Focus follows the shared scene pattern
   (.ew-demo-scene :is(button, a):focus-visible); no local override. */

/* Keep non-interactive regions clear of the fixed dock when the browser
   aligns them to the viewport edge (scrollIntoView block:end, anchors).
   Matches the 6rem reserve already used by the season buttons. */
.ew-thermal__mode-copy,
.ew-thermal__legend,
.ew-thermal__visual-shell .ew-demo-scene__link,
.ew-thermal__note {
	scroll-margin-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

.ew-thermal__mode-copy {
	width: min(100%, 38rem);
	max-width: 30rem;
	margin: 0;
	padding-left: 0.85rem;
	border-left: 2px solid var(--ew-brand-orange);
	font-size: 0.88rem;
	font-weight: 550;
	line-height: 1.45;
	color: rgb(250 247 242 / 0.86);
}

/* Seasonal artwork */
.ew-thermal__visual-shell {
	display: grid;
	justify-items: center;
	gap: 0.75rem;
	min-width: 0;
	padding: 0 var(--ew-demo-copy-inline) calc(7.5rem + env(safe-area-inset-bottom, 0px));
	background:
		radial-gradient(circle at 50% 38%, rgb(146 184 164 / 0.18), transparent 58%),
		var(--ew-green-dark);
}

.ew-thermal__visual {
	width: min(100%, 38rem);
	color: var(--ew-on-brand);
}

.ew-thermal__axis {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 0 auto 0.25rem;
	padding-inline: 0.25rem;
	font-size: 0.68rem;
	font-weight: 650;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: rgb(250 247 242 / 0.78);
	text-shadow: 0 1px 8px rgb(0 0 0 / 0.65);
}

.ew-thermal__art-img,
.ew-thermal__diagram {
	display: block;
	width: 100%;
	height: auto;
	margin-inline: auto;
	object-fit: contain;
	filter: drop-shadow(0 1.25rem 1.5rem rgb(0 0 0 / 0.26));
}

.ew-thermal__diagram { max-height: min(58svh, 33rem); }
.ew-thermal__diagram text { font-family: var(--ew-font-body); }
.ew-thermal__ray { stroke-dasharray: 20 6; animation: ew-thermal-flow 1.4s linear 3; }
@keyframes ew-thermal-flow { to { stroke-dashoffset: -52; } }
@media (prefers-reduced-motion: reduce) { .ew-thermal__ray { animation: none; stroke-dasharray: none; } }

.ew-thermal__legend {
	position: relative;
	z-index: 1;
	display: grid;
	gap: 0.75rem;
	width: min(100%, 38rem);
	margin: 0;
	padding: 0.9rem 1rem 1rem;
	border: 1px solid rgb(250 247 242 / 0.18);
	border-radius: 12px;
	background: rgb(7 27 18 / 0.9);
	box-shadow: 0 0.8rem 1.8rem rgb(0 0 0 / 0.2);
	backdrop-filter: blur(8px);
}

.ew-thermal__legend strong {
	font-family: var(--ew-font-display);
	font-size: 1rem;
	line-height: 1.2;
}

.ew-thermal__legend ul {
	display: grid;
	gap: 0.55rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ew-thermal__legend-item {
	display: grid;
	grid-template-columns: 0.75rem minmax(0, 1fr);
	align-items: start;
	gap: 0.5rem;
	font-size: 0.78rem;
	line-height: 1.35;
	color: rgb(250 247 242 / 0.86);
}

.ew-thermal__legend-item::before {
	content: "";
	width: 0.7rem;
	height: 0.7rem;
	margin-top: 0.16rem;
	border-radius: 999px;
	background: var(--ew-thermal-key, var(--ew-brand-orange));
}

.ew-thermal__legend-item--light {
	--ew-thermal-key: #ffd83d;
}

.ew-thermal__legend-item--return {
	--ew-thermal-key: #f4511e;
}

.ew-thermal__legend-item--residual {
	--ew-thermal-key: #ffad3f;
}

.ew-thermal__legend-item--cold {
	--ew-thermal-key: #5bb5f2;
}

.ew-thermal__note,
.ew-thermal__noscript {
	width: min(100%, 38rem);
	margin: 0;
	font-size: 0.72rem;
	line-height: 1.5;
	color: rgb(250 247 242 / 0.68);
}

.ew-thermal__noscript {
	margin-top: 0.25rem;
}

.ew-thermal__visual-shell .ew-demo-scene__link {
	width: min(100%, 38rem);
	justify-self: center;
}

@media (min-width: 40em) {
	.ew-thermal__legend ul {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* At the shared shell's desktop breakpoint, tablet still uses a flowing
   image-copy-illustration stack. */
@media (min-width: 64em) and (max-width: 74.99em) {
	.ew-thermal .ew-demo-scene__stage {
		display: block;
		min-height: 0;
	}

	.ew-thermal .ew-demo-scene__media {
		position: relative;
		inset: auto;
		min-height: 0;
		aspect-ratio: 1672 / 941;
	}

	.ew-thermal .ew-demo-scene__media-plane {
		position: absolute;
		inset: 0;
		width: 100%;
		height: auto;
		transform: none;
	}

	.ew-thermal .ew-demo-scene__scrim::before,
	.ew-thermal .ew-demo-scene__scrim::after {
		content: none;
	}
}

/* Desktop: artwork and copy sit in separate grid columns over the photo.
 *
 * The shell keeps DOM order (title, image, controls, legend, CTA) for
 * mobile reading order; here it steps aside (display: contents) so the
 * copy column (title, explanation) keeps the controls, result text,
 * legend and CTA beside the artwork instead of floating over the photo.
 */
@media (min-width: 75em) {
	.ew-thermal__layout {
		grid-template-columns: minmax(0, 58fr) minmax(20rem, 36fr);
		grid-template-rows: repeat(6, auto);
		gap: 0 clamp(2rem, 4vw, 5rem);
		align-items: center;
		align-content: center;
		min-height: 100svh;
		padding: clamp(3.25rem, 7vh, 5rem) clamp(3rem, 6vw, 7rem);
		padding-bottom: calc(clamp(7rem, 13vh, 8.5rem) + env(safe-area-inset-bottom, 0px));
		background: transparent;
	}

	.ew-thermal .ew-demo-scene__copy {
		grid-column: 2;
		grid-row: 1;
		align-self: center;
		padding: 0;
		background: transparent;
	}

	.ew-thermal .ew-demo-scene__copy h2 {
		font-size: clamp(2rem, 2.8vw, 3rem);
	}

	.ew-thermal__visual-shell {
		display: contents;
	}

	.ew-thermal__visual {
		grid-column: 1;
		grid-row: 1 / span 6;
		align-self: center;
		justify-self: center;
		width: min(100%, 39rem);
		background: radial-gradient(circle at 50% 38%, rgb(250 247 242 / 0.16), transparent 61%);
	}

	.ew-thermal__season {
		grid-column: 2;
		grid-row: 2;
		width: 100%;
	}

	.ew-thermal__mode-copy {
		grid-column: 2;
		grid-row: 3;
		width: 100%;
		max-width: 30rem;
	}

	.ew-thermal__legend {
		grid-column: 2;
		grid-row: 4;
		width: 100%;
	}

	.ew-thermal__visual-shell .ew-demo-scene__link {
		grid-column: 2;
		grid-row: 5;
		width: 100%;
		justify-self: start;
	}

	.ew-thermal__note,
	.ew-thermal__noscript {
		grid-column: 2;
		grid-row: 6;
		width: 100%;
	}

	.ew-thermal__art-img {
		width: auto;
		max-width: 100%;
		max-height: min(58svh, 33rem);
	}

	.ew-thermal__axis {
		width: min(100%, 31rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ew-thermal__season-btn,
	.ew-thermal__visual {
		animation: none !important;
		transition: none !important;
	}
}
