/* Edgemap viewer. Every rule sits under .edgemap, so the page around a map keeps its own styles.
   The look is ink on paper. Hairline black lines, the root set apart by weight, small black dots. */

.edgemap {
	--edgemap-bg: #fff;
	--edgemap-text: #000;
	--edgemap-line: #000;
	/* By level from the root. The last width holds for every deeper level. */
	--edgemap-line-width: 2, 1;
	--edgemap-accent: #000;
	--markmap-circle-open-bg: var(--edgemap-bg);
	position: relative;
}

/* The outline reads without JavaScript. Once the map is ready it stays in the
   accessibility tree but leaves the screen until keyboard focus moves into it. */
.edgemap.is-ready:not(.is-outline) > .edgemap__outline {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Until the viewer takes over, the outline keeps the map box's height and
   scrolls, so the page does not jump when the map replaces it. */
.edgemap:not(.is-ready) > .edgemap__outline {
	max-height: var(--edgemap-height, clamp(420px, 70vh, 760px));
	overflow: auto;
}

.edgemap:not(.is-ready) > .edgemap__toolbar,
.edgemap:not(.is-ready) > .edgemap__canvas {
	visibility: hidden;
}

.edgemap.is-outline > .edgemap__canvas {
	display: none;
}

.edgemap__toolbar {
	display: flex;
	justify-content: flex-end;
	gap: 4px;
	margin-bottom: 4px;
}

.edgemap .edgemap__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 0;
	background: var(--edgemap-bg);
	color: var(--edgemap-text);
	cursor: pointer;
}

.edgemap .edgemap__button:hover {
	border-color: var(--edgemap-accent);
	color: var(--edgemap-accent);
}

.edgemap .edgemap__button:focus-visible {
	outline: 2px solid var(--edgemap-accent);
	outline-offset: 2px;
}

.edgemap .edgemap__button svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.edgemap__canvas {
	height: var(--edgemap-height, clamp(420px, 70vh, 760px));
	background: var(--edgemap-bg);
	color: var(--edgemap-text);
	/* Inline, one finger scrolls the page and two fingers reach the map. The map takes all touch in full screen. */
	touch-action: pan-y;
}

.edgemap .edgemap__canvas > svg {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	color: var(--edgemap-text);
	font: inherit;
	line-height: 1.25;
}

/* Node rules that markmap would otherwise inject for the whole document. */
.edgemap .markmap-link {
	fill: none;
}

.edgemap .markmap-node > circle {
	cursor: pointer;
	r: 4px;
	stroke-width: 1px;
}

.edgemap .markmap-node[data-depth="1"] .markmap-foreign,
.edgemap .edgemap__outline > .edgemap__root {
	font-size: 1.15em;
	font-weight: 700;
}

.edgemap .edgemap__outline ul {
	padding-left: 1.25em;
	border-left: 1px solid var(--edgemap-line);
	list-style: none;
}

.edgemap .markmap-foreign {
	display: inline-block;
}

.edgemap .markmap-foreign > div {
	width: var(--markmap-max-width, 9999px);
	text-align: left;
}

.edgemap .markmap-foreign > div > div {
	display: inline-block;
}

.edgemap .markmap-foreign a {
	color: var(--edgemap-accent);
}

.edgemap .markmap-foreign code {
	padding: 0.1em 0.25em;
	font-size: 0.9em;
	background: #f0f0f0;
	border-radius: 2px;
}

.edgemap .markmap-foreign del {
	text-decoration: line-through;
}

.edgemap .markmap-foreign em {
	font-style: italic;
}

.edgemap .markmap-foreign strong {
	font-weight: 700;
}

/* Full screen. Covers the viewport whether the browser's Fullscreen API ran or not. */
.edgemap.is-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	width: auto;
	max-width: none !important;
	height: auto;
	margin: 0 !important;
	padding: 8px;
	box-sizing: border-box;
	background: var(--edgemap-bg);
	color: var(--edgemap-text);
	overflow: auto;
}

.edgemap.is-fullscreen > .edgemap__canvas {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
	touch-action: none;
}

