/*
 * March AC Records
 *
 * Same palette as the membership and relay plugins: theme colours where the
 * theme provides them, the site's own values as fallbacks, so this looks like
 * the rest of the site rather than a plugin bolted on.
 *
 * The table is the point of this file. Two hundred rows have to stay readable
 * on a phone and print on one sheet for the club notice board, which rules out
 * anything that only works while JavaScript is running.
 */

.macrec {
	--macrec-ink: var(--wp--preset--color--ink, #0e1424);
	--macrec-navy: var(--wp--preset--color--navy, #1f3864);
	--macrec-accent: var(--wp--preset--color--accent, #1428e0);
	--macrec-border: var(--wp--preset--color--border, #dde2ee);
	--macrec-muted: var(--wp--preset--color--muted, #55607a);
	--macrec-surface: var(--wp--preset--color--surface, #ffffff);
	--macrec-tint: var(--wp--preset--color--tint, #f4f6fb);
	--macrec-gold: var(--wp--preset--color--gold, #8a6d1f);
	--macrec-alert: var(--wp--preset--color--alert, #a4142f);
	--macrec-ok: var(--wp--preset--color--success, #0f7a4a);

	color: var(--macrec-ink);
}

/* ---------------------------------------------------------- the records -- */

.macrec-heads {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 1rem;
	margin-bottom: 1.6rem;
}

.macrec-head {
	border: 1px solid var(--macrec-border);
	border-top: 3px solid var(--macrec-gold);
	border-radius: 6px;
	padding: 1rem 1.2rem;
	background: var(--macrec-surface);
}

.macrec-head__label {
	margin: 0;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--macrec-muted);
}

.macrec-head__time {
	margin: 0.2rem 0 0;
	font-size: 2rem;
	line-height: 1.1;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--macrec-navy);
}

.macrec-head__who {
	margin: 0.2rem 0 0;
	font-size: 0.95rem;
	color: var(--macrec-muted);
}

.macrec-intro {
	margin-bottom: 1.2rem;
	color: var(--macrec-muted);
}

/* ------------------------------------------------------------ the table -- */

.macrec-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.macrec-table th,
.macrec-table td {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--macrec-border);
	text-align: left;
	vertical-align: baseline;
}

.macrec-table thead th {
	position: sticky;
	top: 0;
	background: var(--macrec-surface);
	border-bottom: 2px solid var(--macrec-navy);
	font-size: 0.8rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--macrec-navy);
}

.macrec-table tbody tr:nth-child(even) {
	background: var(--macrec-tint);
}

/* Numbers line up only if they are monospaced to each other and right-aligned.
   Without this a 200-row list of times is unreadable. */
.macrec-num {
	text-align: right !important;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.macrec-time {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.macrec-who {
	font-weight: 500;
}

.macrec-cat {
	color: var(--macrec-muted);
	font-size: 0.9em;
}

.macrec-also {
	display: block;
	font-size: 0.82em;
	font-weight: 400;
	color: var(--macrec-muted);
}

.macrec-star {
	color: var(--macrec-alert);
	font-weight: 700;
	text-decoration: none;
	border: 0;
	cursor: help;
}

.macrec-foot {
	margin-top: 1rem;
	font-size: 0.88rem;
	color: var(--macrec-muted);
}

.macrec-empty {
	color: var(--macrec-muted);
	font-style: italic;
}

@media (max-width: 36rem) {
	.macrec-table {
		font-size: 0.88rem;
	}

	.macrec-table th,
	.macrec-table td {
		padding: 0.4rem 0.35rem;
	}

	/* The category column is the one thing that can go: the position and the
	   time carry the meaning, and on a narrow screen they need the room. */
	.macrec-table .macrec-cat,
	.macrec-table thead th:last-child {
		display: none;
	}
}

@media print {
	.macrec-heads {
		break-inside: avoid;
	}

	.macrec-table thead th {
		position: static;
	}

	.macrec-table tbody tr {
		break-inside: avoid;
	}
}

/* ----------------------------------------------------------- the form ---- */

.macrec-submit {
	margin-top: 2rem;
}

.macrec-form {
	border: 1px solid var(--macrec-border);
	border-radius: 6px;
	padding: 1.2rem 1.4rem;
	background: var(--macrec-surface);
}

.macrec-field {
	margin: 0 0 1rem;
}

.macrec-field label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 600;
	color: var(--macrec-navy);
}

.macrec-field input[type="text"],
.macrec-field input[type="email"],
.macrec-field input[type="url"],
.macrec-field input[type="number"],
.macrec-field select,
.macrec-field textarea {
	width: 100%;
	max-width: 32rem;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--macrec-border);
	border-radius: 4px;
	font: inherit;
	background: var(--macrec-surface);
	color: var(--macrec-ink);
}

.macrec-field input:focus-visible,
.macrec-field select:focus-visible,
.macrec-field textarea:focus-visible {
	outline: 2px solid var(--macrec-accent);
	outline-offset: 1px;
}

.macrec-hint {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.85rem;
	color: var(--macrec-muted);
}

.macrec-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 0 1rem;
}

.macrec-fieldset {
	margin: 0 0 1.2rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--macrec-border);
	border-radius: 4px;
	background: var(--macrec-tint);
}

.macrec-fieldset legend {
	padding: 0 0.4rem;
	font-weight: 600;
	color: var(--macrec-navy);
}

.macrec-check {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
	margin-bottom: 0.4rem;
	cursor: pointer;
}

.macrec-check input {
	margin-top: 0.25rem;
	flex: none;
}

.macrec-submit-btn button {
	padding: 0.6rem 1.4rem;
	border: 0;
	border-radius: 4px;
	background: var(--macrec-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.macrec-submit-btn button:hover {
	filter: brightness(0.92);
}

.macrec-submit-btn button:focus-visible {
	outline: 2px solid var(--macrec-ink);
	outline-offset: 2px;
}

/* --------------------------------------------------------- the notices --- */

.macrec-notice {
	border: 1px solid var(--macrec-border);
	border-left-width: 4px;
	border-radius: 4px;
	padding: 0.9rem 1.1rem;
	margin-bottom: 1.2rem;
	background: var(--macrec-tint);
}

.macrec-notice h3 {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
}

.macrec-notice p:last-child {
	margin-bottom: 0;
}

.macrec-notice--ok {
	border-left-color: var(--macrec-ok);
}

.macrec-notice--error {
	border-left-color: var(--macrec-alert);
}

@media (prefers-reduced-motion: no-preference) {
	.macrec-submit-btn button {
		transition: filter 120ms ease;
	}
}
