/*
 * BUK Site Builder — front-end styles.
 *
 * Rule: no hardcoded colours, no invented nfd-* classes. Everything resolves
 * against Bluehost Blueprint's --wndb--* layer or WordPress preset variables,
 * so if the client changes palette or font pair in the site editor these
 * styles follow automatically.
 */

.bukw-prose {
	max-width: var(--wndb--max-w--prose, 68ch);
	color: var(--wndb--color--text, currentColor);
	line-height: 1.7;
}

.bukw-prose > * + * {
	margin-top: var(--wp--preset--spacing--40, 1rem);
}

.bukw-prose h2 {
	font-size: var(--wp--preset--font-size--large, 1.25em);
	color: var(--wndb--color--text--contrast, currentColor);
	margin-top: var(--wp--preset--spacing--60, 2.25rem);
	line-height: 1.25;
}

.bukw-prose h3 {
	font-size: var(--wp--preset--font-size--medium, 1em);
	font-weight: 600;
	color: var(--wndb--color--text--contrast, currentColor);
	margin-top: var(--wp--preset--spacing--50, 1.5rem);
}

.bukw-prose ul,
.bukw-prose ol {
	padding-left: 1.35em;
}

.bukw-prose li + li {
	margin-top: 0.35em;
}

.bukw-prose a {
	color: var(--wndb--color--links, var(--wndb--color--primary, currentColor));
	text-underline-offset: 0.18em;
}

/* ---------- Collection page ---------- */

.bukw-collection-intro {
	margin-bottom: var(--wndb--gap--lg, 1.5rem);
}

.bukw-collection-copy {
	margin-top: var(--wndb--gap--2xl, 3rem);
	padding-top: var(--wndb--gap--xl, 2rem);
	border-top: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.08));
}

.bukw-collection-copy .bukw-prose {
	max-width: none;
	column-gap: var(--wndb--gap--2xl, 3rem);
}

@media (min-width: 900px) {
	.bukw-collection-copy .bukw-prose {
		columns: 2;
	}
	.bukw-collection-copy .bukw-prose h2,
	.bukw-collection-copy .bukw-prose h3 {
		column-span: all;
	}
}

/* Stat / trust strip — replaces the placeholder social proof. */

.bukw-facts {
	display: grid;
	gap: var(--wndb--gap--md, 1rem);
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.bukw-fact {
	padding: var(--wndb--p--md, 1.25rem);
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--wndb--border--radius--md, 12px);
	background: var(--wndb--color--surface, transparent);
}

.bukw-fact__value {
	display: block;
	font-size: var(--wp--preset--font-size--large, 1.75em);
	font-weight: 700;
	line-height: 1.1;
	color: var(--wndb--color--text--contrast, currentColor);
}

.bukw-fact__label {
	display: block;
	margin-top: 0.35em;
	font-size: var(--wp--preset--font-size--small, 0.85em);
	color: var(--wndb--color--text--faded, currentColor);
}

/* ---------- Cards / related articles ---------- */

.bukw-related {
	margin-top: var(--wndb--gap--2xl, 3rem);
}

.bukw-related > h2 {
	margin-bottom: var(--wndb--gap--md, 1rem);
}

.bukw-grid {
	display: grid;
	gap: var(--wndb--gap--lg, 1.5rem);
}

.bukw-grid--3 {
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.bukw-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	text-decoration: none;
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--wndb--border--radius--md, 12px);
	background: var(--wndb--color--surface, transparent);
	transition: transform 160ms ease, box-shadow 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
	.bukw-card {
		transition: none;
	}
}

.bukw-card:hover,
.bukw-card:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--wndb--shadow--sm, 0 6px 20px rgba(0, 0, 0, 0.08));
}

.bukw-card__media {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--wndb--color--subtle, rgba(0, 0, 0, 0.04));
}

.bukw-card__media img,
.bukw-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.bukw-card__ph {
	display: block;
	width: 100%;
	height: 100%;
}

.bukw-card__body {
	display: block;
	padding: var(--wndb--p--sm, 1rem);
}

.bukw-card__title {
	display: block;
	font-weight: 600;
	line-height: 1.35;
}

.bukw-card__meta {
	display: block;
	margin-top: 0.4em;
}

/* ---------- Article body ---------- */

.bukw-article-toc {
	padding: var(--wndb--p--md, 1.25rem);
	border-left: 3px solid var(--wndb--color--primary, currentColor);
	background: var(--wndb--color--subtle, rgba(0, 0, 0, 0.03));
	border-radius: var(--wndb--border--radius--sm, 6px);
}

.bukw-article-toc ul {
	margin: 0.5em 0 0;
}

.bukw-credit {
	display: block;
	margin-top: 0.5em;
	font-size: 0.78em;
	color: var(--wndb--color--text--faded, currentColor);
}

/* Product grid legibility on collection pages — titles wrap to two lines
   consistently so cards align on a row. */

.bukw-tightened .wc-block-product-template .wp-block-post-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.7em;
}

/* ==========================================================================
   Hero
   ==========================================================================
   The image on this site is a product cutout on a white background, so it
   cannot fill an edge-to-edge box the way a lifestyle photo can — cropping it
   with object-fit:cover slices the product. "contain" on a white surface with
   internal padding gives it room and reads as intentional.
   ========================================================================== */

.bukw-hero__media {
	margin: 0;
	border-radius: var(--wndb--border--radius--lg, 20px);
	overflow: hidden;
	aspect-ratio: var(--bukw-hero-ratio, 4 / 3);
	background: var(--wndb--color--white, #fff);
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.07));
}

.bukw-hero__media img {
	width: 100%;
	height: 100%;
	display: block;
}

.bukw-fit-cover.bukw-hero__media img {
	object-fit: cover;
}

.bukw-fit-contain.bukw-hero__media {
	padding: clamp(1rem, 3vw, 2.5rem);
}

.bukw-fit-contain.bukw-hero__media img {
	object-fit: contain;
}

/* ==========================================================================
   Category cards
   ==========================================================================
   Replaces the three-per-row column layout. An auto-fill grid means the final
   row never leaves a hole, and the cards sit in a real surface so the white
   product cutouts stop bleeding into the grey page background.
   ========================================================================== */

.bukw-cat-grid {
	display: grid;
	gap: var(--wndb--gap--lg, 1.5rem);
	grid-template-columns: repeat(6, minmax(0, 1fr));
	align-items: stretch;
}

/* Each card declares its own span via --bukw-span, set by the row planner in
   PHP. Six columns divides cleanly into two-up (span 3) and three-up (span 2)
   rows, so five categories arrange as 2 + 3 with no gap. */
.bukw-cat-grid > .bukw-cat-card {
	grid-column: span var(--bukw-span, 2);
}

/* Two breakpoints down, spans are overridden rather than the grid rebuilt —
   that keeps the source order intact. */
@media (max-width: 1024px) {
	.bukw-cat-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.bukw-cat-grid > .bukw-cat-card {
		grid-column: span 1;
	}
}

@media (max-width: 600px) {
	.bukw-cat-grid {
		grid-template-columns: 1fr;
	}
}

.bukw-cat-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--wndb--color--surface, #fff);
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--wndb--border--radius--md, 14px);
	transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.bukw-cat-card:hover {
	transform: translateY(-3px);
	border-color: var(--wndb--color--primary, currentColor);
	box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.22);
}

.bukw-cat-card:focus-within {
	border-color: var(--wndb--color--primary, currentColor);
}

@media (prefers-reduced-motion: reduce) {
	.bukw-cat-card,
	.bukw-cat-card:hover {
		transition: none;
		transform: none;
	}
}

.bukw-cat-card__media {
	margin: 0;
	aspect-ratio: 4 / 3;
	background: var(--wndb--color--white, #fff);
	border-bottom: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.06));
	overflow: hidden;
}

.bukw-cat-card__media a,
.bukw-cat-card__media img {
	display: block;
	width: 100%;
	height: 100%;
}

.bukw-cat-card__media--empty {
	background: var(--wndb--color--subtle, rgba(0, 0, 0, 0.04));
}

/* Cutouts get breathing room and are never cropped. */
.bukw-fit-contain .bukw-cat-card__media {
	padding: 1.15rem;
}

.bukw-fit-contain .bukw-cat-card__media img {
	object-fit: contain;
	transition: transform 320ms ease;
}

.bukw-fit-cover .bukw-cat-card__media img {
	object-fit: cover;
	transition: transform 320ms ease;
}

.bukw-cat-card:hover .bukw-cat-card__media img {
	transform: scale(1.035);
}

@media (prefers-reduced-motion: reduce) {
	.bukw-cat-card:hover .bukw-cat-card__media img {
		transform: none;
	}
}

.bukw-cat-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	gap: 0.5rem;
	padding: var(--wndb--p--md, 1.25rem);
}

.bukw-cat-card__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large, 1.25em);
	font-weight: 600;
	line-height: 1.25;
}

/* The live cards render the heading as an underlined green link, which reads
   as body copy rather than a card title. */
.bukw-cat-card__title a {
	color: var(--wndb--color--text--contrast, currentColor);
	text-decoration: none;
}

.bukw-cat-card:hover .bukw-cat-card__title a {
	color: var(--wndb--color--primary, currentColor);
}

.bukw-cat-card__desc {
	margin: 0;
	flex: 1 1 auto;
	font-size: 0.95em;
	line-height: 1.55;
	color: var(--wndb--color--text--faded, currentColor);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.bukw-cat-card__cta {
	margin: 0;
	font-size: 0.9em;
	font-weight: 600;
}

.bukw-cat-card__cta a {
	color: var(--wndb--color--primary, currentColor);
	text-decoration: none;
}

.bukw-cat-card__cta a:hover {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* Make the whole card clickable without nesting links. */
.bukw-cat-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.bukw-cat-card {
	position: relative;
}

.bukw-cat-card__cta a {
	position: relative;
	z-index: 1;
}

/* ==========================================================================
   Facts strip — tighter than the first pass
   ========================================================================== */

.bukw-facts {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.bukw-fact {
	padding: 1.1rem 1.25rem;
	background: var(--wndb--color--surface, transparent);
}

.bukw-fact__value {
	font-size: 1.6em;
	letter-spacing: -0.01em;
}

.bukw-fact__label {
	line-height: 1.4;
}

/* ==========================================================================
   Site-wide polish — only applied when body.bukw-polish is present
   ==========================================================================
   Everything below is scoped to that class so it can be switched off from the
   settings page without editing CSS. Deliberately additive: spacing, focus
   states and card treatment. No colour or type-scale overrides, because those
   belong to the theme's palette and font pair.
   ========================================================================== */

body.bukw-polish :where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wndb--color--primary, currentColor);
	outline-offset: 2px;
	border-radius: 3px;
}

body.bukw-polish ::selection {
	background: var(--wndb--color--primary, #117a4d);
	color: #fff;
}

/* Product grid cards, on the shop and every collection page. Same reasoning
   as the category cards: the catalogue is cutouts on white. */

body.bukw-polish .wc-block-product-template .wc-block-product,
body.bukw-polish .wp-block-woocommerce-product-template > li {
	display: flex;
	flex-direction: column;
	padding: 0.9rem;
	background: var(--wndb--color--surface, #fff);
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.07));
	border-radius: var(--wndb--border--radius--md, 12px);
	transition: border-color 180ms ease, box-shadow 180ms ease;
}

body.bukw-polish .wc-block-product-template .wc-block-product:hover,
body.bukw-polish .wp-block-woocommerce-product-template > li:hover {
	border-color: var(--wndb--color--borders-strong, rgba(0, 0, 0, 0.18));
	box-shadow: 0 8px 24px -14px rgba(0, 0, 0, 0.25);
}

body.bukw-polish .wc-block-product-template .wc-block-components-product-image {
	margin-bottom: 0.65rem;
	border-radius: var(--wndb--border--radius--sm, 8px);
	overflow: hidden;
	background: #fff;
}

body.bukw-polish .wc-block-product-template .wc-block-components-product-image img {
	aspect-ratio: 1 / 1;
	object-fit: contain;
	width: 100%;
	height: auto;
	mix-blend-mode: normal;
}

/* Titles wrap to a consistent two lines so prices align across a row. */
body.bukw-polish .wc-block-product-template .wp-block-post-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
	line-height: 1.3;
	font-size: 0.98em;
}

body.bukw-polish .wc-block-product-template .wc-block-components-product-price {
	margin-top: auto;
	font-weight: 700;
}

body.bukw-polish .wc-block-product-template .wp-block-button__link,
body.bukw-polish .wc-block-product-template .wc-block-components-product-button a {
	width: 100%;
	text-align: center;
	margin-top: 0.6rem;
}

/* Breadcrumbs and toolbars */

body.bukw-polish .wc-block-breadcrumbs {
	margin-bottom: 0.75rem;
	opacity: 0.85;
}

body.bukw-polish .bukw-toolbar {
	padding-block: 0.6rem;
	border-block: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.07));
	align-items: center;
	margin-bottom: var(--wndb--gap--lg, 1.5rem);
}

/* Refine panel */

body.bukw-polish .bukw-filters-col {
	position: sticky;
	top: 2rem;
	align-self: start;
}

body.bukw-polish .bukw-filters {
	padding: 1rem;
	border: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--wndb--border--radius--md, 12px);
	background: var(--wndb--color--surface, transparent);
}

@media (max-width: 781px) {
	body.bukw-polish .bukw-filters-col {
		position: static;
	}
}

/* Pagination */

body.bukw-polish .wp-block-query-pagination {
	gap: 0.4rem;
	margin-top: var(--wndb--gap--xl, 2rem);
}

body.bukw-polish .wp-block-query-pagination a,
body.bukw-polish .wp-block-query-pagination .page-numbers {
	padding: 0.4em 0.75em;
	border-radius: var(--wndb--border--radius--sm, 6px);
	text-decoration: none;
	border: 1px solid transparent;
}

body.bukw-polish .wp-block-query-pagination a:hover {
	border-color: var(--wndb--color--borders, rgba(0, 0, 0, 0.15));
}

body.bukw-polish .wp-block-query-pagination .current {
	background: var(--wndb--color--primary, currentColor);
	color: #fff;
}

/* Forms — the contact and enquiry pages use WPForms */

body.bukw-polish .wpforms-field input[type="text"],
body.bukw-polish .wpforms-field input[type="email"],
body.bukw-polish .wpforms-field input[type="tel"],
body.bukw-polish .wpforms-field select,
body.bukw-polish .wpforms-field textarea {
	border-radius: var(--wndb--border--radius--sm, 6px);
	border: 1px solid var(--wndb--color--borders, rgba(0, 0, 0, 0.18));
	padding: 0.6em 0.75em;
}

body.bukw-polish .wpforms-field input:focus,
body.bukw-polish .wpforms-field textarea:focus {
	border-color: var(--wndb--color--primary, currentColor);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wndb--color--primary, #117a4d) 18%, transparent);
	outline: none;
}

/* Long-form pages — About, Wholesale Solutions, the policy pages — are dense
   walls of text at full container width. */

body.bukw-polish .bukw-prose,
body.bukw-polish .entry-content > p {
	text-wrap: pretty;
}

body.bukw-polish img {
	max-width: 100%;
	height: auto;
}

/* ==========================================================================
   Wide cards — the two-up row
   ==========================================================================
   A card that spans half the grid gets a horizontal layout instead of simply
   scaling up: a 4:3 image stretched to half the page width would dwarf the
   copy beside it.
   ========================================================================== */

@media (min-width: 1025px) {
	.bukw-cat-card--wide {
		flex-direction: row;
		align-items: stretch;
	}

	.bukw-cat-card--wide .bukw-cat-card__media {
		flex: 0 0 44%;
		aspect-ratio: auto;
		border-bottom: 0;
		border-right: 1px solid var(--wndb--color--borders-light, rgba(0, 0, 0, 0.06));
		min-height: 15rem;
	}

	.bukw-cat-card--wide .bukw-cat-card__body {
		justify-content: center;
		gap: 0.6rem;
		padding: var(--wndb--p--lg, 1.75rem);
	}

	.bukw-cat-card--wide .bukw-cat-card__title {
		font-size: var(--wp--preset--font-size--x-large, 1.6em);
	}

	.bukw-cat-card--wide .bukw-cat-card__desc {
		-webkit-line-clamp: 4;
		font-size: 1em;
	}
}

/* ==========================================================================
   Full-bleed hero
   ==========================================================================
   The image runs to the viewport edge on the right; copy stays aligned with
   the page grid on the left. The section takes most of the viewport height so
   it lands like a hero rather than a banner. Inside bleed mode, the fit and
   ratio settings on the figure are overridden — a bleed hero is always
   cover-fitted and sized by the section, never by an aspect box.
   ========================================================================== */

.bukw-hero--bleed {
	/* Escape the constrained content column no matter how the theme treats
	   alignfull: full viewport width, recentred with a negative margin. */
	width: 100vw;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
	margin-block: 0 !important;
	background: var(--wndb--color--surface, transparent);
	overflow: hidden;
}

.bukw-hero--bleed__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	align-items: center;
	min-height: min(78vh, 720px);
	max-width: none;
}

.bukw-hero--bleed__copy {
	/* Left edge lines up with the page container; right side breathes. */
	padding-left: max(var(--wp--style--root--padding-left, 24px), calc((100vw - var(--wndb--container, 1200px)) / 2));
	padding-right: clamp(1.5rem, 4vw, 4rem);
	padding-block: clamp(2rem, 6vh, 4rem);
}

.bukw-hero--bleed__media {
	position: relative;
	align-self: stretch;
	min-height: 320px;
}

/* Whatever the figure was built as, in bleed mode it fills the column. */
.bukw-hero--bleed__media .bukw-hero__media {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0 !important;
	border: 0;
	border-radius: 0;
	aspect-ratio: auto;
	background: transparent;
}

.bukw-hero--bleed__media .bukw-hero__media img {
	width: 100%;
	height: 100%;
	object-fit: cover !important;
}

/* A soft scrim where the image meets the copy, so the transition is not a
   hard vertical line against the page background. */
.bukw-hero--bleed__media::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: clamp(2rem, 8vw, 7rem);
	background: linear-gradient(90deg, var(--wndb--color--surface, #f4f4f4), transparent);
	z-index: 1;
	pointer-events: none;
}

@media (max-width: 900px) {
	.bukw-hero--bleed__inner {
		grid-template-columns: 1fr;
		min-height: 0;
	}

	/* Image first on mobile, copy under it, both full width. */
	.bukw-hero--bleed__media {
		order: -1;
		min-height: 46vh;
	}

	.bukw-hero--bleed__media::before {
		display: none;
	}

	.bukw-hero--bleed__copy {
		padding: 1.5rem var(--wp--style--root--padding-left, 24px) 2rem;
	}
}
