/**
 * CPH Icon Grid Styles
 *
 * Grid layout for displaying icons with labels.
 * Uses CSS custom properties for flexible configuration.
 * Responsive values are controlled via inline styles from shortcode.
 *
 * @package CPH_Elements
 * @since   1.0.0
 */

/* ==========================================================================
   GRID CONTAINER
   ========================================================================== */

/* `div.` specificity (0,1,1) so the grid layout can't be clobbered by
   FontAwesome's `[class*=" icon-"]` rule (0,1,0), which matches when an
   el_class like "icon-grid" is added to the container. */
div.cph-icon-grid {
	display: grid;
	grid-template-columns: repeat(var(--columns, 5), 1fr);
	row-gap: var(--row-gap, 0px);
	width: 100%;
}

/* ==========================================================================
   GRID ITEMS
   ========================================================================== */

/* Grid cell — just the box. Layout lives on the inner element so the cell
   can wrap either an anchor (linked) or a div (static) interchangeably. */
.cph-icon-grid__item {
	box-sizing: border-box;
}

.cph-icon-grid__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end; /* Bottom align content */
	height: var(--cell-height, 175px);
	gap: var(--gap, 30px);
	padding: 10px;
	box-sizing: border-box;
	text-decoration: none;
	color: inherit;
}

/* Linked cells */
a.cph-icon-grid__inner {
	cursor: pointer;
}

a.cph-icon-grid__inner:hover,
a.cph-icon-grid__inner:focus {
	text-decoration: none;
	color: inherit;
}

/* ==========================================================================
   ICON
   ========================================================================== */

.cph-icon-grid__icon {
	max-height: var(--icon-max-height, 100px);
	width: auto;
	max-width: 100%;
	height: auto;
	object-fit: contain;
	color: var(--icon-color, #000000);
}

/* SVG icons inherit color via currentColor */
.cph-icon-grid__icon[src$=".svg"] {
	color: inherit;
}

/* Salient image override - ensure icons display properly */
.row .col .cph-icon-grid__icon {
	height: auto;
	max-height: var(--icon-max-height, 100px);
}

/* ==========================================================================
   HOVER ANIMATION — ICON ZOOM
   ========================================================================== */

.cph-icon-grid--hover-zoom .cph-icon-grid__icon {
	transition: transform 0.4s ease;
	will-change: transform;
}

.cph-icon-grid--hover-zoom .cph-icon-grid__inner:hover .cph-icon-grid__icon,
.cph-icon-grid--hover-zoom .cph-icon-grid__inner:focus .cph-icon-grid__icon {
	transform: scale(1.08);
}

/* ==========================================================================
   LABEL TEXT BLOCK
   ========================================================================== */

/* Wraps the label + sub-label so the icon↔label gap (flex `gap`) stays
   independent of the label↔sub-label spacing (`--sub-label-margin`). */
.cph-icon-grid__text {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.cph-icon-grid__label {
	font-family: var(--label-font-family, inherit);
	font-weight: var(--label-font-weight, 600);
	font-size: var(--label-font-size, 28px);
	line-height: 1.2;
	text-transform: uppercase;
	text-align: center;
	color: var(--label-color, #000000);
	letter-spacing: var(--label-letter-spacing, 0.02em);
}

/* ==========================================================================
   SUB LABEL
   ========================================================================== */

.cph-icon-grid__sublabel {
	font-family: var(--label-font-family, inherit);
	font-weight: var(--sub-label-font-weight, 600);
	font-size: var(--sub-label-font-size, 18px);
	line-height: 1.2;
	text-transform: uppercase;
	text-align: center;
	color: var(--sub-label-color, #9f7c56);
	letter-spacing: var(--sub-label-letter-spacing, 0.02em);
	margin-top: var(--sub-label-margin, 10px);
}
