/**
 * Pillar Tiles
 * Hover (tap on touch screens): a panel grows out of the tile to cover all four tiles,
 * with the title, details and icon; it shrinks back into the tile when unhovered.
 * Linked tiles also get a "ripple" that spreads from the icon.
 */

.pi-pillars__grid {
	align-items: center;
}

.pi-pillars__tiles {
	--pi-tiles-gap: var(--pi-gap);
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--pi-tiles-gap);
}

.pi-tile {
	/* cell position: 0 = first column / row, 1 = second */
	--col: 0;
	--row: 0;
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	aspect-ratio: 407 / 222;
	padding: clamp(12px, 1.16vw, 20px);
	border-radius: var(--pi-radius);
	text-decoration: none;
	transition: z-index 0s .5s;
}

.pi-tile:nth-child(2n) { --col: 1; }
.pi-tile:nth-child(n + 3) { --row: 1; }

.pi-tile__title {
	position: relative;
	font-size: var(--pi-fs-h2);
	line-height: 1;
}

.pi-tile__icon {
	position: relative;
	transition: transform .4s var(--pi-ease-spring);
}

/* Ripple (linked tiles), clipped to the tile */
.pi-tile__fx {
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	overflow: hidden;
	pointer-events: none;
}

.pi-tile__ripple {
	position: absolute;
	left: clamp(34px, 2.8vw, 48px);
	bottom: clamp(34px, 2.8vw, 48px);
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	transform: translate(-50%, 50%) scale(0);
	transition: transform .9s var(--pi-ease);
}

.pi-tile.is-link:hover,
.pi-tile.is-link:focus-visible {
	color: var(--pi-on);
}

.pi-tile.is-link:hover .pi-tile__ripple,
.pi-tile.is-link:focus-visible .pi-tile__ripple {
	transform: translate(-50%, 50%) scale(110);
}

.pi-tile:hover .pi-tile__icon,
.pi-tile:focus-visible .pi-tile__icon,
.pi-tile.is-open .pi-tile__icon {
	transform: var(--pi-tilt);
}

/* ---- Expanded panel ----
   Sized to the whole tile grid and clipped down to this tile's cell while closed. */
.pi-tile--details {
	-webkit-tap-highlight-color: transparent;
}

.pi-tile__panel {
	--half: calc(50% + var(--pi-tiles-gap) / 2);
	position: absolute;
	z-index: 1;
	left: calc(var(--col) * (-100% - var(--pi-tiles-gap)));
	top: calc(var(--row) * (-100% - var(--pi-tiles-gap)));
	width: calc(200% + var(--pi-tiles-gap));
	height: calc(200% + var(--pi-tiles-gap));
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: inherit;
	border-radius: var(--pi-radius);
	background: inherit;
	color: inherit;
	clip-path: inset(
		calc(var(--row) * var(--half)) calc((1 - var(--col)) * var(--half))
		calc((1 - var(--row)) * var(--half)) calc(var(--col) * var(--half))
		round var(--pi-radius)
	);
	opacity: 0;
	pointer-events: none;
	transition: clip-path .5s var(--pi-ease), opacity .15s .38s;
}

.pi-tile__panel-title {
	font-family: var(--pi-font-sans);
	font-weight: var(--pi-fw-sans);
	font-size: var(--pi-fs-h2);
	line-height: 1;
}

.pi-tile__details {
	max-width: 24em;
	margin-top: clamp(16px, 1.6vw, 28px);
	font-family: var(--pi-font-serif);
	font-weight: 400;
	font-size: var(--pi-fs-body);
	line-height: 1.25;
}

/* Bottom row of the open panel: icon left, optional buttons right */
.pi-tile__panel-foot {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--pi-gap);
	align-self: stretch;
	margin-top: auto;
}

.pi-tile__buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
}

.pi-tile__button {
	min-width: 0;
}

.pi-tile__panel > * {
	opacity: 0;
	transform: translateY(10px);
	transition: opacity .2s, transform .2s;
}

.pi-tile--details:hover,
.pi-tile--details:focus-visible,
.pi-tile--details:has(:focus-visible),
.pi-tile--details.is-open {
	z-index: 2;
	transition: none;
}

.pi-tile--details:hover .pi-tile__panel,
.pi-tile--details:focus-visible .pi-tile__panel,
.pi-tile--details:has(:focus-visible) .pi-tile__panel,
.pi-tile--details.is-open .pi-tile__panel {
	clip-path: inset(0 round var(--pi-radius));
	opacity: 1;
	pointer-events: auto;
	transition: clip-path .5s var(--pi-ease), opacity 0s;
}

.pi-tile--details:hover .pi-tile__panel > *,
.pi-tile--details:focus-visible .pi-tile__panel > *,
.pi-tile--details:has(:focus-visible) .pi-tile__panel > *,
.pi-tile--details.is-open .pi-tile__panel > * {
	opacity: 1;
	transform: none;
	transition: opacity .3s .18s, transform .45s .18s var(--pi-ease);
}

@media (prefers-reduced-motion: reduce) {
	.pi-tile__panel,
	.pi-tile__panel > * {
		transition-duration: 0s !important;
		transition-delay: 0s !important;
	}
}

.pi-pillars__text {
	max-width: 29em;
}

.pi-pillars__heading {
	margin-bottom: 8px;
}

.pi-pillars__body {
	margin-bottom: clamp(20px, 1.6vw, 28px);
}

@media (max-width: 991.98px) {
	.pi-pillars__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.pi-pillars__text {
		order: 1;
	}
}

/* Phones: tiles fill by column (Live / Work, Experience / Move) so colors checker like the comp */
@media (max-width: 767.98px) {
	.pi-pillars__grid {
		gap: 26px;
	}

	.pi-pillars__tiles {
		--pi-tiles-gap: 12px;
		grid-auto-flow: column;
		grid-template-rows: repeat(2, auto);
	}

	/* filled by column here, so the cell positions flip */
	.pi-tile:nth-child(n) { --col: 0; --row: 0; }
	.pi-tile:nth-child(2n) { --row: 1; }
	.pi-tile:nth-child(n + 3) { --col: 1; }

	.pi-tile {
		aspect-ratio: 6 / 5;
		padding: 12px;
	}

	.pi-tile__title {
		font-size: 1.6rem;
	}

	.pi-tile__panel-title {
		font-size: 1.6rem;
	}

	.pi-tile__details {
		margin-top: 10px;
		font-size: var(--pi-fs-small);
	}

	.pi-tile__button {
		padding: 10px 14px;
		font-size: var(--pi-fs-small);
	}
}
