/**
 * Front-end styles for the Componon product blocks.
 *
 * Colors and spacing come from theme.json presets so the blocks follow the
 * active design without hardcoding a palette.
 */

/* --- Technical specifications table --- */

.componon-specs__heading,
.componon-docs__heading,
.componon-compatible__heading {
	margin-block-end: var( --wp--preset--spacing--30, 1rem );
}

/*
 * The table scrolls inside its own container on narrow screens rather than
 * dropping columns: a specification the buyer cannot read is a specification
 * that is not published.
 */
.componon-specs__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.componon-specs__scroll:focus-visible {
	outline: 2px solid var( --wp--preset--color--primary, currentColor );
	outline-offset: 2px;
}

.componon-specs__table {
	width: 100%;
	min-width: 32ch;
	border-collapse: collapse;
	font-size: var( --wp--preset--font-size--small, 0.9rem );
}

.componon-specs__table th,
.componon-specs__table td {
	padding: 0.65em 0.9em;
	text-align: start;
	vertical-align: top;
	border-block-end: 1px solid var( --wp--preset--color--border, rgba( 0, 0, 0, 0.12 ) );
}

.componon-specs__table th {
	width: 40%;
	min-width: 14ch;
	font-weight: 600;
	background-color: var( --wp--preset--color--surface-alt, transparent );
}

.componon-specs__table tr:last-child th,
.componon-specs__table tr:last-child td {
	border-block-end: 0;
}

.componon-specs__value--mono {
	font-family: var( --wp--preset--font-family--mono, monospace );
	letter-spacing: 0.01em;
}

/* --- Documentation list --- */

.componon-docs__list {
	display: grid;
	gap: var( --wp--preset--spacing--20, 0.75rem );
	grid-template-columns: 1fr;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media ( min-width: 40em ) {
	.componon-docs__list {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

.componon-docs__link {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1ch;
	padding: 0.8em 1em;
	border: 1px solid var( --wp--preset--color--border, rgba( 0, 0, 0, 0.12 ) );
	border-radius: 6px;
	text-decoration: none;
}

.componon-docs__link:hover,
.componon-docs__link:focus-visible {
	border-color: var( --wp--preset--color--primary, currentColor );
}

.componon-docs__label {
	font-weight: 600;
}

.componon-docs__meta {
	flex: 0 0 auto;
	font-family: var( --wp--preset--font-family--mono, monospace );
	font-size: 0.8em;
	opacity: 0.75;
}

/* --- Editor placeholder --- */

.componon-block-placeholder {
	padding: 1.25em;
	border: 1px dashed currentColor;
	border-radius: 6px;
	opacity: 0.7;
}

.componon-block-placeholder p {
	margin-block: 0.4em 0;
	font-size: 0.9em;
}

@media ( prefers-reduced-motion: reduce ) {
	.componon-docs__link {
		transition: none;
	}
}
