/* ==========================================================================
   Home — The Everlink Thread
   Scoped to .el-thread. Behaviour: assets/js/sections/home-thread.js
   .is-enhanced is added by the script; without it every scene text is shown
   as a list next to the static Connect drawing.
   ========================================================================== */

.el-thread {
	padding: clamp(0.5rem, 2vw, 1.5rem) var(--el-gutter, 1.25rem) var(--wp--preset--spacing--60, 5rem);
}

.el-thread__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Stage ---------- */

.el-thread__stage {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	align-items: center;
	gap: clamp(1.5rem, 4vw, 4rem);
	max-width: var(--el-wide, 1240px);
	margin: 0 auto;
	padding: clamp(2rem, 5vw, 4.5rem);
	border-radius: clamp(28px, 4vw, 44px);
	background-color: var(--el-mist, #f4f5f7);
}

/* ---------- Scene text ---------- */

.el-thread__panels {
	display: grid;
	gap: 2.5rem;
}

.el-thread__panel > * {
	margin: 0;
}

.el-thread__step {
	margin-bottom: 1rem !important;
	color: var(--el-muted, #555a6b);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.el-thread__title {
	font-size: clamp(2rem, 3.3vw, 3.25rem);
	font-weight: 700;
	line-height: 1.02;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

/* Last two words of each scene heading: the brand gradient */
.el-thread__grad {
	color: var(--el-blue, #003dfa);
	background-image: linear-gradient(100deg, #003dfa 15%, #fb484c 90%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.el-thread__text {
	max-width: 30ch;
	margin-top: 1rem !important;
	color: var(--el-muted, #555a6b);
	font-size: var(--wp--preset--font-size--large, 1.25rem);
	line-height: 1.45;
}

.el-thread__link {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	margin-top: 1.6rem !important;
	color: var(--el-ink, #070816);
	font-weight: 600;
	text-decoration: none;
	border-radius: 6px;
}

.el-thread__link span {
	transition: transform 0.3s var(--el-ease, ease);
}

.el-thread__link:hover {
	color: var(--el-blue, #003dfa);
}

.el-thread__link:hover span {
	transform: translateX(3px);
}

.el-thread__actions {
	margin-top: 1.6rem !important;
}

/* Enhanced: one scene at a time, all stacked in the same cell, so the
   stage height is set by the tallest scene and never jumps. */
.el-thread.is-enhanced .el-thread__panels {
	gap: 0;
}

.el-thread.is-enhanced .el-thread__panel {
	grid-area: 1 / 1;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.35s var(--el-ease, ease), transform 0.35s var(--el-ease, ease),
		visibility 0s linear 0.35s;
}

.el-thread.is-enhanced .el-thread__panel.is-active {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.5s var(--el-ease, ease) 0.15s, transform 0.5s var(--el-ease, ease) 0.15s,
		visibility 0s linear 0s;
}

/* Manual scene choice: the text switches at once (autoplay keeps the
   slower crossfade above). */
.el-thread.is-enhanced.is-manual .el-thread__panel,
.el-thread.is-enhanced.is-manual .el-thread__panel.is-active {
	transform: none;
	transition: opacity 0.18s ease, visibility 0s linear 0s;
}

/* ---------- Drawing ---------- */

.el-thread__canvas {
	position: relative;
	aspect-ratio: 600 / 420;
	width: 100%;
}

.el-thread__svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.el-thread__line {
	fill: none;
	stroke: var(--el-blue, #003dfa);
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

.el-thread__dot {
	fill: var(--el-coral, #fb484c);
}

/* Approved wordmark, unchanged PNG, centred above the Connect line. */
.el-thread__logo {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 45%;
	height: auto;
	transform: translate(-50%, -54%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.6s var(--el-ease, ease);
}

.el-thread[data-scene="connect"] .el-thread__logo,
.el-thread:not(.is-enhanced) .el-thread__logo {
	opacity: 1;
	transition-delay: 0.45s;
}

/* ---------- Controls ---------- */

.el-thread__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	max-width: var(--el-wide, 1240px);
	margin: 1.25rem auto 0;
}

.el-thread__controls[hidden] {
	display: none;
}

.el-thread__tabs {
	display: flex;
	gap: 0.375rem;
	padding: 0.375rem;
	border: 1px solid var(--el-line, #e6e8ed);
	border-radius: 999px;
	background-color: var(--el-paper, #fff);
}

.el-thread__tab,
.el-thread__play {
	position: relative;
	min-height: 44px;
	padding: 0 1.2rem;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--el-muted, #555a6b);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
	overflow: hidden;
	transition: background-color 0.25s var(--el-ease, ease), color 0.25s var(--el-ease, ease);
}

.el-thread__tab:hover {
	color: var(--el-ink, #070816);
	background-color: var(--el-mist, #f4f5f7);
}

.el-thread__tab[aria-selected="true"] {
	background-color: var(--el-ink, #070816);
	color: #fff;
}

.el-thread__tab:focus-visible,
.el-thread__play:focus-visible {
	outline: 2px solid var(--el-blue, #003dfa);
	outline-offset: 2px;
	border-radius: 999px;
}

/* Autoplay progress inside the active tab */
.el-thread__progress {
	position: absolute;
	left: 1.2rem;
	right: 1.2rem;
	bottom: 8px;
	height: 2px;
	border-radius: 2px;
	background-color: rgba(255, 255, 255, 0.9);
	transform: scaleX(var(--el-progress, 0));
	transform-origin: left center;
	opacity: 0;
}

.el-thread.is-autoplay .el-thread__tab[aria-selected="true"] .el-thread__progress {
	opacity: 1;
}

.el-thread__play {
	border: 1px solid var(--el-line, #e6e8ed);
	background-color: var(--el-paper, #fff);
	color: var(--el-ink, #070816);
}

.el-thread__play:hover {
	background-color: var(--el-mist, #f4f5f7);
}

.el-thread__play[hidden] {
	display: none;
}

/* ---------- Mobile ---------- */

@media (max-width: 820px) {
	.el-thread__stage {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.5rem;
		padding: 1.5rem 1.5rem 2rem;
	}

	.el-thread__canvas {
		order: -1;
		max-width: 520px;
		margin: 0 auto;
	}

	.el-thread__title {
		font-size: clamp(1.75rem, 7vw, 2.4rem);
	}

	.el-thread__text {
		font-size: 1.0625rem;
	}
}

@media (max-width: 480px) {
	.el-thread__controls {
		flex-direction: column;
		align-items: stretch;
	}

	.el-thread__tabs {
		display: grid;
		grid-template-columns: 1fr 1fr;
		border-radius: 26px;
	}

	.el-thread__play {
		align-self: center;
	}
}
