/* ==========================================================================
   HIMPEL Features 4 — a heading row, then a picture beside four cards
   --------------------------------------------------------------------------
   Everything is scoped under .himpel-f4. Nothing here targets the theme,
   WooCommerce, or any global element.
   ========================================================================== */

.himpel-f4 {
	--himpel-primary: #0b7347;
	--himpel-primary-dark: #095c39;
	--himpel-secondary: #f3f4ea;
	--himpel-white: #ffffff;
	--himpel-dark: #121212;

	position: relative;
	z-index: 2;
	width: auto;

	/* Written by himpel-bleed.js when a theme container holds this section. */
	margin-left: var(--himpel-bleed-l, 0px);
	margin-right: var(--himpel-bleed-r, 0px);

	background-color: var(--hf4-bg, var(--himpel-white));
	box-sizing: border-box;
}

.himpel-f4 *,
.himpel-f4 *::before,
.himpel-f4 *::after {
	box-sizing: border-box;
}

.himpel-f4__inner {
	width: 100%;
	max-width: var(--hf4-max, 1340px);
	margin: 0 auto;
	padding: var(--hf4-py-d, 80px) var(--hf4-px-d, 40px);
}

/* ==========================================================================
   Top — the heading row
   --------------------------------------------------------------------------
   Two rows in one grid: the pill sits alone above, then the heading and the
   paragraph sit side by side. Declaring it as a grid rather than nesting two
   wrappers is what puts the paragraph on the heading's line while leaving the
   pill on its own.
   ========================================================================== */

.himpel-f4__head {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	column-gap: var(--hf4-gap, 60px);
	row-gap: var(--hf4-head-row, 18px);
	align-items: start;
}

/*
 * The same pill the home and about pages use, to the pixel: 8/18 padding, a
 * faint dark border, dark text at 14px, and a green dot before the words. It is
 * the one element that repeats across every section of this site, so it has to
 * be the same thing everywhere rather than a near miss.
 */
.himpel-f4__eyebrow {
	grid-column: 1;
	grid-row: 1;

	display: inline-flex;
	align-items: center;
	justify-self: start;

	margin: 0;
	padding: var(--hf4-pill-pad, 8px 18px);

	border: 1px solid var(--hf4-pill-border, rgba(18, 18, 18, 0.18));
	border-radius: 100px;

	color: var(--hf4-pill-color, var(--himpel-dark));
	font-size: var(--hf4-pill-size, 14px);
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.02em;
}

.himpel-f4__eyebrow::before {
	content: "";
	flex: 0 0 auto;
	width: 7px;
	height: 7px;
	margin-right: 9px;
	border-radius: 50%;
	background-color: var(--himpel-primary);
}

.himpel-f4__title {
	grid-column: 1;
	grid-row: 2;

	margin: 0;
	color: var(--hf4-title-color, var(--himpel-dark));
	font-size: var(--hf4-title-d, 34px);
	line-height: 1.2;
	letter-spacing: -0.01em;
	overflow-wrap: break-word;
}

/*
 * The paragraph starts on the heading's row rather than the pill's, so the two
 * blocks of text line up with each other instead of with the label above them.
 */
.himpel-f4__desc {
	grid-column: 2;
	grid-row: 2;

	color: var(--hf4-text-color, #4f5a55);
	font-size: var(--hf4-text-size, 15px);
	line-height: 1.75;
}

.himpel-f4__desc p {
	margin: 0 0 1em;
}

.himpel-f4__desc p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Bottom — the picture and the cards
   ========================================================================== */

/*
 * The cards take the wider share. Four of them carry a title and a sentence
 * each; the picture carries neither, and an even split left the words in two
 * narrow columns while the photograph had room it did nothing with.
 */
.himpel-f4__body {
	display: grid;
	grid-template-columns: minmax(0, var(--hf4-body-col, 0.62fr)) minmax(0, 1fr);
	gap: var(--hf4-body-gap, 20px);
	margin-top: var(--hf4-body-top, 44px);

	/* The cards stretch to the height the picture's ratio sets. */
	align-items: stretch;
}

/* --- The picture --- */

.himpel-f4__media {
	position: relative;
	border-radius: var(--hf4-radius, 18px);
	background-color: var(--himpel-secondary);
	overflow: hidden;

	/*
	 * Slightly taller than it is wide, because the photographs are portrait and
	 * this panel crops to fill: a landscape frame would throw away the top and
	 * bottom of every one of them.
	 *
	 * The ratio sets the row's height and the cards stretch to match it, so it
	 * is the one number that decides how tall this half of the section runs.
	 * Keep it near 1 — the earlier 0.86 made the section tower over the rest of
	 * the page and left a hand's width of air inside every card.
	 */
	aspect-ratio: var(--hf4-ratio, 0.9);
	min-height: var(--hf4-media-min, 360px);
}

/*
 * All four pictures are stacked and cross-faded. They are in the DOM from the
 * start, so pointing at a card swaps the picture immediately rather than
 * starting a download at the moment of the gesture.
 */
.himpel-f4__shot {
	position: absolute;
	inset: 0;

	opacity: 0;
	visibility: hidden;
	transition: opacity 0.5s ease, visibility 0s linear 0.5s,
		transform 6s ease-out;
	transform: scale(1.04);
}

.himpel-f4__shot.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.5s ease, visibility 0s, transform 6s ease-out;
	transform: scale(1);
}

/*
 * cover, not contain: this is a mood picture filling a panel, not a product cut
 * out on a background — letterboxing it would leave bands of colour down the
 * sides.
 *
 * The rule carries the section class twice so it outweighs WooCommerce's
 * ".woocommerce-page img { height: auto }" on a product page, which would
 * otherwise collapse a picture that has not loaded yet.
 */
.himpel-f4 .himpel-f4__shot-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;

	/*
	 * Which part of the picture survives the crop. A ceiling unit belongs at the
	 * top of its frame and a floor-standing one at the bottom, and the panel is
	 * rarely the shape the photograph was taken in — so this is set per section
	 * rather than assumed.
	 */
	object-position: var(--hf4-shot-pos, center center);
}

/* --- The cards --- */

.himpel-f4__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--hf4-card-gap, 20px);
}

.himpel-f4__card {
	display: flex;
	flex-direction: column;

	/* The number at the top, the words at the bottom, the gap between them. */
	justify-content: space-between;
	gap: var(--hf4-card-inner-gap, 22px);

	min-height: var(--hf4-card-min, 170px);
	padding: var(--hf4-card-pad, 22px);

	border: 1px solid var(--hf4-card-border, rgba(18, 18, 18, 0.1));
	border-radius: var(--hf4-radius, 18px);
	background-color: var(--himpel-white);

	text-align: left;
	cursor: pointer;
	transition: background-color 0.35s ease, border-color 0.35s ease,
		color 0.35s ease, transform 0.35s ease;

	/* The theme styles buttons; these keep the card a card. */
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none;
}

.himpel-f4__card.is-active {
	border-color: var(--himpel-primary);
	background-color: var(--himpel-primary);
	transform: translateY(-2px);
}

.himpel-f4__card:focus-visible {
	outline: 2px solid var(--himpel-primary);
	outline-offset: 3px;
}

/* --- The numbered disc --- */

.himpel-f4__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	align-self: flex-start;

	width: var(--hf4-num, 40px);
	height: var(--hf4-num, 40px);
	border-radius: 50%;

	background-color: var(--hf4-num-bg, var(--himpel-primary));
	color: var(--himpel-white);
	font-size: var(--hf4-num-size, 15px);
	font-weight: 600;
	line-height: 1;

	transition: background-color 0.35s ease, color 0.35s ease;
}

/*
 * The selected card inverts its disc: white circle, green number. Against the
 * green card that is the strongest mark on the row, which is what the selected
 * one should carry.
 */
.himpel-f4__card.is-active .himpel-f4__num {
	background-color: var(--hf4-num-bg-active, var(--himpel-white));
	color: var(--hf4-num-color-active, var(--himpel-primary));
}

/* --- The card's words --- */

.himpel-f4__card-body {
	display: block;
}

.himpel-f4__card-title {
	display: block;
	margin: 0 0 8px;

	color: var(--hf4-title-color, var(--himpel-dark));
	font-size: var(--hf4-card-title, 17px);
	font-weight: 600;
	line-height: 1.3;

	transition: color 0.35s ease;
}

.himpel-f4__card-desc {
	display: block;
	color: var(--hf4-text-color, #4f5a55);
	font-size: var(--hf4-card-desc, 14px);
	line-height: 1.6;

	transition: color 0.35s ease;
}

.himpel-f4__card.is-active .himpel-f4__card-title,
.himpel-f4__card.is-active .himpel-f4__card-desc {
	color: var(--himpel-white);
}

/* ==========================================================================
   Animation
   ========================================================================== */

.himpel-f4.is-revealing .himpel-f4__eyebrow,
.himpel-f4.is-revealing .himpel-f4__title,
.himpel-f4.is-revealing .himpel-f4__desc,
.himpel-f4.is-revealing .himpel-f4__media,
.himpel-f4.is-revealing .himpel-f4__card {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.himpel-f4.is-revealing .himpel-f4__eyebrow,
	.himpel-f4.is-revealing .himpel-f4__title,
	.himpel-f4.is-revealing .himpel-f4__desc,
	.himpel-f4.is-revealing .himpel-f4__media,
	.himpel-f4.is-revealing .himpel-f4__card {
		opacity: 1;
	}

	.himpel-f4__shot,
	.himpel-f4__shot.is-active {
		transition: opacity 0.2s ease;
		transform: none;
	}
}

/* Only ever seen by an editor. */
.himpel-f4__notice {
	margin: 0;
	padding: 16px 20px;
	border: 1px dashed #b9c2bd;
	border-radius: 8px;
	background-color: #f6f7f5;
	color: #55605a;
	font-size: 14px;
	line-height: 1.5;
}

/* ==========================================================================
   Responsive — breakpoints mirror Elementor's defaults
   ========================================================================== */

/* --- Tablet: up to 1024px --- */
@media (max-width: 1024px) {
	.himpel-f4__inner {
		padding: var(--hf4-py-t, 60px) var(--hf4-px-t, 20px);
	}

	.himpel-f4__head {
		column-gap: var(--hf4-gap-t, 36px);
	}

	.himpel-f4__title {
		font-size: var(--hf4-title-t, 28px);
	}

	/*
	 * The picture moves above the cards and takes the full width. Beside them
	 * at this size it would be a narrow slot, and the cards would be narrower
	 * still — two columns of cramped text instead of one clear row.
	 */
	.himpel-f4__body {
		grid-template-columns: minmax(0, 1fr);
	}

	/*
	 * Stacked above the cards here, and full width, so the frame is landscape
	 * again — but not as wide as it was: a portrait photograph in a 1.6 frame
	 * shows little more than a band across its middle.
	 */
	.himpel-f4__media {
		min-height: 0;
		aspect-ratio: var(--hf4-ratio-t, 1.25);
	}

	.himpel-f4__card {
		min-height: var(--hf4-card-min-t, 150px);
		gap: var(--hf4-card-inner-gap-t, 20px);
	}
}

/* --- Mobile: up to 767px --- */
@media (max-width: 767px) {
	.himpel-f4__inner {
		padding: var(--hf4-py-m, 40px) var(--hf4-px-m, 15px);
	}

	/* One column throughout: the heading, the paragraph, then the cards. */
	.himpel-f4__head {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 14px;
	}

	.himpel-f4__eyebrow,
	.himpel-f4__title,
	.himpel-f4__desc {
		grid-column: 1;
	}

	.himpel-f4__eyebrow {
		grid-row: 1;
	}

	.himpel-f4__title {
		grid-row: 2;
		font-size: var(--hf4-title-m, 24px);
	}

	.himpel-f4__desc {
		grid-row: 3;
	}

	.himpel-f4__body {
		gap: 14px;
		margin-top: var(--hf4-body-top-m, 28px);
	}

	/* Portrait on a phone, where the screen has height to spare and width is
	   the scarce thing. */
	.himpel-f4__media {
		aspect-ratio: var(--hf4-ratio-m, 0.9);
	}

	/*
	 * One card per row. Two would leave each title and its sentence about 150px
	 * wide, which breaks every line in the wrong place.
	 */
	.himpel-f4__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
	}

	.himpel-f4__card {
		min-height: 0;
		gap: 18px;
		padding: var(--hf4-card-pad-m, 20px);
	}

	.himpel-f4__num {
		--hf4-num: 36px;
	}
}
