/*
Theme Name: TruStrata
Theme URI: https://trustrata.com
Author: TruStrata Limited
Description: Block theme for the TruStrata website, built from the TruStatMind brand tokens.
Version: 0.1.0
Requires at least: 6.6
Requires PHP: 7.4
Text Domain: trustrata
License: Proprietary
*/

/* Component styles. Every value comes from theme.json presets (--wp--preset--*)
   or custom tokens (--wp--custom--*), never raw hex. */

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Template parts sit flush against main; sections own their own spacing. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

:where(.wp-site-blocks) :focus-visible {
	outline: 2px solid var(--wp--preset--color--blue);
	outline-offset: 2px;
}

.screen-reader-text:not(:focus) {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Header: navy, glass once content scrolls beneath, hides on scroll down.
   The glass lives on ::before because backdrop-filter (and transform) on the
   header itself would trap the fixed-position mobile menu inside it.
--------------------------------------------------------------------------- */

.site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	color: var(--wp--preset--color--paper);
	border-bottom: 1px solid var(--wp--custom--on-navy--divider);
	transition:
		transform var(--wp--custom--motion--reveal),
		opacity var(--wp--custom--motion--reveal);
}

.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: var(--wp--preset--color--navy);
	transition: background-color var(--wp--custom--motion--reveal);
}

.site-header.is-scrolled::before {
	background-color: rgb(10 22 40 / 0.86);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	backdrop-filter: blur(16px) saturate(140%);
}

.site-header.is-hidden {
	transform: translateY(-100%);
	opacity: 0;
	pointer-events: none;
}

.site-header a:where(:not(.wp-element-button)) {
	color: inherit;
	text-decoration: none;
}

.site-header__inner {
	box-sizing: border-box;
	max-width: var(--wp--style--global--wide-size);
	min-height: var(--wp--custom--header-height);
	margin-inline: auto;
	padding-inline: var(--wp--custom--gutter);
	gap: var(--wp--preset--spacing--40);
}

.site-header__logo,
.site-footer__logo {
	flex-shrink: 0;
	margin: 0;
}

.site-header__logo img,
.site-footer__logo img {
	display: block;
	height: auto;
}

.site-header__logo img {
	width: 138px;
}

.site-header__nav {
	flex: 1;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

/* Centre the desktop menu here rather than in the block's layout settings,
   which would also centre the mobile menu. */
@media (min-width: 900px) {
	.site-header__nav,
	.site-header__nav .wp-block-navigation__container {
		justify-content: center;
	}
}

.site-header__nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--10);
}

/* Core forces item links to `color: inherit` with a doubled class, so the
   colour is set on the containers and hover states need the extra weight. */
.site-header__nav,
.site-header__nav .wp-block-navigation__submenu-container {
	color: var(--wp--custom--on-navy--body);
}

.site-header__nav .wp-block-navigation-item__content {
	padding: 8px 12px;
	border-radius: var(--wp--custom--radius--sm);
	transition:
		background-color var(--wp--custom--motion--fast),
		color var(--wp--custom--motion--fast);
}

.site-header .site-header__nav .wp-block-navigation-item__content.wp-block-navigation-item__content:hover,
.site-header .site-header__nav .current-menu-item > .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--preset--color--paper);
	background-color: rgb(255 255 255 / 0.08);
}

.site-header__nav .has-child .wp-block-navigation-item__content {
	padding-inline-end: 4px;
}

.site-header__nav .has-child .wp-block-navigation__submenu-container {
	min-width: 220px;
	padding: var(--wp--preset--spacing--20);
	border: 1px solid var(--wp--custom--on-navy--divider);
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--navy-light);
	box-shadow: var(--wp--preset--shadow--raised);
}

.site-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	width: 100%;
	padding: 10px 12px;
}

.site-header__cta {
	flex-shrink: 0;
	margin: 0;
}

.site-header__cta .wp-element-button {
	font-size: var(--wp--preset--font-size--small);
	white-space: nowrap;
}

/* Phone (with a dropdown like the menu's) and LinkedIn, beside the button. */
.site-header__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 4px;
}

.site-header__icon {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	min-height: 40px;
	padding: 0 10px;
	border: 0;
	border-radius: var(--wp--custom--radius--sm);
	background: none;
	color: var(--wp--custom--on-navy--body);
	cursor: pointer;
	transition:
		background-color var(--wp--custom--motion--fast),
		color var(--wp--custom--motion--fast);
}

.site-header .site-header__icon:hover,
.site-header__phone:hover .site-header__icon,
.site-header__phone.is-open .site-header__icon {
	color: var(--wp--preset--color--paper);
	background-color: rgb(255 255 255 / 0.08);
}

.site-header__icon:focus-visible {
	outline: 2px solid var(--wp--preset--color--blue-light);
	outline-offset: 2px;
}

.site-header__phone {
	position: relative;
}

.site-header__phone-panel {
	position: absolute;
	top: 100%;
	right: 0;
	display: grid;
	gap: 2px;
	padding: var(--wp--preset--spacing--20) 16px;
	border: 1px solid var(--wp--custom--on-navy--divider);
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--navy-light);
	box-shadow: var(--wp--preset--shadow--raised);
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition:
		opacity var(--wp--custom--motion--fast),
		transform var(--wp--custom--motion--fast),
		visibility 0s linear var(--wp--custom--motion--fast);
}

/* A bridge over the gap, so the pointer can reach the panel. */
.site-header__phone-panel::before {
	content: "";
	position: absolute;
	inset: -10px 0 auto;
	height: 10px;
}

.site-header__phone:hover .site-header__phone-panel,
.site-header__phone.is-open .site-header__phone-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(6px);
	transition-delay: 0s;
}

.site-header__phone-panel span {
	color: var(--wp--custom--on-navy--secondary);
	font-size: var(--wp--preset--font-size--caption);
}

.site-header .site-header__phone-panel a {
	color: var(--wp--preset--color--paper);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 600;
}

.site-header .site-header__phone-panel a:hover {
	color: var(--wp--preset--color--cyan-light);
}

.site-header .wp-element-button:focus-visible {
	outline-color: var(--wp--preset--color--blue-light);
}

/* Mobile menu: core switches at 600px; the brand's breakpoint is 900px. */
@media (min-width: 600px) and (max-width: 899px) {
	.site-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

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

@media (max-width: 899px) {
	.site-header__nav {
		flex: 0 0 auto;
		order: 3;
	}

	/* Doubled class: core's flex layout resets child margins. */
	.site-header__inner > .site-header__cta.site-header__cta {
		margin-inline-start: auto;
	}
}

.site-header .wp-block-navigation__responsive-container-open,
.site-header .wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--paper);
}

.site-header .wp-block-navigation__responsive-container-open svg {
	width: 28px;
	height: 28px;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--40) var(--wp--custom--gutter);
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--paper);
}

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

.site-header .wp-block-navigation__responsive-container.is-menu-open {
	--navigation-layout-justification-setting: flex-start;
}

.site-header .is-menu-open .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--30);
	width: 100%;
	align-items: flex-start;
}

.site-header .is-menu-open .wp-block-navigation-item {
	align-items: flex-start;
}

.site-header .is-menu-open .wp-block-navigation-item__content.wp-block-navigation-item__content {
	padding: 8px 0;
	color: var(--wp--preset--color--paper);
	background: none;
	font-size: var(--wp--preset--font-size--heading-5);
	font-weight: 600;
}

.site-header .is-menu-open .wp-block-navigation__submenu-container {
	gap: 0;
	padding: 0 0 0 var(--wp--preset--spacing--30) !important;
	border: 0;
	border-left: 1px solid var(--wp--custom--on-navy--divider) !important;
	background: none;
	box-shadow: none;
	font-size: var(--wp--preset--font-size--body);
}

.site-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content.wp-block-navigation-item__content {
	padding-block: 6px;
	color: var(--wp--custom--on-navy--body);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 500;
}

@media (max-width: 599px) {
	.admin-bar .site-header {
		top: 0;
	}

	/* !important beats the image block's inline width. */
	.site-header__logo img {
		width: 100px !important;
	}

	.site-header__inner {
		gap: var(--wp--preset--spacing--10);
	}

	.site-header__actions {
		gap: 0;
	}

	.site-header__icon {
		padding-inline: 4px;
	}

	.site-header__cta .wp-element-button {
		padding-inline: 14px;
	}
}

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

.site-footer {
	position: relative;
	padding-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--50);
	padding-inline: var(--wp--custom--gutter);
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--custom--on-navy--body);
	font-size: var(--wp--preset--font-size--small);
}

/* Signature gradient as a thin top rule, per the brand guide. */
.site-footer::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 3px;
	background: var(--wp--preset--gradient--brand);
}

.site-footer a {
	color: var(--wp--custom--on-navy--body);
	text-decoration: none;
	transition: color var(--wp--custom--motion--fast);
}

.site-footer a:hover {
	color: var(--wp--preset--color--paper);
}

.site-footer a:focus-visible {
	outline-color: var(--wp--preset--color--blue-light);
}

.site-footer__inner {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
}

.site-footer__grid {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
}

.site-footer__grid > * {
	margin: 0;
}

.site-footer__brand > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.site-footer__logo img {
	width: 150px;
}

.site-footer__tagline {
	max-width: 30ch;
	margin-block-start: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--body);
	line-height: 1.5;
}

.site-footer__fine,
.site-footer__bottom {
	color: var(--wp--custom--on-navy--fine);
	font-size: var(--wp--preset--font-size--caption);
	line-height: 1.6;
}

.site-footer__heading.site-footer__heading {
	margin: 0 0 var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--cyan-light);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1.4;
	text-transform: uppercase;
}

.site-footer__links {
	display: grid;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__social {
	margin-block-start: var(--wp--preset--spacing--30);
}

.site-footer__social .wp-social-link {
	border: 1px solid var(--wp--custom--on-navy--divider);
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--navy-light);
	color: var(--wp--custom--on-navy--body);
	transition: color var(--wp--custom--motion--fast);
}

.site-footer__social .wp-social-link:hover {
	color: var(--wp--preset--color--paper);
	transform: none;
}

.site-footer__social .wp-social-link a {
	padding: 8px;
}

.site-footer__divider {
	margin-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40);
	border: 0;
	border-top: 1px solid var(--wp--custom--on-navy--divider);
}

.site-footer__bottom {
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
}

.site-footer__bottom > * {
	margin: 0;
}

.site-footer__legal {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__bottom a {
	color: var(--wp--custom--on-navy--secondary);
}

@media (max-width: 1199px) {
	.site-footer__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.site-footer__brand {
		grid-column: 1 / -1;
	}
}

@media (max-width: 899px) {
	.site-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {
	.site-footer {
		padding-block-start: var(--wp--preset--spacing--60);
	}

	/* Contact holds the long email address, so give it the full row. */
	.site-footer__col:last-child {
		grid-column: 1 / -1;
	}

	.site-footer__bottom {
		flex-direction: column;
		align-items: flex-start !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-header,
	.site-header::before,
	.site-header__nav .wp-block-navigation-item__content,
	.site-header__icon,
	.site-header__phone-panel,
	.site-footer a {
		transition: none;
	}
}

/* ---------------------------------------------------------------------------
 * Link arrow: a plain ">" on links that take you somewhere
 * (trustrata_link_arrow() in functions.php; src/shared/link-arrow.js in the
 * editor; the link-arrow.after mixin for pseudo-elements). It nudges forward
 * on hover.
 * ------------------------------------------------------------------------- */
.link-arrow {
	display: inline-block;
	flex: none;
	margin-inline-start: 0.35em;
	line-height: 1;
	transition: transform var(--wp--custom--motion--fast);
}

/* The glyph is an inline-block pseudo-element: an atomic box, so the link's
 * hover underline never runs under it, even when the link is a flex box. */
.link-arrow::before {
	content: ">";
	display: inline-block;
}

.link-arrow--back::before {
	content: "<";
}

.link-arrow--back {
	margin-inline: 0 0.35em;
}

.link-arrow--down {
	transform: rotate(90deg);
}

a:hover .link-arrow--forward,
a:focus-visible .link-arrow--forward {
	transform: translateX(2px);
}

a:hover .link-arrow--back,
a:focus-visible .link-arrow--back {
	transform: translateX(-2px);
}

a:hover .link-arrow--down,
a:focus-visible .link-arrow--down {
	transform: rotate(90deg) translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
	.link-arrow {
		transition: none;
	}

	a:hover .link-arrow--forward,
	a:hover .link-arrow--back,
	a:focus-visible .link-arrow--forward,
	a:focus-visible .link-arrow--back {
		transform: none;
	}

	a:hover .link-arrow--down,
	a:focus-visible .link-arrow--down {
		transform: rotate(90deg);
	}
}
