/* Specs list (docs/widgets/specs.md), in the design language (spec §3.7). This is Soft, the default:
   in the table and stacked layouts each group is a white card with a thin border and a soft shadow,
   its heading the card's title and lines between rows; in the cards layout each row is a small card.
   Labels are in the soft grey, values in ink, and "Show more" is a pale pill. Fonts come from the
   theme. specs-outline.css and specs-solid.css change only the --hafe-specs-d-* tokens and the shared
   radius and shadow, on .hafe-specs itself, so a Style control's own property always wins. */
.hafe-specs {
	--hafe-specs-d-card: var(--hafe-surface);
	--hafe-specs-d-edge: var(--hafe-line);
	--hafe-specs-d-head: transparent;
	--hafe-specs-d-head-ink: var(--hafe-ink);
	--hafe-specs-d-head-line: var(--hafe-line);
	--hafe-specs-d-head-lw: 1px;
	--hafe-specs-d-rule: var(--hafe-line);
	--hafe-specs-d-rule-w: 1px;
	--hafe-specs-d-stripe: transparent;
	--hafe-specs-d-btn: var(--hafe-tint);
	--hafe-specs-d-btn-hover: var(--hafe-tint-strong);
	--hafe-specs-d-btn-ink: var(--hafe-accent-ink);
	--hafe-specs-d-btn-line: transparent;
	--hafe-specs-d-row: transparent;
	--hafe-specs-d-row-even: var(--hafe-specs-d-stripe);
	--hafe-specs-d-yes: var(--hafe-accent-ink);
	--hafe-specs-d-yes-bg: var(--hafe-tint);
	--hafe-specs-d-yes-line: transparent;
	--hafe-specs-pad: 0.75em 1.25em;
	display: grid;
	grid-template-columns: repeat(var(--hafe-specs-columns, 1), minmax(0, 1fr));
	gap: var(--hafe-specs-group-gap, 1.5em) 2em;
	align-items: start;
	color: var(--hafe-ink);
	overflow-wrap: anywhere;
}

.hafe-specs__group {
	min-width: 0;
}

/* Table and stacked: the group is a card. It clips its rows and heading to its corners. */
.hafe-specs:not(.hafe-specs--cards) .hafe-specs__group {
	overflow: clip;
	border: 1px solid var(--hafe-specs-card-border, var(--hafe-specs-d-edge));
	border-radius: var(--hafe-specs-card-radius, var(--hafe-radius));
	background: var(--hafe-specs-card-bg, var(--hafe-specs-d-card));
	box-shadow: var(--hafe-shadow);
}

/* The tag says what a heading is to the page, and themes size tags very differently, so its size
   follows the text around it until the Style tab says otherwise. */
.hafe-specs .hafe-specs__heading {
	margin: 0;
	padding: var(--hafe-specs-pad);
	border-block-end: var(--hafe-specs-d-head-lw) solid var(--hafe-specs-d-head-line);
	background: var(--hafe-specs-d-head);
	color: var(--hafe-specs-heading-color, var(--hafe-specs-d-head-ink));
	font-size: 1.05em;
	font-weight: 600;
}

.hafe-specs__list {
	margin: 0;
	padding: 0;
}

.hafe-specs__row {
	padding: var(--hafe-specs-row-padding, var(--hafe-specs-pad));
	border-radius: var(--hafe-specs-radius, 0);
	background: var(--hafe-specs-row-bg, var(--hafe-specs-d-row));
}

.hafe-specs__row:nth-child(even) {
	background: var(--hafe-specs-stripe-bg, var(--hafe-specs-row-bg, var(--hafe-specs-d-row-even)));
}

.hafe-specs__row:hover {
	background: var(--hafe-specs-row-hover-bg, var(--hafe-specs-row-bg, var(--hafe-specs-d-row)));
}

.hafe-specs__row:nth-child(even):hover {
	background: var(--hafe-specs-row-hover-bg, var(--hafe-specs-stripe-bg, var(--hafe-specs-row-bg, var(--hafe-specs-d-row-even))));
}

/* A line between rows, never above the first, so none doubles the heading's line or the card's edge. */
.hafe-specs:not(.hafe-specs--cards) .hafe-specs__row + .hafe-specs__row {
	border-block-start: var(--hafe-specs-d-rule-w) solid var(--hafe-specs-divider, var(--hafe-specs-d-rule));
}

.hafe-specs__label,
.hafe-specs__value {
	margin: 0;
}

/* Themes set terms in bold, which would weigh the label over its value. */
.hafe-specs__label {
	display: flex;
	align-items: center;
	gap: 0.5em;
	color: var(--hafe-specs-label-color, var(--hafe-ink-soft));
	font-weight: inherit;
}

.hafe-specs__value {
	color: var(--hafe-specs-value-color, var(--hafe-ink));
	font-weight: 500;
}

.hafe-specs__note {
	display: block;
	color: var(--hafe-specs-note-color, var(--hafe-ink-soft));
	font-size: 0.875em;
	font-weight: 400;
}

.hafe-specs__icon {
	display: inline-flex;
	flex: none;
	font-size: var(--hafe-specs-icon-size, 1em);
	color: var(--hafe-specs-icon-color, var(--hafe-accent-ink));
}

.hafe-specs__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Yes and no: a check in a circle (its border is always there, so designs never change its size),
   and a quieter cross. The word is read out when the mark stands alone. */
.hafe-specs__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 1.4em;
	block-size: 1.4em;
	margin-inline-end: 0.4em;
	border: 1px solid var(--hafe-specs-d-yes-line);
	border-radius: 50%;
	background: var(--hafe-specs-yes-bg, var(--hafe-specs-d-yes-bg));
	color: var(--hafe-specs-yes-color, var(--hafe-specs-d-yes));
	vertical-align: -0.35em;
}

.hafe-specs__mark svg {
	width: 0.95em;
	height: 0.95em;
}

/* Next to text, the mark takes a column so wrapped lines and the note hang beside it, and the row
   lines up on the text's baseline. */
.hafe-specs__value--marked {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 0.4em;
}

.hafe-specs__value--marked .hafe-specs__mark {
	margin: 0.05em 0 0;
}

.hafe-specs__value--marked .hafe-specs__text {
	align-self: baseline;
}

.hafe-specs__value--marked .hafe-specs__note {
	grid-column: 2;
}

.hafe-specs .hafe-specs__mark--no {
	border-color: transparent;
	background: none;
	color: var(--hafe-specs-no-color, var(--hafe-ink-soft));
}

.hafe-specs__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Links are always underlined: next to plain text, colour alone doesn't show them (WCAG 1.4.1).
   The class is doubled to beat themes' and kits' link colours. */
.hafe-specs .hafe-specs__link {
	color: var(--hafe-specs-link-color, inherit);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.hafe-specs .hafe-specs__link:hover {
	color: var(--hafe-specs-link-hover-color, var(--hafe-accent-ink));
}

/* Table: label and value side by side. By default the label column never drops below 7.5em, or half
   the row where that's less, so on phones a label and its icon keep whole words ("Charging" broke
   mid-word at 40%, found in the bar check). A width set in the Style tab is used as it is. */
.hafe-specs--table .hafe-specs__row {
	display: grid;
	grid-template-columns: var(--hafe-specs-label-width, max(40%, min(7.5em, 50%))) minmax(0, 1fr);
	gap: 1em;
	align-items: baseline;
}

.hafe-specs--table .hafe-specs__label {
	align-self: start;
}

/* Stacked: the value under its label. */
.hafe-specs--list .hafe-specs__value {
	margin-block-start: 0.15em;
}

/* Cards: one small card per row; the group's heading sits above them, on the page. */
.hafe-specs--cards .hafe-specs__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10em, 1fr));
	gap: var(--hafe-specs-card-gap, 0.75em);
}

.hafe-specs.hafe-specs--cards .hafe-specs__heading {
	margin-block-end: 0.6em;
	padding: 0;
	border: 0;
	background: none;
	color: var(--hafe-specs-heading-color, var(--hafe-ink));
}

.hafe-specs--cards .hafe-specs__row {
	--hafe-specs-d-row: var(--hafe-specs-card-bg, var(--hafe-specs-d-card));
	--hafe-specs-d-row-even: var(--hafe-specs-d-row);
	padding: var(--hafe-specs-row-padding, 0.85em 1em);
	border: 1px solid var(--hafe-specs-card-border, var(--hafe-specs-d-edge));
	border-radius: var(--hafe-specs-radius, var(--hafe-specs-card-radius, var(--hafe-radius-sm)));
	box-shadow: var(--hafe-shadow);
}

.hafe-specs--cards .hafe-specs__label {
	font-size: 0.875em;
}

.hafe-specs--cards .hafe-specs__value {
	margin-block-start: 0.25em;
	font-size: 1.25em;
	font-weight: 600;
}

.hafe-specs--cards .hafe-specs__note {
	font-size: 0.7em;
}

/* "Show more": the script collapses the list; without it, and in print, everything shows. */
@media screen {
	.hafe-specs.is-collapsed .hafe-specs__row--extra,
	.hafe-specs.is-collapsed .hafe-specs__group--extra {
		display: none;
	}
}

/* A pill button. The class is doubled to beat themes' and kits' button styles. */
.hafe-specs .hafe-specs__more.hafe-specs__more {
	grid-column: 1 / -1;
	justify-self: start;
	margin: 0;
	padding: 0.45em 1.1em;
	border: 1px solid var(--hafe-specs-d-btn-line);
	border-radius: var(--hafe-pill);
	background: var(--hafe-specs-more-bg, var(--hafe-specs-d-btn));
	box-shadow: none;
	color: var(--hafe-specs-more-color, var(--hafe-specs-d-btn-ink));
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s;
}

.hafe-specs .hafe-specs__more.hafe-specs__more:hover {
	background: var(--hafe-specs-more-bg, var(--hafe-specs-d-btn-hover));
}

/* Stated here too: some packs take the outline off every focused button, site-wide. */
.hafe-specs .hafe-specs__more.hafe-specs__more:focus-visible {
	outline: 2px solid var(--hafe-accent);
	outline-offset: 2px;
}

.hafe-specs .hafe-specs__more[hidden] {
	display: none;
}

.hafe-empty {
	margin: 0;
	padding: 1em;
	border: 1px dashed currentColor;
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.hafe-specs .hafe-specs__more.hafe-specs__more {
		transition: none;
	}
}

@media print {
	.hafe-specs .hafe-specs__more.hafe-specs__more {
		display: none;
	}

	.hafe-specs__row {
		break-inside: avoid;
	}
}
