/*
 * Site-wide accessibility basics (docs/design-tokens.md → Accessibility tokens). Colours come from
 * Elementor's global settings.
 */

/* Visible focus on every interactive element: the live site removed it everywhere (audit, 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--e-global-color-smeadark, #123326);
	outline-offset: 2px;
}

/* On green and dark sections (container class "smea-on-dark") the ring is white */
.smea-on-dark :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline-color: #fff;
}

/* The lightbox's backdrop is dark, so its focus ring is white */
.elementor-lightbox :where(a, button, [tabindex]):focus-visible {
	outline-color: #fff;
}

/* A link inside running text is underlined, so it doesn't rely on colour alone (WCAG 1.4.1). The Text Editor and
   Post Content widgets have no setting for it. Only in the page's <main>: the footer's phone, email and address are
   links on their own, which the rule doesn't need and the design doesn't have */
main :is(.elementor-widget-text-editor, .elementor-widget-theme-post-content) :is(p, li) a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* A long email address breaks rather than pushing the page sideways (WCAG 1.4.10, at 320 px) */
a[href^="mailto:"] {
	overflow-wrap: anywhere;
}

/* Project details box: the values stand out in brand green (container class "smea-details") */
.smea-details strong {
	color: var(--e-global-color-primary, #2e7d5e);
	font-weight: 600;
}

/*
 * FAQ questions are h3s. Elementor's accordion typography has no specificity (:where), so the kit's h3 rule
 * (capitals, 20 px) would beat it: the "FAQ question" global font is applied here instead.
 */
.smea-faq .e-n-accordion-item-title-text {
	font-family: var(--e-global-typography-smeafaq-font-family), sans-serif;
	font-size: var(--e-global-typography-smeafaq-font-size);
	font-weight: var(--e-global-typography-smeafaq-font-weight);
	line-height: var(--e-global-typography-smeafaq-line-height);
	text-transform: none;
}

/*
 * The one card style. On services, projects, case studies and blog the title's link stretches over the whole
 * card, so the card is one tab stop, named by its title. Not in the editor, where each part must stay clickable.
 * Team cards use the same frame with no link.
 */
body:not(.elementor-editor-active) .smea-card .e-con,
body:not(.elementor-editor-active) .smea-card .smea-card-link {
	position: static;
}

body:not(.elementor-editor-active) .smea-card .smea-card-link a::after {
	content: "";
	inset: 0;
	position: absolute;
	z-index: 1; /* Above the summary, details and "View project" that follow it */
}

/*
 * Team cards. Each row's cards match in height (Elementor's own Equal height setting would make every row as tall
 * as the tallest, which photos make very tall). Opening a bio makes that card taller without stretching the one
 * beside it, its pair in the two columns, and leaves the other rows alone.
 */
.smea-team-grid .e-loop-item > .e-con {
	height: 100%;
}

.smea-team-grid .e-loop-item:nth-child(odd of .e-loop-item):has(details[open]) + .e-loop-item,
.smea-team-grid .e-loop-item:nth-child(odd of .e-loop-item):has(+ .e-loop-item details[open]) {
	align-self: start;
}

/* A detail with nothing in it (a new project's location, say) doesn't leave a lone icon */
.smea-card .elementor-icon-list-item:has(.elementor-icon-list-text:empty) {
	display: none;
}

/* No bio, so nothing to open */
.smea-team-grid .smea-no-bio .elementor-widget-n-accordion {
	display: none;
}

/*
 * In two columns a missing line keeps its space, so the rules on cards side by side stay level. Hidden takes it out
 * of the tab order. On phones the cards stack, so there's nothing to line up with. After the rules above, which
 * these override.
 */
@media (min-width: 768px) {
	.smea-team-grid .elementor-icon-list-item:has(.elementor-icon-list-text:empty) {
		display: flex;
		visibility: hidden;
	}

	/* Holds the line at full text height */
	.smea-team-grid .elementor-icon-list-text:empty::before {
		content: "\00a0";
	}

	.smea-team-grid .smea-no-bio .elementor-widget-n-accordion {
		display: block;
		visibility: hidden;
	}
}

.smea-card:hover .smea-card-link a {
	color: var(--e-global-color-primary, #2e7d5e);
}

.smea-card-more span {
	display: inline-block;
	transition: transform 0.2s ease;
}

.smea-card:hover .smea-card-more span {
	transform: translateX(4px);
}

/* Focus shows round the whole card, as it's all one link. White on the green and dark bands. */
.smea-card .smea-card-link a:focus-visible {
	outline: none;
}

.smea-card:has(.smea-card-link a:focus-visible) {
	outline: 3px solid var(--e-global-color-smeadark, #123326);
	outline-offset: 2px;
}

.smea-on-dark .smea-card:has(.smea-card-link a:focus-visible) {
	outline-color: var(--e-global-color-smeawhite, #fff);
}

@media (prefers-reduced-motion: reduce) {
	.smea-card-more span {
		transition: none;
	}
}

/* A photo that fills its row's height (class "smea-fill" on an Image widget) */
@media (min-width: 981px) {
	.elementor-widget-image.smea-fill {
		flex-grow: 1;
		position: relative;
	}

	.elementor-widget-image.smea-fill img {
		height: 100%;
		inset: 0;
		object-fit: cover;
		position: absolute;
		width: 100%;
	}
}

/* The » before each service on About */
.smea-chevrons {
	color: var(--e-global-color-primary, #2e7d5e);
	font-size: 1.4em;
	line-height: 1;
}

/*
 * The header once scrolled: 75% of its height, 80 px instead of 107, with a smaller logo. Elementor has no
 * setting for this, only the class it adds to a sticky container (not to its hidden placeholder, which keeps
 * the full height so the page doesn't jump).
 */
.e-con.smea-header-row,
.e-con.smea-header-row > .e-con-inner,
.e-con.smea-header-row .elementor-widget-image img {
	transition: padding 0.2s ease, transform 0.2s ease;
}

.e-con.smea-header-row .elementor-widget-image img {
	transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
	.e-con.smea-header-row,
	.e-con.smea-header-row > .e-con-inner,
	.e-con.smea-header-row .elementor-widget-image img {
		transition: none;
	}
}

.e-con.smea-header-row.elementor-sticky--effects:not(.elementor-sticky__spacer) {
	--padding-top: 14.5px;
	--padding-bottom: 14.5px;
}

/* Scaled, not resized, so the logo's space stays the same and the menu doesn't slide sideways */
.e-con.smea-header-row.elementor-sticky--effects:not(.elementor-sticky__spacer) .elementor-widget-image img {
	transform: scale(0.75);
}

/* Keep anything scrolled to or focused clear of the header fixed to the top on computers (WCAG 2.4.11) */
@media (min-width: 981px) {
	html {
		scroll-padding-top: 100px;
	}
}

/*
 * Feature strip. Its panels are measured against the page's width, excluding any scrollbar: the outer two
 * take the page edge as well as an equal share, so all three have room for their text on any size of screen.
 */
.smea-strip {
	container-type: inline-size;
}

@media (min-width: 981px) {
	.smea-strip.e-con > .e-con:nth-child(n) {
		--smea-edge: max(5cqw, calc((100cqw - 1296px) / 2));
		--smea-share: calc((100cqw - 2 * var(--smea-edge)) / 3);
		--width: calc(var(--smea-edge) + var(--smea-share));
	}

	.smea-strip.e-con > .e-con:nth-child(2) {
		--width: var(--smea-share);
	}
}

/*
 * Elementor draws a video container's overlay twice, on the container and on the video. Once the video plays it
 * covers the first, but anyone seeing the fallback image gets both, far too dark. This leaves the one on the video.
 */
.e-con:has(> .elementor-background-video-container, > .e-con-inner > .elementor-background-video-container)::before {
	content: none;
}

/*
 * The background video's pause button (class "smea-video-pause" on a Button widget, site.js). Only shown once the
 * script has it working, and never to a visitor who asked for less motion, who gets no video to pause.
 */
.smea-video-pause {
	visibility: hidden;
}

.smea-video-pause.smea-video-ready,
.elementor-editor-active .smea-video-pause {
	visibility: visible;
}

.smea-video-pause .elementor-button {
	cursor: pointer;
}

.smea-video-pause .elementor-button-content-wrapper {
	align-items: center;
	gap: 8px;
}

.smea-video-pause .elementor-button-content-wrapper::before {
	border-left: 4px solid currentColor;
	border-right: 4px solid currentColor;
	box-sizing: border-box;
	content: "";
	height: 14px;
	width: 12px;
}

/* Paused: a play triangle */
.smea-video-pause [data-paused] .elementor-button-content-wrapper::before {
	border-bottom: 7px solid transparent;
	border-left: 12px solid currentColor;
	border-right: 0;
	border-top: 7px solid transparent;
	height: 0;
	width: 0;
}

@media (prefers-reduced-motion: reduce) {
	.smea-video-pause {
		display: none;
	}
}

/* Newsletter band: the button sits on the fields' line, and the honeypot's empty group doesn't take a row */
.smea-newsletter .e-form__buttons {
	align-self: flex-end;
}

.smea-newsletter .elementor-field-group:has(> input[style*="display:none"]) {
	display: none;
}

/* Carousel dots: small to look at, 24 px to press (WCAG 2.5.8; the live dots were 2.6 px) */
.swiper-pagination-bullet {
	position: relative;
}

.swiper-pagination-bullet::after {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 24px;
	height: 24px;
	transform: translate(-50%, -50%);
}
