/*
 * Header and footer. Only what block attributes and theme.json cannot express.
 */

/*
 * ---- Wordmark: the two-colour mark drawn with CSS masks, so it follows the
 * palette in light and dusk.
 */
.gm-wordmark {
	--gm-mark-size: 30px;
	--gm-mark-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg transform='translate(-3 1)' fill='none' stroke='%23000' stroke-width='6' stroke-linecap='round'%3E%3Ccircle cx='29' cy='27' r='12'/%3E%3Cpath d='M41 20V44Q41 56 29 56Q22 56 18 51'/%3E%3C/g%3E%3C/svg%3E");
	--gm-mark-leaf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg transform='translate(-3 1)'%3E%3Cpath d='M41 22C41 12 47 7 56 7C56 16 50 22 41 22Z'/%3E%3C/g%3E%3C/svg%3E");
	margin: 0;
	font-weight: 450;
	letter-spacing: -0.03em;
	text-transform: lowercase;
}

.gm-wordmark a {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding-inline-start: calc(var(--gm-mark-size) + 10px);
	padding-bottom: 3px;
	color: var(--wp--preset--color--soil);
	text-decoration: none;
}

.gm-wordmark a::before,
.gm-wordmark a::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	width: var(--gm-mark-size);
	height: var(--gm-mark-size);
	transform: translateY(-50%);
	-webkit-mask: center / contain no-repeat;
	mask: center / contain no-repeat;
}

.gm-wordmark a::before {
	background: var(--wp--preset--color--moss);
	-webkit-mask-image: var(--gm-mark-ring);
	mask-image: var(--gm-mark-ring);
}

.gm-wordmark a::after {
	background: var(--wp--preset--color--marigold);
	-webkit-mask-image: var(--gm-mark-leaf);
	mask-image: var(--gm-mark-leaf);
}

/* ---- Header */
.gm-header {
	position: relative;
	z-index: 20;
	border-bottom: 1px solid var(--wp--preset--color--stone);
}

.gm-header__row {
	flex-wrap: nowrap;
	gap: var(--wp--preset--spacing--30);
}

.gm-primary-nav {
	flex: 1 1 auto;
	min-width: 0;
}

.gm-primary-nav .wp-block-navigation__responsive-container-content,
.gm-primary-nav .wp-block-navigation__container {
	width: 100%;
}

.gm-primary-nav .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 12px;
	border-radius: var(--wp--custom--radius--button);
	color: var(--wp--preset--color--soil);
	text-decoration: none;
}

.gm-primary-nav .wp-block-navigation-item__content:hover {
	background: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--moss);
}

/* Current page: Moss with a 2px underline. */
.gm-primary-nav .current-menu-item > .wp-block-navigation-item__content,
.gm-primary-nav .wp-block-navigation-item__content[aria-current="page"] {
	color: var(--wp--preset--color--moss);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 8px;
}

.gm-primary-nav .gm-nav-contact > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--muted);
}

.gm-primary-nav .gm-nav-contact > .wp-block-navigation-item__content:hover,
.gm-primary-nav .gm-nav-contact.current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--moss);
}

.gm-primary-nav .gm-nav-cta > .wp-block-navigation-item__content {
	padding: 0 18px;
	background: var(--wp--preset--color--moss);
	color: var(--wp--preset--color--on-moss);
	font-weight: 500;
	text-decoration: none;
}

.gm-primary-nav .gm-nav-cta > .wp-block-navigation-item__content:hover {
	background: var(--wp--preset--color--moss-deep);
	color: var(--wp--preset--color--on-moss);
}

/*
 * Menu button and close button. Core decides when they show; this only styles
 * them.
 */
.gm-primary-nav .wp-block-navigation__responsive-container-open,
.gm-primary-nav .wp-block-navigation__responsive-container-close {
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--stone);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--soil);
}

/*
 * Desktop: two spacers share the free room, so the links sit centred between
 * logo and actions.
 */
@media (min-width: 960px) {

	.gm-primary-nav .wp-block-navigation__container > li:first-child {
		margin-inline-start: auto;
	}

	.gm-primary-nav .wp-block-navigation__container > .gm-nav-contact {
		margin-inline-start: auto;
	}
}

/*
 * Core switches to the inline menu at 600px. The design keeps the drawer until
 * 960px.
 */
@media (min-width: 600px) and (max-width: 959px) {

	.gm-header .gm-primary-nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: inline-flex;
	}

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

	.gm-header .gm-primary-nav {
		flex: 0 0 auto;
	}

	.gm-header__row {
		justify-content: space-between;
	}
}

@media (max-width: 599px) {

	.gm-header .gm-primary-nav {
		flex: 0 0 auto;
	}
}

/* Drawer */
.gm-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--20) clamp(20px, 4vw, 32px) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--soil);
}

.gm-primary-nav .is-menu-open .wp-block-navigation__responsive-container-content {
	justify-content: flex-start;
	padding-top: var(--wp--preset--spacing--40);
}

.gm-primary-nav .is-menu-open .wp-block-navigation__container {
	align-items: stretch;
	gap: 0;
}

.gm-primary-nav .is-menu-open .wp-block-navigation-item {
	width: 100%;
}

.gm-primary-nav .is-menu-open .wp-block-navigation-item__content {
	display: flex;
	justify-content: space-between;
	box-sizing: border-box;
	width: 100%;
	min-height: 56px;
	padding: 0;
	border-bottom: 1px solid var(--wp--preset--color--stone);
	border-radius: 0;
	font-size: var(--wp--preset--font-size--large);
}

.gm-primary-nav .is-menu-open .wp-block-navigation-item__content:hover {
	background: none;
}

.gm-primary-nav .is-menu-open .wp-block-navigation-item__content::after {
	content: "";
	flex: none;
	align-self: center;
	width: 18px;
	height: 18px;
	background: var(--wp--preset--color--muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/*
 * In the drawer, Contact and Browse apps become two stacked actions below the
 * list.
 */
.gm-primary-nav .is-menu-open .gm-nav-contact,
.gm-primary-nav .is-menu-open .gm-nav-cta {
	margin-top: var(--wp--preset--spacing--20);
	margin-inline-start: 0;
}

.gm-primary-nav .is-menu-open .gm-nav-contact + .gm-nav-cta {
	margin-top: 12px;
}

.gm-primary-nav .is-menu-open .gm-nav-contact > .wp-block-navigation-item__content,
.gm-primary-nav .is-menu-open .gm-nav-cta > .wp-block-navigation-item__content {
	justify-content: flex-start;
	min-height: 48px;
	padding: 0 16px;
	border: 1px solid var(--wp--preset--color--stone);
	border-radius: var(--wp--custom--radius--button);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
}

.gm-primary-nav .is-menu-open .gm-nav-contact > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--soil);
}

.gm-primary-nav .is-menu-open .gm-nav-cta > .wp-block-navigation-item__content {
	border-color: var(--wp--preset--color--moss);
}

.gm-primary-nav .is-menu-open .gm-nav-contact > .wp-block-navigation-item__content::after,
.gm-primary-nav .is-menu-open .gm-nav-cta > .wp-block-navigation-item__content::after {
	content: none;
}

/* ---- Footer */
.gm-footer {
	border-top: 1px solid var(--wp--preset--color--stone);
}

.gm-footer .gm-wordmark {
	--gm-mark-size: 28px;
	font-size: var(--wp--preset--font-size--h-4);
}

.gm-footer-grid {
	align-items: start;
}

/* Brand column wider than the link columns, with room between them. */
.gm-footer-grid.gm-footer-grid {
	grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
	column-gap: var(--wp--preset--spacing--50);
}

@media (max-width: 959px) {

	.gm-footer-grid.gm-footer-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 559px) {

	.gm-footer-grid.gm-footer-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.gm-footer-col .wp-block-navigation,
.gm-footer-col .wp-block-navigation-item {
	width: 100%;
}

.gm-footer-col .wp-block-navigation__container {
	width: 100%;
	gap: 0;
}

.gm-footer-col .wp-block-navigation-item__content,
.gm-footer-legal .wp-block-navigation-item__content {
	flex: 1;
	display: flex;
	align-items: center;
	min-height: 44px;
	color: var(--wp--preset--color--soil);
	text-decoration: none;
}

.gm-footer-col .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--moss);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.gm-footer-legal .wp-block-navigation-item__content {
	padding: 0 8px;
	color: var(--wp--preset--color--muted);
}

/* Clearly marked stand-in for a later step. */
.gm-placeholder {
	border: 1px dashed var(--wp--preset--color--stone);
	border-radius: var(--wp--custom--radius--card);
}

.gm-footer-bottom {
	border-top: 1px solid var(--wp--preset--color--stone);
}

.gm-leaf-note {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.gm-leaf-note::before {
	content: "";
	flex: none;
	width: 12px;
	height: 12px;
	background: var(--wp--preset--color--marigold);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='40 6 18 18'%3E%3Cpath d='M41 22C41 12 47 7 56 7C56 16 50 22 41 22Z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='40 6 18 18'%3E%3Cpath d='M41 22C41 12 47 7 56 7C56 16 50 22 41 22Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Colour mode toggle: one 44px button cycling system, light and dark. */
.gm-mode-wrap {
	display: inline-flex;
	flex: none;
	order: 3;
}

.gm-mode-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--stone);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--soil);
	cursor: pointer;
}

.gm-mode-toggle[hidden] {
	display: none;
}

.gm-mode-toggle:hover {
	border-color: var(--wp--preset--color--moss);
	color: var(--wp--preset--color--moss);
}

.gm-mode-toggle::before {
	content: "";
	width: 20px;
	height: 20px;
	background: currentcolor;
	-webkit-mask: var(--gm-mode-icon) center / contain no-repeat;
	mask: var(--gm-mode-icon) center / contain no-repeat;
}

.gm-mode-toggle[data-state="system"] {
	--gm-mode-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='20' height='14' x='2' y='3' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E");
}

.gm-mode-toggle[data-state="light"] {
	--gm-mode-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/svg%3E");
}

.gm-mode-toggle[data-state="dark"] {
	--gm-mode-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z'/%3E%3C/svg%3E");
}

/*
 * Below 960px the menu button and the toggle sit together on the right, in tab
 * order too.
 */
@media (max-width: 959px) {

	.gm-header__row .gm-primary-nav {
		margin-inline-start: auto;
	}
}

/* Legal links and the colour mode toggle sit together at the end. */
.gm-footer-end {
	margin-inline-start: auto;
}

/* First footer column slot: the brand text. */
.gm-footer-slot {
	width: 100%;
	max-width: 320px;
}

.gm-footer-story a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}
