/*
 * Full-screen menu (below 1024px; parts/site-menu.php, site-menu.js).
 * One Forest screen under the fixed bar, like a page of the site: the main
 * menu in Subheadline-size Brando, Cooper 1, with the bar's 6px hover line;
 * Reserve in Hillside; the contact details in the menu type at the bottom.
 * The panel is a fixed sibling of the header, under the bar and its blur
 * (z-index 48 < 49 < 50) and above the page, so a page transition treats it
 * as part of the old page and the new page slides up over it.
 * Open: the screen fades in, then the links rise one by one from a clip mask
 * (the heading reveal of reveal.css, same timing). Closed: hidden.
 */

:root {
	--site-menu-duration: 0.4s;
	--site-menu-link-delay: 0.15s;
}

.site-menu {
	position: fixed;
	inset: var(--wp-admin--admin-bar--height, 0px) 0 0;
	z-index: 48;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--color-forest-a);
	color: var(--color-cooper-1);
	opacity: 0;
	transition: opacity var(--site-menu-duration) ease;
}

.site-menu[hidden] {
	display: none;
}

.site-menu.is-open {
	opacity: 1;
}

/* The page cannot scroll behind the open menu (site-menu.js sets the class). */
html.is-menu-open {
	overflow: hidden;
}

.site-menu__inner {
	display: flex;
	flex: 1 0 auto;
	flex-direction: column;
	gap: var(--space-40);
	padding-top: calc(var(--header-height) + var(--space-40));
	padding-bottom: var(--space-40);
}

.site-menu__list {
	display: flex;
	flex-direction: column;
	gap: var(--space-20);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-menu__reserve {
	margin: 0;
}

.site-menu__link {
	display: inline-block;
	max-width: 100%;
	color: inherit;
	font-family: var(--font-serif);
	font-size: var(--fs-100);
	font-weight: var(--fw-text);
	line-height: var(--lh-subheadline);
	letter-spacing: var(--ls-subheadline);
	text-decoration: none;
	clip-path: inset(-0.3em -0.5em -0.35em -0.5em);
}

.site-menu__link--reserve {
	color: var(--color-hillside);
}

/* Hover and keyboard focus: the bar's Cooper 2 and 6px line (header.css), on the text so the mask keeps it. */
.site-menu__text {
	display: inline-block;
	box-shadow: 0 0 0 currentColor;
	transition: color var(--link-hover-duration) var(--link-hover-ease), box-shadow var(--link-hover-duration) var(--link-hover-ease);
}

.site-menu__link:is(:hover, :focus-visible) .site-menu__text {
	color: var(--color-cooper-2);
	box-shadow: 0 var(--stroke-accent) 0 currentColor;
}

.site-menu__link--reserve:is(:hover, :focus-visible) .site-menu__text {
	color: var(--color-hillside);
}

.site-menu__link:focus-visible {
	outline-offset: 0.2em;
}

/* Opened by a tap or click (site-menu.js): focus moved for screen readers, no ring. */
.site-menu[data-pointer-focus] .site-menu__link:focus-visible {
	outline: none;
}

/* Lines rise once the screen is up: index --site-menu-i, 0.1s apart (reveal.css stagger). */
.site-menu__list > li:nth-child(1) { --site-menu-i: 0; }
.site-menu__list > li:nth-child(2) { --site-menu-i: 1; }
.site-menu__list > li:nth-child(3) { --site-menu-i: 2; }
.site-menu__list > li:nth-child(4) { --site-menu-i: 3; }
.site-menu__list > li:nth-child(5) { --site-menu-i: 4; }
.site-menu__list > li:nth-child(6) { --site-menu-i: 5; }
.site-menu__list > li:nth-child(7) { --site-menu-i: 6; }
.site-menu__list > li:nth-child(n + 8) { --site-menu-i: 7; }
.site-menu__reserve { --site-menu-i: 8; }
.site-menu__contact { --site-menu-i: 9; }

.site-menu:not(.is-open) .site-menu__text,
.site-menu:not(.is-open) .site-menu__contact {
	opacity: 0;
	translate: 0 100%;
}

.site-menu.is-open .site-menu__text,
.site-menu.is-open .site-menu__contact {
	transition:
		opacity var(--reveal-line-duration) var(--reveal-ease),
		translate var(--reveal-line-duration) var(--reveal-ease);
	transition-delay: calc(var(--site-menu-link-delay) + var(--site-menu-i, 0) * var(--reveal-line-stagger));
}

/* The contact lines keep the hover transition on the text; the block rises as one. */
.site-menu.is-open .site-menu__text {
	transition:
		color var(--link-hover-duration) var(--link-hover-ease),
		box-shadow var(--link-hover-duration) var(--link-hover-ease),
		opacity var(--reveal-line-duration) var(--reveal-ease),
		translate var(--reveal-line-duration) var(--reveal-ease);
	transition-delay: 0s, 0s, calc(var(--site-menu-link-delay) + var(--site-menu-i, 0) * var(--reveal-line-stagger)), calc(var(--site-menu-link-delay) + var(--site-menu-i, 0) * var(--reveal-line-stagger));
}

.site-menu__contact {
	margin-top: auto;
	padding-top: var(--space-40);
	color: var(--color-stone);
	clip-path: inset(-0.3em -0.5em -0.35em -0.5em);
}

.site-menu__contact p {
	margin: 0;
}

.site-menu__contact p + p {
	margin-top: 0.5em;
}

.site-menu__contact a {
	text-decoration: none;
}

.site-menu__contact a:is(:hover, :focus-visible) {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

/* At 1024px and up the menu sits in the bar; the panel never shows. */
@media (min-width: 1024px) {
	.site-menu {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--site-menu-duration: 0s;
	}

	.site-menu,
	.site-menu.is-open .site-menu__text,
	.site-menu.is-open .site-menu__contact {
		transition: none;
	}
}
