/**
 * Bailey Morris — Technical Worksheets
 */

/**
 * The panel borrows Elementor's .elementor-column classes to sit correctly in
 * the form grid, and those set `display: flex` — which beats the `hidden`
 * attribute's default `display: none`. This has to win.
 */
.bm-worksheets[hidden] {
	display: none !important;
}

.bm-worksheets {
	--bm-ws-accent: #1668e3;
	--bm-ws-ink: #0f2745;
	--bm-ws-surface: #f4f7fb;
	--bm-ws-border: #d8e2ef;

	margin-block: 8px 4px;
}

.bm-worksheets__inner {
	width: 100%;
	padding: 18px 20px;
	border: 1px solid var(--bm-ws-border);
	border-left: 3px solid var(--bm-ws-accent);
	border-radius: 4px;
	background: var(--bm-ws-surface);
}

.bm-worksheets__heading {
	margin: 0 0 4px;
	color: var(--bm-ws-ink);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
}

.bm-worksheets__intro {
	margin: 0 0 14px;
	color: var(--bm-ws-ink);
	font-size: 0.875rem;
	line-height: 1.5;
	opacity: 0.8;
}

.bm-worksheets__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bm-worksheets__item + .bm-worksheets__item {
	margin-top: 10px;
}

.bm-worksheets__link {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--bm-ws-accent);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.bm-worksheets__link:hover .bm-worksheets__title,
.bm-worksheets__link:focus-visible .bm-worksheets__title {
	text-decoration: underline;
}

.bm-worksheets__link:focus-visible {
	outline: 2px solid var(--bm-ws-accent);
	outline-offset: 3px;
}

.bm-worksheets__badge {
	flex: none;
	padding: 2px 7px;
	border-radius: 3px;
	background: var(--bm-ws-accent);
	color: #fff;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.bm-worksheets__hint {
	display: block;
	margin-top: 2px;
	color: var(--bm-ws-ink);
	font-size: 0.8125rem;
	line-height: 1.4;
	opacity: 0.7;
}

@media (max-width: 480px) {
	.bm-worksheets__inner {
		padding: 15px 16px;
	}
}

/* ---------------------------------------------------------------------------
   Form panel — the "what do I do now" note and its states.
   --------------------------------------------------------------------------- */

.bm-worksheets .bm-worksheets__note {
	display: flex;
	/* Baseline, not flex-start: the marker and the first line of text must sit
	   on the same baseline, and they have different glyph heights. */
	align-items: baseline;
	gap: 8px;
	margin: 16px 0 0;
	padding: 11px 14px;
	border-radius: 6px;
	background: rgba( 15, 39, 69, 0.05 );
	color: var(--bm-ws-ink);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.5;
}

.bm-worksheets .bm-worksheets__note::before {
	flex: none;
	/* Inherit both, so the marker shares the text's baseline box. */
	font-size: inherit;
	font-weight: 700;
	line-height: inherit;
}

/* The idle note is plain information — the tinted panel is marker enough, and
   a chevron here only creates something else to misalign. */
.bm-worksheets .bm-worksheets__note--idle::before {
	content: none;
}

.bm-worksheets .bm-worksheets__note--downloaded {
	background: rgba( 22, 104, 227, 0.09 );
	color: #0b3c86;
}

.bm-worksheets .bm-worksheets__note--downloaded::before {
	content: '↓';
	font-weight: 700;
}

.bm-worksheets .bm-worksheets__note--attached {
	background: rgba( 22, 128, 76, 0.1 );
	color: #14603a;
}

.bm-worksheets .bm-worksheets__note--attached::before {
	content: '✓';
	font-weight: 700;
}

/* Brief highlight on the upload field after a worksheet is downloaded, so the
   customer can see where it comes back. Fades out rather than nagging. */
.bm-worksheets-target {
	position: relative;
	border-radius: 6px;
	animation: bm-worksheets-pulse 2.6s ease-out 1;
}

@keyframes bm-worksheets-pulse {
	0%   { box-shadow: 0 0 0 0 rgba( 22, 104, 227, 0.45 ); }
	18%  { box-shadow: 0 0 0 5px rgba( 22, 104, 227, 0.16 ); }
	100% { box-shadow: 0 0 0 0 rgba( 22, 104, 227, 0 ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.bm-worksheets-target { animation: none; outline: 2px solid rgba( 22, 104, 227, 0.5 ); outline-offset: 3px; }
}

/* ---------------------------------------------------------------------------
   [bm_worksheets] card grid — sector pages

   Specificity note: the Elementor kit emits `.elementor-kit-1304 h3 {...}`
   (0,1,1) and Astra emits `.entry-content :where(h3)` (0,1,0), both of which
   set colour, size and font-family on headings. Every rule below is therefore
   scoped so it scores at least 0,2,0 — and headings/links 0,3,0 — otherwise
   the kit wins and the cards inherit page-heading styling.
   Tokens are the live site's: blue #0765d8, navy #143149, Figtree, 30px pills.
   --------------------------------------------------------------------------- */

.bm-ws-block {
	--bm-blue: #0765d8;
	--bm-blue-dark: #0254b9;
	--bm-navy: #143149;
	--bm-line: #e2e8f0;
	--bm-muted: #67768e;
	--bm-font: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

	margin: 0;
	font-family: var(--bm-font);
}

.bm-ws-block .bm-ws-block__header {
	margin: 0 0 28px;
}

/* 0,3,0 — must out-rank `.elementor-kit-1304 h2`. */
.bm-ws-block .bm-ws-block__header .bm-ws-block__title {
	margin: 0 0 8px;
	padding: 0;
	color: var(--bm-navy);
	font-family: var(--bm-font);
	font-size: clamp( 1.5rem, 1.2rem + 1.2vw, 2.125rem );
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
	text-transform: none;
}

.bm-ws-block .bm-ws-block__header .bm-ws-block__intro {
	max-width: 60ch;
	margin: 0;
	color: var(--bm-muted);
	font-family: var(--bm-font);
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.6;
}

.bm-ws-block .bm-ws-block__grid {
	display: grid;
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
	grid-template-columns: repeat( auto-fit, minmax( 240px, 1fr ) );
}

.bm-ws-block.bm-ws-block--cols-2 .bm-ws-block__grid { max-width: 760px; }
.bm-ws-block.bm-ws-block--cols-4 .bm-ws-block__grid {
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
}

/* A lone card shouldn't stretch the full page width. */
.bm-ws-block .bm-ws-block__grid:has( > .bm-ws-card:only-child ) {
	grid-template-columns: minmax( 240px, 340px );
}

.bm-ws-block .bm-ws-card {
	display: flex;
	overflow: hidden;
	flex-direction: column;
	margin: 0;
	padding: 0;
	border: 1px solid var(--bm-line);
	border-radius: 10px;
	background: #fff;
	list-style: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.bm-ws-block .bm-ws-card:hover {
	border-color: #cbd5e1;
	box-shadow: 0 10px 28px rgba( 20, 49, 73, 0.12 );
	transform: translateY( -3px );
}

.bm-ws-block .bm-ws-card__media {
	display: block;
	overflow: hidden;
	border-bottom: 1px solid var(--bm-line);
	background: #f8fafc;
	aspect-ratio: 4 / 3;
}

.bm-ws-block .bm-ws-card__img {
	display: block;
	width: 100%;
	height: 100%;
	padding: 10px;
	/* Technical drawings: show the whole sheet rather than cropping into it. */
	object-fit: contain;
}

.bm-ws-block .bm-ws-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 20px;
}

/* 0,3,0 — must out-rank `.elementor-kit-1304 h3`, which is 0,1,1 and sets
   colour, font-family and size. */
.bm-ws-block .bm-ws-card .bm-ws-card__title {
	margin: 0 0 6px;
	padding: 0;
	color: var(--bm-navy);
	font-family: var(--bm-font);
	font-size: 1.0625rem;
	font-weight: 700;
	letter-spacing: normal;
	line-height: 1.35;
	text-transform: none;
}

.bm-ws-block .bm-ws-card .bm-ws-card__hint {
	margin: 0 0 18px;
	color: var(--bm-muted);
	font-family: var(--bm-font);
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.5;
}

/* 0,3,0 — theme link colours are the other thing that reliably fights back. */
.bm-ws-block .bm-ws-card .bm-ws-card__cta,
.bm-ws-block .bm-ws-card .bm-ws-card__cta:link,
.bm-ws-block .bm-ws-card .bm-ws-card__cta:visited {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 8px;
	/* Pins the button to the card bottom so CTAs line up across cards whose
	   titles wrap to different heights. */
	margin-top: auto;
	padding: 13px 22px;
	border: 0;
	border-radius: 30px;
	background: var(--bm-blue);
	color: #fff;
	font-family: var(--bm-font);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.18s ease;
}

.bm-ws-block .bm-ws-card .bm-ws-card__cta:hover,
.bm-ws-block .bm-ws-card .bm-ws-card__cta:focus {
	background: var(--bm-blue-dark);
	color: #fff;
	text-decoration: none;
}

.bm-ws-block .bm-ws-card .bm-ws-card__cta:focus-visible {
	outline: 2px solid var(--bm-navy);
	outline-offset: 3px;
}

.bm-ws-block .bm-ws-card__cta-icon {
	display: inline-flex;
	flex: none;
}

/* Screen-reader text, in case the theme doesn't provide it. */
.bm-ws-block .screen-reader-text {
	position: absolute !important;
	overflow: hidden;
	width: 1px;
	height: 1px;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	white-space: nowrap;
}

/* Placed on one of the site's navy sections. */
.bm-ws-block.bm-ws-block--on-dark .bm-ws-block__header .bm-ws-block__title { color: #fff; }
.bm-ws-block.bm-ws-block--on-dark .bm-ws-block__header .bm-ws-block__intro { color: rgba( 255, 255, 255, 0.75 ); }

@media ( max-width: 767px ) {
	.bm-ws-block .bm-ws-block__grid { gap: 18px; grid-template-columns: 1fr; }
	.bm-ws-block .bm-ws-block__header { margin-bottom: 22px; }
}

@media ( prefers-reduced-motion: reduce ) {
	.bm-ws-block .bm-ws-card { transition: none; }
	.bm-ws-block .bm-ws-card:hover { transform: none; }
}

/* Steps strip — only rendered when the block holds a fill-in worksheet. */
.bm-ws-block .bm-ws-block__steps {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 22px;
	margin: 18px 0 0;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.bm-ws-block .bm-ws-block__steps .bm-ws-block__step {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin: 0;
	padding: 0;
	color: var(--bm-navy);
	font-family: var(--bm-font);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
	list-style: none;
}

.bm-ws-block .bm-ws-block__steps .bm-ws-block__step-num {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--bm-blue);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

/* Closing call to action. */
.bm-ws-block .bm-ws-block__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
	margin: 28px 0 0;
	padding: 20px 24px;
	border: 1px solid var(--bm-line);
	border-left: 3px solid var(--bm-blue);
	border-radius: 10px;
	background: #f4f7fb;
}

.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-text {
	margin: 0;
	color: var(--bm-navy);
	font-family: var(--bm-font);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.5;
}

.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta,
.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta:link,
.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta:visited {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 8px;
	padding: 14px 26px;
	border: 0;
	border-radius: 30px;
	background: var(--bm-blue);
	color: #fff;
	font-family: var(--bm-font);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.18s ease;
}

.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta:hover,
.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta:focus {
	background: var(--bm-blue-dark);
	color: #fff;
	text-decoration: none;
}

.bm-ws-block .bm-ws-block__footer .bm-ws-block__footer-cta:focus-visible {
	outline: 2px solid var(--bm-navy);
	outline-offset: 3px;
}

.bm-ws-block .bm-ws-block__footer-icon {
	display: inline-flex;
	flex: none;
}

.bm-ws-block.bm-ws-block--on-dark .bm-ws-block__steps .bm-ws-block__step { color: #fff; }

@media ( max-width: 600px ) {
	.bm-ws-block .bm-ws-block__footer {
		align-items: flex-start;
		flex-direction: column;
		padding: 18px 18px;
	}

	.bm-ws-block .bm-ws-block__steps { gap: 8px 16px; }
}
