/*
 * Block: core/columns. Loads only where a Columns block renders. Two wrapper
 * styles: "Tilted cards" (each column rotated like a sticker, straightens and
 * lifts on hover) and "Numbered steps" (a CSS counter badge per column, so a
 * new column numbers itself). The columns' card look comes from the card
 * partials applied to each column, or to the first group inside it.
 */

/* ---------- tilted cards ---------- */

.wp-block-columns.is-style-cards-tilted > .wp-block-column,
.wp-block-columns.is-style-cards-tilted > .wp-block-column > .wp-block-group:first-child {
	transition:
		transform var(--wp--custom--transition--base, 0.2s ease),
		box-shadow var(--wp--custom--transition--base, 0.2s ease);
}

.wp-block-columns.is-style-cards-tilted > .wp-block-column:nth-child(3n + 1) {
	transform: rotate(-1.6deg);
}

.wp-block-columns.is-style-cards-tilted > .wp-block-column:nth-child(3n + 2) {
	transform: rotate(1deg);
}

.wp-block-columns.is-style-cards-tilted > .wp-block-column:nth-child(3n) {
	transform: rotate(-0.6deg);
}

@media (hover: hover) {
	.wp-block-columns.is-style-cards-tilted > .wp-block-column:hover {
		transform: translateY(-7px) rotate(0);
		z-index: 1;
	}

	/* The shadow sits on the card: the column itself when it carries a card
	   style, otherwise its first group. */
	.wp-block-columns.is-style-cards-tilted > .wp-block-column[class*="is-style-"]:hover,
	.wp-block-columns.is-style-cards-tilted > .wp-block-column:not([class*="is-style-"]):hover > .wp-block-group:first-child {
		box-shadow: var(--wp--preset--shadow--lift);
	}

	/* The column does the lifting; an inner card keeps still (cards.css). */
	.wp-block-columns.is-style-cards-tilted .wp-block-column > .is-style-revsults-card:hover,
	.wp-block-columns.is-style-cards-tilted .wp-block-column > .is-style-card-featured:hover {
		transform: none;
	}
}

/* Stacked or narrow: no rotation. */
@media (max-width: 999px) {
	.wp-block-columns.is-style-cards-tilted > .wp-block-column:nth-child(n) {
		transform: none;
	}
}

/* ---------- numbered steps ---------- */

.wp-block-columns.is-style-steps {
	counter-reset: revsults-step;
	padding-top: 22px; /* room for the badges hanging over the top edge */
}

.wp-block-columns.is-style-steps > .wp-block-column {
	counter-increment: revsults-step;
	position: relative;
	padding-top: calc(var(--wp--preset--spacing--30) + 26px);
}

.wp-block-columns.is-style-steps > .wp-block-column::before,
.wp-block-columns.is-style-steps > .wp-block-column > .wp-block-group:first-child::before {
	content: counter(revsults-step);
	position: absolute;
	top: -22px;
	left: var(--wp--preset--spacing--30);
	z-index: 1;
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 48px;
	height: 48px;
	border-radius: var(--wp--custom--radius--medium, 0.75rem);
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--secondary-contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: var(--wp--custom--typography--font-weight--black, 700);
	line-height: 1;
	letter-spacing: 0;
	box-shadow: var(--wp--preset--shadow--secondary-glow);
}

/* Default: the badge hangs on the column. */
.wp-block-columns.is-style-steps > .wp-block-column > .wp-block-group:first-child::before {
	content: none;
}

/* When the step card is a group inside the column, the badge hangs on the
   group instead (modern browsers; older ones keep the column badge). */
@supports selector(:has(a)) {
	.wp-block-columns.is-style-steps > .wp-block-column:has(> .wp-block-group:first-child) {
		padding-top: 0;
	}

	.wp-block-columns.is-style-steps > .wp-block-column:has(> .wp-block-group:first-child)::before {
		content: none;
	}

	.wp-block-columns.is-style-steps > .wp-block-column > .wp-block-group:first-child {
		position: relative;
		padding-top: calc(var(--wp--preset--spacing--30) + 26px);
	}

	.wp-block-columns.is-style-steps > .wp-block-column > .wp-block-group:first-child::before {
		content: counter(revsults-step);
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.wp-block-columns.is-style-cards-tilted > .wp-block-column,
	.wp-block-columns.is-style-cards-tilted > .wp-block-column > .wp-block-group:first-child {
		transition: none;
	}
}
