/* Advanced Counter Widget — structural layout only. All visuals come from Elementor controls. */

/* Responsive column grid of counter items. The var() fallbacks are load-bearing:
   pages saved before 1.1.0 have cached Elementor CSS that declares none of these.
   Note: `.acw-counter` (item) never matches `.acw-counters` (container) — class
   selectors match whole tokens. */
.acw-counters {
	--acw-div-width: 1px;
	--acw-div-style: solid;
	--acw-div-color: #e5e7eb;
	--acw-divider: 0;
	--acw-divider-overflow: visible;
	display: grid;
	grid-template-columns: repeat(var(--acw-cols, 3), minmax(0, 1fr));
	column-gap: var(--acw-gap-x, 24px);
	row-gap: var(--acw-gap-y, 24px);
	height: 100%;
	overflow: var(--acw-divider-overflow, visible);
}
.acw-counter {
	min-width: 0;
	/* Unconditional on purpose: driven by a variable it would fall back to
	   static on pages with stale cached CSS and the dividers would fly to the
	   section edges. */
	position: relative;
	--acw-direction: row;
	--acw-text-align: start;
	--acw-justify: flex-start;
	--acw-icon-valign: center;
	--acw-icon-gap: 12px;
	--acw-content-gap: 4px;
	--acw-number-gap: 0px;
	display: flex;
	flex-direction: var(--acw-direction);
	align-items: stretch;
	gap: var(--acw-icon-gap);
	text-align: var(--acw-text-align);
	box-sizing: border-box;
	height: 100%;
}
a.acw-counter,
a.acw-counter:hover,
a.acw-counter:focus {
	color: inherit;
	text-decoration: none;
}
/* Second selector covers Elementor's Optimized Markup experiment, where
   .elementor-widget-container does not exist. */
.elementor-widget-acw-advanced-counter > .elementor-widget-container,
.elementor-widget-acw-advanced-counter > .acw-counters {
	height: 100%;
}
.acw-icon-wrap {
	display: flex;
	flex: 0 0 auto;
	justify-content: var(--acw-justify);
	align-items: var(--acw-icon-valign);
}
.acw-icon {
	display: inline-flex;
	line-height: 1;
}
.acw-icon svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}
.acw-content {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	gap: var(--acw-content-gap);
}
.acw-title,
.acw-unit,
.acw-description,
.acw-description p {
	margin: 0;
}
.acw-number-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: var(--acw-justify);
	gap: var(--acw-number-gap);
	font-variant-numeric: tabular-nums;
	/* Hug prefix + number + suffix so a Number background reads as a pill
	   rather than a band across the whole content column. .acw-content is a
	   column flex container, so align-self reproduces the text alignment. */
	width: fit-content;
	max-width: 100%;
	align-self: var(--acw-justify, flex-start);
}

/* --- Dividers in the grid gaps -------------------------------------------
   The column count exists only as the custom property --acw-cols and
   :nth-child() cannot read a variable, so EVERY item draws a line on its
   inline-start side and above itself, and the container clips whatever falls
   outside it — which is exactly the first column's and the first row's lines.
   With one column every vertical line becomes a first-column line and is
   clipped, leaving only the horizontal ones.

   HARD CONSTRAINT: .acw-counters must never get padding. Clipping happens at
   the padding box, so any padding would reveal the first-column and first-row
   lines inside the padding band.
   KNOWN LIMITS: the grid gaps must stay in px/em (a % gap resolves against the
   container while the inset resolves against the item, so the line would
   misplace), and a thick Box border shifts the line inward by its own width
   because the containing block is the item's padding box. */
.acw-counter::before,
.acw-counter::after {
	content: "";
	position: absolute;
	/* The pseudo-elements belong to the <a> variant's hit area; without this
	   the gap between cards becomes clickable and triggers link hover. */
	pointer-events: none;
	border: 0 var(--acw-div-style, solid) var(--acw-div-color, #e5e7eb);
}
/* Vertical line centred in the column gap before the item. min() keeps the
   line fully outside the item when the gap is thinner than the line, so the
   first column never shows a clipped stub. */
.acw-counter::before {
	inset-block: calc(var(--acw-gap-y, 24px) / -2);
	inset-inline-start: min(
		calc((var(--acw-gap-x, 24px) + var(--acw-div-width, 1px)) / -2),
		calc(var(--acw-div-width, 1px) * -1)
	);
	border-inline-start: var(--acw-divider);
}
/* Horizontal line centred in the row gap above the item. It reaches half the
   column gap on each side so the lines of one row meet and read as one rule. */
.acw-counter::after {
	inset-inline: calc(var(--acw-gap-x, 24px) / -2);
	inset-block-start: min(
		calc((var(--acw-gap-y, 24px) + var(--acw-div-width, 1px)) / -2),
		calc(var(--acw-div-width, 1px) * -1)
	);
	border-block-start: var(--acw-divider);
}
