/* Shared rhythm for ordinary WordPress blocks. Colours and content stay editable. */
:root {
	--jm-gutter: clamp(1.25rem, 4vw, 4rem);
}

.wp-block-columns > .wp-block-column { min-width: 0; }
.jm-page-title-shell { padding-block: clamp(3rem, 5vw, 5rem); }
.jm-page-title-shell .wp-block-post-title {
	max-width: var(--wp--style--global--wide-size);
	font-size: clamp(2.75rem, 5vw, 5.25rem);
	line-height: 1.05;
}
.wp-block-post-content > .alignfull > .alignwide > .wp-block-columns + .wp-block-columns { margin-top: 2.5rem; }
.wp-block-post-content > .alignfull > .alignwide .wp-block-column p { font-size: 1rem; line-height: 1.65; }
.wp-block-post-content > .alignfull > .alignwide .wp-block-column .wp-block-buttons { margin-top: 1.5rem; }
.jm-premium-band .wp-block-columns { gap: clamp(1.25rem, 2.5vw, 2.25rem); }
.jm-premium-band .wp-block-column :where(h2, h3) { max-width: 26ch; }
.jm-premium-band .wp-block-column p { font-size: 1rem; line-height: 1.65; }
.jm-premium-band .wp-block-column .wp-block-buttons { margin-top: 1.5rem; }
.jm-premium-band .wp-block-columns:has(> .wp-block-column:nth-child(3)) > .wp-block-column {
	padding: clamp(1.5rem, 2.5vw, 2.25rem);
}
.jm-premium-band .wp-block-columns:has(> .wp-block-column:nth-child(3)) :where(h2, h3) {
	font-size: clamp(1.4rem, 1.1rem + .75vw, 1.85rem);
	line-height: 1.2;
	letter-spacing: -.02em;
}

/* Wide sections share a left edge; prose retains a comfortable reading measure. */
@media (min-width: 1025px) {
	.wp-block-post-content > .alignfull > .alignwide > :where(h2, h3, p, ul, ol, blockquote, details, .wp-block-buttons) {
		margin-left: 0 !important;
		margin-right: auto !important;
	}
	.wp-block-post-content > .alignfull > .alignwide > :where(p, ul, ol, details) {
		max-width: 70ch;
	}
}

/* Keep the gallery controls together inside their photograph. */
.jm-dynamic-hero__copy { pointer-events: none; }
.jm-dynamic-hero__copy > * { pointer-events: auto; }
.jm-main-header .wp-block-site-title { white-space: nowrap; }

/* An ordinary Image block gives the first photo an immediate, local source. */
.wp-block-post-content :where(h2, h3, section, div)[id] { scroll-margin-top: 12rem; }
@media (max-width: 700px) {
	.wp-block-post-content :where(h2, h3, section, div)[id] { scroll-margin-top: 16rem; }
}

/* Two readable cards across on tablets, including portrait tablets. */
@media (min-width: 701px) and (max-width: 1024px) {
	.wp-block-post-content .wp-block-columns:not(.is-not-stacked-on-mobile):not(.is-style-jm-horizontal-showcase) {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.5rem;
	}
	.wp-block-post-content .wp-block-columns:not(.is-not-stacked-on-mobile):not(.is-style-jm-horizontal-showcase) > .wp-block-column {
		margin: 0;
	}
	.wp-block-post-content .wp-block-columns:not(.is-not-stacked-on-mobile):not(.is-style-jm-horizontal-showcase) > .wp-block-column:last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
	.jm-dynamic-hero__copy {
		width: min(660px, calc(100% - 4rem));
		padding-top: 10rem;
		padding-bottom: 5rem;
	}
	.jm-dynamic-hero__copy h1 { max-width: 18ch; }
	.jm-dynamic-hero__copy p { max-width: 56ch; }
	.jm-site-footer .wp-block-columns {
		display: grid !important;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 2.5rem 1.5rem;
	}
	.jm-site-footer .wp-block-columns > .wp-block-column:first-child {
		grid-column: 1 / -1;
		max-width: 680px;
	}
}
@media (min-width: 1025px) and (max-width: 1360px) {
	.wp-block-post-content .wp-block-columns:has(> .wp-block-column:nth-child(4)):not(.is-style-jm-horizontal-showcase) {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 700px) {
	.jm-dynamic-hero__copy { padding-bottom: 5rem; }
	.jm-dynamic-hero__copy h1 { max-width: 16ch; font-size: clamp(2.65rem, 11.5vw, 4rem) !important; }
	.jm-premium-band .wp-block-columns { gap: 1.25rem; }
	.jm-premium-band .wp-block-columns:has(> .wp-block-column:nth-child(3)) > .wp-block-column { padding: 1.5rem; }
}

/* Clear focus and touch targets without adding animation or another library. */
:where(a, button, summary, input, select, textarea):focus-visible {
	outline: 2px solid var(--jm-brass);
	outline-offset: 4px;
}
.wp-block-details > summary { min-height: 48px; }
.jm-main-header .wp-block-navigation__submenu-icon { min-width: 28px; min-height: 32px; }
.jm-main-header .wp-block-navigation__responsive-container-close { z-index: 2; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Native product and enquiry blocks share the site rhythm at every width. */
.wp-block-post-content .wp-block-columns.jm-product-grid {display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));}
.jm-product-grid > .wp-block-column {display:flex;flex-direction:column;}
.jm-product-grid > .wp-block-column > .wp-block-buttons {margin-top:auto!important;padding-top:1.5rem;}
.jm-enquiry-layout {align-items:flex-start!important;gap:clamp(2rem,5vw,5rem)!important;}
.jm-enquiry-layout > .wp-block-column {padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;}
.jm-enquiry-aside {background:#f6f3ed;border-radius:12px;padding:clamp(1.5rem,3vw,2.5rem);}
.jm-enquiry-aside h3 {font-size:1.4rem;line-height:1.25;}
.jm-enquiry-aside h3:not(:first-child) {margin-top:2rem;}
.jm-enquiry-layout .forminator-ui {margin-top:2rem!important;}
@media(min-width:701px) and (max-width:1024px){.wp-block-post-content .wp-block-columns.jm-product-grid {grid-template-columns:repeat(2,minmax(0,1fr));}.wp-block-post-content .wp-block-columns.jm-enquiry-layout {grid-template-columns:1fr!important;}.jm-enquiry-aside {max-width:none!important;}}
@media(max-width:700px){.wp-block-post-content .wp-block-columns.jm-product-grid {grid-template-columns:1fr;}.jm-enquiry-layout {gap:2.5rem!important;}}

/* Form presentation only; fields and validation remain in the native form editor. */
.jm-enquiry-section .forminator-ui {font-family:Arial,sans-serif!important;}
.jm-enquiry-section .forminator-ui .forminator-label {font-size:14px!important;line-height:1.5!important;color:#173f32!important;margin-bottom:8px!important;}
.jm-enquiry-section .forminator-ui .forminator-description {font-size:14px!important;line-height:1.5!important;color:#526259!important;}
.jm-enquiry-section .forminator-ui :is(input.forminator-input,textarea.forminator-textarea,.select2-selection) {border:1px solid #bdc8c1!important;border-radius:8px!important;background:#fbfcfa!important;font-size:16px!important;line-height:1.5!important;color:#172c22!important;min-height:52px!important;padding:12px 14px!important;box-shadow:none!important;}
.jm-enquiry-section .forminator-ui textarea.forminator-textarea {min-height:160px!important;resize:vertical;}
.jm-enquiry-section .forminator-ui .select2-selection__rendered {padding:0!important;line-height:26px!important;}
.jm-enquiry-section .forminator-ui .select2-selection__arrow {top:50%!important;transform:translateY(-50%);}
.jm-enquiry-section .forminator-row:has(> .forminator-field-textarea),.jm-enquiry-section .forminator-row:has(> .forminator-field-consent) {flex-wrap:wrap!important;}
.jm-enquiry-section .forminator-row:has(> .forminator-field-textarea) > .forminator-col,.jm-enquiry-section .forminator-row:has(> .forminator-field-consent) > .forminator-col {width:100%!important;max-width:100%!important;flex:0 0 100%!important;margin-bottom:24px!important;}
.jm-enquiry-section .forminator-ui .forminator-button-submit {min-height:52px!important;background:#173f32!important;color:#fff!important;border-radius:999px!important;padding:14px 28px!important;font-size:15px!important;box-shadow:none!important;}

/* Full-bleed heroes follow the document width, excluding desktop scrollbars. */
.wp-block-post-content > .jm-premium-band:has(.jm-dynamic-hero) {padding-inline:0!important;}
.wp-block-post-content > .jm-premium-band:has(.jm-dynamic-hero) > .wp-block-group {max-width:none!important;width:100%!important;padding-inline:0!important;margin-inline:0!important;}
body.jm-has-dynamic-hero .wp-block-group.is-layout-constrained > .jm-dynamic-hero {width:100%!important;margin-inline:0!important;}

/* Photography stays in native Image and Gallery blocks, with a quieter editorial frame. */
.wp-block-post-content .wp-block-columns.jm-open-cards > .wp-block-column,
.wp-block-post-content .wp-block-columns.jm-product-grid > .wp-block-column {padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;}
.jm-open-cards .wp-block-image img,.jm-product-grid .wp-block-image img {border-radius:3px;}
.jm-selected-work .jm-photo-cards .wp-block-image img {aspect-ratio:5/4;}
.jm-selected-work .wp-block-column > p:first-child {font:600 .75rem/1.5 Arial,sans-serif;letter-spacing:.12em;text-transform:uppercase;}
.jm-reach .wp-block-column:first-child > p:first-child {font:600 .75rem/1.7 Arial,sans-serif;letter-spacing:.1em;}
.jm-reach .wp-block-image img {aspect-ratio:5/4;object-fit:cover;}
.jm-project-jumps {gap:.75rem!important;margin-block:2rem!important;}
.jm-project-jumps .wp-block-button__link {background:transparent!important;color:#173f32!important;border:1px solid #aabbb1;padding:.7rem 1rem!important;font-size:.875rem!important;min-height:44px;}
.jm-project-jumps .wp-block-button__link:hover {background:#e7eee8!important;}
.jm-portfolio-gallery {display:grid!important;grid-template-columns:2fr 1fr;align-items:stretch!important;gap:clamp(.75rem,1.4vw,1.5rem)!important;}
.jm-portfolio-gallery > figure.wp-block-image {width:100%!important;max-width:none!important;margin:0!important;height:100%!important;}
.jm-portfolio-gallery > figure.wp-block-image:first-child {grid-row:span 2;}
.jm-portfolio-gallery > figure.wp-block-image img {width:100%!important;height:100%!important;aspect-ratio:4/3!important;object-fit:cover!important;border-radius:3px;}
.jm-portfolio-gallery > figure.wp-block-image:first-child img {aspect-ratio:4/3!important;}
.jm-sash-photo {display:block!important;}
.jm-sash-photo > figure.wp-block-image {width:100%!important;}
.jm-sash-photo > figure.wp-block-image img {aspect-ratio:4/5!important;object-fit:cover!important;}
@media(max-width:700px){.jm-portfolio-gallery{grid-template-columns:1fr 1fr!important}.jm-portfolio-gallery > figure.wp-block-image:first-child{grid-column:1/-1;grid-row:auto}.jm-portfolio-gallery > figure.wp-block-image:last-child:nth-child(odd){grid-column:auto}.jm-selected-work .jm-photo-cards{gap:3rem!important}.jm-product-grid{row-gap:2.5rem!important}}

.wp-block-post-content :is(.jm-open-cards,.jm-product-grid,.jm-portfolio-gallery) figure.wp-block-image {box-shadow:none!important;border:0!important;background:transparent!important;}
.wp-block-post-content :is(.jm-open-cards,.jm-product-grid,.jm-portfolio-gallery) figure.wp-block-image img {border-radius:3px!important;}

/* Keep assurance links readable on the dark footer band. */
.jm-site-footer .jm-footer-assurance a {
  color: #fff !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.jm-site-footer .jm-footer-assurance a:hover,
.jm-site-footer .jm-footer-assurance a:focus-visible { color: #e6d1ac !important; }

/* Keep the Fire Doors specification heading near its jump-link destination. */
#fire-door-specification { scroll-margin-top: 2rem !important; }

/* Keep the review popup close control clear of its heading on phones. */
@media (max-width: 480px) {
  .grw-drawer-panel .grw-drawer-header { padding-top: 60px !important; }
  .grw-drawer-panel .grw-drawer-close {
    width: 44px !important;
    height: 44px !important;
    top: 8px !important;
    right: 8px !important;
  }
}
