/* ChugCheck Header 1.2.0
 *
 * Colours come from the dark plugin when it is active; the fallbacks are for
 * the pages it has not been told about. The header is dark on every page,
 * because it belongs to the site rather than to the page under it.
 */

.cchd {
	--cchd-ground: var(--cc-ground, #12100D);
	--cchd-ink: var(--cc-ink, #F2EDE4);
	--cchd-dim: var(--cc-dim, #9A9183);
	--cchd-accent: var(--cc-accent, #C9A96A);
	--cchd-line: rgba(242, 237, 228, .16);
	--cchd-h: 62px;

	position: sticky;
	top: 0;
	z-index: 200;
	background: var(--cchd-ground);
	box-shadow: 0 1px 0 var(--cchd-line);
	/* On the header itself, not only on the bar: the panel hangs off the same
	   element, and a link that inherits its colour from the page ends up dark
	   on dark. */
	color: var(--cchd-ink);
	font-family: inherit;
	line-height: 1.2;
}

.cchd *,
.cchd *::before,
.cchd *::after { box-sizing: border-box; }

.cchd a { color: inherit; text-decoration: none; }

.cchd-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Over the homepage backdrop the header has no ground of its own — only a
   shade deep enough to keep the links legible over a photograph. */
.cchd.is-over {
	position: fixed;
	left: 0;
	right: 0;
	/* Deep enough at the top that the menu reads as a bar rather than as words
	   floating on a photograph, and gone by the bottom so the backdrop still
	   runs under it. */
	background: linear-gradient(180deg, rgba(0, 0, 0, .72), rgba(0, 0, 0, .34) 62%, transparent);
	box-shadow: none;
}
.cchd.is-over.is-stuck {
	background: var(--cchd-ground);
	box-shadow: 0 1px 0 var(--cchd-line);
}

/* The admin bar sits above everything; the header has to start below it. */
body.admin-bar .cchd { top: 32px; }

.cchd__in {
	display: flex;
	align-items: center;
	gap: 18px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 18px;
	height: var(--cchd-h);
	color: var(--cchd-ink);
}

/* ------------------------------------------------------------- logo ---- */

.cchd-logo {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	color: var(--cchd-ink);
}
.cchd-mark { display: block; height: 25px; width: auto; }
.cchd-logo__img { display: block; height: 32px; width: auto; }

/* ------------------------------------------------------------- menu ---- */

.cchd-nav { display: none; }

.cchd-nav__link {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .01em;
	color: var(--cchd-ink);
	/* Nearly full strength: a menu at .82 reads as disabled rather than as
	   quiet, which is what made the first version look so timid. */
	opacity: .94;
	white-space: nowrap;
	padding: 7px 0;
	border-bottom: 2px solid transparent;
	transition: opacity .2s ease, border-color .2s ease;
	/* Over a photograph the words need their own shadow to stay readable
	   wherever the backdrop happens to be pale. */
	text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.cchd-nav__link:hover,
.cchd-nav__link:focus-visible { opacity: 1; border-bottom-color: var(--cchd-accent); }

/* ----------------------------------------------------------- search ---- */

.cchd-search {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px;
	border-radius: 999px;
	/* A flat rgba rather than color-mix on the ink: over the backdrop the
	   mixed version came out so faint that the field read as loose text with a
	   magnifying glass beside it, not as somewhere to type. */
	background: rgba(255, 255, 255, .13);
	box-shadow: inset 0 0 0 1px rgba(242, 237, 228, .28);
	backdrop-filter: blur(6px);
}
.cchd-search:focus-within {
	background: rgba(255, 255, 255, .17);
	box-shadow: inset 0 0 0 1px var(--cchd-accent);
}
.cchd-search__icon { display: flex; flex: 0 0 auto; color: var(--cchd-ink); opacity: .75; }

/* The theme styles every input; these have to say so three deep to survive. */
.cchd .cchd-search .cchd-search__input,
.cchd-search .cchd-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	border-radius: 0;
	background: transparent;
	color: var(--cchd-ink);
	font: inherit;
	font-size: 16px;
	font-weight: 500;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}
.cchd-search__input::placeholder { color: var(--cchd-ink); opacity: .72; }
.cchd-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------------------------------------------------------- account ---- */

.cchd__right { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin-left: auto; }

.cchd-account {
	display: none;
	font-size: 14px;
	font-weight: 700;
	white-space: nowrap;
	padding: 10px 18px;
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px rgba(242, 237, 228, .32);
	color: var(--cchd-ink);
	transition: background-color .2s ease, box-shadow .2s ease, color .2s ease;
}
.cchd-account:hover,
.cchd-account:focus-visible {
	background: var(--cchd-accent);
	box-shadow: inset 0 0 0 1px var(--cchd-accent);
	color: #17130E;
}

/* ----------------------------------------------------------- burger ---- */

.cchd .cchd-burger {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--cchd-ink);
	cursor: pointer;
}
.cchd .cchd-burger:hover { background: color-mix(in srgb, var(--cchd-ink) 10%, transparent); }
.cchd-burger__box { display: grid; gap: 4px; width: 18px; }
.cchd-burger__box span {
	display: block;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform .2s ease, opacity .2s ease;
}
.cchd-burger[aria-expanded="true"] .cchd-burger__box span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.cchd-burger[aria-expanded="true"] .cchd-burger__box span:nth-child(2) { opacity: 0; }
.cchd-burger[aria-expanded="true"] .cchd-burger__box span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ------------------------------------------------------------ panel ---- */

/* Hung under the bar rather than sitting after it, so opening the menu never
   pushes the page down. */
.cchd-panel {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	background: var(--cchd-ground);
	border-top: 1px solid var(--cchd-line);
	box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .8);
	padding: 6px 18px 14px;
	max-height: calc(100vh - var(--cchd-h) - 40px);
	overflow-y: auto;
}
.cchd-panel[hidden] { display: none; }

.cchd-panel__link,
.cchd-panel__sub {
	display: block;
	padding: 13px 2px;
	color: var(--cchd-ink);
	font-size: 17px;
	font-weight: 600;
	border-bottom: 1px solid var(--cchd-line);
}
.cchd-panel__sub {
	padding-left: 16px;
	font-size: 16px;
	font-weight: 500;
	opacity: .85;
}
.cchd-panel__link--quiet { color: var(--cchd-accent); border-bottom: 0; }

.cchd-group > summary {
	cursor: pointer;
	list-style: none;
	position: relative;
}
.cchd-group > summary::-webkit-details-marker { display: none; }
.cchd-group > summary::after {
	content: "";
	position: absolute;
	right: 6px;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
	opacity: .6;
	transition: transform .2s ease;
}
.cchd-group[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }

/* --------------------------------------------------------- the page ---- */

/* One rule, so that changing theme means changing one rule. */
body.chugcheck-hide-theme-header .site-header,
body.chugcheck-hide-theme-header #masthead,
body.chugcheck-hide-theme-header .ast-main-header-wrap,
body.chugcheck-hide-theme-header .ast-mobile-header-wrap,
body.chugcheck-hide-theme-header .ast-above-header-wrap,
body.chugcheck-hide-theme-header .ast-below-header-wrap { display: none !important; }

/* ---------------------------------------------------------- desktop ---- */

/* The long menu, at the narrowest width it still fits at this text size. The
   words got bigger in 1.1.0, so the row is tighter than it was: everything
   here is sized for 1024px and given room again at 1220px. */
@media (min-width: 1024px) {
	.cchd { --cchd-h: 70px; }
	.cchd__in { gap: 18px; padding: 0 22px; }
	.cchd-mark { height: 28px; }
	.cchd-logo__img { height: 36px; }

	.cchd-nav { display: flex; align-items: center; gap: 17px; flex: 0 1 auto; min-width: 0; }
	.cchd-search { flex: 0 1 220px; margin-left: auto; }
	.cchd__right { margin-left: 0; }
	.cchd-account { display: inline-block; }
	.cchd .cchd-burger { display: none; }
	.cchd-panel { display: none !important; }
}

@media (min-width: 1220px) {
	.cchd { --cchd-h: 74px; }
	.cchd__in { gap: 28px; padding: 0 26px; }
	.cchd-mark { height: 30px; }
	.cchd-logo__img { height: 38px; }

	.cchd-nav { gap: 24px; }
	.cchd-nav__link { font-size: 16px; }
	.cchd-search { flex: 0 1 320px; }
}

@media (max-width: 782px) {
	body.admin-bar .cchd { top: 46px; }
}
