/* ==========================================================================
   Layout: container, column grid, header and navigation, footer.
   Breakpoints and widths are the Bootstrap 3 ones the design was made with:
   768px (sm), 992px (md) and 1200px (lg); containers 750, 970 and 1170px.
   ========================================================================== */
@layer layout {
	/* flow-root keeps child margins inside, like the clearfix on Bootstrap's container */
	.container {
		--container: 100%;
		display: flow-root;
		width: var(--container);
		margin-inline: auto;
		padding-inline: 15px;
	}
	@media (min-width: 768px) { .container { --container: 750px; } }
	@media (min-width: 992px) { .container { --container: 970px; } }
	@media (min-width: 1200px) { .container { --container: 1170px; } }

	/* Column layouts
	   --------------------------------------------------------------------------
	   Columns stack below their breakpoint (from-sm or from-md) and sit side by
	   side from it. The grid has 12 tracks and 30px gutters, so an N-track span
	   is exactly as wide as the Bootstrap col-*-N it replaces. */
	.cols {
		display: flow-root;
	}
	@media (min-width: 768px) {
		.cols.from-sm {
			display: grid;
			grid-template-columns: repeat(12, minmax(0, 1fr));
			column-gap: var(--gutter);
		}
	}
	@media (min-width: 992px) {
		.cols.from-md {
			display: grid;
			grid-template-columns: repeat(12, minmax(0, 1fr));
			column-gap: var(--gutter);
		}
	}
	.cols-2 > * { grid-column: span 6; }
	.cols-3 > * { grid-column: span 4; }
	.cols-8-4 > :first-child { grid-column: span 8; }
	.cols-8-4 > :last-child { grid-column: span 4; }
	.cols-3-9 > :first-child { grid-column: span 3; }
	.cols-3-9 > :last-child { grid-column: span 9; }
	@media (min-width: 1200px) {
		.cols-lg-9-3 > :first-child { grid-column: span 9; }
		.cols-lg-9-3 > :last-child { grid-column: span 3; }
	}

	/* Header
	   ========================================================================== */
	header {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 99999;
		width: 100%;
		padding: 20px 0;
	}
	#top_header {
		width: min(100%, var(--header-width, 1170px));
		margin: auto;
		background-color: #fff;
		border-radius: 8px;
		box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
	}
	/* The bar is a flex row: logo on the left, menu (or hamburger) on the right, both
	   vertically centred in a fixed-height bar. */
	#top_header .container {
		display: flex;
		justify-content: space-between;
		align-items: center;
		min-height: 55px;
		padding: 0 0 0 8px;
	}
	header.sticky #top_header {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		margin: 0;
		padding: 0;
		border-radius: 0;
	}
	#logo a,
	#logo img {
		display: block;
	}

	@media (max-width: 767px) {
		#top_header .container { min-height: 53px; }
	}
	@media (min-width: 768px) and (max-width: 991px) { #top_header { --header-width: 750px; } }
	@media (min-width: 992px) and (max-width: 1199px) { #top_header { --header-width: 970px; } }
	@media (max-width: 767px) {
		header { padding: 0; }
		#top_header { border-radius: 0; }
	}

	/* Main menu: a row of links while the header is a floating bar (768px and up),
	   a slide-in panel behind the hamburger once the header is full width
	   ========================================================================== */
	:root {
		--menu-open-time: .28s;
		--menu-close-time: .2s;
		--menu-open: var(--menu-open-time) cubic-bezier(.2, .8, .2, 1);
		--menu-close: var(--menu-close-time) cubic-bezier(.4, 0, 1, 1);
	}
	.main-menu { padding-right: 10px; }
	.main-menu ul {
		margin: 0;
		padding: 0;
	}
	.main-menu a {
		display: block;
		font-size: 14px;
		line-height: 20px;
		color: #333;
		text-transform: uppercase;
		transition: all .3s;
	}
	.main-menu li:hover > a { color: var(--green-dark); }
	#close_in,
	#header_menu,
	.cmn-toggle-switch {
		display: none;
	}
	/* Dark overlay behind the open mobile menu. It fades with the panel (timings below). */
	.layer {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 99999;
		width: 100%;
		min-height: 100%;
		background-color: #000;
		opacity: 0;
		visibility: hidden;
		transition: opacity var(--menu-close), visibility 0s var(--menu-close-time);
	}
	.layer.layer-is-visible {
		opacity: .5;
		visibility: visible;
		transition: opacity var(--menu-open), visibility 0s;
	}

	@media (min-width: 768px) {
		.main-menu {
			position: relative;
			z-index: 9;
		}
		.main-menu ul {
			display: flex;
			gap: .28em; /* the width of the space between the old inline-block items */
		}
		.main-menu a {
			padding: 0 12px;
			white-space: nowrap;
		}
	}

	@media (max-width: 767px) {
		/* The panel slides in with a transform (composited, no relayout per frame): quick
		   and decelerating when opening, a little quicker and accelerating when closing.
		   Hidden while closed, so its links can't be reached with Tab. */
		.main-menu {
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 9999;
			width: 55%;
			height: 100%;
			overflow: auto;
			background-color: #fff;
			box-shadow: 1px 0 5px 0 rgba(50, 50, 50, .55);
			transform: translateX(-100%);
			visibility: hidden;
			transition: transform var(--menu-close), visibility 0s var(--menu-close-time);
		}
		.main-menu.show {
			transform: none;
			visibility: visible;
			transition: transform var(--menu-open), visibility 0s;
		}
		/* Links follow the panel in, one after another */
		.main-menu li {
			opacity: 0;
			transform: translateX(-16px);
			transition: opacity .15s, transform .15s;
		}
		.main-menu.show li {
			opacity: 1;
			transform: none;
			transition: opacity .2s ease-out, transform .25s cubic-bezier(.2, .8, .2, 1);
		}
		.main-menu.show li:nth-child(1) { transition-delay: 60ms; }
		.main-menu.show li:nth-child(2) { transition-delay: 100ms; }
		.main-menu.show li:nth-child(3) { transition-delay: 140ms; }
		.main-menu.show li:nth-child(n + 4) { transition-delay: 180ms; }
		#header_menu {
			display: block;
			position: relative;
			padding: 25px 15px;
			text-align: center;
		}
		.main-menu li { border-bottom: 1px solid var(--line); }
		.main-menu li:first-child { border-top: 1px solid var(--line); }
		.main-menu a {
			padding: 10px 15px;
			text-align: center;
		}
		.main-menu a:hover {
			color: var(--green-dark);
			background-color: #f9f9f9;
		}

		/* Hamburger button */
		.cmn-toggle-switch {
			display: block;
			position: relative;
			width: 30px;
			height: 30px;
			margin: 0 20px 0 0;
			padding: 0;
			overflow: visible;
			font-size: 0;
			text-indent: -9999px;
			appearance: none;
			border: none;
			background: none;
			box-shadow: none;
		}
		.cmn-toggle-switch span,
		.cmn-toggle-switch span::before,
		.cmn-toggle-switch span::after {
			display: block;
			position: absolute;
			left: 0;
			height: 2px;
			background-color: #333;
		}
		/* Three 2px lines 10px apart, centred in the 30px button */
		.cmn-toggle-switch span {
			top: 14px;
			right: 0;
			transition: transform .3s;
		}
		.cmn-toggle-switch span::before,
		.cmn-toggle-switch span::after {
			content: "";
			width: 100%;
		}
		.cmn-toggle-switch span::before { top: -10px; }
		.cmn-toggle-switch span::after { bottom: -10px; }
		.cmn-toggle-switch.active span { transform: rotate(90deg); }
	}
	@media (prefers-reduced-motion: reduce) {
		:root { --menu-open-time: 0s; --menu-close-time: 0s; }
		.main-menu li,
		.main-menu.show li { transition: none; }
	}
	@media (max-width: 480px) {
		.main-menu { width: 100%; }
		#close_in {
			display: block;
			position: absolute;
			top: 10px;
			right: 15px;
			width: 20px;
			height: 20px;
			padding: 0;
			border: 0;
			background: none;
		}
		#close_in i {
			font-size: 16px;
			color: var(--text);
		}
	}

	/* Footer
	   ========================================================================== */
	footer {
		padding: 30px 0 10px;
		background: var(--green-footer) url(../img/footer_bg.png) repeat-x center bottom;
		color: #fff;
	}
	footer h3 {
		font-size: 16px;
		font-weight: 700;
		color: #fff;
	}
	footer a { color: #ff9; }
	footer a:hover,
	footer a:focus { color: #111; }
	#contact_details_footer {
		margin: 0 0 20px;
		padding: 0;
	}
	#contact_details_footer li { margin-bottom: 10px; }
	#social_footer {
		margin-top: 30px;
		padding-top: 30px;
		text-align: center;
	}
	#social_footer ul {
		display: flex;
		justify-content: center;
		gap: .28em; /* the width of the space between the old inline-block items */
		margin: 0;
		padding: 0 0 10px;
	}
	#social_footer li { margin: 0 5px 10px; }
	#social_footer li a {
		display: block;
		width: 35px;
		height: 35px;
		line-height: 34px;
		font-size: 16px;
		color: #fff;
		text-align: center;
		border: 2px solid #fff;
		border-radius: 50%;
	}
	#social_footer li a:hover {
		background: #fff;
		color: var(--green);
	}
	.footer_compliance {
		max-width: 600px;
		margin-inline: auto;
		font-size: 11px;
		line-height: 16px;
		color: #fff;
	}
}
