/*
 * EHS Brochures page — matches ehsghealth.com/brochures/.
 * Cards come from the Brochure post type, filters from its Solutions terms.
 * The page header comes from pages.css.
 */

/* Live centres this banner's title as if an empty subtitle line followed it. */
@media (min-width: 960px) {
	.ehs-brochures .ehs-page-header--no-subtitle {
		padding-top: 36px;
		padding-bottom: 58px;
	}
}

/* The popup also opens on product pages, outside .ehs-broch. */
.ehs-broch,
.ehs-modal {
	--ehs-broch-blue: #0078a0;
	--ehs-broch-ink: #1a1a1a;
}

.ehs-broch {
	padding-block: 36px;
	background: #fff;
}

.ehs-broch__layout {
	display: flex;
	align-items: flex-start;
	gap: 40px;
}

.ehs-broch__content {
	flex: 0 0 75%;
	max-width: 75%;
}

.ehs-broch__sidebar {
	position: sticky;
	top: 100px;
	flex: 0 0 calc(25% - 40px);
	max-width: calc(25% - 40px);
}

/* ---------- Cards ---------- */

.ehs-broch__grid-area {
	position: relative;
	min-height: 120px;
	transition: opacity 0.2s ease;
}

.ehs-broch__grid-area.is-loading {
	opacity: 0.35;
	pointer-events: none;
}

.ehs-broch__grid-area.is-loading::after {
	content: "";
	position: absolute;
	top: 48px;
	left: 50%;
	width: 36px;
	height: 36px;
	margin-left: -18px;
	border: 3px solid #e0e0e0;
	border-top-color: var(--ehs-broch-blue);
	border-radius: 50%;
	animation: ehs-broch-spin 0.7s linear infinite;
}

@keyframes ehs-broch-spin {
	to {
		transform: rotate(360deg);
	}
}

.ehs-broch__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ehs-broch__grid > li {
	display: flex;
	margin: 0;
}

.ehs-broch-card {
	flex: 1;
	overflow: hidden;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.ehs-broch-card__media {
	position: relative;
	padding-top: 60%;
	overflow: hidden;
	background: #e6eef0;
}

.ehs-broch-card__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ehs-broch-card__body {
	padding: 20px 24px 24px;
}

.ehs-broch-card__title {
	margin: 27px 0 10px !important;
	color: #141618;
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
}

.ehs-broch-card__excerpt {
	margin: 0 0 16px !important;
	color: #666;
	font-size: 13px;
	line-height: 1.65;
}

.ehs-broch-card__btn {
	display: inline-block;
	padding: 12px 22px;
	border: 0;
	border-radius: 4px;
	background: var(--ehs-broch-ink);
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 1.5px;
	text-decoration: none;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.ehs-broch-card__btn:hover,
.ehs-broch-card__btn:focus-visible {
	background: #444;
	color: #fff;
}

.ehs-broch__empty {
	color: var(--ehs-muted);
}

/* ---------- Filters ---------- */

.ehs-broch__sidebar-title {
	margin: 0 0 12px !important;
	padding-bottom: 10px;
	border-bottom: 2px solid #e5e5e5;
	color: #141618;
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.ehs-broch__filters {
	display: flex;
	flex-direction: column;
}

.ehs-filter {
	border-bottom: 1px solid #efefef;
}

.ehs-filter:last-child {
	border-bottom: 0;
}

.ehs-filter__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 12px 0;
	border: 0;
	background: none;
	color: var(--ehs-broch-ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	text-align: left;
	cursor: pointer;
}

/* Selected product: only shown in the collapsed filter on phones. */
.ehs-filter__current {
	display: none;
}

.ehs-filter__arrow {
	flex: none;
	width: 12px;
	height: 12px;
	color: #aaa;
	transition: transform 0.2s ease;
}

.ehs-filter.is-open .ehs-filter__arrow {
	transform: rotate(180deg);
}

.ehs-filter__body {
	display: none;
	flex-direction: column;
	gap: 2px;
	padding: 4px 0 10px;
}

.ehs-filter.is-open .ehs-filter__body {
	display: flex;
}

.ehs-filter__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 6px 8px;
	border-radius: 6px;
	color: #444;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.3;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.ehs-filter__item:hover {
	background: #f0f8fb;
	color: var(--ehs-broch-blue);
}

.ehs-filter__item.is-active {
	background: #eaf5f9;
	color: var(--ehs-broch-blue);
	font-weight: 600;
}

.ehs-filter__check {
	position: relative;
	flex: none;
	width: 16px;
	height: 16px;
	border: 1.5px solid #ccc;
	border-radius: 4px;
	background: #fff;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ehs-filter__item.is-active .ehs-filter__check {
	border-color: var(--ehs-broch-blue);
	background: var(--ehs-broch-blue);
}

.ehs-filter__item.is-active .ehs-filter__check::after {
	content: "";
	position: absolute;
	top: 1px;
	left: 4px;
	width: 5px;
	height: 9px;
	border: 2px solid #fff;
	border-top: 0;
	border-left: 0;
	transform: rotate(45deg);
}

.ehs-filter__name {
	flex: 1;
}

.ehs-filter__count {
	flex: none;
	color: #bbb;
	font-size: 11px;
}

.ehs-filter__item.is-active .ehs-filter__count {
	color: var(--ehs-broch-blue);
}

/* ---------- Download form popup ---------- */

.ehs-modal {
	width: calc(100% - 32px);
	max-width: 480px;
	max-height: calc(100% - 32px);
	padding: 40px;
	overflow: auto;
	border: 0;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	color: #444;
	font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.4;
}

/* On the Brochures page .ehs-section makes this border-box; product pages print the popup in the footer. */
.ehs-modal,
.ehs-modal *,
.ehs-modal *::before,
.ehs-modal *::after {
	box-sizing: border-box;
}

.ehs-modal::backdrop {
	background: rgba(0, 0, 0, 0.55);
}

body.ehs-modal-open {
	overflow: hidden;
}

.ehs-modal__close {
	position: absolute;
	top: 14px;
	right: 18px;
	padding: 0;
	border: 0;
	background: none;
	color: #aaa;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.ehs-modal__close:hover {
	color: #333;
}

.ehs-modal__title {
	margin: 0 0 8px;
	color: var(--ehs-broch-ink, #1a1a1a);
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
}

.ehs-modal__subtitle {
	margin: 0 0 24px;
	color: #666;
	font-size: 14px;
}

.ehs-modal :focus-visible {
	outline: 2px solid #ff9c23;
	outline-offset: 2px;
}

/* Contact Form 7 fields inside the popup. */
.ehs-modal .wpcf7 p {
	margin: 0;
}

.ehs-modal .wpcf7-form > * + * {
	margin-top: 15px;
}

.ehs-form__legend,
.ehs-form__label {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	color: #262626;
	font-size: 16px;
	font-weight: 700;
}

.ehs-form__legend span,
.ehs-form__label span {
	color: #d63637;
}

.ehs-form__name {
	margin: 0;
	padding: 0;
	border: 0;
}

.ehs-form__row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.ehs-form__row label {
	display: block;
}

.ehs-form__sub {
	display: block;
	margin-top: 5px;
	color: #666;
	font-size: 14px;
}

.ehs-modal .wpcf7-form-control-wrap {
	display: block;
}

.ehs-modal input[type="text"],
.ehs-modal input[type="email"] {
	width: 100%;
	height: 43px;
	padding: 0 14px;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 3px;
	background: #fff;
	color: #262626;
	font-family: inherit;
	font-size: 16px;
}

.ehs-modal input[type="text"]:focus,
.ehs-modal input[type="email"]:focus {
	border-color: var(--ehs-broch-blue, #0078a0);
	outline: none;
	box-shadow: 0 0 0 1px var(--ehs-broch-blue, #0078a0);
}

.ehs-modal .wpcf7-acceptance .wpcf7-list-item {
	margin: 0;
}

.ehs-modal .wpcf7-acceptance label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	line-height: 1.45;
}

.ehs-modal .wpcf7-acceptance input {
	flex: none;
	width: 16px;
	height: 16px;
	margin: 2px 0 0;
}

.ehs-modal .wpcf7-acceptance a {
	color: var(--ehs-broch-blue, #0078a0);
}

.ehs-modal .wpcf7-submit {
	min-height: 41px;
	margin-top: 10px;
	padding: 0 15px;
	border: 0;
	border-radius: 3px;
	background: #066aab;
	color: #fff;
	font-family: inherit;
	font-size: 17px;
	cursor: pointer;
}

.ehs-modal .wpcf7-submit:hover {
	background: #055a91;
}

.ehs-modal .wpcf7-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.ehs-modal .wpcf7-not-valid-tip {
	margin-top: 4px;
	font-size: 13px;
}

.ehs-modal .wpcf7 form .wpcf7-response-output {
	margin: 15px 0 0;
	padding: 8px 12px;
	font-size: 14px;
}

.ehs-modal__done p {
	margin: 0 0 16px;
}

@media (prefers-reduced-motion: reduce) {
	.ehs-broch__grid-area.is-loading::after {
		animation-duration: 2s;
	}
}

/* ---------- iPad ---------- */

@media (max-width: 1024px) {
	/* Filters move above the cards and lay out in two columns. */
	.ehs-broch__layout {
		flex-direction: column-reverse;
		gap: 24px;
	}

	.ehs-broch__content,
	.ehs-broch__sidebar {
		flex: 0 0 auto;
		width: 100%;
		max-width: 100%;
	}

	.ehs-broch__sidebar {
		position: static;
	}

	/* The products become a row of pill buttons across the full width
	   (the live site leaves the right half empty), with bigger tap targets. */
	.ehs-filter__body {
		flex-flow: row wrap;
		gap: 8px;
	}

	.ehs-filter__item {
		width: auto;
		min-height: 40px;
		padding: 8px 12px;
		border: 1px solid #e3e8ea;
		border-radius: 999px;
	}

	.ehs-filter__item.is-active {
		border-color: var(--ehs-broch-blue);
	}

	.ehs-broch-card__btn {
		padding-block: 15px;
	}
}

/* ---------- Phones ---------- */

@media (max-width: 600px) {
	.ehs-broch__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The filter starts as one bar ("Products: All") so the cards come
	   first; tapping it opens the list (brochures.js toggles .is-open-phone). */
	.ehs-filter__head {
		min-height: 48px;
		padding: 0 14px;
		border: 1px solid #e3e8ea;
		border-radius: 6px;
		font-size: 14px;
	}

	.ehs-filter__current {
		display: block;
		min-width: 0;
		margin-left: auto;
		overflow: hidden;
		color: var(--ehs-broch-blue);
		font-weight: 600;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.ehs-broch .ehs-filter .ehs-filter__body {
		display: none;
	}

	.ehs-broch .ehs-filter.is-open-phone .ehs-filter__body {
		display: flex;
	}

	.ehs-broch .ehs-filter .ehs-filter__arrow {
		transform: none;
	}

	.ehs-broch .ehs-filter.is-open-phone .ehs-filter__arrow {
		transform: rotate(180deg);
	}

	.ehs-filter__body {
		flex-direction: column;
		gap: 2px;
		padding: 6px 0 0;
	}

	.ehs-filter__item {
		width: 100%;
		min-height: 44px;
		padding: 10px 12px;
		border: 0;
		border-radius: 6px;
		font-size: 14px;
	}

	.ehs-modal {
		padding: 32px 24px 24px;
	}

	.ehs-form__row {
		grid-template-columns: minmax(0, 1fr);
	}
}
