/**
 * Diamond Port Sync - product specification table (front end).
 *
 * Deliberately theme-agnostic. Colours are derived from whatever the theme has
 * already set (`currentColor` and translucent greys) rather than hard-coded, so
 * the table sits correctly on a light or a dark product page without the
 * plugin needing to know which it is. Sizes are in `em` so it scales with the
 * theme's own type scale instead of fighting it.
 *
 * Everything is scoped under `.dps-specs`, and the selectors are specific
 * enough to beat a theme's generic `table {}` rules without resorting to
 * !important.
 */

.dps-specs {
	margin: 1.5em 0;
	clear: both;
}

.dps-specs-title {
	margin: 0 0 0.65em;
	padding: 0;
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.65;
}

/* The frame carries the border and radius. Doing it on the table itself
 * doesn't clip reliably across browsers once border-collapse is involved. */
.dps-specs .dps-specs-frame {
	border: 1px solid rgba(128, 128, 128, 0.24);
	border-radius: 6px;
	overflow: hidden;
	background: transparent;
}

.dps-specs .dps-specs-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 0.875em;
	line-height: 1.5;
	background: transparent;
	table-layout: fixed;
}

.dps-specs .dps-specs-table tbody {
	border: 0;
}

.dps-specs .dps-specs-table tr {
	border: 0;
	background: transparent;
}

/* Zebra striping reads better than row borders alone on a spec sheet, and
 * survives themes that strip table borders entirely. */
.dps-specs .dps-specs-table tr:nth-child(odd) {
	background: rgba(128, 128, 128, 0.055);
}

.dps-specs .dps-specs-table th,
.dps-specs .dps-specs-table td {
	padding: 0.6em 0.9em;
	margin: 0;
	border: 0;
	border-bottom: 1px solid rgba(128, 128, 128, 0.14);
	text-align: left;
	vertical-align: top;
	background: transparent;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.dps-specs .dps-specs-table tr:last-child th,
.dps-specs .dps-specs-table tr:last-child td {
	border-bottom: 0;
}

.dps-specs .dps-specs-table th.dps-specs-key {
	width: 44%;
	font-weight: 500;
	opacity: 0.72;
	text-transform: none;
	letter-spacing: 0;
}

.dps-specs .dps-specs-table td.dps-specs-val {
	font-weight: 600;
}

/* Item codes are reference data, not prose - a touch of tracking and a
 * monospace-ish feel makes them easier to read back over the phone. */
.dps-specs .dps-specs-row--item_code td.dps-specs-val {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.94em;
	letter-spacing: 0.01em;
}

/* Below this width a two-column table starts wrapping every value onto three
 * lines, so stack label above value instead. */
@media (max-width: 480px) {
	.dps-specs .dps-specs-table,
	.dps-specs .dps-specs-table tbody,
	.dps-specs .dps-specs-table tr,
	.dps-specs .dps-specs-table th,
	.dps-specs .dps-specs-table td {
		display: block;
		width: auto;
	}

	.dps-specs .dps-specs-table th.dps-specs-key {
		width: auto;
		padding-bottom: 0;
		border-bottom: 0;
		font-size: 0.92em;
	}

	.dps-specs .dps-specs-table td.dps-specs-val {
		padding-top: 0.15em;
	}
}

/* The host wrapper is swapped by JS on variation change. A short fade keeps
 * the change legible rather than making the table appear to flicker. */
.dps-specs-host .dps-specs {
	animation: dps-specs-in 0.22s ease-out;
}

@keyframes dps-specs-in {
	from {
		opacity: 0;
		transform: translateY(2px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dps-specs-host .dps-specs {
		animation: none;
	}
}
