/*
 * Product tools: hourly cost form, series comparison table.
 * Composes the classes of components.css (dg-field, dg-input, dg-card, dg-btn, dg-table ...)
 * and adds only what is specific to these tools. Colours come from the --dg-* tokens.
 * Mobile first: built for 375px, then 720px.
 */

.dg-cost,
.dg-sel-tablebox {
	box-sizing: border-box;
	font-size: 1rem;
	line-height: 1.5;
}

.dg-cost *,
.dg-sel-tablebox * {
	box-sizing: border-box;
}

/* components.css gives .dg-field display: grid, which would beat the hidden attribute. */
.dg-cost [hidden] {
	display: none !important;
}

.dg-cost .dg-field > label {
	font-size: 1rem;
}

.dg-cost .dg-field__error {
	font-size: 0.9375rem;
}

/* Hourly cost ------------------------------------------------------------ */

.dg-cost {
	display: grid;
	align-content: start;
	gap: var(--dg-space-4);
	padding: var(--dg-space-4);
	border: 1px solid var(--dg-line);
	border-radius: var(--dg-radius-lg);
	background: var(--dg-white);
}

@media (min-width: 720px) {
	.dg-cost {
		padding: var(--dg-space-5);
	}
}

.dg-cost__title {
	margin: 0;
	color: var(--dg-ink);
	font-size: var(--dg-fs-h3);
	font-weight: 700;
	line-height: 1.2;
}

.dg-cost p {
	margin: 0;
}

.dg-cost__fields {
	display: grid;
	gap: var(--dg-space-3);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

.dg-cost .dg-specs {
	font-size: 1rem;
}

.dg-cost__out {
	padding: var(--dg-space-4);
	border-radius: var(--dg-radius);
	background: var(--dg-bg-soft);
	box-shadow: inset 4px 0 0 var(--dg-accent);
	color: var(--dg-ink);
	font-size: var(--dg-fs-md);
}

.dg-cost__lines {
	display: grid;
	gap: var(--dg-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Series comparison table ------------------------------------------------- */

.dg-sel-tablebox {
	display: grid;
	gap: var(--dg-space-3);
}

.dg-sel-tablenote {
	margin: 0;
}

/* Few columns must not force the 640px minimum of the base table. */
.dg-sel-table {
	min-width: 0;
}

.dg-sel-table tbody th {
	position: sticky;
	inset-inline-start: 0;
	z-index: 1;
	background: var(--dg-white);
	color: var(--dg-ink);
	font-weight: 600;
	text-align: start;
}

/* On phones the model name wraps so the data columns stay in view next to the sticky first column. */
@media (max-width: 719px) {
	.dg-sel-table tbody th {
		width: 12rem;
		min-width: 9rem;
		white-space: normal;
	}
}

.dg-sel-table tbody th a {
	display: block;
	box-sizing: border-box;
	min-height: 44px;
	margin: calc(-1 * var(--dg-space-3)) calc(-1 * var(--dg-space-4));
	padding: var(--dg-space-3) var(--dg-space-4);
	color: inherit;
	text-decoration: none;
}

.dg-sel-table tbody th a:focus-visible {
	outline-offset: -2px;
}

.dg-sel-table tbody th a:hover {
	color: var(--dg-accent-hover);
	text-decoration: underline;
	text-decoration-color: var(--dg-accent);
	text-underline-offset: 4px;
}

.dg-sel-table tbody tr:hover th {
	background: var(--dg-bg-softer);
}

.dg-sel-table tbody tr.is-current th {
	background: color-mix(in srgb, var(--dg-accent) 10%, var(--dg-white));
}

.dg-sel-table .dg-table__group th {
	position: sticky;
	inset-inline-start: 0;
	background: var(--dg-bg-soft);
	color: var(--dg-ink);
	font-size: var(--dg-fs-sm);
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
}

.dg-sel-table .dg-table__group:hover {
	background: transparent;
}

.dg-sel-table .dg-na {
	color: var(--dg-muted);
}

.dg-table-wrap:focus-visible {
	outline: none;
	box-shadow: var(--dg-focus);
}
