/* evive base: the few rules theme.json can't express. Tokens only. */

/* Visible focus for keyboard users, on light and on primary/accent backgrounds. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast);
	outline-offset: 2px;
}
:where(.has-primary-background-color, .has-contrast-background-color) :focus-visible {
	outline-color: var(--wp--preset--color--primary-contrast);
}
:where(.has-accent-background-color) :focus-visible {
	outline-color: var(--wp--preset--color--accent-contrast);
}
.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible {
	outline-offset: 3px;
}

/* Buttons: smooth state changes (switched off below for reduced motion). */
.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Inputs follow the tokens. */
:where(input:not([type="checkbox"], [type="radio"], [type="submit"]), select, textarea) {
	border: 1px solid var(--wp--preset--color--muted);
	border-radius: var(--wp--custom--radius--s);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* Short pages: keep the footer at the bottom of the viewport. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}
.wp-site-blocks > main,
.wp-site-blocks > :where(main) {
	flex: 1 0 auto;
}

/* Flex items default to min-width: auto, so wide content (a table) would stretch the page instead of
   scrolling inside its own box. */
.wp-site-blocks > * {
	min-width: 0;
}

/* Very narrow screens: let the header actions wrap instead of overflowing. */
@media (max-width: 30em) {
	.evive-header .wp-block-group.alignwide {
		flex-wrap: wrap;
	}
}

/* Block style "Motif": large, faded rounded-rectangle outlines behind the section content. */
.wp-block-group.is-style-motif {
	isolation: isolate;
	overflow: hidden;
	position: relative;
}
.wp-block-group.is-style-motif::before,
.wp-block-group.is-style-motif::after {
	border: 2px solid currentColor;
	border-radius: calc(var(--wp--custom--radius--l) * 3);
	content: "";
	opacity: 0.12;
	pointer-events: none;
	position: absolute;
	z-index: -1;
}
.wp-block-group.is-style-motif::before {
	aspect-ratio: 1;
	right: -8%;
	top: -30%;
	width: min(45%, 32rem);
}
.wp-block-group.is-style-motif::after {
	aspect-ratio: 1;
	bottom: -40%;
	right: 22%;
	width: min(28%, 20rem);
}

/* Images in patterns fill their column; placeholder art keeps its shape. */
.evive-media img {
	height: auto;
	width: 100%;
}
.evive-logo-wall img {
	opacity: 0.7;
}

/* Pricing plans (pattern evive/pricing-plans): equal-height cards, buttons aligned at the bottom. */
.evive-plan {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
}
.evive-plan > * {
	margin-block: 0;
}
.evive-plan > .evive-plan-actions {
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--30);
}
.evive-plan-actions .wp-block-button {
	flex: 1 1 100%;
}
.evive-plan-actions .wp-block-button__link {
	width: 100%;
}
.evive-plan.is-featured {
	border-color: var(--wp--preset--color--primary);
	border-width: 2px;
	box-shadow: var(--wp--preset--shadow--m);
}
.evive-plan.is-featured {
	position: relative;
}
/* The badge sits centred on the top border, so plan names line up across the cards. */
.evive-plan-badge {
	left: 50%;
	position: absolute;
	top: 0;
	transform: translate(-50%, -50%);
	white-space: nowrap;
	background: var(--wp--preset--color--accent);
	border-radius: 999px;
	color: var(--wp--preset--color--accent-contrast);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 600;
	padding: 0.2em 0.8em;
}
.evive-price {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--s);
}
.evive-price strong {
	color: var(--wp--preset--color--contrast);
	display: block;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--xxl);
	font-weight: 700;
	line-height: 1.1;
}

/* Add-on card (pattern evive/pricing-addon): the price box on the right uses the plan price style. */
.evive-addon-price {
	border-radius: var(--wp--custom--radius--m);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}
.evive-addon-price > * {
	margin-block: 0;
}
.evive-addon-price > .evive-plan-actions {
	padding-top: var(--wp--preset--spacing--20);
}

/* CTA band with image (pattern evive/cta-media): on wide screens the image rises above the band and
   rests on its bottom edge; on phones it sits centred below the text. */
.evive-cta-media-image {
	margin: 0;
}
.evive-cta-media-image img {
	display: block;
	height: auto;
	margin-inline: auto;
	max-width: 100%;
}
@media (min-width: 782px) {
	/* Two classes: core's layout rules zero the first/last child's block margins at one class. */
	.evive-cta-media .evive-cta-media-image {
		margin-bottom: calc(-1 * var(--wp--preset--spacing--60));
		margin-top: calc(-1 * var(--wp--preset--spacing--70) - var(--wp--preset--spacing--60));
	}
	.evive-cta-media-image img {
		max-height: 28rem;
		object-fit: contain;
		width: auto;
	}
	/* Phone frames in the CTA: the height cap sets the size and the phone shape sets the width. They
	   don't rest on the band's bottom edge like a cut-out mockup: they stand inside the band. */
	.evive-cta-media-image.is-style-phone img,
	.evive-cta-media-image.is-style-phone-float img {
		object-fit: cover;
		width: auto;
	}
	.evive-cta-media .evive-cta-media-image.is-style-phone {
		margin-bottom: 0;
	}
	/* The turned phone reaches lower than its box, so it keeps clear space under it in the band. */
	.evive-cta-media .evive-cta-media-image.is-style-phone-float {
		margin-bottom: var(--wp--preset--spacing--50);
	}
}
@media (max-width: 781px) {
	.evive-cta-media-image img {
		max-height: 18rem;
		width: auto;
	}
	.evive-cta-media-image.is-style-phone img,
	.evive-cta-media-image.is-style-phone-float img {
		width: auto;
	}
}

/* Checklist: list items with a check mark in the primary colour. */
.evive-checklist {
	list-style: none;
	padding-left: 0;
}
.evive-checklist li {
	padding-left: 1.75em;
	position: relative;
}
.evive-checklist li + li {
	margin-top: var(--wp--preset--spacing--20);
}
.evive-checklist li::before {
	background: var(--wp--preset--color--primary);
	content: "";
	height: 1em;
	left: 0;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
	position: absolute;
	top: 0.3em;
	width: 1em;
}

/* Table block style "Comparison" (pattern evive/pricing-comparison): plan columns centred, ✓ in the
   primary colour, an empty cell shows a muted dash, a row with a bold first cell and empty plan cells
   is a group heading. The header row sticks while scrolling; on phones the table scrolls sideways
   with the feature column fixed. */
.wp-block-table.is-style-comparison {
	overflow: visible;
}
.is-style-comparison table {
	border-collapse: separate;
	border-spacing: 0;
	table-layout: auto;
	width: 100%;
}
.is-style-comparison :is(th, td) {
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	vertical-align: middle;
}
.is-style-comparison :is(th, td):first-child {
	text-align: left;
	width: 40%;
}
.is-style-comparison :is(th, td):not(:first-child) {
	text-align: center;
}
.is-style-comparison thead th {
	background: var(--wp--preset--color--base);
	border-bottom: 2px solid var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--m);
	position: sticky;
	top: 0;
	z-index: 1;
}
.is-style-comparison td:not(:first-child) {
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--l);
	font-weight: 700;
	line-height: 1;
}
.is-style-comparison td:not(:first-child):empty::before {
	color: var(--wp--preset--color--muted);
	content: "–";
	font-weight: 400;
}
.is-style-comparison tbody tr:hover td {
	background: var(--wp--preset--color--surface);
}
.is-style-comparison tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) td {
	background: var(--wp--preset--color--surface);
	font-size: var(--wp--preset--font-size--s);
	letter-spacing: 0.04em;
	padding-top: var(--wp--preset--spacing--40);
	text-transform: uppercase;
}
.is-style-comparison tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) td:empty::before {
	content: none;
}
@media (max-width: 781px) {
	.wp-block-table.is-style-comparison {
		max-width: 100%;
		overflow-x: auto;
	}
	.is-style-comparison tr:has(> td:first-child > strong):has(> td:nth-child(2):empty) td {
		letter-spacing: normal;
		text-transform: none;
	}
	.is-style-comparison :is(th, td) {
		padding-inline: var(--wp--preset--spacing--10);
	}
	.is-style-comparison :is(th, td):not(:first-child) {
		padding-inline: 0.2em;
	}
	.is-style-comparison thead th {
		font-size: var(--wp--preset--font-size--xs);
		position: static;
	}
	.is-style-comparison :is(th, td):first-child {
		background: var(--wp--preset--color--base);
		font-size: var(--wp--preset--font-size--s);
		hyphens: auto;
		left: 0;
		position: sticky;
		width: auto;
		z-index: 1;
	}
}

/* Headings take the text colour of a section that sets one (e.g. a CTA band on the primary colour);
   theme.json gives headings their own colour, which would otherwise disappear on a coloured background. */
.has-text-color :where(h1, h2, h3, h4, h5, h6):not(.has-text-color) {
	color: inherit;
}

/* Steps (pattern evive/steps): a numbered circle per step; on wide screens a line runs from each
   circle to the next column. */
.evive-step-number {
	align-items: center;
	background: var(--wp--preset--color--primary);
	border-radius: 50%;
	color: var(--wp--preset--color--primary-contrast);
	display: flex;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--l);
	font-weight: 700;
	height: 3rem;
	justify-content: center;
	line-height: 1;
	margin: 0;
	position: relative;
	width: 3rem;
}
@media (min-width: 782px) {
	.evive-steps > .wp-block-column {
		position: relative;
	}
	.evive-steps > .wp-block-column:not(:last-child)::after {
		border-top: 2px dashed var(--wp--preset--color--border);
		content: "";
		left: 4rem;
		position: absolute;
		right: calc(1rem - var(--wp--preset--spacing--50));
		top: 1.5rem;
	}
}

/* Device frames for screenshots: image block styles "Phone", "Browser window" and "Laptop". The frame is
   drawn around any image, so a plain screenshot is enough (no mockup with a baked-in device). */
.wp-block-image.is-style-phone,
.wp-block-image.is-style-phone-float,
.wp-block-image.is-style-browser,
.wp-block-image.is-style-laptop {
	margin-left: auto;
	margin-right: auto;
	position: relative;
}
.wp-block-image.is-style-phone img,
.wp-block-image.is-style-phone-float img,
.wp-block-image.is-style-browser img,
.wp-block-image.is-style-laptop img {
	display: block;
	height: auto;
	width: 100%;
}
.wp-block-image.is-style-phone,
.wp-block-image.is-style-phone-float {
	max-width: 300px;
	/* The frame hugs the screen, so the notch stays centred on it at any size. */
	width: fit-content;
}
/* A fixed phone shape: a screenshot of any size fills the screen from the top, and whatever is too
   long is cut off at the bottom (like a phone showing the top of a scrolling page). */
.wp-block-image.is-style-phone img,
.wp-block-image.is-style-phone-float img {
	aspect-ratio: 9 / 19.5;
	border: 0.6rem solid var(--wp--preset--color--contrast);
	/* Corners in proportion (horizontal / vertical), so a small phone keeps its shape. */
	border-radius: 15% / 7%;
	box-shadow: var(--wp--preset--shadow--m);
	object-fit: cover;
	object-position: top;
}
.wp-block-image.is-style-phone::before {
	background: var(--wp--preset--color--contrast);
	border-radius: 1rem;
	content: "";
	aspect-ratio: 4 / 1;
	left: 50%;
	position: absolute;
	top: 2.4%;
	transform: translateX(-50%);
	width: 30%;
	z-index: 1;
}
/* "Phone, floating": the same phone (without the camera notch, which would cover the top of a screenshot without a status bar), slightly turned in 3D, with a metal edge, a side button and a
   soft shadow below, so it seems to hover. Static (no animation), so reduced motion needs nothing. */
.wp-block-image.is-style-phone-float {
	margin-bottom: var(--wp--preset--spacing--50);
	transform: perspective(1400px) rotateX(5deg) rotateY(-16deg) rotateZ(4deg);
}
.wp-block-image.is-style-phone-float img {
	border-width: 0.5rem;
	box-shadow:
		0 0 0 2px color-mix(in srgb, var(--wp--preset--color--contrast) 55%, var(--wp--preset--color--base)),
		1.5rem 2.5rem 3rem -0.5rem color-mix(in srgb, var(--wp--preset--color--contrast) 45%, transparent);
}
.wp-block-image.is-style-phone-float::after {
	background: color-mix(in srgb, var(--wp--preset--color--contrast) 70%, var(--wp--preset--color--base));
	border-radius: 0 3px 3px 0;
	content: "";
	height: 12%;
	position: absolute;
	right: -4px;
	top: 22%;
	width: 4px;
}
.wp-block-image.is-style-browser {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--m);
	box-shadow: var(--wp--preset--shadow--m);
	overflow: hidden;
	padding-top: 2.25rem;
}
.wp-block-image.is-style-browser::before {
	background:
		radial-gradient(circle, var(--wp--preset--color--border) 0.3rem, transparent 0.32rem) 0.6rem 50% / 1.1rem 100% repeat-x;
	content: "";
	height: 2.25rem;
	left: 0.25rem;
	position: absolute;
	top: 0;
	width: 3.6rem;
}
.wp-block-image.is-style-laptop {
	padding: 0 8%;
}
.wp-block-image.is-style-laptop img {
	border: 0.6rem solid var(--wp--preset--color--contrast);
	border-bottom-width: 1rem;
	border-radius: var(--wp--custom--radius--l) var(--wp--custom--radius--l) 0 0;
}
.wp-block-image.is-style-laptop::after {
	background: linear-gradient(var(--wp--preset--color--border), var(--wp--preset--color--muted));
	border-radius: 0 0 1.2rem 1.2rem;
	box-shadow: var(--wp--preset--shadow--m);
	content: "";
	display: block;
	height: 0.9rem;
	margin: 0 -8%;
}
.wp-block-image.is-style-phone figcaption,
.wp-block-image.is-style-phone-float figcaption,
.wp-block-image.is-style-browser figcaption,
.wp-block-image.is-style-laptop figcaption {
	text-align: center;
}

/* Bento grid (pattern evive/bento): tiles of different sizes in the core grid layout. On narrow screens
   every tile takes the full width; !important because core prints the spans as generated classes. */
.evive-bento > .evive-bento-tile {
	display: flex;
	flex-direction: column;
	margin: 0;
}
.evive-bento-tile .evive-bento-media {
	margin-top: auto;
}
.evive-bento-tile .evive-bento-figure {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--xxl);
	font-weight: 700;
	line-height: 1;
}
@media (max-width: 781px) {
	.evive-bento {
		grid-template-columns: 1fr !important;
	}
	.evive-bento > * {
		grid-column: auto !important;
		grid-row: auto !important;
	}
}

/* Cross list: the "without" side of a comparison, a cross in the muted colour (pair of .evive-checklist). */
.evive-crosslist {
	list-style: none;
	padding-left: 0;
}
.evive-crosslist li {
	padding-left: 1.75em;
	position: relative;
}
.evive-crosslist li + li {
	margin-top: var(--wp--preset--spacing--20);
}
.evive-crosslist li::before {
	background: var(--wp--preset--color--muted);
	content: "";
	height: 0.85em;
	left: 0.1em;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
	position: absolute;
	top: 0.35em;
	width: 0.85em;
}

/* Problem → solution (pattern evive/problem-solution): the solution card stands out. */
.evive-solution {
	border: 2px solid var(--wp--preset--color--primary);
	box-shadow: var(--wp--preset--shadow--m);
}

/* Case cards: the link to the full case sits at the bottom, so cards in a row line up. */
.evive-case-card > .evive-case-link {
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--20);
}
