/*
 * Astra header and footer: the three details from the design that Astra free has no setting for.
 * Everything else (colours, fonts, sizes, layout) is set in Astra's header and footer builder.
 *   1. The header stays at the top while scrolling.
 *   2. Menu links are pills; the current page and hover get a rounded background.
 *   3. On phones, the footer link columns open and close on tap.
 * Plus the sizes and footer layout details Astra free has no control for (noted at each rule).
 */

/* 1. Sticky header */
#masthead {
	position: sticky;
	top: 0;
	z-index: 20;
}

.admin-bar #masthead {
	top: 32px;
}

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

@media (max-width: 600px) {
	/* WordPress lets the admin bar scroll away on small screens. */
	.admin-bar #masthead {
		top: 0;
	}
}

/* 2. Pill-shaped menu links */
.ast-builder-menu-1 .main-header-menu {
	gap: 4px;
}

.ast-builder-menu-1 .main-header-menu > .menu-item {
	display: flex;
	align-items: center;
}

.ast-builder-menu-1 .main-header-menu > .menu-item > .menu-link {
	display: flex;
	align-items: center;
	min-height: 40px;
	border-radius: 999px;
	transition: background-color 160ms, color 160ms;
}

/* The "Menu" toggle is a 40px pill; Astra free sets its colours and border but not its height or padding. */
#ast-mobile-header [data-section="section-header-mobile-trigger"] .menu-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 16px;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
}

#ast-mobile-header [data-section="section-header-mobile-trigger"] .menu-toggle .mobile-menu {
	font-weight: 700;
	line-height: 1;
}

.ast-mobile-header-content #ast-hf-mobile-menu .menu-item {
	border: 0;
}

.ast-mobile-header-content #ast-hf-mobile-menu .menu-link {
	display: flex;
	align-items: center;
	min-height: 52px;
	border: 0;
	border-radius: 12px;
}

.ast-mobile-header-content .ast-builder-button-wrap,
.ast-mobile-header-content .ast-custom-button-link,
.ast-mobile-header-content .ast-custom-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.ast-mobile-header-content .ast-custom-button {
	min-height: 52px;
}

/* The open menu lines up with the header edges: 32px on tablets, 20px on phones. */
.ast-mobile-header-content > .ast-builder-menu-mobile {
	padding: 8px 32px;
}

.ast-mobile-header-content > .site-header-focus-item {
	padding: 0 32px 20px;
}

@media (max-width: 544px) {
	.ast-mobile-header-content > .ast-builder-menu-mobile {
		padding: 8px 20px;
	}

	.ast-mobile-header-content > .site-header-focus-item {
		padding: 0 20px 20px;
	}
}

/*
 * Footer layout from the design. Astra free only offers equal-width columns, a full-width row
 * divider and fixed menu spacing, so the column widths, list gaps, the divider inside the content
 * width, the outlined social icons and the tablet/phone arrangements are set here.
 */
.site-footer .site-above-footer-wrap .ast-builder-grid-row.ast-builder-footer-grid-columns {
	grid-template-columns: 284px 1fr 1.4fr 1fr;
	column-gap: 40px;
	row-gap: 0;
}

/* Brand column: 260px wide, 64px from the link columns. */
.site-footer .site-footer-above-section-1 {
	padding-right: 24px;
}

.site-footer .site-footer-above-section-1 .footer-widget-area {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
}

.site-footer .footer-widget-area .widget {
	margin: 0;
}

.site-footer .widget_nav_menu .menu {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 16px 0 0;
}

.site-footer .widget_nav_menu .menu-item {
	margin: 0;
	padding: 0;
	line-height: 1.3;
}

/* Bottom row: divider inside the content width, legal links left, social icons right. */
.site-footer .site-primary-footer-wrap .ast-builder-grid-row.ast-builder-footer-grid-columns {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
	padding-top: 24px;
	border-top: 1px solid #3a3a47;
}

.site-footer .site-footer-primary-section-1 {
	flex: 1 1 0%;
	min-width: 0;
}

.site-footer .site-footer-primary-section-2 {
	flex: none;
}

.site-footer #astra-footer-menu {
	flex-wrap: wrap;
	gap: 8px 24px;
}

.site-footer #astra-footer-menu .menu-link {
	padding: 0;
	font-weight: 600;
	line-height: 1.3;
}

.site-footer .ast-builder-social-element {
	border: 1px solid #3a3a47;
	transition: background-color 160ms, border-color 160ms, color 160ms;
}

.site-footer .ast-builder-social-element:hover {
	border-color: #df0139;
}

@media (max-width: 921px) {
	.site-footer .site-above-footer-wrap .ast-builder-grid-row.ast-builder-footer-grid-columns {
		grid-template-columns: 1fr 1.4fr 1fr;
		column-gap: 24px;
		row-gap: 40px;
	}

	/* Tablet: logo and tagline side by side above a divider. */
	.site-footer .site-footer-above-section-1 {
		grid-column: 1 / -1;
		padding: 0 0 40px;
		border-bottom: 1px solid #3a3a47;
	}

	.site-footer .site-footer-above-section-1 .footer-widget-area {
		flex-direction: row;
		align-items: center;
		gap: 40px;
	}

	.site-footer .site-footer-above-section-1 .widget_text {
		max-width: 600px;
	}
}

/* 3. Footer columns as accordions on phones (the script adds the toggle buttons) */
.site-footer .jfx-accordion-toggle,
.site-footer .jfx-accordion-toggle:hover,
.site-footer .jfx-accordion-toggle:focus {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-align: left;
	color: inherit;
	cursor: default;
}

@media (max-width: 699px) {
	.site-footer .site-above-footer-wrap .ast-builder-grid-row.ast-builder-footer-grid-columns {
		grid-template-columns: 1fr;
		row-gap: 0;
	}

	.site-footer .site-footer-above-section-1 {
		padding: 0 0 40px;
		border-bottom: 0;
	}

	.site-footer .site-footer-above-section-1 .footer-widget-area {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	/* Phones: social icons above the legal links. */
	.site-footer .site-primary-footer-wrap .ast-builder-grid-row.ast-builder-footer-grid-columns {
		flex-direction: column-reverse;
		align-items: flex-start;
		gap: 24px;
	}

	.site-footer .site-footer-above-section-2 .jfx-accordion {
		border-top: 1px solid #3a3a47;
	}

	.site-footer .jfx-accordion {
		border-bottom: 1px solid #3a3a47;
	}

	.site-footer .jfx-accordion h2 {
		margin: 0;
	}

	.site-footer .jfx-accordion-toggle,
	.site-footer .jfx-accordion-toggle:hover,
	.site-footer .jfx-accordion-toggle:focus {
		min-height: 48px;
		cursor: pointer;
	}

	.site-footer .jfx-accordion-toggle:focus-visible {
		outline: 2px solid #df0139;
		outline-offset: 2px;
	}

	.site-footer .jfx-accordion-toggle::after {
		content: "";
		width: 8px;
		height: 8px;
		margin-right: 4px;
		border-right: 2px solid #c4c4cc;
		border-bottom: 2px solid #c4c4cc;
		transform: translateY(-2px) rotate(45deg);
		transition: transform 160ms;
	}

	.site-footer .jfx-accordion.is-open .jfx-accordion-toggle::after {
		transform: translateY(2px) rotate(-135deg);
	}

	.site-footer .jfx-accordion:not(.is-open) .menu {
		display: none;
	}

	.site-footer .jfx-accordion .menu {
		margin-top: 4px;
		padding-bottom: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ast-builder-menu-1 .main-header-menu > .menu-item > .menu-link,
	.site-footer .jfx-accordion-toggle::after {
		transition: none;
	}
}
