/*
 * FLO — top stack: scrim, announcement bar, header, navigation, drawer.
 * Values from design/source/flo-nav.js and the homepage scroll script.
 *
 * Variants:
 *   .c-topbar--hero   fixed over the hero photo; transparent with a dark scrim,
 *                     turns light (paper) with navy text once the hero is past
 *   .c-topbar--solid  sticky, navy
 *   .c-topbar--demo   static copy on the styleguide
 *   .is-scrolled      the "after scroll" state (set by header.js)
 */

/* ---- Stack ----------------------------------------------------------------- */
/* The stack's height, for heroes that sit under it: an estimate per state
   (header 72px at every width — the Donate button sets it; announcement bar
   36px, 69px on ≤480px where its text takes two lines — WP-10l, it was 64)
   so the first paint is right; header.js then writes the measured value on
   <body> where it differs. Without the estimate the hero moved by ~60px on a
   phone once the script ran (CLS 0.03); with a wrong one the whole page was
   styled again (Lighthouse at 412px). Between 481 and 767px the bar may wrap
   to a second or third line: measured then. */
body {
	--flo-topbar-h: 72px;
}

body.has-announce {
	--flo-topbar-h: 108px;
}

@media (max-width: 480px) {
	body.has-announce {
		--flo-topbar-h: 141px;
	}
}

.c-topbar {
	position: relative;
	z-index: 100;
	color: var(--paper);
}

.c-topbar--hero {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

.c-topbar--solid {
	position: sticky;
	top: 0;
}

.c-topbar--demo {
	position: relative;
}

/* Logged in, WordPress's toolbar lies over the top of the window (32px; 46px ≤782px): the stack and
   the open drawer start under it — it covered the announcement bar and the drawer's close button.
   On ≤600px WordPress lets the toolbar scroll away; here it stays, as on wider screens, so no gap
   opens above the header. */
.admin-bar .c-topbar--hero,
.admin-bar .c-topbar--solid,
.admin-bar .c-drawer.is-open {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar #wpadminbar {
		position: fixed;
	}
}

.c-topbar__scrim {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 210px;
	background: linear-gradient(180deg, rgba(0, 7, 22, .86) 0%, rgba(0, 7, 22, .6) 34%, rgba(0, 7, 22, .28) 64%, rgba(0, 7, 22, .08) 84%, transparent 100%);
	pointer-events: none;
	transition: opacity var(--t-slow);
	z-index: 0;
}

.is-scrolled .c-topbar__scrim {
	opacity: 0;
}

/* ---- Announcement bar ------------------------------------------------------ */
.c-announce {
	position: relative;
	z-index: 1;
	overflow: hidden;
	max-height: 64px;
	opacity: 1;
	background: var(--navy);
	color: var(--paper);
	transition: max-height .45s ease, opacity .3s ease;
}

.is-scrolled .c-announce {
	max-height: 0;
	opacity: 0;
}

.c-announce__inner {
	max-width: var(--container);
	margin: 0 auto;
	padding: 9px var(--gutter);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	flex-wrap: wrap;
	text-align: center;
}

.c-announce__text {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-weight: 600;
	font-size: 13px;
	line-height: 1.35;
	color: rgba(255, 255, 255, .84);
}

.c-announce__text strong {
	font-weight: 700;
	color: var(--gold);
}

.c-announce__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--gold);
	flex: none;
}

.c-announce__link {
	font-weight: 700;
	font-size: 13px;
	line-height: 1;
	color: var(--gold);
	white-space: nowrap;
}

.c-announce__link:hover {
	color: #ffb524;
}

/* ---- Header ------------------------------------------------------------------ */
.c-header {
	position: relative;
	z-index: 1;
	color: var(--paper);
	background: transparent;
	transition: background var(--t-slow), box-shadow var(--t-slow), color var(--t-slow);
}

/* The frosted background lives on a pseudo-element: a backdrop-filter on the
   header itself would become the containing block of the fixed drawer. */
.c-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: transparent;
	transition: background var(--t-slow), box-shadow var(--t-slow);
}

.c-topbar--solid .c-header::before {
	background: rgba(0, 27, 66, .97);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.c-topbar--solid .c-header {
	padding-bottom: 1px; /* the border of ::before */
}

.c-topbar--hero.is-scrolled .c-header::before {
	background: rgba(251, 250, 247, .96);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: var(--shadow-header);
}

.c-topbar--hero.is-scrolled .c-header {
	color: var(--navy);
}

.c-header__inner {
	max-width: var(--container-header);
	margin: 0 auto;
	padding: 14px var(--gutter);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

/* ---- Logo lockup ------------------------------------------------------------ */
.c-logo {
	flex: none;
	display: inline-flex;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

.c-logo:hover {
	color: inherit;
}

.c-logo:focus-visible {
	outline: var(--focus-ring);
	outline-offset: 4px;
	border-radius: 6px;
}

.c-logo__set {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}

/* The official lockup, one file, mark 44px tall (225px wide) */
.c-logo__lockup {
	height: 44px;
	width: auto;
}

/* The header carries both colourways; CSS picks one by state */
.c-header .c-logo__set--color {
	display: none;
}

.c-topbar--hero.is-scrolled .c-logo__set--white {
	display: none;
}

.c-topbar--hero.is-scrolled .c-logo__set--color {
	display: inline-flex;
}

/* ---- Desktop navigation --------------------------------------------------- */
.c-nav {
	display: flex;
	align-items: center;
	white-space: nowrap;
}

.c-nav__list {
	display: flex;
	align-items: center;
	gap: 22px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-nav__item {
	position: relative;
	display: flex;
	align-items: center;
}

.c-nav__item.has-sub {
	padding-bottom: 14px;
	margin-bottom: -14px;
}

.c-nav__link {
	display: inline-flex;
	align-items: center;
	height: 21px;
	padding-top: 3.5px; /* sits on the baseline of the 21px row, as in the design */
	font-family: var(--font-sans);
	font-weight: 700;
	font-size: 12.5px;
	line-height: 1;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: inherit;
	text-decoration: none;
	transition: color .2s;
}

.c-topbar--solid .c-nav__link {
	color: rgba(255, 255, 255, .9);
}

.c-nav__item.is-active > .c-nav__link,
.c-topbar--solid .c-nav__item.is-active > .c-nav__link {
	color: var(--gold);
}

.c-nav__link:hover {
	color: inherit;
}

.c-topbar--solid .c-nav__link:hover {
	color: rgba(255, 255, 255, .9);
}

.c-nav__item.is-active > .c-nav__link:hover {
	color: var(--gold);
}

/* The caret stays 8px wide where the design draws it; the button around it is
   24×24 (WCAG 2.5.8 target size), reaching into the 22px gap after the item. */
.c-nav__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	width: 24px;
	height: 24px;
	margin: 0 -8px 0 -1px;
	padding: 3.5px 0 0 8px;
	overflow: visible;
	color: inherit;
	cursor: pointer;
}

.c-topbar--solid .c-nav__toggle {
	color: rgba(255, 255, 255, .9);
}

.c-nav__item.is-active > .c-nav__toggle {
	color: var(--gold);
}

.c-nav__caret {
	display: inline-block;
	font-weight: 700;
	font-size: 8px;
	line-height: 1;
	letter-spacing: 1px; /* inherited from the 12.5px link in the design */
	transform: translateY(-1px);
	opacity: .6;
	transition: transform .18s ease, opacity .18s ease;
}

.c-nav__item.has-sub:hover .c-nav__caret,
.c-nav__item.is-open .c-nav__caret {
	transform: translateY(-1px) rotate(180deg);
	opacity: 1;
}

/* Dropdown panel (sized by its longest note, as in the design) */
.c-nav .c-nav__sub {
	position: absolute;
	left: -18px;
	top: calc(100% + 8px);
	min-width: 308px;
	margin: 0;
	padding: 12px;
	list-style: none;
	background: #02163a;
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: var(--r-panel);
	box-shadow: var(--shadow-panel);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	/* visibility flips at once when opening (so the panel can take focus) and
	   only after the fade when closing */
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
	z-index: 60;
	white-space: nowrap;
}

.c-nav__item.has-sub:hover .c-nav__sub,
.c-nav__item.is-open .c-nav__sub {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity .2s ease, transform .2s ease, visibility 0s;
}

.c-nav__sublink {
	display: block;
	position: relative;
	padding: 13px 16px 13px 18px;
	border-radius: 9px;
	color: var(--paper);
	text-decoration: none;
	transition: background .16s ease;
}

.c-nav__sublink::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 50%;
	width: 3px;
	height: 0;
	border-radius: 2px;
	background: var(--gold);
	transform: translateY(-50%);
	transition: height .18s ease;
}

.c-nav__sublink:hover::before,
.c-nav__sublink:focus-visible::before,
.c-nav__sublink[aria-current]::before {
	height: 22px;
}

.c-nav__sublink:hover,
.c-nav__sublink:focus-visible {
	background: rgba(255, 255, 255, .06);
	color: var(--paper);
}

.c-nav__sublink[aria-current] {
	background: rgba(245, 163, 4, .1);
}

.c-nav__sublink b {
	display: block;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.2;
	letter-spacing: .01em;
	color: var(--paper);
}

.c-nav__sublink[aria-current] b {
	color: var(--gold);
}

.c-nav__sublink span {
	display: block;
	margin-top: 4px;
	font-weight: 500;
	font-size: 12.5px;
	line-height: 1.45;
	color: rgba(255, 255, 255, .55);
}

.c-nav a:focus-visible,
.c-nav button:focus-visible,
.c-drawer a:focus-visible,
.c-drawer button:focus-visible,
.c-burger:focus-visible,
.c-header__donate:focus-visible {
	outline: var(--focus-ring);
	outline-offset: 3px;
	border-radius: 6px;
}

.c-header__donate:focus-visible,
.c-drawer__donate:focus-visible {
	border-radius: var(--r-pill);
}

/* ---- Right-hand tools ------------------------------------------------------- */
.c-header__tools {
	flex: none;
	display: flex;
	align-items: center;
	gap: 16px;
	white-space: nowrap;
}

.c-lang {
	display: flex;
	align-items: center;
	gap: 7px;
	font-weight: 700;
	font-size: 11.5px;
	line-height: 1;
	letter-spacing: .08em;
	color: inherit;
}

.c-lang__on {
	color: var(--gold);
}

.c-lang__sep {
	opacity: .3;
}

.c-lang__off {
	opacity: .6;
}

.c-lang--drawer {
	color: var(--paper);
}

.c-burger {
	display: none;
	flex: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 11px;
	color: inherit;
	cursor: pointer;
}

.c-burger__bar {
	display: block;
	height: 2px;
	width: 100%;
	background: currentColor;
	border-radius: 2px;
}

/* ---- Drawer (≤1149px: below that the full menu does not fit, WP-10k) ---------- */
.c-drawer {
	display: none;
}

.c-drawer__close {
	display: none;
	position: absolute;
	top: 18px;
	right: 18px;
	width: 46px;
	height: 46px;
	align-items: center;
	justify-content: center;
	border: 1.5px solid rgba(255, 255, 255, .32);
	border-radius: 50%;
	background: transparent;
	color: var(--paper);
	font-weight: 400;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.c-drawer__close:focus-visible {
	border-radius: 50%;
}

/* WP-10k: the header of the design needs about 1210px (lockup 225 + menu 681 +
   languages and Donate 214 + gaps and gutters). Below 1220px its gaps shrink —
   the text keeps its size — so the full menu still fits down to the width
   where the burger takes over (see the next two blocks). */
@media (min-width: 1150px) and (max-width: 1219px) {
	.c-header__inner {
		gap: 14px;
	}

	.c-nav__list {
		gap: 14px;
	}

	.c-header__tools {
		gap: 12px;
	}

	.c-header__donate {
		padding-left: 18px;
		padding-right: 18px;
	}
}

@media (min-width: 1150px) {
	.c-nav {
		display: flex;
	}

	.c-burger,
	.c-drawer {
		display: none;
	}
}

@media (max-width: 1149px) {
	.c-nav {
		display: none;
	}

	.c-burger {
		display: flex;
	}

	.c-drawer.is-open {
		position: fixed;
		inset: 0;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		gap: 2px;
		padding: 88px 24px 44px;
		background: rgba(0, 14, 36, .985);
		overflow-y: auto;
		z-index: 200;
	}

	.c-drawer.is-open .c-drawer__close {
		display: flex;
	}

	body.nav-open {
		overflow: hidden;
	}

	.c-drawer__link {
		padding: 19px 4px;
		border-bottom: 1px solid rgba(255, 255, 255, .08);
		font-weight: 700;
		font-size: 19px;
		line-height: 1;
		letter-spacing: .04em;
		text-transform: uppercase;
		color: var(--paper);
		text-decoration: none;
	}

	.c-drawer__link.is-active {
		color: var(--gold);
	}

	.c-drawer__group {
		border-bottom: 1px solid rgba(255, 255, 255, .08);
	}

	.c-drawer__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		padding: 19px 4px;
		border: none;
		background: transparent;
		cursor: pointer;
		font-weight: 700;
		font-size: 19px;
		line-height: 1;
		letter-spacing: .04em;
		text-transform: uppercase;
		color: var(--paper);
		text-align: left;
	}

	.c-drawer__group.is-active .c-drawer__toggle {
		color: var(--gold);
	}

	.c-drawer__caret {
		font-size: 11px;
		color: var(--gold);
	}

	.c-drawer__sub {
		display: none;
		padding: 0 0 12px 14px;
	}

	.c-drawer__group.is-open .c-drawer__sub {
		display: block;
	}

	.c-drawer__sublink {
		display: block;
		padding: 12px 4px;
		font-weight: 600;
		font-size: 14px;
		line-height: 1.3;
		color: rgba(255, 255, 255, .8);
		text-decoration: none;
	}

	.c-drawer__sublink.is-active {
		color: var(--gold);
	}

	.c-drawer__donate {
		margin-top: 22px;
		padding: 19px 4px;
		font-size: 19px;
		letter-spacing: .04em;
		text-transform: uppercase;
	}

	.c-drawer__langs {
		margin-top: 20px;
	}
}

/* The design's header does not fit a phone: on 390px the language switch,
   Donate and even the burger ran off the right edge. Below 768px the switch
   leaves the header (it is in the drawer). Donate always stays: below 480px
   the lockup shrinks with the viewport so lockup + Donate + burger fit from
   360px up (docs/DECISIONS.md). */
@media (max-width: 768px) {
	.c-lang--header {
		display: none;
	}

	/* The announcement may wrap to two or three lines here: room for them, so
	   the link is never cut off (WP-10b, answer 14). .is-scrolled still folds
	   the bar to 0 (its rule is more specific), with the same transition. */
	.c-announce {
		max-height: 12em;
	}
}

@media (max-width: 480px) {
	.c-header__inner {
		gap: 14px;
	}

	.c-header__tools {
		gap: 12px;
	}

	/* 100vw − gutters 48 − Donate 102 − burger 44 − gaps 26 = the lockup's
	   width; height = width × 1174 / 5993 */
	.c-header .c-logo__lockup {
		height: clamp(26px, calc((100vw - 220px) * .1959), 44px);
	}

	.c-announce__text {
		display: inline;
	}

	.c-announce__dot {
		display: inline-block;
		vertical-align: middle;
		margin-right: 8px;
	}

	.c-announce__inner {
		display: block;
		padding: 8px 18px;
	}

	.c-announce__link {
		margin-left: 10px;
	}
}

/* 320px (WCAG reflow, the narrowest phones): tighter gutters and a compact
   Donate so that lockup + Donate + burger still fit without a horizontal
   scroll. Lockup width = 100vw − gutters 32 − Donate 86 − burger 44 − gaps 18. */
@media (max-width: 360px) {
	.c-header__inner {
		padding-left: 16px;
		padding-right: 16px;
		gap: 10px;
	}

	.c-header__tools {
		gap: 8px;
	}

	.c-header__donate {
		padding: 12px 14px;
		font-size: 12px;
	}

	.c-header .c-logo__lockup {
		height: clamp(22px, calc((100vw - 184px) * .1959), 44px);
	}
}
