/**
 * Site ribbon (includes/site-ribbon.php, core 2.140.0).
 *
 * Inner pages: in normal flow above .wp-site-blocks, so it pushes the page
 * down. The theme's header is absolutely positioned over the hero, so it is
 * moved down by the same amount with margin-top (on top of the admin-bar
 * offset header.css already gives it). `--wwh-ribbon-h` starts as an estimate
 * and assets/js/site-ribbon.js replaces it with the measured height.
 *
 * Home page: <main> is a fixed-height scroll container, so a flow element
 * would cut the bottom off. The ribbon floats over the top of the hero
 * instead, and goes once the visitor scrolls past the hero (home2-scroll.js
 * drops `home2-on-hero`), taking the header back up with it.
 *
 * Pinned header (sticky-header.js `wwh-header-stuck`): the ribbon has
 * scrolled away, so the bar goes back to the top.
 *
 * River teal with cream text: 8.0:1; the gold link words 4.56:1.
 */

body.has-wwh-ribbon {
	--wwh-ribbon-h: 44px;
}

@media (max-width: 600px) {
	body.has-wwh-ribbon {
		--wwh-ribbon-h: 64px;
	}
}

html.wwh-ribbon-closed body.has-wwh-ribbon,
body.home2.has-wwh-ribbon:not(.home2-on-hero) {
	--wwh-ribbon-h: 0px !important;
}

html.wwh-ribbon-closed .wwh-ribbon,
body.home2:not(.home2-on-hero) .wwh-ribbon {
	display: none;
}

.wwh-ribbon {
	position: relative;
	z-index: 101; /* above the header part (100) */
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 0.5rem 3.25rem;
	background: var(--wp--preset--color--river, #1F4E5A);
	color: var(--wp--preset--color--warm-cream, #F2EFEA);
	font-family: var(--wp--preset--font-family--body, 'EB Garamond', Georgia, serif);
	font-size: 1.0625rem;
	line-height: 1.3;
	text-align: center;
	/* A gold hairline keeps it apart from teal page panels (the Events hero). */
	box-shadow: inset 0 -1px 0 rgba(217, 178, 92, 0.5);
}

body.home2 .wwh-ribbon {
	position: absolute;
	top: var(--wp-admin--admin-bar--height, 0px);
	left: 0;
	right: 0;
}

.wwh-ribbon__text {
	margin: 0;
}

/* The sentence, then the gold link words (MEMBERSHIPS_MOCKS.pdf, Option 2).
   Gold on river teal is 4.56:1, so it passes AA as normal-size text. */
.wwh-ribbon__words {
	margin-right: 0.9em;
}

.wwh-ribbon__link--cta,
.wwh-ribbon__link--cta:visited {
	display: inline;
	color: var(--wp--preset--color--gold, #D9B25C);
	font-family: var(--wp--preset--font-family--ui, 'Montserrat', Arial, sans-serif);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
	line-height: 1.4;
}

.wwh-ribbon__link--cta:hover {
	border-bottom-width: 2px;
	padding-bottom: 1px;
}

/* No link words: the sentence itself is the link. */
.wwh-ribbon__link--whole,
.wwh-ribbon__link--whole:visited {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.wwh-ribbon__link--whole:hover {
	text-decoration-thickness: 2px;
}

.wwh-ribbon__link:focus-visible,
.wwh-ribbon__close:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold, #D9B25C);
	outline-offset: 3px;
	border-radius: 2px;
}

.wwh-ribbon__arrow {
	display: inline-block;
	margin-left: 0.4em;
	color: var(--wp--preset--color--gold, #D9B25C);
	text-decoration: none;
}

.wwh-ribbon__close {
	appearance: none;
	-webkit-appearance: none;
	position: absolute;
	top: 50%;
	right: 0.5rem;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.wwh-ribbon__close:hover {
	background: rgba(255, 255, 255, 0.12);
}

/* The header follows the ribbon down; the pinned bar goes back to the top. */
body.has-wwh-ribbon .wp-site-blocks > .wp-block-template-part:first-child {
	margin-top: var(--wwh-ribbon-h, 0px);
	transition: margin-top 0.25s ease;
}

body.has-wwh-ribbon.wwh-header-stuck .wp-site-blocks > .wp-block-template-part:first-child {
	margin-top: 0;
	transition: none;
}

@media (max-width: 600px) {
	.wwh-ribbon {
		padding: 0.5rem 3rem 0.5rem 1rem;
		font-size: 1rem;
		text-align: left;
		justify-content: flex-start;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.has-wwh-ribbon .wp-site-blocks > .wp-block-template-part:first-child {
		transition: none;
	}
}

@media print {
	.wwh-ribbon {
		display: none;
	}
}
