/*
 * Terezin interactive map.
 *
 * Replaces the retired interactive-map plugin's stylesheet. The map used to be
 * a fixed 681px table with the image as a background, so on a phone the right
 * 40% simply fell off the screen. It is now one SVG that scales with its
 * viewBox, and the hotspots scale with it.
 *
 * Roboto is loaded by Avada's WebFont config, so it needs no @font-face here.
 * The old stylesheet declared Roboto-Regular and Roboto-LightItalic against
 * files that do not exist, which 404'd on every page load.
 */

@font-face {
	font-family: 'fjallaoneregular';
	src: url('../fonts/FjallaOne-Regular-webfont.woff2') format('woff2'),
	     url('../fonts/FjallaOne-Regular-webfont.woff') format('woff'),
	     url('../fonts/FjallaOne-Regular-webfont.ttf') format('truetype');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

#map-wrapper {
	max-width: 760px;
	margin: 0 auto;
	padding: 1.5em 20px 3em;
	box-sizing: border-box;
}

.dr-map__title {
	font-family: 'fjallaoneregular', 'Roboto', sans-serif;
	font-size: 2em;
	line-height: 1.15;
	font-weight: 400;
	text-align: center;
	text-transform: uppercase;
	margin: 0 0 .35em;
	color: #1d120e;
}

.dr-map__title span {
	color: #6c97b7;
}

.dr-map__intro {
	font-family: 'Roboto', sans-serif;
	font-style: italic;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
	color: #444;
	margin: 0 0 1.5em;
}

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

.dr-map {
	position: relative;
	max-width: 681px;
	/* The map carries a drop shadow, so it needs clear air beneath it before the
	   index starts. Set here rather than relying on the heading's own margin,
	   which the parent theme's heading rules flatten. */
	margin: 0 auto 2.75em;
}

.dr-map__svg {
	display: block;
	width: 100%;
	height: auto;
	box-shadow: 0 0 18px rgba(0, 0, 0, .55);
}

.dr-map__hotspot {
	cursor: pointer;
}

.dr-map__shape {
	fill: rgba(0, 0, 0, 0);
	stroke: #000;
	stroke-width: 2;
	/* Keep the outline the same visual weight however far the map is scaled. */
	vector-effect: non-scaling-stroke;
	/* A fully transparent fill is still "painted", but say so explicitly so the
	   inside of every hotspot is clickable rather than just its outline. */
	pointer-events: all;
	transition: fill .12s ease-out;
}

/*
 * ⚠️ :focus-visible, NOT :focus (MOD-075).
 *
 * "On interactive map after closing a selection that selection remains
 * highlighted" - Brian, 2026-09-10. Reproduced and measured on staging:
 *
 *      after close()   is-active class  []          <- correctly removed
 *                      matches :focus   true        <- focus was handed back
 *                      shape fill       rgba(207,229,242,.85)   still painted
 *                      shape stroke     #1b6ca8 at 4px          still painted
 *
 * So the JavaScript was right and the CSS was wrong. Closing the panel returns
 * focus to the hotspot that opened it - which is correct behaviour, and the
 * only way a keyboard user knows where they are - but `:focus` then repainted
 * the shape exactly as if it were still selected.
 *
 * `:focus-visible` only matches when the browser judges that a focus ring is
 * wanted, which is after keyboard interaction and not after a click. Close the
 * panel with the mouse and the highlight goes; close it with Escape and the
 * ring stays, which is the outcome both users want.
 */
.dr-map__hotspot:focus-visible .dr-map__shape,
.dr-map__hotspot.is-active .dr-map__shape {
	fill: rgba(207, 229, 242, .85);
}

/*
 * ⚠️ :hover IS GATED ON (hover: hover), AND THAT MATTERS ON A PHONE (MOD-089).
 *
 * A touch screen has no hover, so the browser synthesises one on tap and it
 * STAYS on the tapped element until something else is tapped. With :hover
 * painting the same fill as .is-active, closing the panel left the hotspot you
 * opened still lit - which is what Brian reported, alongside the tooltip.
 *
 * `hover: hover` matches only a device that can genuinely hover, which is the
 * real condition. A width breakpoint would be a proxy for it and wrong on
 * touchscreen laptops.
 *
 * ⚠️ Do NOT move this into dr-design.css. That file loads BEFORE this one
 * (measured on the rendered page: dr-design.css is 6th, interactive-map.css is
 * 7th), so an override there of equal specificity loses. Verified with
 * Emulation.setEmulatedMedia hover:none - the fill was still painted.
 */
@media (hover: hover) {

	.dr-map__hotspot:hover .dr-map__shape {
		fill: rgba(207, 229, 242, .85);
	}
}

.dr-map__hotspot:focus {
	outline: none;
}

.dr-map__hotspot:focus-visible .dr-map__shape {
	stroke: #1b6ca8;
	stroke-width: 4;
}

.dr-map__tooltip {
	position: absolute;
	z-index: 5;
	display: none;
	max-width: 220px;
	padding: 5px 9px;
	border-radius: 3px;
	background: #1d120e;
	color: #fff;
	font-family: 'Roboto', sans-serif;
	font-size: 13px;
	line-height: 1.3;
	pointer-events: none;
	transform: translate(-50%, -100%);
}

.dr-map__tooltip.is-visible {
	display: block;
}

/* ------------------------------------------------------------- the index */

#map-wrapper .dr-map__index-heading {
	font-family: 'fjallaoneregular', 'Roboto', sans-serif;
	font-size: 1.2em;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #1d120e;
	margin: 0 0 .9em;
}

.dr-map__index {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 2px 18px;
}

.dr-map__index li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.dr-map__index-link {
	display: flex;
	gap: 8px;
	align-items: baseline;
	padding: 6px 4px;
	font-family: 'Roboto', sans-serif;
	font-size: 14px;
	line-height: 1.35;
	color: #1d120e;
	text-decoration: none;
	border-radius: 3px;
}

.dr-map__index-link:hover,
.dr-map__index-link:focus {
	background: #eef4f9;
	color: #1b6ca8;
	text-decoration: underline;
}

.dr-map__index-number {
	flex: 0 0 auto;
	min-width: 1.6em;
	font-variant-numeric: tabular-nums;
	color: #6c97b7;
	font-weight: 700;
}

/* ------------------------------------------------------------- the panels
 * Hidden in the page; the lightbox clones them. :target keeps the content
 * reachable if the script does not run, because the index links point here.
 */

.dr-map-panel {
	display: none;
}

.dr-map-panel:target {
	display: block;
	margin: 1.5em 0;
	padding: 1em;
	border: 1px solid #d8d8d8;
	background: #fff;
}

.dr-map-panel__title {
	display: flex;
	gap: 10px;
	align-items: baseline;
	font-family: 'fjallaoneregular', 'Roboto', sans-serif;
	font-size: 1.25em;
	font-weight: 400;
	text-transform: uppercase;
	letter-spacing: .02em;
	color: #1d120e;
	margin: 0 0 .6em;
}

.dr-map-panel__number {
	flex: 0 0 auto;
	color: #6c97b7;
	font-variant-numeric: tabular-nums;
}

.dr-map-panel__media {
	display: grid;
	gap: 10px;
	margin: 0 0 1em;
}

.dr-map-panel__media--pair {
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dr-map-panel__media img,
.dr-map-panel__image {
	display: block;
	width: 100%;
	height: auto;
}

.dr-map-panel__video {
	width: 100%;
	height: auto;
}

.dr-map-panel__embed {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
}

.dr-map-panel__embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.dr-map-panel__text {
	font-family: 'Roboto', sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #1d120e;
}

.dr-map-panel__text p {
	margin: 0 0 .8em;
}

.dr-map-panel__text p:last-child {
	margin-bottom: 0;
}

/* ---------------------------------------------------------- the lightbox */

.dr-map-lightbox[hidden] {
	display: none;
}

.dr-map-lightbox {
	position: fixed;
	inset: 0;
	/* Above Avada's sticky header (10000) and the notification bar. */
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.dr-map-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .78);
	border: 0;
}

.dr-map-lightbox__dialog {
	position: relative;
	width: 100%;
	max-width: 780px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: #fff;
	padding: 22px;
	box-sizing: border-box;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.dr-map-lightbox__dialog:focus {
	outline: 2px solid #6c97b7;
	outline-offset: 2px;
}

.dr-map-lightbox__close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
	line-height: 1;
	color: #1d120e;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
}

.dr-map-lightbox__close:hover,
.dr-map-lightbox__close:focus {
	background: #eef4f9;
	color: #1b6ca8;
}

/* The cloned panel is always shown inside the dialog. */
.dr-map-lightbox__content .dr-map-panel {
	display: block;
}

.dr-map-lightbox__content .dr-map-panel__title {
	padding-right: 44px;
}

.dr-map-lightbox__nav {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 1.2em;
	padding-top: 1em;
	border-top: 1px solid #e2e2e2;
}

.dr-map-lightbox__nav button {
	font-family: 'Roboto', sans-serif;
	font-size: 14px;
	padding: 9px 16px;
	border: 1px solid #6c97b7;
	background: #fff;
	color: #1b6ca8;
	border-radius: 3px;
	cursor: pointer;
}

.dr-map-lightbox__nav button:hover:not(:disabled),
.dr-map-lightbox__nav button:focus:not(:disabled) {
	background: #6c97b7;
	color: #fff;
}

.dr-map-lightbox__nav button:disabled {
	opacity: .4;
	cursor: default;
}

/* Stop the page behind scrolling while the lightbox is open. */
body.dr-map-lightbox-open {
	overflow: hidden;
}

@media (max-width: 782px) {
	#map-wrapper {
		padding: 1em 14px 2.5em;
	}

	.dr-map__title {
		font-size: 1.5em;
	}

	.dr-map__intro {
		font-size: 14px;
	}

	/* Hotspots get small on a narrow screen; the index below the map is the
	   dependable way through the tour there, so give it more prominence. */
	.dr-map__index {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.dr-map__index-link {
		padding: 11px 6px;
		border-bottom: 1px solid #ececec;
		font-size: 15px;
	}

	.dr-map-lightbox {
		padding: 0;
	}

	.dr-map-lightbox__dialog {
		max-width: none;
		max-height: 100vh;
		height: 100%;
		padding: 18px 16px 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dr-map__shape {
		transition: none;
	}
}
