/**
 * Interactive trial — hover animations and effects on a copy of the homepage
 * (see inc/interactive-trial.php). Loaded on that page only, after the theme's
 * own styles, and scoped to body.is-interactive; it works with either design,
 * since both share the theme's colour tokens.
 *
 * From the client's Homepage Design:
 *   - product cards, three at a time, that open under the pointer to show
 *     their description;
 *   - the reasons as points on a world map, opening to a card;
 *   - news cards that glow, fill their arrow and show their summary.
 * From the reference site (curiumpharma.com):
 *   - button labels that roll over, and arrows that slide;
 *   - pictures that draw back into a frame as they zoom;
 *   - sections that fade and rise into place as they scroll in.
 *
 * Every animation stops for visitors who ask for reduced motion.
 */

.is-interactive {
	--trial-ease: cubic-bezier(0.7, 0, 0.3, 1);
	--trial-ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
	--trial-glow: 0 0 0 1px var(--brand), 0 22px 44px -22px rgb(0 91 150 / 55%);
}

/* Sections fade and rise in as they scroll into view ------------------------
   Only once the script has marked the page, so nothing is hidden without it. */

.trial-js .trial-reveal-item {
	opacity: 0;
	transform: translateY(2rem);
	transition: opacity 0.8s ease-out, transform 0.8s var(--trial-ease-out);
	transition-delay: calc(var(--trial-i, 0) * 90ms);
}

.trial-js .is-revealed .trial-reveal-item {
	opacity: 1;
	transform: none;
}

/* Buttons: the label rolls up and a copy rolls in; the arrow slides -------- */

.is-interactive .trial-roll {
	display: inline-grid;
	overflow: hidden;
	line-height: inherit;
	vertical-align: top;
}

.is-interactive .trial-roll > span {
	grid-area: 1 / 1;
	transition: transform 0.45s var(--trial-ease);
}

.is-interactive .trial-roll__copy {
	transform: translateY(110%);
}

.is-interactive .button:hover .trial-roll__label,
.is-interactive .button:focus-visible .trial-roll__label {
	transform: translateY(-110%);
}

.is-interactive .button:hover .trial-roll__copy,
.is-interactive .button:focus-visible .trial-roll__copy {
	transform: none;
}

.is-interactive .button .icon,
.is-interactive .link-arrow .icon {
	transition: transform 0.35s var(--trial-ease), background-color 0.3s, color 0.3s;
}

.is-interactive .button:hover .icon,
.is-interactive .button:focus-visible .icon {
	transform: translateX(4px);
}

/* "View Details →", "Read more →": an underline draws in under the words. */
.is-interactive .link-arrow {
	background-image: linear-gradient(currentColor, currentColor);
	background-position: 0 100%;
	background-repeat: no-repeat;
	background-size: 0 1px;
	transition: color 0.3s, background-size 0.45s var(--trial-ease);
}

.is-interactive .link-arrow:hover,
.is-interactive .link-arrow:focus-visible {
	background-size: 100% 1px;
	text-decoration: none;
}

.is-interactive .link-arrow:hover .icon {
	transform: translateX(4px);
}

/* Product categories: a sliding row of cards, three to a view ---------------- */

.trial-products__head {
	display: grid;
	gap: 1rem 3rem;
	align-items: end;
	margin-block-end: 1rem;
}

/* Heading on the left, button on the far right, level with it. The middle
   column is only there for an intro: without one, an empty middle third
   pulled the button in and squeezed the heading onto two lines. */
@media (min-width: 900px) {
	.trial-products__head {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.trial-products__head--intro {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
	}

	.trial-products__head .trial-products__all {
		justify-self: end;
	}
}

.trial-products__heading .section-header__eyebrow {
	margin-block-end: 0.5rem;
}

/* The news section uses this heading too. */
.trial-products__head + .news-grid {
	margin-block-start: 2.5rem;
}

.trial-products__title {
	margin: 0;
	font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
	line-height: 1.1;
}

/* Phones: the heading scales with the screen so "Latest from isoSolutions"
   and "Core product categories" stay on one line, as on wider screens. */
@media (max-width: 599px) {
	.trial-products__title {
		font-size: min(2rem, 6.3vw);
	}
}

.trial-products__intro {
	margin: 0;
	color: var(--fg-muted);
}

.trial-products__all {
	justify-self: start;
	white-space: nowrap;
}

.trial-products__stage {
	position: relative;
}

/* Room around the cards for their shadow and for one to grow a little, without
   moving the row out of line with the heading. */
.trial-products__track {
	display: flex;
	gap: 1rem;
	margin: 0 -0.75rem;
	padding: 1.5rem 0.75rem 1.5rem;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	list-style: none;
	scroll-padding-inline: 0.75rem;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.trial-products__track::-webkit-scrollbar {
	display: none;
}

.trial-card {
	position: relative;
	flex: 0 0 calc((100% - 2rem) / 3);
	min-height: 26rem;
	scroll-snap-align: start;
	transition: transform 0.45s var(--trial-ease);
}

@media (max-width: 899px) {
	.trial-card {
		flex-basis: calc((100% - 1rem) / 2);
	}
}

/* The next card peeks in, so the row reads as one to swipe. */
@media (max-width: 599px) {
	.trial-card {
		flex-basis: 84%;
	}
}

.trial-card__link {
	position: absolute;
	inset: 0;
	display: block;
	color: inherit;
	text-decoration: none;
	background: var(--base);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	transition: box-shadow 0.35s, border-color 0.35s;
}

.trial-card__link:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 3px;
}

.trial-card__num {
	position: absolute;
	inset-block-start: 1rem;
	inset-inline-start: 1.25rem;
	color: color-mix(in srgb, var(--fg-muted) 28%, transparent);
	font-family: var(--font-display, inherit);
	font-size: 3.5rem;
	font-weight: 300;
	line-height: 1;
	letter-spacing: -0.02em;
}

.trial-card__media {
	position: absolute;
	inset-block-start: 4.75rem;
	inset-inline-start: 50%;
	display: grid;
	place-items: center;
	width: 8.5rem;
	height: 8.5rem;
	color: var(--brand);
	background: radial-gradient(circle at 35% 30%, var(--base), color-mix(in srgb, var(--brand) 14%, var(--base)) 72%);
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent), 0 24px 40px -24px color-mix(in srgb, var(--brand) 70%, transparent);
	transform: translateX(-50%);
	transition: transform 0.6s var(--trial-ease), box-shadow 0.6s;
}

.trial-card__media .icon {
	width: 3.25rem;
	height: 3.25rem;
	transition: transform 0.6s var(--trial-ease);
}

/* The row has a set height, or the picture's max-height below has nothing to
   measure against, and a tall picture runs over the card. */
.trial-card--photo .trial-card__media {
	grid-template-rows: 100%;
	width: min(15.5rem, 78%);
	height: 11.5rem;
	background: none;
	border-radius: 0;
	box-shadow: none;
}

/* As big as it fits, whatever its shape; rounded corners follow the picture. */
.trial-card__photo {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 100%;
	border-radius: var(--radius);
	filter: drop-shadow(0 16px 18px rgb(10 31 60 / 16%));
}

.trial-card__body {
	position: absolute;
	inset-block-end: 1.25rem;
	inset-inline: 1.25rem 4.25rem;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
}

.trial-card__title {
	color: var(--brand-dark);
	font-family: var(--font-display, inherit);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.3;
}

.trial-card__text {
	color: var(--fg-muted);
	font-size: 0.875rem;
	line-height: 1.5;
}

.trial-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-block-start: 0.25rem;
	padding: 0.5rem 1rem;
	color: #fff;
	font-size: 0.875rem;
	font-weight: 600;
	background: var(--brand);
	border-radius: var(--radius-pill);
}

.trial-card__arrow {
	position: absolute;
	inset-block-end: 1.25rem;
	inset-inline-end: 1.25rem;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	color: var(--brand);
	background: color-mix(in srgb, var(--brand) 10%, var(--base));
	border-radius: 50%;
	transition: opacity 0.3s, transform 0.4s var(--trial-ease), background-color 0.3s, color 0.3s;
}

/* With a pointer: cards start compact — number, picture, name and arrow —
   and the one under it grows a touch, its picture lifts and the rest of it
   opens underneath, inside the card, so nothing is pushed out of view. Touch
   screens keep every card as it is above, everything showing. */
@media (hover: hover) {
	.trial-card__text,
	.trial-card__cta {
		max-height: 0;
		overflow: hidden;
		opacity: 0;
		transform: translateY(0.5rem);
		transition: max-height 0.5s var(--trial-ease), opacity 0.3s, transform 0.5s var(--trial-ease);
	}

	.trial-card:hover,
	.trial-card:focus-within {
		z-index: 1;
		transform: scale(1.025);
	}

	.trial-card:hover .trial-card__link,
	.trial-card:focus-within .trial-card__link {
		border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
		box-shadow: 0 34px 64px -32px rgb(10 31 60 / 45%);
	}

	.trial-card:hover .trial-card__media,
	.trial-card:focus-within .trial-card__media {
		transform: translate(-50%, -3rem) scale(0.84);
	}

	.trial-card:not(.trial-card--photo):hover .trial-card__media,
	.trial-card:not(.trial-card--photo):focus-within .trial-card__media {
		box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent), 0 40px 60px -30px color-mix(in srgb, var(--brand) 80%, transparent);
	}

	.trial-card:hover .trial-card__media .icon,
	.trial-card:focus-within .trial-card__media .icon {
		transform: rotate(-8deg);
	}

	.trial-card:hover .trial-card__body,
	.trial-card:focus-within .trial-card__body {
		inset-inline-end: 1.25rem;
	}

	.trial-card:hover .trial-card__text,
	.trial-card:hover .trial-card__cta,
	.trial-card:focus-within .trial-card__text,
	.trial-card:focus-within .trial-card__cta {
		max-height: 10rem;
		opacity: 1;
		transform: none;
		transition-delay: 0.15s;
	}

	.trial-card:hover .trial-card__arrow,
	.trial-card:focus-within .trial-card__arrow {
		opacity: 0;
		transform: scale(0.6);
	}
}

@media (hover: none) {
	.trial-card {
		min-height: 22rem;
	}

	.trial-card__arrow {
		display: none;
	}

	.trial-card__body {
		inset-inline-end: 1.25rem;
	}

	/* Beside the number, clear of the name and text below. */
	.trial-card__media {
		inset-block-start: 1.25rem;
		inset-inline-start: auto;
		inset-inline-end: 1.25rem;
		width: 5rem;
		height: 5rem;
		transform: none;
	}

	.trial-card__media .icon {
		width: 2.25rem;
		height: 2.25rem;
	}

	.trial-card--photo .trial-card__media {
		width: 9rem;
		height: 6.5rem;
	}
}

.trial-products__nav {
	position: absolute;
	inset-block-start: 50%;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	color: var(--brand);
	background: var(--base);
	border: 1px solid var(--line);
	border-radius: 50%;
	box-shadow: var(--shadow-card);
	cursor: pointer;
	transform: translateY(-50%);
	transition: color 0.3s, background-color 0.3s, opacity 0.3s, transform 0.3s var(--trial-ease);
}

.trial-products__nav--prev {
	inset-inline-start: -1.375rem;
}

.trial-products__nav--next {
	inset-inline-end: -1.375rem;
}

.trial-products__nav:hover:not(:disabled) {
	color: #fff;
	background: var(--brand);
	transform: translateY(-50%) scale(1.08);
}

.trial-products__nav:disabled {
	cursor: default;
	opacity: 0.35;
}

@media (max-width: 700px) {
	.trial-products__nav {
		display: none;
	}
}

.trial-products__progress {
	max-width: 14rem;
	height: 4px;
	margin: 0.5rem auto 0;
	overflow: hidden;
	background: var(--line);
	border-radius: 4px;
}

.trial-products__progress span {
	display: block;
	width: var(--trial-w, 30%);
	height: 100%;
	background: var(--brand);
	border-radius: inherit;
	transform: translateX(var(--trial-x, 0%));
	transition: transform 0.25s ease-out;
}

/* The reasons, as points on a world map ------------------------------------- */

.trial-why__inner {
	display: grid;
	gap: 2.5rem;
	align-items: center;
}

@media (min-width: 1000px) {
	.trial-why__inner {
		grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
		gap: 3rem;
	}
}

.trial-why__title {
	margin: 0 0 1.25rem;
	font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
	line-height: 1.1;
}

.trial-why__intro {
	margin: 0;
	color: var(--fg-muted);
	font-size: 1.0625rem;
}

.trial-dark .trial-why__intro {
	color: rgb(255 255 255 / 72%);
}

.trial-map {
	position: relative;
	color: var(--brand);
}

.trial-dark .trial-map {
	color: var(--teal-soft, #5fc6c6);
}

.trial-map__svg {
	display: block;
	width: 100%;
	height: auto;
}

.trial-map__land path {
	fill: currentColor;
	opacity: 0.16;
}

.trial-dark .trial-map__land path {
	opacity: 0.2;
}

.trial-map__spots {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.trial-spot {
	position: absolute;
	inset-block-start: var(--y);
	inset-inline-start: var(--x);
	z-index: 1;
	transform: translate(-50%, -50%);
}

.trial-spot:hover,
.trial-spot:focus-within,
.trial-spot.is-open {
	z-index: 3;
}

.trial-spot__pin {
	position: relative;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	color: var(--brand);
	background: var(--base);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 16%, transparent), 0 12px 30px -10px color-mix(in srgb, var(--brand) 70%, transparent);
	cursor: pointer;
	transition: color 0.3s, background-color 0.3s, transform 0.4s var(--trial-ease);
}

/* Two rings pulse out from each point, a beat apart. */
.trial-spot__pin::before,
.trial-spot__pin::after {
	position: absolute;
	inset: 0;
	border: 1px solid var(--brand);
	border-radius: 50%;
	content: "";
	opacity: 0;
	animation: trial-pulse 2.8s ease-out infinite;
	pointer-events: none;
}

.trial-spot__pin::after {
	animation-delay: 1.4s;
}

.trial-dark .trial-spot__pin::before,
.trial-dark .trial-spot__pin::after {
	border-color: var(--teal-soft, #5fc6c6);
}

@keyframes trial-pulse {
	0% {
		opacity: 0.6;
		transform: scale(1);
	}

	100% {
		opacity: 0;
		transform: scale(2.4);
	}
}

.trial-spot:hover .trial-spot__pin,
.trial-spot:focus-within .trial-spot__pin,
.trial-spot.is-open .trial-spot__pin {
	color: #fff;
	background: var(--brand);
	transform: scale(1.1);
}

.trial-spot__card {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: calc(100% + 0.75rem);
	width: max-content;
	max-width: 15rem;
	padding: 0.5rem 0.875rem;
	color: var(--fg);
	background: var(--base);
	border-radius: var(--radius);
	box-shadow: 0 18px 40px -20px rgb(10 31 60 / 50%);
	transform: translateY(-50%);
	transition: padding 0.4s var(--trial-ease), box-shadow 0.4s;
}

.trial-spot--left .trial-spot__card {
	inset-inline: auto calc(100% + 0.75rem);
}

.trial-spot__title {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin: 0;
	color: var(--brand-dark);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.3;
}

/* A small "+" that turns to "×" as the card opens. */
.trial-spot__plus {
	position: relative;
	flex: none;
	width: 1.125rem;
	height: 1.125rem;
	background: var(--brand);
	border-radius: 50%;
	transition: transform 0.4s var(--trial-ease);
}

.trial-spot__plus::before,
.trial-spot__plus::after {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	width: 0.5rem;
	height: 1.5px;
	background: #fff;
	content: "";
	transform: translate(-50%, -50%);
}

.trial-spot__plus::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

/* Width 0, then the card's full width: the hidden reason takes no part in how
   wide the closed card is, so it is as wide as its name. */
.trial-spot__more {
	display: grid;
	grid-template-rows: 0fr;
	width: 0;
	min-width: 100%;
	transition: grid-template-rows 0.45s var(--trial-ease);
}

.trial-spot__text {
	min-height: 0;
	margin: 0;
	overflow: hidden;
	color: var(--fg-muted);
	font-size: 0.8125rem;
	line-height: 1.5;
	opacity: 0;
	transition: opacity 0.3s;
}

.trial-spot:hover .trial-spot__card,
.trial-spot:focus-within .trial-spot__card,
.trial-spot.is-open .trial-spot__card {
	width: 15rem;
	padding: 0.75rem 1rem;
	box-shadow: var(--trial-glow);
}

.trial-spot:hover .trial-spot__more,
.trial-spot:focus-within .trial-spot__more,
.trial-spot.is-open .trial-spot__more {
	grid-template-rows: 1fr;
}

.trial-spot:hover .trial-spot__text,
.trial-spot:focus-within .trial-spot__text,
.trial-spot.is-open .trial-spot__text {
	margin-block-start: 0.375rem;
	opacity: 1;
	transition-delay: 0.1s;
}

.trial-spot:hover .trial-spot__plus,
.trial-spot:focus-within .trial-spot__plus,
.trial-spot.is-open .trial-spot__plus {
	transform: rotate(45deg);
}

/* Phones: the map stays as a picture, with the reasons listed under it. */
@media (max-width: 760px) {
	.trial-map__spots {
		position: static;
		display: grid;
		gap: 0.75rem;
		margin-block-start: 1.5rem;
	}

	.trial-spot {
		position: static;
		display: flex;
		align-items: flex-start;
		gap: 0.875rem;
		transform: none;
	}

	.trial-spot__card,
	.trial-spot:hover .trial-spot__card,
	.trial-spot.is-open .trial-spot__card {
		position: static;
		flex: 1;
		width: auto;
		max-width: none;
		transform: none;
	}

	.trial-spot__more {
		grid-template-rows: 1fr;
	}

	.trial-spot__text {
		margin-block-start: 0.375rem;
		opacity: 1;
	}

	.trial-spot__plus {
		display: none;
	}
}

/* News: the card glows, its picture draws back into a frame as it zooms, its
   arrow fills, and its summary opens ------------------------------------------ */

.is-interactive .news-card {
	transition: transform 0.4s var(--trial-ease), box-shadow 0.4s, border-color 0.4s;
}

.is-interactive .news-card:hover,
.is-interactive .news-card:focus-within {
	border-color: var(--brand);
	box-shadow: var(--trial-glow);
}

.is-interactive .news-card__media {
	overflow: hidden;
	clip-path: inset(0 round 0);
	transition: clip-path 0.6s var(--trial-ease);
}

.is-interactive .news-card__media img {
	transition: transform 0.9s var(--trial-ease-out);
}

.is-interactive .news-card:hover .news-card__media,
.is-interactive .news-card:focus-within .news-card__media {
	clip-path: inset(0.625rem round calc(var(--radius-lg) - 0.25rem));
}

.is-interactive .news-card:hover .news-card__media img,
.is-interactive .news-card:focus-within .news-card__media img {
	transform: scale(1.08);
}

.is-interactive .news-card__title {
	transition: color 0.3s;
}

.is-interactive .news-card:hover .news-card__title,
.is-interactive .news-card:focus-within .news-card__title {
	color: var(--brand);
}

/* The arrow sits in a circle that fills. */
.is-interactive .news-card .link-arrow .icon {
	box-sizing: content-box;
	padding: 0.375rem;
	color: var(--brand);
	background: color-mix(in srgb, var(--brand) 10%, transparent);
	border-radius: 50%;
}

.is-interactive .news-card:hover .link-arrow .icon,
.is-interactive .news-card:focus-within .link-arrow .icon {
	color: #fff;
	background: var(--brand);
	transform: translateX(4px);
}

/* The summary needs the script to wrap it, so it is only hidden once it has. */
@media (hover: hover) {
	.trial-js .is-interactive .news-card__text {
		display: grid;
		grid-template-rows: 0fr;
		margin-block-end: 1rem;
		opacity: 0;
		transition: grid-template-rows 0.5s var(--trial-ease), opacity 0.3s;
	}

	.trial-js .is-interactive .news-card__text > span {
		min-height: 0;
		overflow: hidden;
	}

	.trial-js .is-interactive .news-card:hover .news-card__text,
	.trial-js .is-interactive .news-card:focus-within .news-card__text {
		grid-template-rows: 1fr;
		opacity: 1;
		transition-delay: 0s, 0.1s;
	}
}

/* The quote card lifts ------------------------------------------------------- */

.is-interactive .quote-card {
	transition: box-shadow 0.4s, transform 0.4s var(--trial-ease);
}

.is-interactive .quote-card:hover {
	box-shadow: var(--trial-glow);
	transform: translateY(-4px);
}

/* Partners and communities: the card lifts and the logo comes into colour --- */

.is-interactive .partners__item {
	transition: transform 0.4s var(--trial-ease), box-shadow 0.4s, border-color 0.4s;
}

.is-interactive .partners__item img {
	filter: grayscale(1);
	opacity: 0.75;
	transition: filter 0.4s, opacity 0.4s, transform 0.5s var(--trial-ease);
}

.is-interactive .partners__item:hover {
	border-color: var(--brand);
	box-shadow: var(--trial-glow);
	transform: translateY(-4px);
}

.is-interactive .partners__item:hover img {
	filter: none;
	opacity: 1;
	transform: scale(1.06);
}

/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html:not(.motion-on) .is-interactive *,
	html:not(.motion-on) .is-interactive *::before,
	html:not(.motion-on) .is-interactive *::after {
		transition-duration: 0.01ms !important;
		animation: none !important;
	}

	.trial-js:not(.motion-on) .trial-reveal-item {
		opacity: 1;
		transform: none;
	}
}
