/*
 * Project History and Clients List (inc/blocks-clients.php, record R-115).
 *
 * Project History uses the theme's tokens. Clients List is a FAITHFUL PORT of the
 * old www.e3es.com/next/clients-list.html stylesheet, scoped under .e3-oldlist:
 * owner, 5 Nov 2026, "the point of the /clients-list/ page is to have a printable
 * list that fits on a letter-size paper so the original css and layout and header
 * are all very important." Three deliberate departures, each for WCAG AA:
 *   - the region checkboxes are visually hidden, not display:none, so a keyboard
 *     can reach them (the old page could only be used with a mouse);
 *   - the highlight green is #15803d, not #16a34a, which is 3.3:1 on white and
 *     fails for 12px text; #15803d is 5.0:1 and reads as the same green;
 *   - names that open a client page are underlined on screen (not in print), so a
 *     link is not told apart by nothing at all.
 *
 * Loaded only on pages that contain one of the blocks (inc/blocks-clients.php).
 */

/* =========================================================================
 * Project History
 * ====================================================================== */

.e3-history {
	padding: 3rem 1.25rem;
}

.e3-history [hidden] {
	display: none !important;
}

.e3-history__header {
	margin: 0 auto 2rem;
	max-width: 1000px;
	text-align: center;
}

.e3-history__intro {
	margin: 0 auto;
	max-width: 700px;
}

.e3-history__layout {
	display: grid;
	gap: 2.5rem;
	grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
	margin: 0 auto;
	max-width: 1400px;
}

@media (max-width: 900px) {
	.e3-history__layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

.e3-history__sidebar {
	align-self: start;
	background: var(--color-bg-light, #f6f8f4);
	border-radius: 12px;
	padding: 1.5rem;
}

.e3-history__control {
	border: 0;
	margin: 0 0 1.5rem;
	min-width: 0;
	padding: 0;
}

.e3-history__label {
	border-bottom: 2px solid var(--color-primary-green, #7da044);
	color: var(--color-primary-dark, #215734);
	display: block;
	font-weight: 700;
	margin: 0 0 0.6rem;
	padding-bottom: 0.3rem;
	width: 100%;
}

.e3-history__search,
.e3-history__select {
	background: #fff;
	border: 1px solid #767676;
	border-radius: 8px;
	font: inherit;
	padding: 0.6rem 0.7rem;
	width: 100%;
}

.e3-history__map {
	margin: 0 0 1rem;
}

.e3-history__map-svg {
	display: block;
	height: auto;
	overflow: visible;
	width: 100%;
}

/* States as on the /k12/ Sales Rep map (the same drawing, R-115). */
.e3-history__region {
	cursor: pointer;
	transform-box: fill-box;
	transform-origin: center;
}

.e3-history__region path {
	transition: all 0.3s ease;
}

.e3-history__region .cls-1 { fill: #2b5434; }
.e3-history__region .cls-2 { fill: #598e64; }
.e3-history__region .cls-3 { fill: #31623d; }
.e3-history__region .cls-4 { fill: #034411; }
.e3-history__region .cls-5 { fill: #5b8764; }
.e3-history__region .cls-6 { fill: #65b776; }
.e3-history__region .cls-7 { fill: #54725a; }
.e3-history__region .cls-8 { fill: #115620; }

.e3-history__map-svg.has-active .e3-history__region:not(.active) path {
	fill: #11411d;
	transition: fill 0.3s ease;
}

.e3-history__region.active {
	filter: brightness(1.2) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
	stroke: #fff;
	stroke-width: 4px;
	transform: scale(1.02);
}

.e3-history__map-svg.has-locked .e3-history__region.is-hover-under {
	filter: brightness(1.1) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
	stroke: #fff;
	stroke-width: 4px;
}

@media (prefers-reduced-motion: reduce) {
	.e3-history__region,
	.e3-history__region path {
		transition: none;
	}
}

.e3-history__range-label {
	display: block;
	font-size: 0.9rem;
	margin-top: 0.4rem;
}

.e3-history__range {
	accent-color: var(--color-primary-dark, #215734);
	width: 100%;
}

.e3-history__hint {
	font-size: 0.85rem;
	margin: 0.4rem 0 0;
}

.e3-history__check {
	align-items: center;
	cursor: pointer;
	display: flex;
	gap: 0.5rem;
	padding: 0.2rem 0;
}

.e3-history__toolbar {
	align-items: center;
	border-bottom: 2px solid #e5e5e5;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	justify-content: space-between;
	margin: 0 0 1rem;
	padding-bottom: 0.75rem;
}

.e3-history__views {
	display: flex;
}

.e3-history__view {
	background: #fff;
	border: 1px solid var(--color-primary-dark, #215734);
	color: var(--color-primary-dark, #215734);
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 0.4rem 0.8rem;
}

.e3-history__view + .e3-history__view {
	border-left: 0;
}

.e3-history__view[aria-pressed="true"] {
	background: var(--color-primary-dark, #215734);
	color: #fff;
}

.e3-history__count {
	font-weight: 600;
	margin: 0;
}

.e3-history__table-wrap {
	overflow-x: auto;
}

.e3-history__table {
	border-collapse: collapse;
	font-size: 0.95rem;
	min-width: 640px;
	width: 100%;
}

.e3-history__table th {
	background: var(--color-bg-light, #f6f8f4);
	border-bottom: 2px solid #e5e5e5;
	color: var(--color-primary-dark, #215734);
	padding: 0.5rem 0.75rem;
	text-align: left;
}

.e3-history__sort {
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	padding: 0;
}

.e3-history__sort::after {
	content: "";
	margin-left: 0.3em;
}

th[aria-sort="ascending"] .e3-history__sort::after {
	content: "▲";
	font-size: 0.75em;
}

th[aria-sort="descending"] .e3-history__sort::after {
	content: "▼";
	font-size: 0.75em;
}

.e3-history__table td {
	border-bottom: 1px solid #eee;
	padding: 0.5rem 0.75rem;
	vertical-align: middle;
}

/* Flex on a div inside the cell, not on the cell: a flex <td> stops being a table cell and its row line drifts. */
.e3-history__client {
	align-items: center;
	display: flex;
	gap: 0.75rem;
}

/* A fixed logo column, so every name starts at the same x with or without a logo. */
.e3-history__logo-box {
	align-items: center;
	display: flex;
	flex: none;
	height: 44px;
	justify-content: center;
	width: 88px;
}

.e3-history__logo {
	height: 44px;
	max-width: 88px;
	object-fit: contain;
	width: auto;
}

/*
 * A client with a public page is a link: dark green, bold, underlined. A private
 * client is plain text: regular weight, near-black, no underline, so it does not
 * read as a link (#333 on white is 12.6:1).
 */
.e3-history__name {
	color: #333;
	font-weight: 400;
}

a.e3-history__name {
	color: var(--color-primary-dark, #215734);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.e3-history__tag {
	background: #eef2ea;
	border-radius: 4px;
	color: #263826;
	display: inline-block;
	font-size: 0.8rem;
	margin: 0.1rem 0.25rem 0.1rem 0;
	padding: 0.1rem 0.45rem;
}

.e3-history__grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.e3-history__card {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 1.25rem;
}

.e3-history__card-head {
	align-items: flex-start;
	display: flex;
	gap: 0.9rem;
	margin-bottom: 0.75rem;
}

.e3-history__card-logo {
	height: 56px;
	max-width: 96px;
	object-fit: contain;
	width: auto;
}

.e3-history__card-title {
	font-size: 1.05rem;
	margin: 0 0 0.3rem;
}

.e3-history__badge {
	background: var(--color-primary-dark, #215734);
	border-radius: 999px;
	color: #fff;
	display: inline-block;
	font-size: 0.75rem;
	padding: 0.1rem 0.55rem;
}

.e3-history__card-rows {
	font-size: 0.9rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.e3-history__card-rows li {
	border-top: 1px solid #eee;
	padding: 0.4rem 0;
}

.e3-history__card-contract {
	margin-left: 0.4rem;
}

.e3-history__empty {
	background: var(--color-bg-light, #f6f8f4);
	border-radius: 12px;
	padding: 2rem;
	text-align: center;
}

.e3-history__print-key {
	display: none;
}

/* =========================================================================
 * Clients List — the old page's own stylesheet, scoped
 * ====================================================================== */

.e3-oldlist {
	--primary: #0056b3;
	--bg-color: #f8fafc;
	--card-bg: #ffffff;
	--text-main: #1e293b;
	--text-muted: #64748b;
	--border-color: #e2e8f0;
	--shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--e3-list-green: #15803d;
	background-color: var(--bg-color);
	color: var(--text-main);
	font-family: 'Outfit', sans-serif;
}

.e3-oldlist *,
.e3-oldlist *::before,
.e3-oldlist *::after {
	box-sizing: border-box;
}

.e3-oldlist .page-container {
	display: flex;
	gap: 30px;
	margin: 0 auto;
	max-width: 1800px;
	padding: 30px;
	width: 100%;
}

/* Sidebar Filters */
.e3-oldlist .filter-sidebar {
	background: var(--card-bg);
	border-radius: 16px;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	height: calc(100vh - 60px);
	padding: 24px;
	position: sticky;
	top: 30px;
	width: 300px;
}

.e3-oldlist .filter__fieldset {
	border: 0;
	display: flex;
	flex-direction: column;
	margin: 0;
	min-height: 0;
	min-width: 0;
	padding: 0;
}

.e3-oldlist .filter__header {
	border-bottom: 2px solid var(--border-color);
	display: block;
	margin-bottom: 20px;
	padding: 0 0 15px;
	width: 100%;
}

.e3-oldlist .filter__title {
	color: var(--primary);
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
}

.e3-oldlist .filter__subtitle {
	color: var(--text-muted);
	display: block;
	font-size: 0.9rem;
	margin-top: 5px;
}

.e3-oldlist .filter__list {
	flex-grow: 1;
	overflow-y: auto;
	padding-right: 10px;
}

.e3-oldlist .filter__list::-webkit-scrollbar {
	width: 6px;
}

.e3-oldlist .filter__list::-webkit-scrollbar-track {
	background: transparent;
}

.e3-oldlist .filter__list::-webkit-scrollbar-thumb {
	background-color: #cbd5e1;
	border-radius: 10px;
}

/* Custom Checkboxes */
.e3-oldlist .esc-filter {
	align-items: center;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	margin-bottom: 8px;
	padding: 12px 10px;
	position: relative;
	transition: background-color 0.2s;
}

.e3-oldlist .esc-filter:hover {
	background-color: #f1f5f9;
}

/* Hidden from sight, not from the keyboard (see the note at the top). */
.e3-oldlist .esc-filter__input {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	margin: 0;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.e3-oldlist .esc-filter:focus-within {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

.e3-oldlist .esc-filter__label {
	color: var(--text-main);
	font-size: 1.1rem;
	font-weight: 400;
	transition: all 0.2s;
	user-select: none;
}

.e3-oldlist .esc-filter__input:checked ~ .esc-filter__label {
	color: var(--e3-list-green);
	font-weight: 700;
}

/* Client Grid */
.e3-oldlist .clients-main {
	flex-grow: 1;
	min-width: 0;
}

.e3-oldlist .clients__header {
	align-items: flex-start;
	border-bottom: 2px solid var(--e3-list-green);
	display: flex;
	justify-content: flex-start;
	margin-bottom: 24px;
}

.e3-oldlist .header__title-area {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin-bottom: 10px;
	text-align: left;
}

.e3-oldlist .header__title-text {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.e3-oldlist .header-logo {
	display: block;
	height: 60px;
	width: auto;
}

.e3-oldlist .clients__title {
	color: #11411d;
	font-family: inherit;
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: normal;
	line-height: 1;
	margin: 0;
	text-transform: none;
}

.e3-oldlist .print-key {
	color: var(--e3-list-green);
	display: none;
	font-size: 10pt;
	font-weight: 700;
	margin-top: 4px;
	text-align: left;
}

.e3-oldlist .clients__back,
.e3-oldlist .clients__print {
	background: var(--card-bg);
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	color: var(--text-main);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 6px 12px;
	text-decoration: none;
}

.e3-oldlist .clients-grid {
	column-count: 6;
	column-gap: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Client Cards */
.e3-oldlist .client-card {
	break-inside: avoid;
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin: 0 0 6px;
	padding: 2px 4px;
	page-break-inside: avoid;
	transition: all 0.2s;
}

.e3-oldlist .client-card:hover {
	opacity: 0.7;
}

.e3-oldlist .client-card__name {
	color: var(--text-main);
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	transition: all 0.2s;
}

.e3-oldlist a.client-card__name {
	text-decoration: underline;
	text-decoration-color: #94a3b8;
	text-underline-offset: 2px;
}

.e3-oldlist .client-card__badge {
	color: var(--text-muted);
	font-size: 0.65rem;
}

/* Interaction States */
.e3-oldlist .clients-grid.has-active-filters .client-card.highlighted .client-card__name {
	color: var(--e3-list-green);
	font-weight: 700;
}

/* Responsive */
@media screen and (max-width: 1400px) {
	.e3-oldlist .clients-grid { column-count: 5; }
}

@media screen and (max-width: 1100px) {
	.e3-oldlist .clients-grid { column-count: 4; }
	.e3-oldlist .filter-sidebar { width: 250px; }
}

@media screen and (max-width: 800px) {
	.e3-oldlist .page-container { flex-direction: column; padding: 16px; }
	.e3-oldlist .filter-sidebar {
		height: auto;
		position: relative;
		top: 0;
		width: 100%;
	}
	.e3-oldlist .filter__list {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
	}
	.e3-oldlist .esc-filter { margin-bottom: 0; width: calc(33.333% - 10px); }
}

/* Phone width: two columns, no sideways scroll. Not in the old page, which had none. */
@media screen and (max-width: 560px) {
	.e3-oldlist .clients-grid { column-count: 2; }
	.e3-oldlist .esc-filter { width: calc(50% - 10px); }
}

/* =========================================================================
 * Print — the old page's printed result, on US Letter
 * ====================================================================== */

@page {
	margin: 0;
	size: letter;
}

@media print {
	/* The site's own chrome is not part of the printed list. */
	body:has(.e3-oldlist) .skip-link,
	body:has(.e3-oldlist) header.header,
	body:has(.e3-oldlist) .breadcrumb-bar,
	body:has(.e3-oldlist) .site-footer,
	body:has(.e3-oldlist) .floating-chat-btn,
	body:has(.e3-oldlist) #wpadminbar,
	body:has(.e3-history) .skip-link,
	body:has(.e3-history) header.header,
	body:has(.e3-history) .breadcrumb-bar,
	body:has(.e3-history) .site-footer,
	body:has(.e3-history) .floating-chat-btn,
	body:has(.e3-history) #wpadminbar {
		display: none !important;
	}

	body:has(.e3-oldlist),
	body:has(.e3-history) {
		background: #fff !important;
		margin: 0.5in !important;
		padding: 0 !important;
	}

	html:has(.e3-oldlist),
	html:has(.e3-history) {
		margin-top: 0 !important;
	}

	body:has(.e3-oldlist) main,
	body:has(.e3-oldlist) .services-page__container,
	body:has(.e3-oldlist) .services-page__content,
	body:has(.e3-history) main,
	body:has(.e3-history) .services-page__container,
	body:has(.e3-history) .services-page__content {
		margin: 0 !important;
		max-width: none !important;
		padding: 0 !important;
		width: auto !important;
	}

	.e3-oldlist {
		background: #fff;
	}

	.e3-oldlist .page-container {
		display: block !important;
		margin: 0 !important;
		max-width: none !important;
		padding: 0 !important;
	}

	.e3-oldlist .filter-sidebar {
		display: none !important;
	}

	.e3-oldlist .clients-main {
		display: block !important;
		width: 100% !important;
	}

	.e3-oldlist .clients-grid {
		column-count: 6 !important;
		column-gap: 12px !important;
	}

	.e3-oldlist .client-card {
		margin-bottom: 4px !important;
		padding: 0 !important;
	}

	.e3-oldlist .client-card__name {
		font-size: 8pt !important;
		line-height: 1.3 !important;
		text-decoration: none !important;
	}

	.e3-oldlist .clients__header {
		align-items: center !important;
		border-bottom: 2px solid var(--e3-list-green) !important;
		display: flex !important;
		flex-direction: row !important;
		justify-content: flex-start !important;
		margin-bottom: 20px !important;
	}

	.e3-oldlist .header__title-area {
		align-items: center !important;
		display: flex !important;
		flex-direction: row !important;
		gap: 20px !important;
		justify-content: flex-start !important;
	}

	.e3-oldlist .header-logo {
		height: 60px !important;
		margin-bottom: 0 !important;
	}

	.e3-oldlist .clients__title {
		color: #11411d !important;
		font-size: 16pt !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.e3-oldlist .no-print {
		display: none !important;
	}

	.e3-oldlist .print-key {
		color: var(--e3-list-green) !important;
		display: block !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.e3-oldlist .clients-grid.has-active-filters .client-card.highlighted .client-card__name {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	/* Project History prints its table with the filters described above it. */
	.e3-history {
		padding: 0;
	}

	.e3-history__sidebar,
	.e3-history__views,
	.e3-history__print,
	.e3-history__grid {
		display: none !important;
	}

	.e3-history__layout {
		display: block;
	}

	.e3-history__print-key {
		display: block !important;
		font-weight: 700;
	}

	.e3-history .e3-history__table-wrap,
	.e3-history .e3-history__table-wrap[hidden] {
		display: block !important;
		overflow: visible;
	}

	.e3-history__table {
		font-size: 8.5pt;
		min-width: 0;
	}

	.e3-history__table tr {
		break-inside: avoid;
	}

	.e3-history__logo,
	.e3-history__logo-box {
		height: 28px;
	}
}
