/*
 * SECTION STYLE: AITIO HUBS (the Playbook service rows).
 *
 * Measured from Figma "Palvelut" (369:352) and the opened-row
 * exploration "expanded-hub" (371:3696), at 1440 px:
 *
 *   content          80 -> 1360 (1280 wide)
 *   row              80 -> 1339 (1259 wide)
 *   colour block     300 x 280 at the row start
 *   service name     x 426 (36 px Neue Montreal Medium, 130%, -3%)
 *   description      x 732 (20 px Neue Montreal, 140%, -3%)
 *   plus sign        45 x 45 at the row's right edge
 *   dashed rule      64 px above / 68 px below every row
 *
 * Opened row: "INCLUDES" on the left, the includes line + Learn more
 * button at x 405, then "RELATED WORK" over a bleeding work rail.
 * The whole row is one button - the client asked for that - so the
 * title and the + sign are NOT separate links.
 */

.aitio-front-section--playbook_hubs {
	background: var(--aitio-page);
	color: var(--aitio-dark);
}

.aitio-playbook-hubs {
	/* The Figma rule: the exported 1280 x 5 dashed line. */
	--pb-rule: url("../../images/line-shape-divider.svg");
	/* 85 px between the hero and the yellow label; 329 px between the
	 * last rule and the dark CTA band on the 1440 frame. */
	padding-top: 85px;
	padding-bottom: clamp(120px, 22.85vw, 329px);
}

/* ---- the small yellow label, heading and intro ------------------- */

.aitio-playbook-hubs__eyebrow {
	display: inline-block;
	margin: 0;
	padding: 0 7px 0 6px;
	background: var(--aitio-yellow);
	color: var(--aitio-dark);
	font-family: var(--aitio-font);
	font-size: 14px;
	font-weight: 400;
	line-height: 19.2px;
	letter-spacing: 0;
	text-transform: uppercase;
}

.aitio-playbook-hubs__heading {
	max-width: 730px;
	margin: 41px 0 0;
	font-family: var(--aitio-font);
	font-size: var(--aitio-h2);
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.03em;
	color: var(--aitio-dark);
}

.aitio-playbook-hubs__lede {
	max-width: 577px;
	margin: 42px 0 0;
	font-family: var(--aitio-font);
	font-size: var(--aitio-body-m);
	font-weight: 400;
	line-height: 1.5;
	color: var(--aitio-dark);
}

/* ---- the six rows and their dashed rules ------------------------ */

.aitio-playbook-hubs__list {
	margin-top: 63px;
	padding-top: 68px;
	background-image: var(--pb-rule);
	background-position: left top;
	background-repeat: repeat-x;
	background-size: 1280px 5px;
}

/* keeps the anchored row clear of the sticky header */
.aitio-pb {
	scroll-margin-top: 96px;
}

.aitio-pb + .aitio-pb {
	margin-top: 64px;
	padding-top: 68px;
	background-image: var(--pb-rule);
	background-position: left top;
	background-repeat: repeat-x;
	background-size: 1280px 5px;
}

/* the closing rule under the last row */
.aitio-playbook-hubs__list::after {
	content: "";
	display: block;
	height: 5px;
	margin-top: 64px;
	background: var(--pb-rule);
	background-repeat: repeat-x;
	background-position: left top;
	background-size: 1280px 5px;
}

/* ---- one row ---------------------------------------------------- */

.aitio-pb__head {
	position: relative;
	display: grid;
	/* 346 / 310 / 515 / 88 px at the 1259 px row width. The first
	 * column holds the 300 px block and the 46 px gap before the name. */
	grid-template-columns: 27.482% 24.623% 40.906% 6.989%;
	align-items: start;
	width: calc(100% - 21px);
	min-height: 280px;
}

/* The whole row is one big button (transparent). */
.aitio-pb__toggle {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.aitio-pb__toggle:focus-visible {
	outline: 2px solid var(--aitio-black);
	outline-offset: -2px;
}

/* the colour block */
.aitio-pb__swatch {
	position: relative;
	align-self: stretch;
	width: 86.705%;
	min-height: 280px;
	background: var(--hub-colour, var(--aitio-dark));
	overflow: hidden;
}

/* the service video, shown paused until the visitor presses play */
.aitio-pb__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* the Figma colour, laid over the video */
.aitio-pb__tint {
	position: absolute;
	inset: 0;
	background: var(--hub-tint, rgba(0, 0, 0, 0.4));
}

/* the small play button, revealed when the row (the video) is hovered */
.aitio-pb__play {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 68px;
	height: 68px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.94);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, -50%) scale(0.9);
	transition: opacity 0.25s ease, transform 0.3s var(--aitio-ease), background 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.aitio-pb__play-icon {
	width: 0;
	height: 0;
	margin-left: 4px;
	border-style: solid;
	border-width: 11px 0 11px 18px;
	border-color: transparent transparent transparent var(--aitio-dark);
}

.aitio-pb__play:focus-visible {
	outline: 2px solid var(--aitio-dark);
	outline-offset: 3px;
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, -50%) scale(1);
}

@media (hover: hover) {

	.aitio-pb.is-video-hover .aitio-pb__play {
		opacity: 1;
		pointer-events: auto;
		transform: translate(-50%, -50%) scale(1);
	}

	.aitio-pb__play:hover {
		background: #fff;
		transform: translate(-50%, -50%) scale(1.06);
	}
}

/* touch screens cannot hover, so the play button is always there */
@media (hover: none) {

	.aitio-pb__play {
		opacity: 1;
		pointer-events: auto;
		transform: translate(-50%, -50%) scale(1);
	}
}

/* once the video runs, the button gets out of the way */
.aitio-pb.is-playing .aitio-pb__play {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.aitio-pb__name {
	grid-column: 2;
	min-width: 0;
	margin: 0;
	padding-right: 12px;
	font-family: var(--aitio-font);
	font-size: var(--aitio-h3);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -0.03em;
	color: var(--aitio-dark);
	/* Finnish service names can contain long compounds: break them
	 * instead of letting the word run into the description column. */
	overflow-wrap: break-word;
	hyphens: auto;
}

.aitio-pb__text {
	grid-column: 3;
	min-width: 0;
	max-width: 515px;
	margin: 0 0 0 -4px;
	font-family: var(--aitio-font);
	font-size: 20px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: -0.03em;
	color: var(--aitio-dark);
	overflow-wrap: break-word;
}

/* the round + / − sign */
.aitio-pb__sign {
	position: relative;
	grid-column: 4;
	justify-self: end;
	align-self: start;
	width: 45px;
	height: 45px;
	border: 3px solid var(--aitio-black);
	border-radius: 50%;
	box-sizing: border-box;
	transition: transform 0.25s var(--aitio-ease);
}

.aitio-pb__sign::before,
.aitio-pb__sign::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	background: var(--aitio-black);
	border-radius: 1px;
}

.aitio-pb__sign::before {
	width: 21px;
	height: 2px;
	transform: translate(-50%, -50%);
}

.aitio-pb__sign::after {
	width: 2px;
	height: 21px;
	transform: translate(-50%, -50%);
	transition: transform 0.3s var(--aitio-ease), opacity 0.3s ease;
}

.aitio-pb.is-open .aitio-pb__sign::after {
	transform: translate(-50%, -50%) scaleY(0);
	opacity: 0;
}

@media (hover: hover) {

	.aitio-pb__head:hover .aitio-pb__sign {
		transform: scale(1.06);
	}
}

/* ---- the opened part -------------------------------------------- */

.aitio-pb__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.55s var(--aitio-ease);
}

.aitio-pb__panel-inner {
	min-height: 0;
	overflow: hidden;
}

.aitio-pb.is-open .aitio-pb__panel {
	grid-template-rows: 1fr;
}

.aitio-pb__includes,
.aitio-pb__related {
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.35s ease, transform 0.45s var(--aitio-ease);
}

.aitio-pb.is-open .aitio-pb__includes {
	opacity: 1;
	transform: none;
	transition-delay: 0.08s;
}

.aitio-pb.is-open .aitio-pb__related {
	opacity: 1;
	transform: none;
	transition-delay: 0.16s;
}

.aitio-pb__label {
	margin: 0;
	font-family: var(--aitio-font);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 0;
	text-transform: uppercase;
	color: var(--aitio-dark);
}

/* INCLUDES: label on the left, the line + button at x 405 */
.aitio-pb__includes {
	display: grid;
	grid-template-columns: 325px minmax(0, 1fr);
	margin-top: 43px;
	padding-top: 33px;
	background-image: var(--pb-rule);
	background-position: left top;
	background-repeat: repeat-x;
	background-size: 1280px 5px;
}

.aitio-pb__includes-body {
	min-width: 0;
}

.aitio-pb__includes-text {
	max-width: 522px;
	margin: 0;
	font-family: var(--aitio-font);
	font-size: 20px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: -0.03em;
	text-transform: uppercase;
	color: var(--aitio-dark);
}

.aitio-pb__more {
	margin-top: 43px;
}

/* RELATED WORK: label on the left, a rail that bleeds to the right */
.aitio-pb__related {
	display: grid;
	grid-template-columns: 325px minmax(0, 1fr);
	margin-top: 59px;
	padding-top: 47px;
	background-image: var(--pb-rule);
	background-position: left top;
	background-repeat: repeat-x;
	background-size: 1280px 5px;
}

.aitio-pb__rail-wrap {
	min-width: 0;
	margin-top: 20px;
	/* let the rail run to the window edge like the Figma frame */
	margin-right: calc(-1 * var(--aitio-gutter));
	overflow: hidden;
	container-type: inline-size;
}

.aitio-pb__rail {
	display: flex;
	width: max-content;
	gap: var(--aitio-rail-group-gap, 20px);
	margin: 0;
	padding: 0;
	list-style: none;
	transform: translateX(0);
	will-change: transform;
}

.aitio-pb.is-open .aitio-pb__rail {
	animation: aitio-pb-related-marquee var(--aitio-rail-duration, 30s) linear infinite;
}

.aitio-pb__rail-wrap:hover .aitio-pb__rail,
.aitio-pb__rail-wrap:focus-within .aitio-pb__rail {
	animation-play-state: paused;
}

@keyframes aitio-pb-related-marquee {
	to {
		transform: translate3d(var(--aitio-rail-distance, -50%), 0, 0);
	}
}

.aitio-pb__rail-group {
	display: flex;
	flex: 0 0 auto;
	gap: 20px;
	width: max-content;
	margin: 0;
	padding: 0;
	list-style: none;
}

.aitio-pb__work {
	position: relative;
	flex: 0 0 var(--aitio-related-card-width, calc((100cqw - 40px) / 3));
	width: var(--aitio-related-card-width, calc((100cqw - 40px) / 3));
	max-width: var(--aitio-related-card-width, calc((100cqw - 40px) / 3));
	min-width: 0;
	aspect-ratio: 413 / 308.5;
	box-sizing: border-box;
	overflow: hidden;
}

.aitio-pb__work-link {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
}

.aitio-pb__work > picture {
	display: block;
	width: 100%;
	height: 100%;
}

.aitio-pb__cover {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #d9d9d9;
	transition: opacity 0.25s ease;
}

.aitio-pb__work-link:hover .aitio-pb__cover {
	opacity: 0.88;
}

/* ---- tablet: block left, words right, still one row -------------- */

.aitio-pb__close {
	display: none;
}

@media (max-width: 999px) {

	.aitio-pb__head {
		grid-template-columns: 240px minmax(0, 1fr) 45px;
		grid-template-areas:
			"swatch name plus"
			"swatch text plus";
		column-gap: 32px;
		row-gap: 8px;
		width: 100%;
		min-height: 240px;
		padding-bottom: 28px;
	}

	.aitio-pb__swatch {
		grid-area: swatch;
		width: 100%;
		min-height: 240px;
	}

	.aitio-pb__name {
		grid-area: name;
		font-size: 32px;
	}

	.aitio-pb__text {
		grid-area: text;
		max-width: none;
		margin-left: 0;
		font-size: 17px;
	}

	.aitio-pb__sign {
		grid-area: plus;
	}

	.aitio-pb__includes,
	.aitio-pb__related {
		grid-template-columns: 240px minmax(0, 1fr);
	}

}

/* ---- phone: stacked row ----------------------------------------- */

@media (max-width: 759px) {

	.aitio-playbook-hubs {
		padding-top: 59px;
		padding-bottom: 48px;
	}

	.aitio-playbook-hubs__eyebrow {
		font-size: 14px;
		line-height: 21px;
		padding: 0 6px 0 5px;
	}

	.aitio-playbook-hubs__heading {
		max-width: 100%;
		margin-top: 35px;
		font-size: 28px;
		line-height: 1.35;
	}

	.aitio-playbook-hubs__lede {
		max-width: 317px;
		margin-top: 36px;
		font-size: 15px;
		line-height: 24px;
	}

	.aitio-playbook-hubs__list {
		margin-top: 45px;
		padding-top: 36px;
		background-position: center top;
		background-size: calc(100% - 8px) 5px;
	}

	.aitio-pb + .aitio-pb {
		margin-top: 50px;
		padding-top: 0;
		background: none;
	}

	.aitio-pb:nth-child(2) {
		margin-top: 69px;
	}

	.aitio-pb {
		position: relative;
		min-height: 583px;
		margin-inline: 4px;
		padding-bottom: 28px;
	}

	.aitio-pb::after {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 5px;
		background-image: var(--pb-rule);
		background-position: left center;
		background-repeat: repeat-x;
		background-size: 1280px 5px;
		content: "";
	}

	.aitio-playbook-hubs__list::after {
		display: none;
	}

	.aitio-pb__head {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"swatch"
			"name"
			"text"
			"sign";
		column-gap: 0;
		row-gap: 24px;
		min-height: 0;
		padding-bottom: 0;
	}

	.aitio-pb__swatch {
		grid-area: swatch;
		width: 100%;
		height: 197px;
		min-height: 197px;
	}

	.aitio-pb__play {
		width: 56px;
		height: 56px;
	}

	.aitio-pb__play-icon {
		border-width: 9px 0 9px 15px;
	}

	.aitio-pb__name {
		grid-area: name;
		max-width: 310px;
		font-size: 24px;
		line-height: 1.3;
	}

	.aitio-pb__text {
		grid-area: text;
		min-height: 192px;
		font-size: 16px;
		line-height: 1.5;
	}

	.aitio-pb__sign {
		grid-area: sign;
		justify-self: end;
		width: 32px;
		height: 32px;
		border-width: 1px;
	}

	.aitio-pb__sign::before {
		width: 15px;
	}

	.aitio-pb__sign::after {
		width: 2px;
		height: 15px;
	}

	.aitio-pb__includes,
	.aitio-pb__related {
		grid-template-columns: 1fr;
	}

	.aitio-pb__includes {
		margin-top: 4px;
		padding-top: 24px;
	}

	.aitio-pb__includes .aitio-pb__label,
	.aitio-pb__related .aitio-pb__label {
		margin-bottom: 58px;
	}

	.aitio-pb__related .aitio-pb__label {
		margin-bottom: 20px;
	}

	.aitio-pb__includes-text {
		max-width: 100%;
		font-size: 20px;
		line-height: 1.4;
	}

	.aitio-pb__more {
		margin-top: 38px;
	}

	.aitio-pb__related {
		margin-top: 54px;
		padding-top: 32px;
	}

	.aitio-pb__rail-wrap {
		margin-top: 20px;
	}

	.aitio-pb__rail-group {
		gap: 12px;
	}

	.aitio-pb__work {
		flex: 0 0 min(78vw, 274px);
		width: min(78vw, 274px);
	}

	.aitio-pb__close {
		display: flex;
		align-items: center;
		width: max-content;
		gap: 8px;
		margin: 72px 0 0 auto;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--aitio-dark);
		font-family: var(--aitio-font);
		font-size: 14px;
		font-weight: 400;
		line-height: 21px;
		text-transform: uppercase;
		cursor: pointer;
	}

	.aitio-pb__close span {
		color: var(--aitio-yellow);
		font-size: 22px;
		line-height: 1;
	}
}

@media (max-width: 430px) {

	.aitio-pb__swatch {
		height: 196.8px;
		min-height: 196.8px;
	}
}

/* People who ask for less motion get no sliding. */
@media (prefers-reduced-motion: reduce) {

	.aitio-pb__panel,
	.aitio-pb__includes,
	.aitio-pb__related,
	.aitio-pb__sign,
	.aitio-pb__sign::after,
	.aitio-pb__cover {
		transition: none;
	}

	.aitio-pb__rail-wrap {
		overflow-x: auto;
	}

	.aitio-pb__rail {
		animation: none !important;
	}

	.aitio-pb__rail-group {
		gap: 20px;
	}
}
