/*
 * Shared Celestia icon foundation.
 *
 * This stylesheet contains only the structural icon primitive. It is loaded
 * as a dependency of blocks that actually use it and adds no JavaScript.
 */

.celestia-icon-shape {
	--celestia-icon-size: 20px;
	--celestia-icon-frame-size: 36px;
	--celestia-icon-rotation: 0deg;
	--celestia-icon-filled-glyph-color: var(--wp--preset--color--base, #fff);

	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	box-sizing: border-box;
	color: var(--celestia-icon-color, currentColor);
	line-height: 0;
	vertical-align: middle;
}

.celestia-icon-shape--bare {
	inline-size: var(--celestia-icon-size);
	block-size: var(--celestia-icon-size);
}

.celestia-icon-shape--circle,
.celestia-icon-shape--circle-filled {
	inline-size: var(--celestia-icon-frame-size);
	block-size: var(--celestia-icon-frame-size);
	border-radius: 999px;
}

.celestia-icon-shape--circle {
	border: 1px solid currentColor;
}

.celestia-icon-shape--circle-filled {
	background: currentColor;
}

.celestia-rendered-icon,
.celestia-icon-shape__glyph {
	display: inline-flex;
	inline-size: var(--celestia-icon-size);
	block-size: var(--celestia-icon-size);
	align-items: center;
	justify-content: center;
	transform: rotate(var(--celestia-icon-rotation));
	transform-origin: center;
}

.celestia-icon-shape--circle-filled .celestia-icon-shape__glyph {
	color: var(--celestia-icon-filled-glyph-color);
}

.celestia-rendered-icon svg,
.celestia-icon-shape__glyph svg {
	display: block;
	inline-size: 100%;
	block-size: 100%;
}

.wp-block-celestia-icon:is(a) {
	text-decoration: none;
}

/* Keep outline SVGs hollow even when surrounding editor styles target SVG fill. */
.celestia-rendered-icon svg[fill="none"],
.celestia-icon-shape__glyph svg[fill="none"] {
	fill: none !important;
	stroke: currentColor;
}

.celestia-rendered-icon svg[fill="currentColor"],
.celestia-icon-shape__glyph svg[fill="currentColor"],
.celestia-rendered-icon svg:not([fill]),
.celestia-icon-shape__glyph svg:not([fill]) {
	fill: currentColor;
}

