/*
Theme Name: QLL
Author: Quality of Life Laboratory
Description: Custom block theme for qllab.org, a think tank and consultancy. No page builder required.
Version: 1.1.0
Requires at least: 6.5
Requires PHP: 7.4
Text Domain: qll
*/

/* Header */
.qll-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 28px;
	padding: 16px clamp(16px, 4vw, 48px);
	border-bottom: 2px solid #59000e;
	margin: 0;
}

.qll-header > * {
	margin: 0 !important;
}

.qll-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.qll-header .qll-brand > * {
	margin: 0 !important;
}

.qll-logo img {
	display: block;
	width: auto;
	height: 56px;
}

.qll-brand-text {
	display: flex;
	min-height: 56px;
	height: 56px;
	flex-direction: column;
	justify-content: center;
	line-height: 1.15;
	position: relative;
	top: -5px;
}

.qll-brand-name {
	color: #59000e;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

.qll-brand-tagline {
	margin: 4px 0 0;
	color: #474747;
	font-size: 0.9rem;
	line-height: 1.2;
}

/* Primary navigation supplied by Appearance > Menus */
.qll-header .qll-navigation {
	flex: 1 1 480px;
	min-width: 0;
	font-weight: 700;
}

.qll-header .qll-navigation ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.qll-header .qll-navigation > .wp-block-navigation__container {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 2px 22px;
}

.qll-header .qll-navigation li {
	position: relative;
	margin: 0;
}

.qll-header .qll-navigation a {
	display: block;
	padding: 10px 0;
	color: #474747;
	text-decoration: none;
}

.qll-header .qll-navigation a:hover,
.qll-header .qll-navigation a:focus,
.qll-header .qll-navigation .current-menu-item > a,
.qll-header .qll-navigation .current-menu-ancestor > a {
	color: #59000e;
}

.qll-header .qll-navigation a:focus-visible {
	outline: 2px solid #59000e;
	outline-offset: 3px;
}

.qll-header .qll-navigation .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 7px;
	vertical-align: middle;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
}

/* Default submenu treatment for touch and mobile screens */
.qll-header .qll-navigation .sub-menu {
	margin: 0 0 10px;
	padding: 0 0 0 16px;
	border-left: 1px solid #bfbfbf;
}

.qll-header .qll-navigation .sub-menu a {
	font-weight: 400;
}

/* Desktop dropdowns, including keyboard access */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
	.qll-header .qll-navigation .sub-menu {
		position: absolute;
		top: 100%;
		left: -16px;
		z-index: 1000;
		min-width: 240px;
		margin: 0;
		padding: 8px 0;
		border: 1px solid #bfbfbf;
		background: #fff;
		box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateY(6px);
		transition:
			opacity 140ms ease,
			transform 140ms ease,
			visibility 140ms ease;
	}

	.qll-header .qll-navigation .sub-menu a {
		padding: 10px 16px;
		white-space: normal;
	}

	.qll-header .qll-navigation .sub-menu .sub-menu {
		top: -9px;
		left: 100%;
	}

	.qll-header .qll-navigation > .wp-block-navigation__container
		> .menu-item:nth-last-child(-n + 2) > .sub-menu {
		left: auto;
		right: 0;
	}

	.qll-header .qll-navigation .menu-item:hover > .sub-menu,
	.qll-header .qll-navigation .menu-item:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(0);
	}

	.qll-header .qll-navigation .sub-menu .menu-item-has-children > a::after {
		border-top: 4px solid transparent;
		border-bottom: 4px solid transparent;
		border-left: 5px solid currentColor;
		border-right: 0;
	}
}

/* Mobile navigation toggle */
.qll-menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.65rem 0.9rem;
	border: 2px solid #59000e;
	border-radius: 0.25rem;
	background: #fff;
	color: #59000e;
	font: inherit;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.qll-menu-toggle:hover,
.qll-menu-toggle:focus-visible {
	background: #59000e;
	color: #fff;
}

.qll-menu-toggle:focus-visible {
	outline: 2px solid #59000e;
	outline-offset: 3px;
}

.qll-menu-toggle-icon {
	font-size: 1.2rem;
	line-height: 1;
}

/* Give navigation its own row when the header becomes crowded */
@media (max-width: 1050px) {
	.qll-header .qll-navigation {
		order: 3;
		flex-basis: 100%;
	}
}

/* Compact navigation on phones */
@media (max-width: 767px) {
	.qll-header {
		align-items: center;
	}

	.qll-header > .qll-brand {
		order: 1;
	}

	.qll-header > .qll-menu-toggle {
		display: inline-flex;
		order: 2;
		margin-left: auto;
	}

	/*
	 * JavaScript adds qll-js to the header. Without JavaScript,
	 * the complete navigation remains visible as a fallback.
	 */
	.qll-header.qll-js .qll-navigation:not(.is-open) {
		display: none;
	}

	.qll-header.qll-js .qll-navigation.is-open {
		display: block;
		order: 3;
		flex: 1 0 100%;
		width: 100%;
	}

	.qll-header .qll-navigation > .wp-block-navigation__container {
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 4px;
		width: 100%;
	}

	.qll-header .qll-navigation .sub-menu {
		margin-top: -4px;
	}

	.qll-header > .wp-block-buttons {
		order: 4;
		flex: 1 0 100%;
	}
}

/* Layout */
.qll-main {
	max-width: 1180px;
	margin: 0 auto;
	padding: 40px clamp(16px, 4vw, 48px) 24px;
}

.qll-section {
	margin-block: 56px;
}

.qll-pale {
	background: #f5f5f5;
	padding: 36px clamp(16px, 3vw, 36px);
}

.qll-prose {
	max-width: 780px;
}

.qll-lede {
	font-size: 1.25rem;
	max-width: 820px;
}

.qll-eyebrow {
	font-size: 0.9rem !important;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 700;
	margin-bottom: 0.4rem;
}

/* Grids and boxes */
.qll-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 22px;
}

.qll-grid-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
	.qll-grid-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.qll-grid,
	.qll-grid-4 {
		grid-template-columns: 1fr;
	}
}

.qll-grid > * {
	margin: 0 !important;
}

.qll-card {
	border: 1px solid #bfbfbf;
	padding: 22px;
	background: #fff;
}

.qll-card > *:first-child {
	margin-top: 0;
}

.qll-services {
	border: 1px solid #bfbfbf;
	padding: 26px;
}

.qll-services .qll-card {
	border: 0;
	padding: 0;
}

.qll-phase strong {
	color: #59000e;
}

/* Lists of posts, talks, publications */
.qll-item {
	border-bottom: 1px solid #bfbfbf;
	padding-block: 16px;
}

.qll-meta {
	font-size: 0.9rem;
	color: #474747;
}

.qll-pubs li {
	margin-bottom: 0.7rem;
}

/* Call to action and footer */
.qll-cta {
	text-align: center;
	padding: 48px 0 16px;
	border-top: 1px solid #bfbfbf;
}

.qll-cta .wp-block-buttons {
	justify-content: center;
}

.qll-footer {
	padding: 28px clamp(16px, 4vw, 48px);
	border-top: 1px solid #bfbfbf;
	font-size: 0.9rem;
	margin: 0;
}

.qll-footer a {
	color: #474747;
}

/* Footer navigation supplied by Appearance > Menus */
.qll-footer-navigation {
	margin: 16px 0;
}

.qll-footer-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.qll-footer-menu li {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}

.qll-footer-menu li:not(:last-child)::after {
	content: "·";
	margin: 0 0.6rem;
	color: #7f7f7f;
}

.qll-footer-menu a {
	display: block;
	color: #474747;
	text-decoration: none;
}

.qll-footer-menu a:hover,
.qll-footer-menu a:focus,
.qll-footer-menu .current-menu-item > a {
	color: #59000e;
}

.qll-footer-menu a:focus-visible {
	outline: 2px solid #59000e;
	outline-offset: 3px;
}

/* Homepage news */
.qll-main > .wp-block-post-content,
.qll-main > .wp-block-post-content > .qll-news {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
	text-align: left;
}

.qll-main .qll-news h2,
.qll-main .qll-news ul,
.qll-main .qll-news li {
	text-align: left;
}

.qll-main .qll-news ul {
	margin-left: 0;
	padding-left: 1rem;
}

.qll-main .qll-news li {
	margin-bottom: 0.55rem;
	padding-left: 0;
}

/* Contact layout */
body.qll-contact-page .wp-block-post-title {
	text-align: left;
}

body.qll-contact-page .wp-block-post-content {
	width: 100%;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

body.qll-contact-page .wp-block-post-content > * {
	max-width: 780px;
	margin-left: 0 !important;
	margin-right: auto !important;
	text-align: left;
}

body.qll-contact-page .wpcf7,
body.qll-contact-page .wpcf7-form {
	max-width: 780px;
	margin-left: 0 !important;
	margin-right: 0 !important;
	text-align: left;
}

body.qll-contact-page .qll-main > .wp-block-post-title {
	width: 100%;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	text-align: left;
}

body.qll-contact-page .qll-main > .wp-block-post-content.is-layout-constrained > * {
	width: 100%;
	max-width: 780px;
	margin-left: 0 !important;
	margin-right: 0 !important;
	text-align: left;
}

/* Publication list */
.qll-page .qll-pubs {
	margin-left: 0;
	padding-left: 0;
	list-style-position: inside;
}

.qll-page .qll-pubs li {
	margin-bottom: 0.75rem;
	padding-left: 0;
}

/* Reusable biography-and-photo layout */
.qll-pi-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
	gap: 2rem;
	align-items: start;
}

.qll-pi-text {
	min-width: 0;
}

.qll-pi-text > :first-child {
	margin-top: 0;
}

.qll-pi-photo {
	width: 100%;
	max-width: 300px;
	margin: 0;
	justify-self: end;
}

.qll-pi-photo img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	margin: 0;
}

@media (max-width: 767px) {
	.qll-pi-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.qll-pi-photo {
		justify-self: start;
	}
}

/* Primary action links used in WP Admin content */
a.qll-btn,
a.qll-btn--primary {
	display: inline-block;
	padding: 0.75rem 1.25rem;
	border: 2px solid #59000e;
	border-radius: 0.25rem;
	background: #59000e;
	color: #fff;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
}

a.qll-btn:hover,
a.qll-btn:focus,
a.qll-btn--primary:hover,
a.qll-btn--primary:focus {
	background: #fff;
	color: #59000e;
}

a.qll-btn:focus-visible,
a.qll-btn--primary:focus-visible {
	outline: 2px solid #59000e;
	outline-offset: 3px;
}

/* Align constrained introductory prose with its heading and lede. */
.qll-main .qll-legacy-intro > .qll-prose {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* Keep every element in the consulting introduction left-aligned. */
.qll-main .qll-legacy-intro > * {
	margin-left: 0 !important;
	margin-right: 0 !important;
	text-align: left;
}