/*
 * Icon-card pattern family (odd/tasks/pattern-wall-pages.md, T2).
 *
 * Opt-in structural sheet, enqueued on `enqueue_block_assets` by the shared loop in
 * functions.php, so it loads in the visitor's page AND on the editor canvas. Scoped to
 * `.cs-icon-card` only: nothing here can reach another family's markup.
 *
 * GEOMETRY LIVES HERE, per variant, and that is a correction of the first cut (measured, not
 * designed): the measured numbers used to travel as CSS custom properties inline on the blocks,
 * and THIS WordPress cannot save a custom property from block attributes — `style` with a
 * `--cs-*` key lands in the block comment and is dropped from the markup, so every badge, column
 * and heading of the registered pattern parsed as an INVALID block in the editor (measured on
 * the registered content: 3 of 5 blocks). The numbers are the same measured ones (feature doc
 * L8, evidence data/out/pattern-wall-pages/live-icon-bands.json), declared once on the card so
 * the badge, the glyph slot and the two measured margins inherit them exactly as they did when
 * they were inline. What no block attribute can express stays here too:
 *
 *   - the circle, and the badge's centering of a glyph that may be absent,
 *   - the inline variant's badge-sits-beside-the-text layout,
 *   - the 600px stack, where the measured px sizes stop fitting.
 *
 * Padding, surface, width, alignment and the row gap still travel as block attributes (they ARE
 * declarable), so a converted page keeps them editable in the block inspector.
 *
 * No positional selectors: a converted page reorders or deletes cards, and `.cs-icon-card__item`
 * must not depend on which column it is.
 */

/* --- the measured geometry, per variant -------------------------------------------------------
   panel  /haitian-creole-translator/ resource card: 110px badge, 30px padding, 50px glyph,
          15px/0 badge air, 22.4px under the title.
   step   /translation-services/ process step: 46px badge, 15px padding, 16px glyph, 22px below.
   inline /creole-translators/ item: 50px badge, 15px padding, 20px glyph, the badge 16px to the
          RIGHT of the text (the same measurement the old inline --cs-icon-card-gap carried; the
          badge margin is what paints it), 11.2px under the title.
   checks /request-a-custom-translation/ checklist item (L5/L8 of odd/tasks/legacy-rollout.md): the
          live badge is a WHITE circle of rgb(255,255,255) holding a 40x40 glyph inked #69a84f, so
          only two numbers differ from the inline shape it sits on — the glyph box and the padding
          that has to keep it inside the 50px badge (5 + 40 + 5 = 50). Everything else — layout,
          the 16px badge-to-text margin, the 11.2px under the title, the phone stack — is
          INHERITED from --inline rather than restated, so the two shapes cannot drift apart.
   The card defaults to the panel instance; the two variants override only what they measure. */
.cs-icon-card__item {
	--cs-icon-card-size: 110px;
	--cs-icon-card-pad: 30px;
	--cs-icon-card-glyph: 50px;
	--cs-icon-card-badge-margin: 15px 0;
	--cs-icon-card-title-mb: 22.4px;
}

.cs-icon-card__item--step {
	--cs-icon-card-size: 46px;
	--cs-icon-card-pad: 15px;
	--cs-icon-card-glyph: 16px;
	--cs-icon-card-badge-margin: 0 0 22px;
}

.cs-icon-card__item--inline {
	--cs-icon-card-size: 50px;
	--cs-icon-card-pad: 15px;
	--cs-icon-card-glyph: 20px;
	--cs-icon-card-badge-margin: 0 16px 0 0;
	--cs-icon-card-title-mb: 11.2px;
}

/* --- the checklist variant (L8 of odd/tasks/legacy-rollout.md): the inline shape, narrowed to the
   two numbers the live badge measures. Single-class specificity like the rule above, so it MUST
   come after it: the item carries BOTH modifiers and this rule is the only one that moves. Never
   restate what --inline already declares here — the layout, the measured margins, the air and the
   phone stack are inherited on purpose. */
.cs-icon-card__item--checks {
	--cs-icon-card-pad: 5px;
	--cs-icon-card-glyph: 40px;
}

/* --- the badge: a circle that centers a glyph, and keeps its shape when the glyph is absent ---
   The size, the inner padding and the glyph size come from the card's own custom properties
   above; the background colour is the badge block's `style.color.background` attribute. An empty
   badge is the owner's decision for the glyphs the theme does not ship (L9), and an empty
   inline-flex box still paints the measured circle. */
.cs-icon-card__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--cs-icon-card-size, 3.125rem);
	height: var(--cs-icon-card-size, 3.125rem);
	padding: var(--cs-icon-card-pad, 0);
	border-radius: 50%;
	box-sizing: border-box;
	flex: 0 0 auto;
}

/* A shipped glyph is a native core/image, so it inherits the figure's margins unless reset. The
   measured glyph box (50px / 16px / 20px) is the card's --cs-icon-card-glyph: the image carries
   no inline size of its own, because a block cannot save one it has not declared. */
.cs-icon-card__icon {
	margin: 0;
	width: auto;
	max-width: none;
	line-height: inherit;
}

.cs-icon-card__icon img {
	width: var(--cs-icon-card-glyph, 3.125rem);
	height: var(--cs-icon-card-glyph, 3.125rem);
	display: block;
}

/* --- the card --- */
.cs-icon-card__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	box-sizing: border-box;
}

/* The air is the measured --cs-icon-card-badge-margin and --cs-icon-card-title-mb declared above;
   the fallbacks are the panel instance's values, used only if a hand-edited card loses the
   family class that carries them. */
/* Two classes, not one: `.entry-content h3` carries its own `margin-block: 1.5em .5em` and a
   1.25 line-height, and a single-class selector loses to it (measured: the badge-to-title air
   came out 51px instead of the measured 15px until these rules were scoped this way). */
.cs-icon-card .cs-icon-card__item > .cs-icon-card__badge {
	margin: var(--cs-icon-card-badge-margin, 15px 0);
}

.cs-icon-card .cs-icon-card__title {
	margin-block: 0 var(--cs-icon-card-title-mb, 22.4px);
}

.cs-icon-card .cs-icon-card__text {
	margin-block: 0;
}

.cs-icon-card .cs-icon-card__action {
	margin-block: 0;
}

/* --- the panel variant: the card surface itself. Padding and #FAFAFA are the column block's own
   attributes; the sheet only keeps the surface square, as the live card is (radius 0 measured). --- */
.cs-icon-card__item--panel {
	border-radius: 0;
}

/* --- the inline variant: badge beside the text (measured on /creole-translators/, where the
   50px badge sits 16px left of a left-aligned title). The gap IS the badge margin above. --- */
.cs-icon-card__item--inline {
	flex-direction: row;
	align-items: flex-start;
	text-align: left;
}

/* --- stack: the measured px badge sizes and a 50/33% column split do not survive a phone.
   Below the theme's own 37.5rem content breakpoint every card goes full width, centered, with
   the badge back above the text — the shape the live site itself degrades to. --- */
@media (max-width: 37.5rem) {
	.cs-icon-card__row {
		flex-direction: column;
	}

	.cs-icon-card__item,
	.cs-icon-card__item--inline {
		flex-direction: column;
		align-items: center;
		text-align: center;
		width: 100%;
	}

	.cs-icon-card__item > .cs-icon-card__badge {
		margin: 0 0 1rem;
	}

	.cs-icon-card__title {
		text-align: center;
	}
}
