/*
 * AbleSpark theme styles: block styles and the few things theme.json can't express.
 * Loaded on the front end and in the editor (add_editor_style), so pages look the same in both.
 */

/* Cookie banner colours (AbleSpark Cookie Consent). White on dark 13.27:1, white on accent 5.18:1,
   muted on white 5.85:1. */
:root {
	--ablespark-cc-dark: var(--wp--preset--color--contrast);
	--ablespark-cc-accent: var(--wp--preset--color--accent-1);
	--ablespark-cc-muted: var(--wp--preset--color--accent-4);
	--ablespark-cc-radius: 4px;
}

/* Sticky footer: keep the footer at the bottom of the window on short pages. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.wp-site-blocks > main,
.wp-site-blocks > #main-content {
	flex: 1 0 auto;
}

/* No gap between header, content and footer. */
.wp-site-blocks > * + * {
	margin-top: 0;
}

/* Outline buttons: teal on light backgrounds, white on dark ones. */
.wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--accent-1);
	border: 2px solid var(--wp--preset--color--accent-1);
	background: transparent;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.wp-block-button.is-style-outline .wp-block-button__link:focus {
	background: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--base);
}

.has-contrast-background-color .wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
}

.has-contrast-background-color .wp-block-button.is-style-outline .wp-block-button__link:hover,
.has-contrast-background-color .wp-block-button.is-style-outline .wp-block-button__link:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

/* Filled button hover, over a colour set in the editor. */
.wp-block-button__link.has-accent-1-background-color:hover {
	background-color: var(--wp--preset--color--accent-3) !important;
}

/* Focus rings: light on dark sections. */
a:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1);
	outline-offset: 2px;
	border-radius: 2px;
}

.has-contrast-background-color a:focus-visible,
.has-contrast-background-color .wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--base);
}

/* Headings on dark sections take the section's white text (theme.json sets headings dark). */
.has-contrast-background-color :where(h1, h2, h3, h4, h5, h6) {
	color: inherit;
}

/* Links on dark sections: white, underlined on hover. */
.has-contrast-background-color a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.has-contrast-background-color a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
}

.wp-block-button__link {
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.wp-block-list li {
	margin-bottom: 0.5rem;
}

/* ---- Block style: AbleSpark card (core/group) ---- */

/* Shape only: each card's background and border are block settings, so editors pick them. */
.is-style-ablespark-card {
	border-radius: 8px;
	padding: var(--wp--preset--spacing--40);
	height: 100%;
	box-sizing: border-box;
}

.is-style-ablespark-card .ablespark-icon {
	display: flex;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: 0.5rem;
}

.ablespark-card__link {
	font-weight: 600;
}

/* ---- Block style: eyebrow label (core/paragraph). Typed in normal case, shown in capitals. ---- */

.is-style-ablespark-eyebrow {
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ---- Block style: feature list (core/group of icon + text items) ---- */

.is-style-ablespark-feature-list > .wp-block-group {
	align-items: flex-start;
}

.is-style-ablespark-feature-list .ablespark-icon {
	flex: 0 0 24px;
	margin-top: 0.2rem;
}

.is-style-ablespark-feature-list p {
	margin: 0;
}

/* ---- Header ---- */

.ablespark-header__logo {
	margin: 0;
}

.ablespark-header__logo a,
.ablespark-header__logo img {
	display: block;
}

.ablespark-header__logo img {
	height: auto;
}

/* Below 350px the 240px logo pushes the menu button onto a second line. */
@media (max-width: 349px) {
	.ablespark-header__logo img {
		max-width: 200px;
	}
}

/* ---- Footer ---- */

.ablespark-footer__social {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 0.5rem;
	font-size: 1.25rem;
}

.ablespark-footer__social a {
	display: inline-flex;
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.ablespark-footer__social svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Each link keeps its separator with it, so a wrapped line never ends on a stray "|". */
/* 24px tall so wrapped links keep a large enough tap target (WCAG 2.5.8). */
.ablespark-footer__legal a {
	display: inline-block;
	line-height: 24px;
	white-space: nowrap;
}

.ablespark-footer__legal a + a::before {
	content: "|";
	display: inline-block;
	margin: 0 0.5em;
	text-decoration: none;
}

/* ---- Columns holding a box (stat boxes): the box fills the column height ---- */

.wp-block-columns > .wp-block-column > .wp-block-group:only-child {
	height: 100%;
}

/* ---- Listing cards (Query Loop on Case Studies and Adventures) ---- */

.is-style-ablespark-card .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.is-style-ablespark-card .wp-block-post-title a:hover,
.is-style-ablespark-card .wp-block-post-title a:focus-visible {
	color: var(--wp--preset--color--accent-1);
	text-decoration: underline;
}

.is-style-ablespark-card .wp-block-post-excerpt__excerpt {
	margin: 0;
}

/* Respect reduced motion preferences. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
