/* Ported from the Next.js app's matrix.module.css. */
.matrix__wrap {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

/*
 * position: relative is load bearing, not decoration.
 *
 * Each cell carries a visually hidden span, and the hidden pattern is `position:
 * absolute`. Without a positioned ancestor its containing block is the page itself, so
 * those spans escaped this scroll container, sat at their static position out past the
 * right edge of a wide table, and made the whole document scroll sideways at phone width.
 * The table is allowed to scroll; the page is not.
 */
.matrix__scroll {
	position: relative;
	overflow-x: auto;
	border: var(--border-1) solid var(--border-default);
	border-radius: var(--radius-lg);
	background: var(--background-surface);
}

.matrix__table {
	border-collapse: collapse;
	width: 100%;
	font-size: var(--font-size-sm);
}

.matrix__table th,
.matrix__table td {
	padding: var(--space-2) var(--space-3);
	border-bottom: var(--border-1) solid var(--border-subtle);
	text-align: center;
	white-space: nowrap;
}

.matrix__table tbody tr:last-child th,
.matrix__table tbody tr:last-child td {
	border-bottom: 0;
}

.matrix__table thead th {
	font-weight: var(--font-weight-medium);
	color: var(--text-tertiary);
	border-bottom: var(--border-1) solid var(--border-default);
}

.matrix__corner,
.matrix__row-head {
	text-align: left;
	color: var(--text-primary);
	font-weight: var(--font-weight-medium);
}

.matrix__corner {
	color: var(--text-tertiary);
	font-weight: var(--font-weight-regular);
}

/*
 * Three states, one ink, three amounts of it: empty, half, full.
 *
 * This used to be a green dot against an amber dot, which is the single most commonly
 * confused pair there is and left the matrix saying nothing at all to a colourblind
 * reader, or on a printout. The states are a sequence, so the mark is a sequence, and
 * hue is not asked to carry anything.
 */
.matrix__dot {
	position: relative;
	display: inline-block;
	width: 13px;
	height: 13px;
	border-radius: var(--radius-full);
	border: 1.5px solid var(--text-primary);
	background: transparent;
	overflow: hidden;
	vertical-align: middle;
}

.matrix__dot[data-state='not_started'] {
	border-color: var(--text-disabled);
}

.matrix__dot[data-state='submitted'] {
	background: var(--text-primary);
}

/* Half filled, cut down the middle: the same circle, visibly part way. */
.matrix__dot[data-state='in_progress']::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to right, var(--text-primary) 0 50%, transparent 50% 100%);
}

/* A ring, concentric with the dot, never a rounded box around it. */
.matrix__dot[data-self] {
	box-shadow:
		0 0 0 2px var(--background-surface),
		0 0 0 3.5px var(--blue-gray-400);
}

/*
 * A finished reviewer, marked down the whole column.
 *
 * Quiet on purpose: this is good news, and the app is meant to be loud about what is owed
 * rather than about what is done. The tint alone would be a colour-only state, so the
 * check in the header is the thing that carries it and the shading only makes the column
 * scannable.
 */
.matrix__table th[data-done],
.matrix__table td[data-done] {
	background: var(--blue-gray-50);
}

.matrix__table thead th[data-done] {
	color: var(--text-primary);
	font-weight: var(--font-weight-semibold);
}

.matrix__check {
	color: var(--green-700);
	font-weight: var(--font-weight-semibold);
}

.matrix__legend {
	display: flex;
	gap: var(--space-5);
	flex-wrap: wrap;
	margin: 0;
	font-size: var(--font-size-xs);
	color: var(--text-tertiary);
}

.matrix__legend span {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

.matrix__empty {
	color: var(--text-tertiary);
}

/*
 * The cell is the hit target, not the 13px dot inside it. A link only where the phase
 * allows reading; otherwise the same box without the affordance.
 */
.matrix__cell {
	display: grid;
	place-items: center;
	padding: var(--space-2);
	margin: calc(var(--space-2) * -1);
	border-radius: var(--radius-md);
	color: inherit;
	text-decoration: none;
}

/* The subject's name, leading to their calibration. Underlined on hover rather than
   always: twenty names underlined at once is a list of links, not a table of people. */
.matrix__subject {
	color: inherit;
	text-decoration: none;
	border-radius: var(--radius-sm);
}

.matrix__subject:hover {
	color: var(--text-link);
	text-decoration: underline;
}

.matrix__subject:focus-visible {
	outline: var(--border-2) solid var(--border-focus);
	outline-offset: 2px;
}
