/* IND-1: industries. Picture tiles; each tile is one link, carried by its heading. */

/*
 * One column on phones, two on tablets, three on wide screens.
 * WordPress writes its own column rule for a grid, hence the longer selector.
 */
.wprk-section.wprk-ind-1 .wprk-cards {
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
	grid-template-columns: minmax(0, 1fr);
}

/* An open tile: picture, name, one line, and a hairline that closes it. */
.wprk-ind-1 .wprk-ind-1__tile {
	border-block-end: 1px solid var(--wprk-border);
	min-width: 0;
	padding-block-end: var(--wp--preset--spacing--30);
	position: relative;
}

.wprk-ind-1 .wprk-ind-1__tile > * {
	margin-block: 0;
}

/* The picture is clipped by its frame, so it can grow a little on hover without spilling. */
.wprk-ind-1 .wprk-ind-1__tile > .wp-block-image {
	border-radius: var(--wprk-picture-radius, var(--wp--custom--radius--md));
	margin: 0;
	overflow: hidden;
}

.wprk-ind-1 .wprk-ind-1__tile > .wp-block-image img {
	border-radius: 0;
	display: block;
	width: 100%;
}

.wprk-ind-1 .wprk-ind-1__tile > .wp-block-heading {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
	overflow-wrap: break-word;
}

.wprk-ind-1 .wprk-ind-1__tile > * + .wp-block-heading {
	margin-block-start: var(--wp--preset--spacing--30);
}

.wprk-ind-1 .wprk-ind-1__tile > .wp-block-heading a {
	color: var(--wprk-heading);
	text-decoration: none;
}

/* A small arrow after the name of a linked tile. It is decoration, so it has an empty text alternative. */
.wprk-ind-1 .wprk-ind-1__tile > .wp-block-heading:has(a)::after {
	color: var(--wprk-accent-text);
	content: "\2192";
	content: "\2192" / "";
	display: inline-block;
	font-family: var(--wp--preset--font-family--body);
	font-weight: 400;
	margin-inline-start: 0.4em;
}

.wprk-ind-1 .wprk-ind-1__tile > * + p {
	color: var(--wprk-muted);
	margin-block-start: var(--wp--preset--spacing--10);
}

/*
 * The whole tile is one link: the heading link is stretched over it, so the
 * tap target is the tile. Not inside the editor, where the picture and the
 * text must stay clickable for editing.
 */
.wprk-ind-1 .wprk-ind-1__tile:not(.block-editor-block-list__block) > .wp-block-heading a::after {
	content: "";
	inset: 0;
	position: absolute;
}

/* Hover and keyboard focus: the name is underlined in the accent colour and the hairline darkens. */
.wprk-ind-1 .wprk-ind-1__tile:hover {
	border-block-end-color: color-mix(in srgb, var(--wprk-heading) 40%, transparent);
}

.wprk-ind-1 .wprk-ind-1__tile:hover > .wp-block-heading a,
.wprk-ind-1 .wprk-ind-1__tile > .wp-block-heading a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--wprk-accent);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.25em;
}

/* Keyboard focus is drawn around the whole tile, not only around the name. */
.wprk-ind-1 .wprk-ind-1__tile:not(.block-editor-block-list__block) > .wp-block-heading a:focus-visible {
	outline: none;
}

.wprk-ind-1 .wprk-ind-1__tile:not(.block-editor-block-list__block) > .wp-block-heading a:focus-visible::after {
	border-radius: var(--wp--custom--radius--md);
	outline: 2px solid var(--wprk-focus);
	outline-offset: 4px;
}

/* As a carousel the row clips what lies outside it, so the ring is drawn inside the tile. */
.wprk-ind-1 [class*="is-style-wprk-carousel"] > .wprk-ind-1__tile:not(.block-editor-block-list__block) > .wp-block-heading a:focus-visible::after {
	outline-offset: -2px;
}

@media (min-width: 600px) {
	.wprk-section.wprk-ind-1 .wprk-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.wprk-section.wprk-ind-1 .wprk-cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (prefers-reduced-motion: no-preference) {
	.wprk-ind-1 .wprk-ind-1__tile {
		transition: border-color 0.18s ease;
	}

	.wprk-ind-1 .wprk-ind-1__tile > .wp-block-image img {
		transition: transform 0.45s ease;
	}

	/* The picture grows slightly. Focus counts only on the front end; in the editor it would move while typing. */
	.wprk-ind-1 .wprk-ind-1__tile:hover > .wp-block-image img,
	.wprk-ind-1 .wprk-ind-1__tile:not(.block-editor-block-list__block):focus-within > .wp-block-image img {
		transform: scale(1.04);
	}

	.wprk-ind-1 .wprk-ind-1__tile > .wp-block-heading::after {
		transition: transform 0.18s ease;
	}

	.wprk-ind-1 .wprk-ind-1__tile:hover > .wp-block-heading::after {
		transform: translateX(0.2em);
	}
}
