/**
 * CIMSPA theme styles: things theme.json can't express. Loaded on the front end and in the editor.
 *
 * Breakpoints (match core): 600px small, 782px columns stack, 1080px header switches to menu button.
 */

:root {
	--cimspa-radius: 8px;
	--cimspa-radius-small: 4px;
	--cimspa-focus: var(--wp--preset--color--navy);
	--cimspa-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h16M13 5l7 7-7 7' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* -------------------------------------------------------------------------
 * Base
 * ---------------------------------------------------------------------- */

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img {
	height: auto;
	max-width: 100%;
}

/* Header, main and footer sit flush; full-width sections inside a page sit flush too. */
.wp-site-blocks > *,
.wp-block-post-content > .alignfull {
	margin-block: 0;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--white);
	clip: auto;
	clip-path: none;
	color: var(--wp--preset--color--navy);
	height: auto;
	left: 1rem;
	padding: 1rem 1.5rem;
	top: 1rem;
	width: auto;
	z-index: 100000;
}

/* Visible focus on every background: navy ring on light colours, white on navy. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--cimspa-focus);
	outline-offset: 2px;
}

.has-navy-background-color {
	--cimspa-focus: var(--wp--preset--color--white);
}

.has-background:not(.has-navy-background-color) {
	--cimspa-focus: var(--wp--preset--color--navy);
}

/* Text colour follows the background unless the editor has set one. */
.has-navy-background-color:not(.has-text-color) {
	color: var(--wp--preset--color--white);
}

.has-background:not(.has-navy-background-color):not(.has-text-color) {
	color: var(--wp--preset--color--navy);
}

.has-background :where(h1, h2, h3, h4, h5, h6) {
	color: inherit;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		scroll-behavior: auto !important;
		transition: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */

.wp-block-button.is-style-white .wp-block-button__link {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--navy);
}

.wp-block-button.is-style-navy .wp-block-button__link {
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
}

.wp-block-button.is-style-white .wp-block-button__link:hover,
.wp-block-button.is-style-navy .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--light-blue);
	color: var(--wp--preset--color--navy);
}

.wp-block-button.is-style-text .wp-block-button__link {
	background: transparent;
	color: inherit;
	padding-inline: 0.5rem;
}

.wp-block-button.is-style-text .wp-block-button__link:hover {
	background: transparent;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

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

.cimspa-header {
	position: relative;
	z-index: 20;
}

.cimspa-header__inner {
	gap: var(--wp--preset--spacing--40);
}

.cimspa-header__logo img,
.cimspa-logo-fallback img {
	display: block;
}

.cimspa-logo-fallback a {
	color: inherit;
	text-decoration: none;
}

.cimspa-logo-text {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.cimspa-header__nav {
	flex: 1 1 auto;
}

.cimspa-header__actions {
	flex: 0 0 auto;
	flex-wrap: nowrap;
	gap: 0.5rem;
}

.cimspa-header .wp-block-navigation a {
	text-decoration: none;
}

.cimspa-header .wp-block-navigation a:hover {
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

.cimspa-header .wp-block-navigation__submenu-container {
	border: 0 !important;
	border-radius: var(--cimspa-radius-small);
	box-shadow: var(--wp--preset--shadow--card);
	min-width: 15rem !important;
	padding: 0.5rem 0;
}

.cimspa-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.55rem 1.1rem;
}

/* "Log in to Dashboard" lives in the menu button overlay on small screens. */
.cimspa-header .cimspa-mobile-only {
	display: none !important;
}

.cimspa-header .is-menu-open .cimspa-mobile-only {
	display: flex !important;
}

.cimspa-header .wp-block-navigation__responsive-container-open,
.cimspa-header .wp-block-navigation__responsive-container-close {
	padding: 0.5rem;
}

.cimspa-header .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

.cimspa-header .is-menu-open .wp-block-navigation__responsive-container-content {
	font-size: var(--wp--preset--font-size--medium);
	gap: 1.25rem;
}

.cimspa-header .is-menu-open .wp-block-navigation__submenu-container {
	box-shadow: none;
	font-size: var(--wp--preset--font-size--base);
	padding: 0.75rem 0 0 1rem !important;
}

/* Core collapses the menu at 600px; the full CIMSPA menu needs more room, so collapse at 1080px. */
@media (max-width: 1079px) {
	.cimspa-header .cimspa-desktop-only {
		display: none;
	}

	.cimspa-header__nav {
		flex: 0 0 auto;
		order: 3;
	}

	.cimspa-header__actions {
		margin-left: auto;
	}

	.cimspa-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.cimspa-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

@media (max-width: 479px) {
	.cimspa-header__logo img {
		width: 110px !important;
	}

	.cimspa-header__actions .wp-block-button__link {
		font-size: 0.8125rem;
		padding: 0.55rem 0.75rem;
	}
}

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

.cimspa-footer a {
	text-decoration: none;
}

.cimspa-footer a:hover {
	text-decoration: underline;
	text-underline-offset: 0.3em;
}

.cimspa-footer__nav {
	font-weight: 500;
}

.cimspa-footer__nav .wp-block-navigation-item__content {
	padding: 0;
}

.cimspa-footer__partner img {
	max-width: 110px;
}

.cimspa-footer__bottom p {
	margin: 0;
}

/* -------------------------------------------------------------------------
 * Home hero (photo with diagonal edge, bleeding to the right of the screen)
 * ---------------------------------------------------------------------- */

.cimspa-hero-split > .wp-block-columns {
	margin: 0;
}

.cimspa-hero-split__text {
	padding-left: max(var(--wp--style--root--padding-left), calc((100vw - var(--wp--style--global--wide-size)) / 2));
	padding-right: var(--wp--preset--spacing--60);
}

.cimspa-hero-split__media {
	align-self: stretch;
}

.cimspa-hero-split__media .wp-block-image {
	height: 100%;
	margin: 0;
}

.cimspa-hero-split__media img {
	display: block;
	height: 100%;
	min-height: 24rem;
	object-fit: cover;
	width: 100%;
}

@media (max-width: 781px) {
	.cimspa-hero-split__text {
		padding-right: var(--wp--style--root--padding-right);
	}

	.cimspa-hero-split__media img {
		aspect-ratio: 4 / 3;
		min-height: 0;
	}
}

/* -------------------------------------------------------------------------
 * Image styles
 * ---------------------------------------------------------------------- */

.wp-block-image.is-style-diagonal img {
	clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
}

@media (max-width: 781px) {
	.wp-block-image.is-style-diagonal img {
		clip-path: polygon(0 12%, 100% 0, 100% 100%, 0 100%);
	}
}

.wp-block-image.is-style-cutout {
	margin: 0;
}

.wp-block-image.is-style-cutout img {
	display: block;
	margin-inline: auto;
	max-height: 22rem;
	object-fit: contain;
	object-position: bottom;
	width: auto;
}

/* -------------------------------------------------------------------------
 * Hero card (inset navy card with a coloured wedge behind a cut-out photo)
 * ---------------------------------------------------------------------- */

[class*="is-style-hero-card"] {
	--hero-wedge: var(--wp--preset--color--vivid-blue);
	isolation: isolate;
	overflow: hidden;
	position: relative;
}

.is-style-hero-card-teal {
	--hero-wedge: var(--wp--preset--color--teal);
}

.is-style-hero-card-lime {
	--hero-wedge: var(--wp--preset--color--lime);
}

[class*="is-style-hero-card"]::before {
	background: var(--hero-wedge);
	bottom: 0;
	clip-path: polygon(100% 0, 100% 100%, 0 100%);
	content: "";
	position: absolute;
	right: 0;
	top: 0;
	width: 42%;
	z-index: -1;
}

[class*="is-style-hero-card"] > .wp-block-columns {
	margin: 0;
}

@media (max-width: 781px) {
	[class*="is-style-hero-card"]::before {
		height: 45%;
		top: auto;
		width: 85%;
	}

	[class*="is-style-hero-card"] .wp-block-image.is-style-cutout img {
		max-height: 16rem;
	}
}

/* -------------------------------------------------------------------------
 * Audience tiles (home)
 * ---------------------------------------------------------------------- */

.wp-block-columns.is-style-staggered {
	align-items: stretch;
	margin: 0;
}

@media (min-width: 782px) {
	.is-style-staggered > .wp-block-column:not(:first-child) {
		margin-top: var(--wp--preset--spacing--60);
	}

	/* A navy strip behind the raised first tile continues the hero above. */
	.cimspa-audience {
		background: linear-gradient(var(--wp--preset--color--navy) 0 var(--wp--preset--spacing--60), transparent var(--wp--preset--spacing--60));
	}
}

.is-style-audience-tile {
	display: flex;
	flex-direction: column;
	height: 100%;
	position: relative;
}

.is-style-audience-tile > .wp-block-heading {
	margin: 0;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
}

.is-style-audience-tile > .wp-block-heading a {
	align-items: center;
	color: inherit;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	text-decoration: none;
}

/* The whole tile is clickable. */
.is-style-audience-tile > .wp-block-heading a::before {
	content: "";
	inset: 0;
	position: absolute;
}

.is-style-audience-tile > .wp-block-heading a::after {
	background: var(--wp--preset--color--white);
	content: "";
	flex: 0 0 1.75rem;
	height: 1.75rem;
	-webkit-mask: var(--cimspa-arrow) center / contain no-repeat;
	mask: var(--cimspa-arrow) center / contain no-repeat;
	transition: transform 0.15s;
}

.is-style-audience-tile:hover > .wp-block-heading a {
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

.is-style-audience-tile:hover > .wp-block-heading a::after {
	transform: translateX(4px);
}

.is-style-audience-tile > .wp-block-heading a:focus-visible {
	outline: none;
}

.is-style-audience-tile > .wp-block-heading a:focus-visible::before {
	outline: 3px solid var(--wp--preset--color--navy);
	outline-offset: -3px;
}

.is-style-audience-tile > p {
	font-weight: 500;
	margin: 0;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
}

/* -------------------------------------------------------------------------
 * Link tiles (About page)
 * ---------------------------------------------------------------------- */

.wp-block-group.is-style-link-tile {
	border-radius: var(--cimspa-radius-small);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-height: 7.5rem;
	padding: var(--wp--preset--spacing--40);
	position: relative;
	transition: box-shadow 0.15s, transform 0.15s;
}

.is-style-link-tile > * {
	margin: 0;
}

.is-style-link-tile a {
	color: inherit;
	text-decoration: none;
}

.is-style-link-tile a::before {
	content: "";
	inset: 0;
	position: absolute;
}

.is-style-link-tile a:focus-visible {
	outline: none;
}

.is-style-link-tile a:focus-visible::before {
	border-radius: var(--cimspa-radius-small);
	outline: 3px solid var(--wp--preset--color--navy);
	outline-offset: 2px;
}

.is-style-link-tile::after {
	align-self: flex-end;
	background: currentColor;
	content: "";
	height: 1.25rem;
	margin-top: 1rem;
	-webkit-mask: var(--cimspa-arrow) center / contain no-repeat;
	mask: var(--cimspa-arrow) center / contain no-repeat;
	width: 1.25rem;
}

.is-style-link-tile:hover {
	box-shadow: var(--wp--preset--shadow--card);
	transform: translateY(-2px);
}

.is-style-link-tile:hover a {
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

/* -------------------------------------------------------------------------
 * Arrow link paragraphs
 * ---------------------------------------------------------------------- */

p.is-style-arrow-link {
	border-bottom: 2px solid var(--wp--preset--color--vivid-blue);
	margin: 0;
}

p.is-style-arrow-link a {
	align-items: center;
	display: flex;
	font-weight: 600;
	gap: 1rem;
	justify-content: space-between;
	padding: 0.85rem 0;
	text-decoration: none;
}

p.is-style-arrow-link a::after {
	background: currentColor;
	content: "";
	flex: 0 0 1.4rem;
	height: 1.4rem;
	-webkit-mask: var(--cimspa-arrow) center / contain no-repeat;
	mask: var(--cimspa-arrow) center / contain no-repeat;
	transition: transform 0.15s;
}

p.is-style-arrow-link a:hover {
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

p.is-style-arrow-link a:hover::after {
	transform: translateX(4px);
}

/* -------------------------------------------------------------------------
 * Pills
 * ---------------------------------------------------------------------- */

ul.is-style-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

ul.is-style-pills li {
	background: var(--wp--preset--color--white);
	border-radius: var(--cimspa-radius-small);
	color: var(--wp--preset--color--navy);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	margin: 0;
	padding: 0.35rem 0.75rem;
}

/* -------------------------------------------------------------------------
 * Testimonial quote
 * ---------------------------------------------------------------------- */

.wp-block-quote.is-style-testimonial {
	margin: 0;
}

.wp-block-quote.is-style-testimonial > p {
	margin: 0;
}

.wp-block-quote.is-style-testimonial > p:first-child::before {
	content: "\201C";
}

.wp-block-quote.is-style-testimonial > p:last-of-type::after {
	content: "\201D";
}

.wp-block-quote.is-style-testimonial cite {
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	font-weight: 400;
	line-height: 1.5;
	margin-top: 1rem;
}

.wp-block-quote.is-style-testimonial cite::first-line {
	font-weight: 600;
}

/* -------------------------------------------------------------------------
 * Sections
 * ---------------------------------------------------------------------- */

.cimspa-section-link {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.cimspa-cta-band .wp-block-heading {
	margin-block: 0;
}

.cimspa-cta-band.is-layout-flex {
	align-items: center;
	gap: var(--wp--preset--spacing--40);
}

.cimspa-clip {
	overflow: hidden;
}

.cimspa-media-card {
	margin: 0;
}

.cimspa-media-card .cimspa-video {
	aspect-ratio: auto;
	border-radius: 0;
	height: 100%;
	min-height: 16rem;
}

.cimspa-definition-row {
	border-top: 1px solid var(--wp--preset--color--pale-blue);
	padding-top: 1rem;
}

.cimspa-definition-row p {
	margin: 0;
}

@media (max-width: 781px) {
	.cimspa-definition-row {
		gap: 0.25rem !important;
	}
}

/* -------------------------------------------------------------------------
 * Posts
 * ---------------------------------------------------------------------- */

.wp-block-post-title a {
	text-decoration: none;
}

.wp-block-post-title a:hover {
	text-decoration: underline;
}
