/* Campus Event Map: front end.
 *
 * Phone first: the base styles are for a phone held upright, and wider layouts are added with
 * container queries (the map block's own width, so it also works in narrow theme columns).
 * Accessibility: text sizes use rem so they follow the visitor's font-size setting, tap targets
 * are at least 48px, contrast meets WCAG AA (most text AAA), focus is always visible, color is
 * never the only signal, and motion, high-contrast and Windows forced-color settings are honoured.
 *
 * A theme can recolor everything with one line, e.g. .imh-map-block, .imh-popup { --imh-accent: #8a1538; }
 */
.imh-map-block, .imh-popup, .imh-backdrop {
	--imh-accent: #1d4ed8;
	--imh-accent-hover: #1e40af;
	--imh-accent-soft: #e8efff;
	--imh-text: #111827;
	--imh-muted: #374151;
	--imh-border: #9ca3af;
	--imh-border-soft: #d9dde3;
	--imh-surface: #ffffff;
	--imh-subtle: #f3f4f6;
	--imh-warn: #7c2d12;
	--imh-warn-soft: #fef3c7;
	--imh-radius: 14px;
	--imh-radius-sm: 10px;
	--imh-tap: 48px;
	--imh-shadow: 0 1px 3px rgba(17, 24, 39, .1), 0 4px 12px rgba(17, 24, 39, .06);
	--imh-shadow-lg: 0 12px 32px rgba(17, 24, 39, .2), 0 2px 6px rgba(17, 24, 39, .1);
}

.imh-map-block {
	container-type: inline-size;
	container-name: imh;
	margin: 1.5em 0;
	color: var(--imh-text);
	font-size: 1rem;
	line-height: 1.55;
	-webkit-text-size-adjust: 100%;
}
.imh-map-block *, .imh-map-block *::before, .imh-map-block *::after,
.imh-popup *, .imh-popup *::before, .imh-popup *::after { box-sizing: border-box; }

/* Theme stylesheets often style every <button>; reset ours to a clean baseline. */
.imh-map-block button, .imh-popup button, .imh-map-block select {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
/* One focus style everywhere: a thick ring with a white gap, visible on any background. */
.imh-map-block :focus { outline: none; }
.imh-popup :focus { outline: none; }
.imh-map-block :focus-visible, .imh-popup :focus-visible { outline: 3px solid var(--imh-accent); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }

.imh-sr-only, .imh-check-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------- division filter */

.imh-filters {
	display: grid;
	gap: 14px;
	margin: 0 0 16px;
	padding: 16px;
	background: var(--imh-surface);
	border: 1px solid var(--imh-border-soft);
	border-radius: var(--imh-radius);
	box-shadow: var(--imh-shadow);
}
.imh-filter-label { display: block; margin: 0 0 10px; color: var(--imh-text); font-size: 1.0625rem; font-weight: 700; }
.imh-filter-buttons { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container imh (min-width: 460px) { .imh-filter-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.imh-map-block .imh-filter-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 60px;
	padding: 8px 6px;
	border: 2px solid var(--imh-border);
	border-radius: var(--imh-radius-sm);
	background: var(--imh-surface);
	color: var(--imh-text);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	overflow-wrap: anywhere;
	cursor: pointer;
	box-shadow: 0 2px 0 var(--imh-border-soft);
	transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.imh-map-block .imh-filter-btn:active { transform: translateY(1px); }
@media (hover: hover) {
	.imh-map-block .imh-filter-btn:hover { border-color: var(--imh-accent); color: var(--imh-accent); }
}
.imh-map-block .imh-filter-btn.is-pressed {
	background: var(--imh-accent);
	border-color: var(--imh-accent);
	color: #fff;
	transform: translateY(2px);
	box-shadow: inset 0 2px 5px rgba(0, 0, 0, .3);
}
@media (hover: hover) {
	.imh-map-block .imh-filter-btn.is-pressed:hover { background: var(--imh-accent-hover); color: #fff; }
}
/* A tick as well as the color, so the choice is clear without relying on color. */
.imh-filter-btn.is-pressed .imh-filter-btn-label::before { content: "✓ "; }

.imh-filter-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--imh-border-soft); }
.imh-count { color: var(--imh-muted); font-size: 1rem; font-weight: 500; }
.imh-map-block .imh-clear {
	min-height: 44px;
	padding: 8px 16px;
	border: 2px solid var(--imh-accent);
	border-radius: 999px;
	background: var(--imh-surface);
	color: var(--imh-accent);
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
}
.imh-map-block .imh-clear:active { background: var(--imh-accent); color: #fff; }
@media (hover: hover) { .imh-map-block .imh-clear:hover { background: var(--imh-accent); color: #fff; } }
.imh-map-block .imh-clear[hidden] { display: none; }

/* -------------------------------------------------------------------- map */

.imh-map-wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "key" "times"; }
.imh-map-wrap > .imh-map { grid-area: map; }
.imh-map-wrap > .imh-legend { grid-area: key; }
.imh-map-wrap > .imh-sessions { grid-area: times; }

/* ---------------------------------------------------------------- map key */

.imh-legend { margin-top: 12px; padding: 8px; background: var(--imh-surface); border: 1px solid var(--imh-border-soft); border-radius: var(--imh-radius); box-shadow: var(--imh-shadow); }
.imh-map-block .imh-legend-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: var(--imh-tap);
	padding: 8px 10px;
	border: 0;
	border-radius: var(--imh-radius-sm);
	background: none;
	color: var(--imh-text);
	font-size: 1.0625rem;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
}
@media (hover: hover) { .imh-map-block .imh-legend-toggle:hover { background: var(--imh-subtle); } }
.imh-legend-title { flex: 1; }
.imh-legend-hint { display: flex; gap: 4px; }
.imh-legend-mini { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--imh-surface), 0 0 0 2.5px var(--imh-border-soft); }
.imh-legend:not(.is-collapsed) .imh-legend-hint { display: none; }
.imh-legend.is-collapsed .imh-sessions-chevron { transform: rotate(-135deg) translate(-2px, -2px); }
.imh-legend.is-collapsed .imh-legend-list { display: none; }
.imh-legend-list { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 0; padding: 4px 10px 8px; list-style: none; }
.imh-legend-item { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; min-height: 32px; font-size: 1rem; font-weight: 600; color: var(--imh-text); }
.imh-legend-item::before, .imh-legend-item::marker { content: none; }
.imh-legend-pin { flex: none; width: 18px; height: 27px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.imh-legend-pin svg { display: block; width: 100%; height: 100%; }
.imh-legend-pin svg path { stroke: #fff; stroke-width: 1.5; }
.imh-map { position: relative; width: 100%; margin: 0 auto; border-radius: var(--imh-radius); box-shadow: var(--imh-shadow); background: var(--imh-subtle); }
.imh-map-img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none !important; object-fit: cover; display: block; margin: 0 !important; border-radius: var(--imh-radius); user-select: none; -webkit-user-drag: none; }
.imh-pins { position: absolute; inset: 0; }

.imh-map-block .imh-pin {
	position: absolute;
	width: var(--imh-pin-size, 24px);
	height: calc(var(--imh-pin-size, 24px) * 1.5);
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	transform: translate(-50%, -100%);
	transform-origin: 50% 100%;
	cursor: pointer;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4));
	transition: transform .15s ease-out;
}
.imh-map-block .imh-pin[hidden] { display: none; }
/* Invisible hit area of at least 48 x 48px around every pin, however small the icon is. */
.imh-pin::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(48px, 100%); height: max(48px, 100%); transform: translate(-50%, -50%); }
.imh-pin svg { width: 100%; height: 100%; display: block; }
.imh-pin svg path { stroke: #fff; stroke-width: 1.5; }
.imh-map-block .imh-pin:focus-visible { outline: none; box-shadow: none; transform: translate(-50%, -100%) scale(1.2); z-index: 2; }
.imh-map-block .imh-pin:focus-visible svg path { stroke: #111827; stroke-width: 3; }
@media (hover: hover) { .imh-map-block .imh-pin:hover { transform: translate(-50%, -100%) scale(1.15); z-index: 2; } }
.imh-map-block .imh-pin.is-active { transform: translate(-50%, -100%) scale(1.35); z-index: 3; }
.imh-map-block .imh-pin.is-active svg path { stroke: #111827; stroke-width: 2.5; }

/* ---------------------------------------------------- session time picker */

/* Phones: a full-width stacked list under the map. Wide maps: overlaid in the lower-right corner. */
.imh-sessions {
	margin-top: 12px;
	padding: 8px;
	background: var(--imh-surface);
	border: 1px solid var(--imh-border-soft);
	border-radius: var(--imh-radius);
	box-shadow: var(--imh-shadow);
}
.imh-map-block .imh-sessions-head {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: var(--imh-tap);
	padding: 8px 10px;
	border: 0;
	border-radius: var(--imh-radius-sm);
	background: none;
	color: var(--imh-text);
	font-size: 1.0625rem;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
}
.imh-clock { width: 22px; height: 22px; flex: none; color: var(--imh-accent); }
.imh-sessions-title { flex: 1; }
.imh-sessions-chevron { width: 10px; height: 10px; margin-right: 4px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.imh-sessions.is-collapsed .imh-sessions-chevron { transform: rotate(-135deg) translate(-2px, -2px); }
.imh-sessions.is-collapsed .imh-sessions-list { display: none; }
.imh-sessions-hint { font-size: 1rem; font-weight: 600; color: var(--imh-accent); white-space: nowrap; }
.imh-sessions:not(.is-collapsed) .imh-sessions-hint { display: none; }

/* Stacked segments joined by a timeline running through the dots. */
.imh-sessions-list { position: relative; display: grid; gap: 4px; margin-top: 4px; }
.imh-sessions-list::before { content: ""; position: absolute; left: 24px; top: 28px; bottom: 28px; width: 2px; background: var(--imh-border-soft); }
.imh-map-block .imh-time-btn {
	position: relative;
	display: grid;
	grid-template-columns: 24px 1fr auto;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 56px;
	padding: 8px 12px 8px 13px;
	border: 2px solid transparent;
	border-radius: var(--imh-radius-sm);
	background: transparent;
	color: var(--imh-text);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .15s, color .15s;
}
@media (hover: hover) { .imh-map-block .imh-time-btn:hover { background: var(--imh-subtle); } }
.imh-time-main { font-variant-numeric: tabular-nums; }
.imh-time-all .imh-time-main { font-weight: 600; }
.imh-time-dot { position: relative; z-index: 1; width: 22px; height: 22px; border: 2.5px solid var(--imh-border); border-radius: 50%; background: var(--imh-surface); }
.imh-time-tag { min-width: 30px; padding: 3px 9px; border-radius: 999px; background: var(--imh-subtle); color: var(--imh-muted); font-size: .875rem; font-weight: 700; text-align: center; }

.imh-map-block .imh-time-btn.is-pressed { background: var(--imh-accent); color: #fff; }
@media (hover: hover) { .imh-map-block .imh-time-btn.is-pressed:hover { background: var(--imh-accent-hover); } }
.imh-time-btn.is-pressed .imh-time-dot { border-color: #fff; background: var(--imh-accent); box-shadow: inset 0 0 0 4px var(--imh-accent), inset 0 0 0 11px #fff; }
.imh-time-btn.is-pressed .imh-time-tag { background: rgba(255, 255, 255, .22); color: #fff; }

@container imh (min-width: 620px) {
	/* The time picker shares the map's grid cell and floats in its lower-right corner. */
	.imh-map-wrap > .imh-sessions { grid-area: map; }
	.imh-sessions {
		position: relative;
		z-index: 5;
		align-self: end;
		justify-self: end;
		width: 250px;
		margin: 0 14px 14px 0;
		padding: 6px;
		background: rgba(255, 255, 255, .96);
		-webkit-backdrop-filter: blur(8px);
		backdrop-filter: blur(8px);
		box-shadow: var(--imh-shadow-lg);
	}
	.imh-map-block .imh-time-btn { min-height: 48px; font-size: 1rem; }
	.imh-map-block .imh-sessions-head { font-size: .9375rem; min-height: 44px; }
	.imh-sessions-list::before { top: 24px; bottom: 24px; }
}

/* ---------------------------------------------- details: bubble or bottom sheet */

.imh-popup {
	position: absolute;
	z-index: 10;
	width: 360px;
	max-width: calc(100% - 16px);
	background: var(--imh-surface);
	color: var(--imh-text);
	border-radius: var(--imh-radius);
	box-shadow: var(--imh-shadow-lg);
	font-size: 1rem;
	line-height: 1.55;
	text-align: left;
}
.imh-popup::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: var(--imh-radius) var(--imh-radius) 0 0; background: var(--imh-color, var(--imh-accent)); }
.imh-popup[hidden] { display: none; }
.imh-sheet-grip { display: none; }
.imh-popup-inner { padding: 20px 20px 18px; max-height: min(70vh, 520px); overflow: auto; overscroll-behavior: contain; }
.imh-popup-head { padding-right: 40px; margin: 0 0 12px; }
.imh-popup-cat { margin: 0 0 4px; color: var(--imh-muted); font-size: .9375rem; font-weight: 700; }
.imh-popup .imh-popup-title { margin: 0; font-size: 1.3125rem; font-weight: 700; line-height: 1.3; color: var(--imh-text); letter-spacing: normal; text-transform: none; }
.imh-popup-location { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; color: var(--imh-muted); font-size: 1rem; }
.imh-popup-location::before {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	margin-top: 4px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.2 7 13 7 13s7-7.8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.2 7 13 7 13s7-7.8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.imh-popup-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.imh-tag { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 12px; border-radius: 999px; background: var(--imh-subtle); border: 1px solid var(--imh-border-soft); color: var(--imh-text); font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.imh-tag-session { background: var(--imh-accent-soft); border-color: transparent; color: var(--imh-accent-hover); font-variant-numeric: tabular-nums; }
.imh-popup-people { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; padding: 12px 14px; background: var(--imh-subtle); border-radius: var(--imh-radius-sm); font-size: 1rem; }
.imh-popup-people dt { margin: 0; color: var(--imh-muted); font-weight: 500; }
.imh-popup-people dd { margin: 0; font-weight: 700; }
.imh-popup .imh-popup-desc { margin: 0; padding-top: 14px; border-top: 1px solid var(--imh-border-soft); color: var(--imh-text); font-size: 1.125rem; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.imh-popup .imh-popup-close {
	position: absolute;
	top: 10px;
	right: 8px;
	width: var(--imh-tap);
	height: var(--imh-tap);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--imh-text);
	font-size: 30px;
	line-height: var(--imh-tap);
	cursor: pointer;
	box-shadow: none;
}
@media (hover: hover) { .imh-popup .imh-popup-close:hover { background: var(--imh-subtle); } }
.imh-popup .imh-popup-done { display: none; }
.imh-popup-arrow { position: absolute; bottom: -9px; width: 18px; height: 9px; margin-left: -9px; overflow: hidden; }
.imh-popup-arrow::after { content: ""; position: absolute; left: 2px; top: -7px; width: 14px; height: 14px; background: var(--imh-surface); transform: rotate(45deg); box-shadow: 2px 2px 4px rgba(17, 24, 39, .12); }
.imh-popup.is-below .imh-popup-arrow { top: -9px; bottom: auto; }
.imh-popup.is-below .imh-popup-arrow::after { top: 3px; background: var(--imh-color, var(--imh-accent)); }

/* Bottom sheet (phones): big, readable, and easy to close. */
.imh-backdrop { position: fixed; inset: 0; z-index: 99997; background: rgba(17, 24, 39, .5); }
.imh-backdrop[hidden] { display: none; }
/* Copy of the selected pin, drawn above the backdrop so it stays bright and easy to find. */
.imh-spotlight { position: fixed; z-index: 99998; pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .9)) drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
.imh-spotlight[hidden] { display: none; }
.imh-spotlight svg { width: 100%; height: 100%; display: block; overflow: visible; }
.imh-spotlight svg path { stroke: #111827; stroke-width: 2.5; }
.imh-spotlight::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 70%; aspect-ratio: 2 / 1; transform: translateX(-50%); border: 3px solid #fff; border-radius: 50%; animation: imh-ping 1.4s ease-out infinite; }
@keyframes imh-ping { from { opacity: .9; transform: translateX(-50%) scale(.6); } to { opacity: 0; transform: translateX(-50%) scale(1.8); } }
@media (prefers-reduced-motion: reduce) { .imh-spotlight::after { animation: none; opacity: .9; } }
.imh-popup.is-sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	top: auto;
	z-index: 99999;
	width: auto;
	max-width: 640px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	max-height: 85vh;
	max-height: 85dvh;
	border-radius: 20px 20px 0 0;
	font-size: 1.0625rem;
	animation: imh-sheet-in .22s ease-out;
}
.imh-popup.is-sheet[hidden] { display: none; }
.imh-popup.is-sheet::before { border-radius: 20px 20px 0 0; }
.imh-popup.is-sheet .imh-popup-arrow { display: none; }
.imh-popup.is-sheet .imh-sheet-grip { display: block; flex: none; width: 44px; height: 5px; margin: 14px auto 0; border-radius: 3px; background: var(--imh-border); }
.imh-popup.is-sheet .imh-popup-inner { flex: 1 1 auto; max-height: none; padding: 14px 20px 8px; }
.imh-popup.is-sheet .imh-popup-title { font-size: 1.5rem; }
.imh-popup.is-sheet .imh-popup-close { top: 14px; right: 10px; }
.imh-popup.is-sheet .imh-popup-done {
	display: block;
	flex: none;
	width: calc(100% - 40px);
	min-height: 56px;
	margin: 8px 20px calc(16px + env(safe-area-inset-bottom, 0px));
	border: 0;
	border-radius: var(--imh-radius-sm);
	background: var(--imh-text);
	color: #fff;
	font-size: 1.125rem;
	font-weight: 700;
	cursor: pointer;
}
@keyframes imh-sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------- event list (cards on phones) */

.imh-table-wrap { margin-top: 20px; }
.imh-instructions {
	position: relative;
	margin: 0 0 16px;
	padding: 14px 16px 14px 50px;
	background: var(--imh-accent-soft);
	border-radius: var(--imh-radius);
	color: var(--imh-text);
	font-size: 1rem;
	line-height: 1.6;
	white-space: pre-line;
}
.imh-instructions::before {
	content: "i";
	position: absolute;
	left: 16px;
	top: 15px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--imh-accent);
	color: #fff;
	font: italic 700 15px/24px Georgia, serif;
	text-align: center;
}

.imh-list-tools { display: flex; justify-content: flex-end; margin: 0 0 12px; }
.imh-sort-menu { display: flex; align-items: center; gap: 10px; color: var(--imh-text); font-size: 1rem; font-weight: 600; }
.imh-map-block .imh-sort-menu select {
	min-height: var(--imh-tap);
	padding: 8px 40px 8px 14px;
	border: 2px solid var(--imh-border);
	border-radius: var(--imh-radius-sm);
	background: var(--imh-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 18px no-repeat;
	color: var(--imh-text);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

.imh-table-scroll[hidden], .imh-no-results[hidden] { display: none; }
.imh-map-block .imh-table, .imh-map-block .imh-table tbody { display: block; width: 100%; margin: 0; border: 0; background: transparent; }
.imh-map-block .imh-table thead { display: none; }
.imh-map-block .imh-table tbody { display: grid; gap: 12px; }
.imh-map-block .imh-table tr {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	position: relative;
	padding: 18px 16px 16px;
	background: var(--imh-surface);
	border: 1px solid var(--imh-border-soft);
	border-radius: var(--imh-radius);
	box-shadow: var(--imh-shadow);
	cursor: pointer;
}
/* Each card carries its hotspot's color as a top stripe, matching the details popup. */
.imh-map-block .imh-table tr::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 6px; border-radius: var(--imh-radius) var(--imh-radius) 0 0; background: var(--imh-color, var(--imh-accent)); }
.imh-map-block .imh-table td { display: block; flex: 1 1 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.imh-map-block .imh-table td.is-empty { display: none; }
.imh-map-block .imh-table td.imh-col-teacher, .imh-map-block .imh-table td.imh-col-location { display: flex; gap: 8px; font-size: 1rem; color: var(--imh-text); }
.imh-map-block .imh-table td.imh-col-teacher::before::before, .imh-map-block .imh-table td.imh-col-location::before { content: attr(data-label); flex: none; min-width: 7.5em; color: var(--imh-muted); font-weight: 500; }
.imh-map-block .imh-table td.imh-col-check { display: none; flex: 0 0 auto; }
.imh-map-block .imh-table td.imh-col-check.is-yes { display: block; margin-top: 6px; }
.imh-map-block .imh-table td.is-yes .imh-check { display: none; }
.imh-map-block .imh-table td.is-yes .imh-check-text {
	position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: nowrap;
	display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px;
	background: var(--imh-accent-soft); color: var(--imh-accent-hover); font-size: .9375rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.imh-map-block .imh-table tr.is-active { border-color: var(--imh-accent); box-shadow: 0 0 0 2px var(--imh-accent); }

.imh-map-block .imh-row-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: var(--imh-tap);
	padding: 0;
	border: 0;
	background: none;
	color: var(--imh-text);
	font-size: 1.1875rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
}
.imh-name { flex: 1; display: flex; flex-direction: column; }
.imh-row-cat { color: var(--imh-muted); font-size: .9375rem; font-weight: 600; }
.imh-row-cta { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--imh-accent-soft); color: var(--imh-accent-hover); font-size: .875rem; font-weight: 700; white-space: nowrap; }
.imh-row-cta::after { content: "›"; font-size: 1.25em; line-height: 1; }
.imh-no-results { margin: 0; padding: 24px 16px; text-align: center; color: var(--imh-muted); font-size: 1.0625rem; background: var(--imh-subtle); border-radius: var(--imh-radius); }

/* Wide maps: a real sortable table. */
@container imh (min-width: 620px) {
	.imh-filters { padding: 20px; }
	.imh-map-block .imh-filter-btn { min-height: 52px; padding: 10px 16px; }
	.imh-list-tools { display: none; }
	.imh-table-scroll { overflow-x: auto; background: var(--imh-surface); border: 1px solid var(--imh-border-soft); border-radius: var(--imh-radius); box-shadow: var(--imh-shadow); }
	.imh-map-block .imh-table { display: table; border-collapse: separate; border-spacing: 0; font-size: 1rem; }
	.imh-map-block .imh-table thead { display: table-header-group; }
	.imh-map-block .imh-table tbody { display: table-row-group; }
	.imh-map-block .imh-table tr { display: table-row; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
	.imh-map-block .imh-table tr::before { content: none; }
	/* In table form a row can't take a top stripe, so the color runs down its left edge. */
	.imh-map-block .imh-table td.imh-col-name { box-shadow: inset 6px 0 0 var(--imh-color, var(--imh-accent)); padding-left: 22px; }
	.imh-map-block .imh-table th, .imh-map-block .imh-table td,
	.imh-map-block .imh-table td.imh-col-teacher, .imh-map-block .imh-table td.imh-col-location,
	.imh-map-block .imh-table td.imh-col-check, .imh-map-block .imh-table td.imh-col-check.is-yes, .imh-map-block .imh-table td.is-empty { display: table-cell; padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--imh-border-soft); vertical-align: middle; }
	.imh-map-block .imh-table td::before { content: none !important; }
	.imh-map-block .imh-table tbody tr:last-child td[class] { border-bottom: 0; }
	.imh-map-block .imh-table th { padding: 0; background: var(--imh-subtle); white-space: nowrap; border-bottom: 2px solid var(--imh-border-soft); text-align: left; }
	.imh-map-block .imh-table .imh-col-check { text-align: center; }
	.imh-table th.imh-col-check { min-width: 104px; }
	.imh-table td.imh-col-name { min-width: 200px; }
	.imh-map-block .imh-table td.imh-col-teacher, .imh-map-block .imh-table td.imh-col-location { min-width: 120px; }
	.imh-map-block .imh-table td.is-yes .imh-check { display: inline-flex; }
	.imh-map-block .imh-table td.is-yes .imh-check-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); }
	.imh-map-block .imh-row-btn { font-size: 1rem; min-height: 44px; }
	.imh-row-cta { display: none; }
	.imh-map-block .imh-table tbody tr:hover td { background: var(--imh-subtle); }
	.imh-map-block .imh-table tr.is-active { box-shadow: none; }
	.imh-map-block .imh-table tr.is-active td { background: var(--imh-accent-soft); }
	.imh-map-block .imh-table tr.is-active td:first-child { box-shadow: inset 6px 0 0 var(--imh-color, var(--imh-accent)); }
}

.imh-map-block .imh-sort {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: var(--imh-tap);
	padding: 12px 16px;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--imh-text);
	font-size: .9375rem;
	font-weight: 700;
	text-align: inherit;
	cursor: pointer;
	box-shadow: none;
}
.imh-map-block th.imh-col-check .imh-sort { align-items: center; }
@media (hover: hover) { .imh-map-block .imh-sort:hover { background: var(--imh-border-soft); } }
.imh-map-block .imh-sort:focus-visible { outline-offset: -3px; }
.imh-sort-sub { font-weight: 500; font-size: .875rem; color: var(--imh-muted); white-space: nowrap; margin-top: 2px; font-variant-numeric: tabular-nums; }
.imh-sort-label::after { content: "↕"; display: inline-block; margin-left: 6px; opacity: .5; font-weight: 400; }
th[aria-sort="ascending"] .imh-sort-label::after { content: "▲"; opacity: 1; font-size: .7em; color: var(--imh-accent); }
th[aria-sort="descending"] .imh-sort-label::after { content: "▼"; opacity: 1; font-size: .7em; color: var(--imh-accent); }
th[aria-sort="ascending"] .imh-sort, th[aria-sort="descending"] .imh-sort { color: var(--imh-accent); }
.imh-check { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--imh-accent-soft); color: var(--imh-accent); font-weight: 700; font-size: 1rem; }

/* --------------------------------------------------- visitor settings */

@media (prefers-reduced-motion: reduce) {
	.imh-map-block *, .imh-map-block *::before, .imh-map-block *::after, .imh-popup { transition: none !important; animation: none !important; }
}

@media (prefers-contrast: more) {
	.imh-map-block, .imh-popup { --imh-muted: #111827; --imh-border: #4b5563; --imh-border-soft: #6b7280; --imh-accent-soft: #dbe5ff; }
	.imh-map-block .imh-filter-btn, .imh-map-block .imh-time-btn, .imh-map-block .imh-table tr { border-width: 2px; }
}

/* Windows High Contrast / forced colors: keep borders, and show the chosen button with system highlight colors. */
@media (forced-colors: active) {
	.imh-map-block .imh-filter-btn, .imh-map-block .imh-time-btn, .imh-map-block .imh-clear, .imh-map-block .imh-table tr, .imh-filters, .imh-sessions, .imh-popup { border: 2px solid CanvasText; }
	.imh-map-block .imh-filter-btn.is-pressed, .imh-map-block .imh-time-btn.is-pressed { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
	.imh-time-dot, .imh-legend-mini { forced-color-adjust: none; }
	.imh-pin svg { forced-color-adjust: none; }
	.imh-map-block :focus-visible, .imh-popup :focus-visible { outline-color: Highlight; }
}

/* ---------------------------------------------------- arrive-on-time and pinned programs */
.imh-flag-icon { display: inline-flex; flex: none; width: 1.1em; height: 1.1em; }
.imh-flag-icon .imh-icon { width: 100%; height: 100%; display: block; }
.imh-ontime-badge { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--imh-warn-soft, #fef3c7); color: var(--imh-warn, #7c2d12); font-size: .9375rem; font-weight: 700; line-height: 1.3; }
.imh-pinned-icon { margin-right: 6px; vertical-align: -0.12em; color: var(--imh-accent); }
.imh-popup-ontime { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--imh-radius-sm); background: var(--imh-warn-soft, #fef3c7); color: var(--imh-warn, #7c2d12); font-size: 1rem; line-height: 1.45; }
.imh-popup-ontime .imh-flag-icon { width: 1.35em; height: 1.35em; margin-top: 1px; }
.imh-popup-ontime p { margin: 0; }
.imh-popup-ontime strong { display: block; }
.imh-legend-ontime .imh-flag-icon { width: 22px; height: 22px; margin: 0 -2px; color: var(--imh-warn, #7c2d12); }
.imh-legend-mini-clock { width: 16px; height: 16px; margin-left: 4px; color: var(--imh-warn, #7c2d12); }
@media (forced-colors: active) {
	.imh-ontime-badge, .imh-popup-ontime { border: 1px solid CanvasText; }
}
