/**
 * VICTVS Assured: theme stylesheet.
 *
 * Colours, fonts, sizes, spacing, buttons and section styles live in
 * theme.json and /styles, and can be changed in Appearance > Editor > Styles.
 * This file holds only what theme.json cannot express. Every value
 * refers to a design token (var(--wp--preset--*) or var(--wp--custom--*)).
 *
 * Loaded on the front end and inside the block editor (add_editor_style),
 * so editing matches the published site.
 *
 * Contents
 *  1. Tokens used only by this file
 *  2. Base: links, focus, motion, scroll offset
 *  3. Fixed transparent header
 *  4. Primary navigation and dropdowns
 *  5. Hero sections
 *  6. Diagonal image crop
 *  7. Buttons: text-link style, minimum target size
 *  8. Ruled lists and rows
 *  9. Contents list (articles and policies)
 * 10. Insights lists
 * 11. Footer
 * 12. Forms (Contact Form 7 or any plugin form)
 * 13. Logo strip and testimonials
 * 14. Small screens
 */

/* 1. Tokens ------------------------------------------------------------ */

:root {
	--va-header-height: var(--wp--custom--header--height, 104px);
	--va-rule: 1px solid var(--wp--preset--color--muted-sage);
	--va-focus: 2px solid currentColor;
}

/* 2. Base --------------------------------------------------------------- */

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--va-focus);
	outline-offset: 3px;
}

/* Keep anchored headings clear of the fixed header. */
html {
	scroll-padding-top: calc(var(--va-header-height) + 1.5rem);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		/* A blanket override is the documented way to honour this preference. */
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Long words in large headings must never cause sideways scrolling. */
:where(h1, h2, h3, .wp-block-post-title) {
	overflow-wrap: break-word;
	hyphens: manual;
}

/* 3. Fixed transparent header ------------------------------------------
 * Front end only: the header part is a direct child of .wp-site-blocks.
 * In the Site Editor it stays in normal flow so it is easy to edit.
 */

.wp-site-blocks > .va-site-header {
	position: fixed;
	inset: 0 0 auto;
	z-index: 100;
	background-color: transparent;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.admin-bar .wp-site-blocks > .va-site-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

.wp-site-blocks > .va-site-header.is-scrolled {
	background-color: var(--wp--custom--header--scrolled-background);
	color: var(--wp--custom--header--scrolled-text);
}

/* The logo artwork is single-colour black; show it white on the dark bar. */
.va-site-header .wp-block-site-logo img {
	transition: filter 0.3s ease;
}

.wp-site-blocks > .va-site-header.is-scrolled .wp-block-site-logo img {
	filter: brightness(0) invert(1);
}

.va-header__bar {
	padding-block: 1.4375rem;
	/* Full 1440px rule, with the logo and menu aligned to the 1240px content edge. */
	padding-inline: max(0px, calc((min(100%, var(--wp--style--global--wide-size)) - var(--wp--style--global--content-size)) / 2));
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--muted-sage) 50%, transparent);
}

.wp-site-blocks > .va-site-header.is-scrolled .va-header__bar {
	border-bottom-color: transparent;
}

/*
 * The page starts underneath the transparent header. A hero section
 * (class "va-hero") extends its own background up behind the header by
 * adding a transparent top border the height of the header, so its
 * editable padding still controls the space above the text.
 */
.wp-site-blocks .va-hero {
	border-top: var(--va-header-height) solid transparent;
}

/* Sections meet edge to edge: no gap between the main area and the footer. */
.wp-site-blocks > .va-main,
.wp-site-blocks > footer.wp-block-template-part {
	margin-block-start: 0;
}

/* Pages that do not start with a hero still need clearance. */
.wp-site-blocks .va-main:not(:has(.va-hero)) {
	padding-top: var(--va-header-height);
}

/* 4. Primary navigation ------------------------------------------------ */

.va-site-header .wp-block-navigation-item__content {
	text-decoration: none;
}

.va-site-header .wp-block-navigation-item__content:hover,
.va-site-header .current-menu-item > .wp-block-navigation-item__content,
.va-site-header .current-menu-ancestor > .wp-block-navigation-item__content {
	text-decoration: underline;
}

/* Use the "+" from the designs instead of the default chevron.
 * The toggle is at least 24px square (WCAG 2.2 target size). */
.va-site-header .wp-block-navigation .wp-block-navigation__submenu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	margin-left: 0;
	padding: 0;
}

.va-site-header .wp-block-navigation__submenu-icon svg {
	display: none;
}

.va-site-header .wp-block-navigation__submenu-icon::before {
	content: "+";
	display: block;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1;
	transition: transform 0.2s ease;
}

.va-site-header .wp-block-navigation-item.has-child:is(:hover, :focus-within) > .wp-block-navigation__submenu-icon::before,
.va-site-header .wp-block-navigation__submenu-icon[aria-expanded="true"]::before {
	transform: rotate(45deg);
}

/* Dropdown panels: always light, whatever the header state. */
.va-site-header .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
	min-width: 18rem;
	padding: 0.5rem 0;
	border: var(--va-rule);
	background-color: var(--wp--preset--color--chalk-white);
	color: var(--wp--preset--color--deep-mineral);
}

.va-site-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.55rem 1.25rem;
}

/* Sizing the items (not the panel) keeps the width when core's hover rules apply. */
.va-site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container > .wp-block-navigation-item {
	min-width: 18rem;
}

/* Contact link shown as an outline button (menu item class "va-nav-button"). */
.va-site-header .va-nav-button > .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 2.25rem;
	padding: 0.5rem 1rem;
	border: 1px solid currentColor;
	font-weight: 500;
}

.va-site-header .va-nav-button > .wp-block-navigation-item__content:hover {
	background-color: var(--wp--preset--color--deep-mineral);
	border-color: var(--wp--preset--color--deep-mineral);
	color: var(--wp--preset--color--pure-white);
	text-decoration: none;
}

.wp-site-blocks > .va-site-header.is-scrolled .va-nav-button > .wp-block-navigation-item__content:hover {
	background-color: var(--wp--preset--color--pure-white);
	border-color: var(--wp--preset--color--pure-white);
	color: var(--wp--preset--color--deep-mineral);
}

/* Mobile overlay: full-screen light panel with large, easy targets. */
.va-site-header .is-menu-open :is(.wp-block-navigation__container, .wp-block-navigation-item) {
	/* The menu is right-aligned in the bar; the open overlay reads left to right. */
	--navigation-layout-justification-setting: flex-start;
}

.va-site-header .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--80);
	color: var(--wp--preset--color--deep-mineral);
}

.va-site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--50);
}

.va-site-header .is-menu-open .wp-block-navigation-item {
	font-size: var(--wp--preset--font-size--x-large);
}

.va-site-header .is-menu-open .wp-block-navigation__submenu-container {
	border: 0;
	padding: 0.25rem 0 0.75rem 1rem;
	font-size: var(--wp--preset--font-size--medium);
}

.va-site-header .is-menu-open .wp-block-navigation__submenu-icon {
	display: none;
}

.va-site-header .wp-block-navigation__responsive-container-open,
.va-site-header .wp-block-navigation__responsive-container-close {
	min-width: 44px;
	min-height: 44px;
	justify-content: center;
}

/* 5. Hero sections ----------------------------------------------------- */

/* The ruled eyebrow hugs its text, as in the designs. */
.is-style-eyebrow-boxed {
	width: fit-content;
	max-width: 100%;
}

.va-hero__content {
	position: relative;
	z-index: 1;
}

/*
 * Hero with photograph (Home, Agriculture): the image fills the right
 * of the hero behind the text, cropped on a diagonal. Desktop only;
 * on smaller screens it sits under the text (see section 14).
 */
/* Same alignment rule as the header bar: 1440px image area, text on the 1240px edge. */
.va-hero--media > .va-hero__inner {
	padding-inline: max(0px, calc((min(100%, var(--wp--style--global--wide-size)) - var(--wp--style--global--content-size)) / 2));
}

@media (min-width: 1024px) {
	.va-hero--media > .va-hero__inner {
		position: relative;
		display: flex;
		align-items: center;
		min-height: 40rem;
	}

	.va-hero--media .va-hero__media {
		position: absolute;
		inset: 0 0 0 39%;
		margin: 0;
	}

	.va-hero--media .va-hero__media img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

}

/* 6. Diagonal image crop ----------------------------------------------- */

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

/* 7. Buttons ----------------------------------------------------------- */

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.875rem;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* "Text link" button style: an underlined link that sits beside buttons. */
.wp-block-button.is-style-text-link .wp-block-button__link {
	min-height: 2.75rem;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 0.9375rem;
	font-weight: 400;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.wp-block-button.is-style-text-link .wp-block-button__link:hover,
.wp-block-button.is-style-text-link .wp-block-button__link:focus {
	background: none;
	color: inherit;
	text-decoration: none;
}

/* Light buttons hover to pure white. */
.wp-block-button.is-style-light .wp-block-button__link:hover,
.wp-block-button.is-style-light .wp-block-button__link:focus {
	background-color: var(--wp--preset--color--pure-white);
	border-color: var(--wp--preset--color--pure-white);
	color: var(--wp--preset--color--deep-mineral);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.wp-block-button.is-style-outline .wp-block-button__link:focus {
	background-color: var(--wp--preset--color--deep-mineral);
	border-color: var(--wp--preset--color--deep-mineral);
	color: var(--wp--preset--color--pure-white);
}

/* 8. Ruled lists and rows ---------------------------------------------- */

.wp-block-list:is(.is-style-ruled, .is-style-ruled-large) {
	padding-left: 0;
	list-style: none;
	border-bottom: var(--va-rule);
}

.wp-block-list:is(.is-style-ruled, .is-style-ruled-large) > li {
	margin: 0;
	padding: 0.875rem 0;
	border-top: var(--va-rule);
}

.wp-block-list.is-style-ruled-large > li {
	padding: 1.0625rem 0 1.125rem;
	font-family: var(--wp--preset--font-family--stix-general);
	font-size: var(--wp--preset--font-size--heading-xs);
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.wp-block-list.is-style-ruled-large a {
	text-decoration: none;
}

.wp-block-list.is-style-ruled-large a:hover {
	text-decoration: underline;
}

/* Term / detail rows ("Our team", policy details). */
.va-term-row > * {
	margin-block: 0;
}

/* 9. Contents list (filled by assets/js/contents.js) ------------------ */

.va-contents:not(.is-ready) {
	display: none;
}

.va-contents__list {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.45;
}

.va-contents__list li {
	border-top: var(--va-rule);
}

.va-contents__list a {
	display: block;
	padding: 0.6875rem 0 0.75rem;
	text-decoration: none;
}

.va-contents__list a:hover {
	text-decoration: underline;
}

@media (min-width: 782px) {
	.va-contents {
		position: sticky;
		top: calc(var(--va-header-height) + 1.5rem);
	}

	.admin-bar .va-contents {
		top: calc(var(--va-header-height) + 1.5rem + 32px);
	}
}

/* Article body (single template): 18px text, 45px section headings. */
.va-article {
	font-size: var(--wp--preset--font-size--large);
	line-height: var(--wp--custom--line-height--relaxed);
}

.va-article h2 {
	margin-top: var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--heading-m);
	line-height: var(--wp--custom--line-height--snug);
	letter-spacing: var(--wp--custom--letter-spacing--heading-article);
}

.va-article h3 {
	font-size: var(--wp--preset--font-size--heading-xs);
	letter-spacing: var(--wp--custom--letter-spacing--heading-article);
}

/* 10. Insights lists --------------------------------------------------- */

.va-insight-rows .wp-block-post-title a,
.va-insight-list .wp-block-post-title a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.12em;
}

.va-insight-rows .wp-block-post-title a:hover,
.va-insight-list .wp-block-post-title a:hover {
	text-decoration: none;
}

.va-insight-rows .wp-block-post-template,
.va-insight-list .wp-block-post-template {
	gap: 0;
}

.va-insight-rows .wp-block-post-excerpt__excerpt,
.va-insight-list .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.va-post-meta > * + *::before {
	content: none;
}

/* 11. Footer ----------------------------------------------------------- */

.va-footer p {
	margin: 0;
}

.va-footer .wp-block-navigation {
	--navigation-layout-direction: column;
}

.va-footer .wp-block-navigation-item__content {
	display: inline-block;
	min-height: 1.5rem;
	padding: 0.15rem 0;
	text-decoration: underline;
}

.va-footer .wp-block-navigation-item__content:hover {
	text-decoration: none;
}

/* 12. Forms ------------------------------------------------------------ */

.va-form :is(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], select, textarea),
.wpcf7 :is(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], select, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: 3.0625rem;
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--wp--preset--color--field-border);
	border-radius: 0;
	background-color: var(--wp--preset--color--pure-white);
	color: var(--wp--preset--color--near-black);
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.4;
}

.va-form textarea,
.wpcf7 textarea {
	min-height: 8.25rem;
	height: 9.75rem;
	resize: vertical;
}

.va-form label,
.wpcf7 label {
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.58;
}

.wpcf7 form > p {
	margin: 0 0 0.9375rem;
}

.wpcf7 label > .wpcf7-form-control-wrap {
	display: block;
	margin-top: 0.3125rem;
}

.wpcf7 .wpcf7-submit {
	margin-top: 0.8rem;
	cursor: pointer;
}

.wpcf7 .wpcf7-not-valid-tip,
.wpcf7 form .wpcf7-response-output {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--near-black);
}

.wpcf7 .wpcf7-not-valid {
	border-color: #b3261e;
	border-width: 2px;
}

/* 13. Logo strip and testimonials -------------------------------------- */

.va-logo-strip .wp-block-image img {
	width: auto;
	max-width: 100%;
	max-height: 3.5rem;
	object-fit: contain;
	filter: grayscale(1);
	opacity: 0.85;
	transition: filter 0.2s ease, opacity 0.2s ease;
}

.va-logo-strip .wp-block-image a:is(:hover, :focus) img {
	filter: none;
	opacity: 1;
}

/* 14. Small screens ---------------------------------------------------- */

@media (max-width: 781px) {
	:root {
		--va-header-height: 88px;
	}

	.va-site-header .wp-block-site-logo img {
		width: 120px;
		height: auto;
	}

	.va-header__bar {
		padding-block: 1rem;
	}

	.admin-bar .va-contents {
		top: auto;
	}
}

@media (max-width: 1023px) {
	.va-hero--media .va-hero__media {
		margin-bottom: var(--wp--preset--spacing--40);
	}

	.va-hero--media .va-hero__media img {
		width: 100%;
		aspect-ratio: 4 / 3;
		object-fit: cover;
	}

	.va-hero--media .is-style-diagonal img {
		clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
	}
}
