/*
 * CSSA Members — front-end components.
 * Palette drawn from the site itself: cream paper, navy ink, slate secondary.
 * Headings inherit the theme's serif; this sheet only sets scale and casing.
 */

.cssa-members-dashboard,
.cssa-members-form,
.cssa-notice {
	--cssam-paper: #faf6ef;
	--cssam-card: #fffdf8;
	--cssam-ink: #14263c;
	--cssam-slate: #51637a;
	--cssam-line: #e4dccc;
	--cssam-band: #f3ecdd;
	--cssam-stripe: #f8f3e9;
}

/* ── Page gutter ─────────────────────────────────────────────────────────
 * Astra's full-width "page builder" layout removes all side padding, so the
 * title and content would touch the screen edge. This stylesheet only loads
 * on the three member pages, so the fix stays scoped to them.
 */

body.ast-page-builder-template .ast-article-single > .entry-header,
body.ast-page-builder-template .ast-article-single > .entry-content {
	max-width: 1600px;
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 40px);
}

/* ── Top bar ─────────────────────────────────────────────────────────── */

.cssa-members-topbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	justify-content: space-between;
	align-items: baseline;
	border-top: 1px solid var(--cssam-line);
	border-bottom: 1px solid var(--cssam-line);
	padding: 0.65rem 0;
	margin: 0 0 2.25rem;
}

.cssa-members-welcome {
	color: var(--cssam-slate);
	font-size: 0.95rem;
}

.cssa-members-signout {
	font-size: 0.75rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cssam-ink);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 1px;
}

.cssa-members-signout:hover {
	color: var(--cssam-slate);
}

/* ── Sections ────────────────────────────────────────────────────────── */

.cssa-members-dashboard .cssa-members-doc {
	margin: 0 0 3rem;
}

.cssa-members-dashboard .cssa-members-doc h2 {
	font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.8rem);
	line-height: 1.2;
	margin: 0 0 1rem;
}

/* ── Download cards ──────────────────────────────────────────────────── */

.cssa-doc-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.cssa-doc-card {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	background: var(--cssam-card);
	border: 1px solid var(--cssam-line);
	padding: 1.15rem 1.25rem 1.3rem;
}

.cssa-doc-kind {
	font-size: 0.66rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--cssam-slate);
}

.cssa-members-dashboard .cssa-doc-card h2 {
	font-size: 1.2rem;
	line-height: 1.3;
	margin: 0 0 0.35rem;
}

.cssa-members-download {
	margin-top: auto;
	align-self: flex-start;
	background: var(--cssam-ink);
	color: #fff;
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 0.6rem 1.2rem;
	transition: background-color 0.15s ease;
}

.cssa-members-download:hover {
	background: var(--cssam-slate);
	color: #fff;
}

.cssa-members-download:focus-visible,
.cssa-members-signout:focus-visible {
	outline: 2px solid var(--cssam-ink);
	outline-offset: 2px;
}

/* ── The register (sheet table) ──────────────────────────────────────── */

.cssa-members-find {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4rem 0.9rem;
	margin-bottom: 0.9rem;
}

.cssa-members-find label {
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--cssam-slate);
}

/* Specific enough to beat the theme's own input[type="text"] rules. */
.cssa-members-dashboard .cssa-members-find input[type="text"] {
	flex: 0 1 22rem;
	min-width: 12rem;
	box-sizing: border-box;
	padding: 0.7rem 1rem;
	font: inherit;
	color: var(--cssam-ink);
	background: var(--cssam-card);
	border: 1px solid var(--cssam-line);
	border-radius: 0;
}

.cssa-members-dashboard .cssa-members-find input[type="text"]:focus-visible {
	outline: 2px solid var(--cssam-ink);
	outline-offset: 2px;
}

.cssa-find-status {
	font-size: 0.82rem;
	color: var(--cssam-slate);
}

.cssa-members-table tbody tr.cssa-row-found td {
	background: #f1e2b4;
	box-shadow: inset 0 1px 0 var(--cssam-ink), inset 0 -1px 0 var(--cssam-ink);
}

.cssa-members-table-wrap {
	background: var(--cssam-card);
	border: 1px solid var(--cssam-line);
	max-height: 72vh;
	overflow: auto;
}

.cssa-members-table {
	border-collapse: collapse;
	width: 100%;
	font-size: 0.88rem;
	font-variant-numeric: tabular-nums;
}

.cssa-members-table th,
.cssa-members-table td {
	white-space: nowrap;
	text-align: left;
	padding: 0.5rem 0.9rem;
	border-bottom: 1px solid var(--cssam-line);
	border-right: 1px solid var(--cssam-line);
}

.cssa-members-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--cssam-band);
	color: var(--cssam-ink);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--cssam-ink);
}

.cssa-members-table tbody tr:nth-child(even) td {
	background: var(--cssam-stripe);
}

.cssa-members-table tbody tr:hover td {
	background: var(--cssam-band);
}

/* Section dividers ("ALBERTA - Regional Director") */
.cssa-members-table .cssa-row-group th {
	background: var(--cssam-paper);
	color: var(--cssam-slate);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	padding-top: 1.1rem;
	border-bottom: 1px solid var(--cssam-slate);
}

.cssa-members-table a {
	color: var(--cssam-ink);
	text-decoration: underline;
	text-decoration-color: var(--cssam-line);
	text-underline-offset: 3px;
}

.cssa-members-table a:hover {
	text-decoration-color: currentColor;
}

.cssa-members-table a:focus-visible {
	outline: 2px solid var(--cssam-ink);
	outline-offset: 2px;
}

/*
 * Phones and tablets: each member becomes a card of labelled fields. A
 * dozen columns cannot fit a handheld screen, and a sideways-scrolling grid
 * loses track of whose row you're on. No inner scroll box either — on touch,
 * a nested scroller traps the swipe meant for the page.
 */
@media (max-width: 1023.98px) {
	.cssa-members-table-wrap {
		max-height: none;
		overflow: visible;
		background: none;
		border: 0;
	}

	.cssa-members-table,
	.cssa-members-table tbody,
	.cssa-members-table tr,
	.cssa-members-table td {
		display: block;
		width: auto;
	}

	/* Themes (Astra included) border every table cell; cards draw their own. */
	.cssa-members-table,
	.cssa-members-table th,
	.cssa-members-table td {
		border: 0;
	}

	.cssa-members-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.cssa-members-table tbody {
		display: grid;
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.cssa-members-table tbody tr {
		background: var(--cssam-card);
		border: 1px solid var(--cssam-line);
		padding: 0.9rem 1rem 0.7rem;
	}

	.cssa-members-table tbody tr:nth-child(even) td,
	.cssa-members-table tbody tr:hover td {
		background: none;
	}

	/* Found member: highlight the whole card. */
	.cssa-members-table tbody tr.cssa-row-found {
		background: #f1e2b4;
		border-color: var(--cssam-ink);
	}

	.cssa-members-table tbody tr.cssa-row-found td {
		background: none;
		box-shadow: none;
	}

	.cssa-members-table td {
		display: grid;
		grid-template-columns: minmax(6.5rem, 34%) 1fr;
		gap: 0.75rem;
		align-items: baseline;
		white-space: normal;
		overflow-wrap: anywhere;
		padding: 0.3rem 0;
		border: 0;
	}

	.cssa-members-table td::before {
		content: attr(data-label);
		font-size: 0.66rem;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--cssam-slate);
	}

	.cssa-members-table td:empty {
		display: none;
	}

	/* The first column (surname) is the card's title. */
	.cssa-members-table td:first-child {
		display: block;
		font-size: 1.05rem;
		font-weight: 600;
		color: var(--cssam-ink);
		padding: 0 0 0.45rem;
		margin-bottom: 0.35rem;
		border-bottom: 1px solid var(--cssam-line);
	}

	.cssa-members-table td:first-child::before {
		content: none;
	}

	/* Comfortable tap targets for phone, email and website links. */
	.cssa-members-table td a {
		display: inline-block;
		padding-block: 0.2rem;
	}

	.cssa-members-table tbody tr.cssa-row-group {
		grid-column: 1 / -1;
		background: none;
		border: 0;
		padding: 0;
	}

	.cssa-members-table .cssa-row-group th {
		display: block;
		white-space: normal;
		background: none;
		border-bottom: 1px solid var(--cssam-slate);
		padding: 1rem 0 0.4rem;
	}

	.cssa-members-table tbody tr.cssa-row-group:first-child th {
		padding-top: 0;
	}
}

/* Tablets: two member cards per row. */
@media (min-width: 640px) and (max-width: 1023.98px) {
	.cssa-members-table tbody {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ── Forms (login / registration) ────────────────────────────────────── */

.cssa-members-form {
	max-width: 28rem;
}

.cssa-members-form input[type="text"],
.cssa-members-form input[type="email"],
.cssa-members-form input[type="password"] {
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--cssam-line);
	background: var(--cssam-card);
	color: var(--cssam-ink);
}

.cssa-members-form input:focus-visible {
	outline: 2px solid var(--cssam-ink);
	outline-offset: 1px;
}

.cssa-members-form button[type="submit"],
.cssa-members-form input[type="submit"] {
	background: var(--cssam-ink);
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	padding: 0.65rem 1.4rem;
	transition: background-color 0.15s ease;
}

.cssa-members-form button[type="submit"]:hover,
.cssa-members-form input[type="submit"]:hover {
	background: var(--cssam-slate);
}

.cssa-hp {
	position: absolute;
	left: -9999px;
}

/* ── Notices ─────────────────────────────────────────────────────────── */

.cssa-notice {
	padding: 0.75rem 1rem;
	margin: 0 0 1rem;
	border-left: 3px solid var(--cssam-slate);
	background: var(--cssam-band);
	color: var(--cssam-ink);
}

.cssa-notice-success {
	border-color: #2e6b3f;
}

.cssa-notice-error {
	border-color: #9c2f2f;
}

/* ── Accessibility ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.cssa-members-dashboard *,
	.cssa-members-form * {
		transition: none !important;
	}
}
