/*
 * Entangle Records — figures: the numbers of the site, a few on a front page or all of them with a filter by period.
 *
 * Written to stand on any block theme. Nothing here names a class of a theme: colours, spacing and shape come from
 * custom properties with fallbacks — the theme's own where it has them (--color-*, --radius-control,
 * --wp--preset--spacing--*), else values derived from the colour of the text around. Override the --ef-* properties
 * (below) to restyle the whole thing at once.
 *
 *   --ef-cols     how many figures in a row where the window is wide (the block's `columns` sets it)
 *   --ef-gap      the air between figures
 *   --ef-rule     the line over a figure
 *   --ef-muted    the colour of the words under a number
 *   --ef-accent   the picture of a figure, and what can be done (the filter's button, the way to all figures)
 */

.entangle-figures {
	--ef-cols: 4;
	--ef-gap: var(--wp--preset--spacing--50, 1.5rem);
	/* The line over a figure is what parts one from the next: two pixels of the text's own colour at a quarter of
	   its strength, so it is seen on a white page and on a band alike (the owner, 18. 11.: the hairline of the
	   theme was too faint to do that). */
	--ef-rule: color-mix(in srgb, currentColor 26%, transparent);
	--ef-rule-width: 2px;
	--ef-muted: var(--color-ink-soft, color-mix(in srgb, currentColor 68%, transparent));
	--ef-accent: var(--color-brand, currentColor);
	--ef-accent-deep: var(--color-brand-deep, var(--ef-accent));
	--ef-on-accent: var(--color-on-brand, #fff);
	--ef-tint: var(--color-brand-soft, color-mix(in srgb, var(--ef-accent) 12%, transparent));
	--ef-radius-control: var(--radius-control, 0.375rem);
	/* The air under the heading: a theme names it once for every list (--entangle-head-gap). */
	--ef-head-gap: var(--entangle-head-gap, var(--wp--preset--spacing--50, 1.5rem));
	box-sizing: border-box;
	min-width: 0;
}

.entangle-figures__title {
	margin: 0 0 var(--ef-head-gap);
}

/* ===== The figures =====
   A row of them, each under a line: its picture in the accent, the number large in the face of the headings, the
   words under it small and quiet. No box and no ground of its own, so the row stands on a white page and on a band
   alike. Two in a row on a phone; the rows stand a little further apart than the figures of a row. */
.entangle-figures__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: calc(var(--ef-gap) * 1.5) var(--ef-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}
@media (min-width: 48rem) {
	.entangle-figures__list {
		grid-template-columns: repeat(min(var(--ef-cols), 3), minmax(0, 1fr));
	}
	/* Whole rows: a number of figures three do not divide stands in pairs here. */
	.entangle-figures__list--pairs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (min-width: 64rem) {
	.entangle-figures__list {
		grid-template-columns: repeat(var(--ef-cols), minmax(0, 1fr));
	}
}
.entangle-figures__item {
	display: grid;
	min-width: 0;
}
/* The figure: one element, a link as a whole where it names its list. It fills its place in the row, so the line
   over it is as long as the place and the whole of it can be pointed at. */
.entangle-figures__figure {
	display: grid;
	align-content: start;
	justify-items: start;
	gap: 0.25rem;
	min-width: 0;
	margin: 0;
	padding-top: 1.125rem;
	border-top: var(--ef-rule-width) solid var(--ef-rule);
	color: inherit;
	text-decoration: none;
}
.entangle-figures__icon {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	margin-bottom: 0.5rem;
	border-radius: 50%;
	background: var(--ef-tint);
	color: var(--ef-accent-deep);
}
.entangle-figures__icon svg {
	display: block;
	width: 1.375rem;
	height: 1.375rem;
}
.entangle-figures__number {
	font-family: var(--font-serif, inherit);
	font-size: clamp(2rem, 1.5rem + 1.8vw, 2.875rem);
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	line-height: 1.05;
}
.entangle-figures__label {
	color: var(--ef-muted);
	font-size: 0.9375rem;
	line-height: 1.4;
	text-wrap: balance;
}
/* A figure that is a link, pointed at or reached by the keyboard: no ground under it (a tint behind a number reads
   as a selection) — its line takes the accent, its picture fills with it and its number turns to it. The words stay
   as they are: one thing changes its colour, not everything. */
a.entangle-figures__figure:hover,
a.entangle-figures__figure:focus-visible {
	border-top-color: var(--ef-accent);
	background: none;
	color: inherit;
	text-decoration: none;
}
a.entangle-figures__figure:hover .entangle-figures__icon,
a.entangle-figures__figure:focus-visible .entangle-figures__icon {
	background: var(--ef-accent);
	color: var(--ef-on-accent);
}
a.entangle-figures__figure:hover .entangle-figures__number,
a.entangle-figures__figure:focus-visible .entangle-figures__number {
	color: var(--ef-accent-deep);
}
a.entangle-figures__figure:focus-visible {
	outline: 2px solid var(--ef-accent);
	outline-offset: 4px;
}
@media (prefers-reduced-motion: no-preference) {
	a.entangle-figures__figure,
	a.entangle-figures__figure .entangle-figures__icon,
	a.entangle-figures__figure .entangle-figures__number {
		transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
	}
}

/* ===== The page of all figures: groups under their headings =====
   What belongs together stands together: the heading of a group close over its figures, the groups well apart, and
   the filter — which is over all of them — further from the first group than a heading is from its own figures. */
.entangle-figures__group + .entangle-figures__group {
	margin-top: var(--wp--preset--spacing--70, 3.5rem);
}
.entangle-figures__group-title {
	margin: 0 0 1.25rem;
}

/* ===== The filter by period: two years and a button, in one row ===== */
.entangle-figures__filter {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem 1rem;
	margin: 0 0 3rem;
}
/* With a period chosen the sentence that says it stands right under the filter, and the air is under the sentence. */
.entangle-figures__filter:has(+ .entangle-figures__period) {
	margin-bottom: 1rem;
}
.entangle-figures__field {
	display: grid;
	gap: 0.375rem;
}
.entangle-figures__field-label {
	font-size: 0.875rem;
	font-weight: 600;
}
.entangle-figures__select {
	box-sizing: border-box;
	min-width: 9rem;
	min-height: 2.75rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
	border-radius: var(--ef-radius-control);
	background-color: var(--color-card, transparent);
	color: inherit;
	font: inherit;
}
.entangle-figures__submit {
	box-sizing: border-box;
	min-height: 2.75rem;
	padding: 0.4em 1.25em;
	border: 1px solid var(--ef-accent);
	border-radius: var(--ef-radius-control);
	background: var(--ef-accent);
	color: var(--ef-on-accent);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
}
.entangle-figures__submit:hover {
	border-color: var(--ef-accent-deep);
	background: var(--ef-accent-deep);
}
.entangle-figures__reset {
	align-self: center;
	margin-top: 1.375rem;
	color: var(--ef-accent-deep);
	font-size: 0.9375rem;
	font-weight: 600;
}
.entangle-figures__period {
	margin: 0 0 3rem;
	color: var(--ef-muted);
}
.entangle-figures__empty {
	margin: 0;
	color: var(--ef-muted);
}

/* ===== The way to all figures (`moreUrl`), and the heading's row (`--headed`) =====
   A line with an arrow under the figures. A block that has its heading too draws it as a small outlined button,
   and where the window has the width the button stands at the end of the heading's row, on the heading's own
   middle; in a narrow window it stays under the figures, the whole width. One link in the markup, moved by the
   grid — the same row the lists of engagements, of updates and of projects have. */
.entangle-figures__all {
	margin: var(--ef-gap) 0 0;
}
.entangle-figures__all > a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	color: var(--ef-accent-deep);
	font-weight: 600;
}
.entangle-figures__all > a::after {
	content: "\2192";
	content: "\2192" / "";
}
.entangle-figures--headed > .entangle-figures__all > a {
	display: flex;
	justify-content: center;
	box-sizing: border-box;
	min-height: 2.75rem;
	padding: 0.4em 1.125em;
	border: 1px solid var(--ef-accent);
	border-radius: var(--ef-radius-control);
	font-size: 0.9375rem;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}
@media (hover: hover) {
	.entangle-figures--headed > .entangle-figures__all > a:hover {
		background: var(--ef-tint);
	}
}
@media (min-width: 48rem) {
	.entangle-figures--headed {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		column-gap: var(--ef-gap);
	}
	.entangle-figures--headed > * {
		grid-column: 1 / -1;
	}
	.entangle-figures--headed > .entangle-figures__title {
		grid-row: 1;
		grid-column: 1;
	}
	.entangle-figures--headed > .entangle-figures__all {
		grid-row: 1;
		grid-column: 2;
		align-self: center;
		/* The heading's own air under it, so the middle of the button is the middle of the heading. */
		margin: 0 0 var(--ef-head-gap);
	}
	.entangle-figures--headed > .entangle-figures__all > a {
		display: inline-flex;
		min-height: 2.5rem;
	}
}
