/* Review strip in the home hero (.ew-hero-stroom), rebuilt in 1.26.6 on
   the `review` post type. Markup: template-parts/sections/hero-stroom.php.
   Loaded by parkettipro_hero_stroom_assets() (inc/enqueue.php) on the front
   page when there are published reviews. Tokens: --ew-hero-stroom-* in
   tokens.css.

   Two placements, one visible at a time:
   - --frame from 64rem: one row at the bottom of the photograph, from
     behind the copy to the right edge, where the frame crops it. Layers,
     back to front: photograph (.ew-hero__media), strip, scrim
     (.ew-hero__shade, lifted to z-index 1 here), copy (.ew-hero__stage,
     z 1, later in the DOM), progress marks (z 2), pause button (z 3).
   - --onder below 64rem: a full-width strip under the frame on the page
     background, then the hero foot (its pause button and the link to all
     projects; the link also shows on desktop).

   Both move LEFT TO RIGHT: the track holds two identical groups and moves
   from -50% to 0, so the second group takes the place of the first and the
   loop has no seam. Each group ends with the gap that sits between its
   cards, so -50% is exactly one group plus one gap. Only transform
   animates. Duration = time per card x cards per group (--aantal), so the
   speed does not depend on the number of reviews. */

/* ------------------------------------------------- Hero layout with a strip */

/* The copy keeps the bottom padding the strip lines up with, and the stage
   (full width, above the strip) lets the pointer through: only the copy
   column catches it, so the cards beside it can be hovered. */
.ew-hero--has-stroom .ew-hero__stage {
	padding-bottom: var(--ew-hero-stroom-onder);
	pointer-events: none;
}

.ew-hero--has-stroom .ew-hero__content {
	pointer-events: auto;
}

.ew-hero--has-stroom .ew-hero-dots {
	inset-block-end: var(--ew-space-6);
}

@media (min-width: 64rem) {
	.ew-hero--has-stroom .ew-hero-dots {
		inset-block-end: clamp(1.75rem, 3vh + 0.5rem, 2.5rem);
	}
}

/* ------------------------------------------------------------ Shared card */

.ew-hero-stroom {
	display: none;
}

.ew-hero-stroom__baan {
	display: flex;
	width: max-content;
	animation: ew-hero-stroom-schuif calc(var(--ew-hero-stroom-kaart-tijd) * var(--aantal, 6)) linear infinite;
}

.ew-hero-stroom__groep {
	display: flex;
	flex: none;
	gap: var(--ew-hero-stroom-tussenruimte);
	margin: 0;
	padding: 0;
	padding-inline-end: var(--ew-hero-stroom-tussenruimte);
	list-style: none;
}

.ew-hero-stroom__item {
	flex: none;
	margin: 0;
}

/* Rest: a few lines of the review. Hover (mouse or pen, .is-hover): two
   more lines. Lue lisää (.is-open): the full review and, for a review
   linked to a project, Katso projekti. hero-stroom.js animates the height
   in pixels between any two states; the text takes the shrinking room, so
   the caption and Lue lisää stay at the card's lower edge. */
.ew-hero-stroom__kaart {
	display: flex;
	flex-direction: column;
	gap: var(--ew-space-2);
	box-sizing: border-box;
	margin: 0;
	overflow: hidden;
	padding: var(--ew-hero-stroom-kaart-pad);
	transition: height var(--ew-motion-duration-slow) var(--ew-motion-ease);
	border: 1px solid var(--ew-hero-stroom-rand);
	border-radius: var(--ew-radius-sm);
	background: var(--ew-hero-stroom-bg);
	box-shadow: var(--ew-hero-stroom-schaduw);
	color: var(--ew-hero-stroom-fg);
}

.ew-hero-stroom__tekst {
	display: -webkit-box;
	flex: 1 1 auto;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--ew-hero-stroom-regels);
	min-height: 0;
	margin: 0;
	overflow: hidden;
	font-family: var(--ew-font-heading);
	font-size: var(--ew-text-small);
	line-height: 1.5;
}

.ew-hero-stroom__item.is-hover .ew-hero-stroom__tekst {
	-webkit-line-clamp: calc(var(--ew-hero-stroom-regels) + 2);
}

.ew-hero-stroom__item.is-open .ew-hero-stroom__tekst {
	display: block;
	-webkit-line-clamp: unset;
}

.ew-hero-stroom__item.is-begrensd .ew-hero-stroom__tekst {
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Card head (the design from before 1.26.6, restored in 1.26.7): the
   project photo, then the job and place on one line with the stars under
   it. It never shrinks; the text below takes the room that is left. */
.ew-hero-stroom__kop {
	display: flex;
	flex: none;
	align-items: center;
	gap: var(--ew-space-3);
	min-width: 0;
	margin: 0;
}

.ew-hero-stroom__foto {
	flex: none;
	width: var(--ew-hero-stroom-foto);
	height: var(--ew-hero-stroom-foto);
	max-width: none;
	border-radius: var(--ew-radius-sm);
	object-fit: cover;
	background: var(--ew-hero-stroom-rand);
}

.ew-hero-stroom__meta {
	display: grid;
	gap: var(--ew-space-1);
	min-width: 0;
}

.ew-hero-stroom__naam {
	overflow: hidden;
	font-family: var(--ew-font-interface);
	font-size: var(--ew-text-small);
	font-weight: var(--ew-weight-semibold);
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ew-hero-stroom__tahdet {
	display: inline-flex;
	gap: 2px;
	color: var(--ew-hero-stroom-tahti-pohja);
}

.ew-hero-stroom__tahti {
	display: block;
	fill: currentColor;
}

.ew-hero-stroom__tahti--tays {
	color: var(--ew-hero-stroom-tahti);
}

/* Lue lisää / Näytä vähemmän: a quiet underlined text button. */
.ew-hero-stroom__lees {
	flex: none;
	align-self: flex-start;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: var(--ew-font-interface);
	font-size: var(--ew-text-small);
	font-weight: var(--ew-weight-medium);
	line-height: 1.4;
	text-decoration: underline;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

.ew-hero-stroom__lees[hidden] {
	display: none;
}

.ew-hero-stroom__lees:hover,
.ew-hero-stroom__lees:focus-visible,
.ew-hero-stroom__meer .ew-button:hover {
	color: var(--ew-hero-stroom-muted);
}

.ew-hero-stroom__lees:focus-visible,
.ew-hero-stroom__meer .ew-button:focus-visible {
	outline: 2px solid var(--ew-color-focus);
	outline-offset: 2px;
}

/* Katso projekti: only on an opened card. Without the script a focused
   link still shows. */
.ew-hero-stroom__meer {
	display: none;
	flex: none;
	margin: 0;
}

.ew-hero-stroom__meer .ew-button {
	min-height: 0;
	color: inherit;
	font-size: var(--ew-text-small);
}

.ew-hero-stroom__item.is-open .ew-hero-stroom__meer,
html:not(.ew-js) .ew-hero-stroom__kaart:focus-within .ew-hero-stroom__meer {
	display: block;
}

.ew-hero-stroom__item.is-open .ew-hero-stroom__meer {
	animation: ew-hero-stroom-in var(--ew-motion-duration-slow) var(--ew-motion-ease) var(--ew-motion-duration-fast) backwards;
}

/* Hovering the row, an open card or keyboard focus inside it stops the
   row. Focus left behind by a mouse click does not count (:focus-visible).
   The :has() rule stands alone, so a browser without it only loses that
   rule. Paused by the button or out of view: set by hero-stroom.js. */
.ew-hero-stroom:is(:hover, .is-open, .is-gepauzeerd, .is-buiten-beeld) .ew-hero-stroom__baan {
	animation-play-state: paused;
}

.ew-hero-stroom:has(:focus-visible) .ew-hero-stroom__baan {
	animation-play-state: paused;
}

/* Pause button (WCAG 2.2.2), shown by hero-stroom.js. */
.ew-hero-stroom__knop {
	display: none;
}

.ew-hero-stroom__icoon {
	width: var(--ew-hero-stroom-icoon);
	height: var(--ew-hero-stroom-icoon);
	fill: currentColor;
}

.ew-hero-stroom__icoon--afspelen,
.ew-hero-stroom__knop[aria-pressed="true"] .ew-hero-stroom__icoon--pauze {
	display: none;
}

.ew-hero-stroom__knop[aria-pressed="true"] .ew-hero-stroom__icoon--afspelen {
	display: block;
}

/* --------------------------------------------------- In the frame, 64rem+ */

@media (min-width: 64rem) {
	/* The scrim moves above the strip; the copy stays above the scrim (same
	   z-index, later in the DOM). The scrim lets the pointer through. */
	.ew-hero--has-stroom .ew-hero__frame > .ew-hero__shade {
		z-index: 1;
		pointer-events: none;
	}

	/* Anchored at the bottom: a card that grows (hover, Lue lisää) makes the
	   box taller upwards and nothing else moves. The cards' lower edge is
	   level with the bottom of the CTA buttons. The box takes no pointer;
	   only the cards do. The mask fades the row in behind the copy and out
	   at the right edge; it makes the box a backdrop root, so the cards are
	   a near-opaque light surface rather than blurred glass. */
	.ew-hero-stroom--frame {
		position: absolute;
		inset-block-end: calc(var(--ew-hero-stroom-onder) - var(--ew-space-5));
		inset-inline: var(--ew-hero-stroom-start) 0;
		display: block;
		overflow: hidden;
		padding-block: var(--ew-space-5);
		pointer-events: none;
		-webkit-mask-image: var(--ew-hero-stroom-masker);
		mask-image: var(--ew-hero-stroom-masker);
	}

	.ew-hero-stroom--frame .ew-hero-stroom__groep {
		align-items: flex-end;
	}

	.ew-hero-stroom--frame .ew-hero-stroom__item {
		width: var(--ew-hero-stroom-kaart-breedte);
		pointer-events: auto;
	}

	.ew-hero-stroom__knop--frame:not([hidden]) {
		position: absolute;
		z-index: 3;
		inset-block-start: var(--ew-space-5);
		inset-inline-end: var(--ew-space-5);
		display: grid;
		place-items: center;
		box-sizing: border-box;
		width: var(--ew-hero-stroom-knop);
		height: var(--ew-hero-stroom-knop);
		margin: 0;
		padding: 0;
		border: 1px solid var(--ew-hero-stroom-rand);
		border-radius: 50%;
		background: color-mix(in srgb, var(--ew-color-charcoal) 30%, transparent);
		color: var(--ew-color-white);
		cursor: pointer;
		opacity: 0.7;
		-webkit-backdrop-filter: blur(var(--ew-hero-stroom-glas-vervaging));
		backdrop-filter: blur(var(--ew-hero-stroom-glas-vervaging));
		transition: opacity var(--ew-motion-duration-medium) var(--ew-hero-stroom-ease), background-color var(--ew-motion-duration-medium) var(--ew-hero-stroom-ease);
	}

	.ew-hero-stroom__knop--frame:hover,
	.ew-hero-stroom__knop--frame:focus-visible {
		background: color-mix(in srgb, var(--ew-color-charcoal) 55%, transparent);
		opacity: 1;
	}

	.ew-hero-stroom__knop--frame:focus-visible {
		outline: 2px solid var(--ew-color-white);
		outline-offset: 3px;
	}
}

/* Small desktops: the lede runs to almost 60% of the frame. The row starts
   at 47% and never before 36rem, so no card runs under the lede; slightly
   narrower cards keep more of them in view. */
@media (min-width: 64rem) and (max-width: 89.99rem) {
	.ew-hero--has-stroom {
		--ew-hero-stroom-start: max(47%, 36rem);
		--ew-hero-stroom-kaart-breedte: 16rem;
	}
}

/* ------------------------------------------- Under the frame, below 64rem */

/* Full width under the frame: the hero has an inset of page whitespace, so
   the strip steps out of it. Cards are an opaque page surface with a
   hairline: no glass, no shadow (cheaper on a phone, too). */
.ew-hero-stroom-onder {
	margin-inline: calc(-1 * var(--ew-hero-inset));
}

@media (max-width: 63.99rem) {
	.ew-hero-stroom--onder {
		--ew-hero-stroom-bg: var(--ew-color-surface);
		--ew-hero-stroom-rand: var(--ew-color-border);
		--ew-hero-stroom-fg: var(--ew-color-text);
		--ew-hero-stroom-muted: var(--ew-color-text-muted);
		--ew-hero-stroom-schaduw: none;
		--ew-hero-stroom-regels: var(--ew-hero-stroom-onder-regels);
		--ew-hero-stroom-foto: var(--ew-hero-stroom-onder-foto);
		display: block;
		overflow: hidden;
		padding-block-start: var(--ew-space-4);
		-webkit-mask-image: linear-gradient(to right, transparent, #000 var(--ew-hero-inset), #000 calc(100% - var(--ew-hero-inset)), transparent);
		mask-image: linear-gradient(to right, transparent, #000 var(--ew-hero-inset), #000 calc(100% - var(--ew-hero-inset)), transparent);
	}

	.ew-hero-stroom--onder .ew-hero-stroom__groep {
		align-items: flex-start;
	}

	/* One height for every card at rest, as the strip had before 1.26.6.
	   The text keeps its clamped height (growing it would show a line past
	   the clamp) and Lue lisää drops to the card's lower edge, so it sits
	   at the same place on each card. An opened card grows past it. */
	.ew-hero-stroom--onder .ew-hero-stroom__kaart {
		gap: var(--ew-space-3);
		min-height: var(--ew-hero-stroom-onder-hoogte);
	}

	.ew-hero-stroom--onder .ew-hero-stroom__tekst {
		flex: none;
	}

	.ew-hero-stroom--onder .ew-hero-stroom__lees {
		margin-top: auto;
	}

	.ew-hero-stroom--onder .ew-hero-stroom__item {
		width: var(--ew-hero-stroom-onder-breedte);
	}

	.ew-hero-stroom__knop--onder:not([hidden]) {
		display: grid;
		flex: none;
		place-items: center;
		box-sizing: border-box;
		width: var(--ew-hero-stroom-knop);
		height: var(--ew-hero-stroom-knop);
		margin: 0;
		padding: 0;
		border: 1px solid var(--ew-color-border);
		border-radius: 50%;
		background: var(--ew-color-surface);
		color: var(--ew-color-text);
		cursor: pointer;
	}

	.ew-hero-stroom__knop--onder:focus-visible {
		outline: 2px solid var(--ew-color-focus);
		outline-offset: 2px;
	}
}

@media (min-width: 48rem) and (max-width: 63.99rem) {
	.ew-hero-stroom--onder {
		--ew-hero-stroom-onder-breedte: var(--ew-hero-stroom-onder-breedte-tablet);
	}
}

/* -------------------------------------------------------------- Hero foot */

/* Under the frame on the page background: the strip's pause button (phones
   and tablets) and the link to all projects, right-aligned with the frame
   on desktop. In the flow from the first paint, so nothing shifts. */
.ew-hero__voet {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ew-space-4);
	padding: var(--ew-space-3) var(--ew-hero-inset) 0;
}

.ew-hero__voet > .ew-hero__alle-projecten {
	margin-inline-start: auto;
}

@media (min-width: 64rem) {
	.ew-hero__voet {
		justify-content: flex-end;
	}
}

/* Tertiary button without the fixed underline: a hairline that runs in
   from left to right on hover and focus, and an arrow that moves along. */
.ew-hero__alle-projecten {
	color: var(--ew-color-fg);
	text-decoration: none;
}

.ew-hero__alle-projecten .ew-button__label {
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0 var(--ew-border-hairline);
	transition: background-size var(--ew-motion-duration-fast) var(--ew-motion-ease);
}

.ew-hero__alle-projecten:hover .ew-button__label,
.ew-hero__alle-projecten:focus-visible .ew-button__label {
	background-size: 100% var(--ew-border-hairline);
}

.ew-hero__pijl {
	width: 1.05em;
	height: 1.05em;
	flex: none;
	transition: transform var(--ew-motion-duration-fast) var(--ew-motion-ease);
}

.ew-hero__alle-projecten:hover .ew-hero__pijl,
.ew-hero__alle-projecten:focus-visible .ew-hero__pijl {
	transform: translateX(var(--ew-hero-voet-pijl-schuif));
}

/* --------------------------------------------------------- Reduced motion */

/* The row stands still. In the frame it shows the first reviews; under the
   frame the copies go and the first group scrolls sideways, a card at a
   time. No pause button: nothing moves. */
@media (prefers-reduced-motion: reduce) {
	.ew-hero-stroom__baan {
		animation: none;
	}

	.ew-hero-stroom__knop,
	.ew-hero-stroom__knop:not([hidden]) {
		display: none;
	}

	.ew-hero__alle-projecten .ew-button__label {
		background-image: none;
		transition: none;
	}

	.ew-hero__pijl,
	.ew-hero__alle-projecten:hover .ew-hero__pijl,
	.ew-hero__alle-projecten:focus-visible .ew-hero__pijl {
		transform: none;
		transition: none;
	}
}

@media (prefers-reduced-motion: reduce) and (max-width: 63.99rem) {
	.ew-hero-stroom--onder {
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.ew-hero-stroom--onder .ew-hero-stroom__groep {
		padding-inline: var(--ew-hero-inset);
	}

	.ew-hero-stroom--onder .ew-hero-stroom__groep[aria-hidden="true"] {
		display: none;
	}

	.ew-hero-stroom--onder .ew-hero-stroom__item {
		scroll-snap-align: center;
	}
}

/* Left to right: the track starts one group (half its width) to the left
   and ends where it began, where the second group has taken the first
   one's place. */
@keyframes ew-hero-stroom-schuif {
	from {
		transform: translateX(-50%);
	}

	to {
		transform: translateX(0);
	}
}

@keyframes ew-hero-stroom-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}
