/** plugin: DnD5 Condition Tooltips #2.1 fonts **/
@import url('https://fonts.googleapis.com/css2?family=Andada+Pro:wght@500&family=Libre+Baskerville&display=swap');

/** plugin: Vertical Timelines #2.2 code **/
/* BEGIN Vertical Timelines by Salvatos */
/* Set vars */
.timeline {
	--svtlinecolor: hsl(var(--s));
	--svtbgc: hsl(var(--n));
	--svtbgt: hsl(var(--nc));
}
/* Container shorthand */
.kanka-entity-timeline:not(.kanka-tag-horizontaltimeline) .entity-main-block {
	container: svt / inline-size;
}
@container svt (width > 600px) {
	/* Position events */
	li[id|="timeline-element"] {
		width: 50%;
		padding-bottom: 25px;
	}
	li[id|="timeline-element"]:nth-child(2n+1) {
		left: 0;
		padding-right: 25px;
	}
	li[id|="timeline-element"]:nth-child(2n) {
		left: 50%;
		padding-left: 25px;
	}
	/* Shorten the bar on the last item so it doesn't collide with buttons */
	li[id|="timeline-element"]:last-child {
		padding-bottom: 0;
		margin-bottom: 15px;
	}
	/* Position markers*/
	li[id|="timeline-element"] > i {
		position: absolute;
		top: 7px;
		background-color: var(--svtbgc);
		color: var(--svtbgt);
	}
	li[id|="timeline-element"]:nth-child(2n) > i {
		left: calc(0% - 15px);
	}
	li[id|="timeline-element"]:nth-child(2n+1) > i {
		left: calc(100% - 15px);
	}
	/* Position lines */
	li[id|="timeline-element"]::before {
		display: block !important; /* important otherwise Kanka sets the last one to 'table' */
		width: 6px;
		border-radius: 0;
		background-color: var(--svtlinecolor);
	}
	li[id|="timeline-element"]:nth-child(2n)::before {
		left: calc(0% - 2px);
	}
	li[id|="timeline-element"]:nth-child(2n+1)::before {
		left: calc(100% - 2px);
	}
	/* Set radius of line start */
	:is(li[id|="timeline-element"]::after, li[id|="timeline-element"]:first-of-type::before) {
		border-top-left-radius: 5px !important;
		border-top-right-radius: 5px !important;
	}
	/* Fix length and set radius of line end */
	:is(li[id|="timeline-element"]::after, li[id|="timeline-element"]:last-of-type::before) {
		display: initial;
		height: calc(100% - 25px);
		border-bottom-left-radius: 5px !important;
		border-bottom-right-radius: 5px !important;
	}
	/* Reshape event blocks */
	.timeline-item {
		margin: 0;
	}
	/* Remove the misplaced box-shadow from Kanka */
	.timeline > li .timeline-item {
		box-shadow: unset;
	}
  	/* More consistent spacing around the toggle */
  	.element-toggle .icon-hide {
		padding-inline: 2px;
	}
	/* Set date markers */
	.bg-aqua + .timeline-item .text-neutral-content {--svtbgc:#00c0ef;--svtbgt:#fff}
	.bg-black + .timeline-item .text-neutral-content {--svtbgc:#111;--svtbgt:#fff}
	.bg-brown + .timeline-item .text-neutral-content {--svtbgc: #a35831;--svtbgt:#fff}
  	.bg-grey + .timeline-item .text-neutral-content {/* use defaults */}
	.bg-green + .timeline-item .text-neutral-content {--svtbgc:#00a65a;--svtbgt:#fff}
	.bg-light-blue + .timeline-item .text-neutral-content {--svtbgc:#3c8dbc;--svtbgt:#fff}
	.bg-maroon + .timeline-item .text-neutral-content {--svtbgc:#d81b60;--svtbgt:#fff}
	.bg-navy + .timeline-item .text-neutral-content {--svtbgc:#001f3f;--svtbgt:#fff}
	.bg-orange + .timeline-item  .text-neutral-content {--svtbgc:#ff851b;--svtbgt:#fff}
	.bg-pink + .timeline-item .text-neutral-content {--svtbgc:#ebbde9;--svtbgt:#fff}
	.bg-purple + .timeline-item .text-neutral-content {--svtbgc:#605ca8;--svtbgt:#fff}
	.bg-red + .timeline-item .text-neutral-content {--svtbgc:#dd4b39;--svtbgt:#fff}
	.bg-teal + .timeline-item .text-neutral-content {--svtbgc:#39cccc;--svtbgt:#111}
	.bg-yellow + .timeline-item .text-neutral-content {--svtbgc:#f39c12;--svtbgt:#fff}
	.timeline-item-head .text-neutral-content {
		position: absolute;
		top: 7px;
		width: max-content;
		padding: 5px 8px;
		border: 1px solid var(--svtbgc);
		border-radius: 3px;
		box-shadow: 0 1px 1px rgba(0,0,0,.1);
		background-color: var(--svtbgc);
		color: var(--svtbgt);
      	overflow: visible;
	}
	li[id|="timeline-element"]:nth-child(2n) .text-neutral-content {
		right: calc(100% + 75px);
	}
	li[id|="timeline-element"]:nth-child(2n+1) .text-neutral-content {
		left: calc(100% + 75px);
	}
	/* Fancy arrowheads */
	li[id|="timeline-element"]:nth-child(2n) .text-neutral-content:after,
	li[id|="timeline-element"]:nth-child(2n+1) .text-neutral-content:before {
		content: "";
		display: block;
		position: absolute;
		top: 1px;
		border-top: 15px solid transparent;
		border-bottom: 15px solid transparent;
		border-radius: 50%;
	}
	li[id|="timeline-element"]:nth-child(2n) .text-neutral-content:after {
		right: -25px;
		border-right: none;
		border-left: 25px solid var(--svtbgc);
	}
	li[id|="timeline-element"]:nth-child(2n+1) .text-neutral-content:before {
		left: -25px;
		border-left: none;
		border-right: 25px solid var(--svtbgc);
	}
}
/* END Vertical Timelines by Salvatos */

/** plugin: Context-Aware Classes #1.7 code **/
:root { --summernote-insert-context-aware-classes: enabled; }

.entity-content .dashboard-only { display: none; }
#campaign-dashboard .dashboard-only { display: initial; }

#campaign-dashboard .no-dashboard {	display: none; }

@media (min-width: 768px) {
	.entity-content .mobile-only { display: none; }
}
@media (max-width: 767px) {
	.entity-content .no-mobile { display: none; }
}

.entity-content .tooltip-only {	display: none; }
.tippy-box .tooltip-only { display: initial; }
.tippy-box .no-tooltip { display: none; }

.entity-content .marker-only { display: none; }
.marker-popup-entry .marker-only { display: initial; }

.entity-content .marker-details-only { display: none; }
#sidebar-marker .marker-details-only { display: initial; }

#map-body .no-map, .map-dashboard .no-map { display: none; }

@media print {
	.no-print { display: none; }
}
@media screen {
	.print-only { display: none; }
}

.editor-only { display: none; }
.note-editing-area .editor-only { display: initial; }

.entity-content .transclusion-only { display: none; }
.mention-entry-content .transclusion-only { display: initial; }
.mention-entry-content .no-transclusion { display: none; }

/** plugin: External Link Icon and Styling #1.4 code **/
/* BEGIN External Link Icon and Styling by Salvatos */
:root {
	--external-link-color: var(--link-text);
	--external-link-hover-color: var(--link-hover);
	--external-link-font: inherit;
	--external-link-size: inherit;
	--external-link-weight: inherit;
	--external-link-decoration: inherit;
}
.entity-content a[href*="//"]:not([href*="kanka.io"]) {
	color: var(--external-link-color, hsl(var(--p)));
	font-family: var(--external-link-font);
	font-size: var(--external-link-size);
	font-weight: var(--external-link-weight);
	text-decoration: var(--external-link-decoration);
}
.entity-content a[href*="//"]:not([href*="kanka.io"]):hover {
	color: var(--external-link-hover-color, hsl(var(--pf)));
}
.entity-content a[href*="//"]:not([href*="kanka.io"]):after {
	font-family: "Font Awesome 6 Pro";
	font-weight: 900;
	content: "\f35d";
	font-size: 9px;
	vertical-align: top;
	margin-left: 2px;
}
/* END External Link Icon and Styling by Salvatos */

/** plugin: Responsive Image Gallery #RC3 code **/
/* Hint strings */
html {
	--autogallery-hint-d: "Click and hold to enlarge an image";
	--autogallery-hint-m: "Tap to enlarge an image";
}
html[lang="fr"] {
	--autogallery-hint-d: "Cliquer et tenir enfoncé pour agrandir une image";
	--autogallery-hint-m: "Appuyer pour agrandir une image";
}
/* Plugin HTML Inserter support */
:root { --summernote-insert-autogallery: enabled; }
/* Gallery layout */
.autogallery {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-evenly;
	padding: 10px 0;
	--autogallery-height: 20vh;
}
.autogallery:after {
	flex: 0 0 100%;
	text-align: center;
	font-style: italic;
}
@media(min-width:768px) {
	.autogallery:after {
		content: var(--autogallery-hint-d);
	}
}
@media(max-width:767px) {
	.autogallery:after {
		content: var(--autogallery-hint-m);
	}
}
.autogallery img {
	height: var(--autogallery-height) !important;
	width: auto !important;
	margin: 0 5px 15px 5px;
	box-shadow: 4px 4px 3px rgba(0, 0, 0, 0.35);
	cursor: nesw-resize;
}
/* Image expansion */
@media(min-width:768px) {
    /* Desktop: hover effect and zoom on active (hold) */
  .autogallery img:hover {
		opacity: 0.75;
		transform: scale(.98, .98);
	}
	.autogallery img:active {
	    position: fixed;
	    z-index: 820; /* over sidebar */
	    top: 50%;
	    left: 50%;
	    transform: translate(-50%, -50%);
	    height: unset !important;
	    max-height: 60vh;
	    max-width: 80vw;
	    background:white;
	    padding: 8px;
	    border:1px solid #ccc;
	    box-shadow: 1px 1px 4px #000, 1px 1px 200px rgba(0, 0, 0, 0.3);
		opacity: 1;
    }
}
@media(max-width:767px) {
    /* Mobile: zoom on hover (tap) */
    .autogallery img:hover {
	    position: fixed;
	    z-index: 820; /* over sidebar */
	    top: 50%;
	    left: 50%;
	    transform: translate(-50%, -50%);
	    height: unset !important;
	    max-height: 80vh;
	    max-width: 80vw;
	    background:white;
	    padding: 3px;
	    border:1px solid #ccc;
	    box-shadow: 1px 1px 4px #000, 1px 1px 200px rgba(0, 0, 0, 0.3);
    }
}

/** plugin: Figure Box and Floats #1.2 code **/
/*Adds functionality to Salvatos' userscript plugin*/
:root {
	--summernote-insert-figure-box: enabled;
}

/*Left float with margin*/
.l {
	float: left;
	margin-left: 0.5em;
	margin-right: 0.5em;
}
/* Right float with margin*/
.r {
	float: right;
	margin-left: 0.5em;
	margin-right: 0.5em;
}
/*Adds a clear class to avoid a tetris stack*/
.clear {
    clear:both;
}

/*Figure box. For an image with optional title or subtitle*/
div.figure {
	width: 25%;
	text-align: center;
	font-style: italic;
	font-size: smaller;
	text-indent: 0;
	border: thin silver solid;
	margin: 0.5em;
	margin-top: 0em;
	padding: 0.5em;
}
/*adding margin to the figure image to give space for the text*/

.figure img {
	margin-bottom: 0.5em;
}
div.figure::after {
    clear: both;

}

/** plugin: Keep Map Layers Visible #1 code **/
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
	display: block;
	position: relative;
}
.leaflet-control-layers .leaflet-control-layers-toggle,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
	display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
	display: block;
}
.leaflet-control-layers {
	padding: 6px 10px 6px 6px;
	color: #333;
	background: #fff;
}

/** plugin: Scrollable Map Sidebar #EOL code **/
/* BEGIN Scrollable Map Sidebar by Salvatos */
.main-sidebar {
	--map-sidebar-scrollbar-track-color: auto;
	--map-sidebar-scrollbar-slider-color: auto;
	--map-sidebar-scrollbar-width: thin;
}
@media (min-width:768px) {
	#map-body {
		/* Prevent scrollbar in main pane */
		#sidebar-map, .main-sidebar {
			max-height: calc(100vh - 3.1rem);
		}

		/* Scrollbar width and colors */
		#sidebar-content {
			scrollbar-width: var(--map-sidebar-scrollbar-width);
			scrollbar-color: var(--map-sidebar-scrollbar-slider-color) var(--map-sidebar-scrollbar-track-color);
		}
		/* Webkit patch */
		#sidebar-content::-webkit-scrollbar {
			background-color: var(--map-sidebar-scrollbar-track-color);
		}
		#sidebar-content::-webkit-scrollbar-thumb {
			background-color: var(--map-sidebar-scrollbar-slider-color);
		}

		/* Legend spacing */
		#sidebar-map {
			.marker-actions {
				padding-block: 1em;
			}
			.map-legend:not(:last-child) {
				padding: 0 10px;
			}
		}

		/* Sticky Back/Remove button */
		.map-legend:last-child,
		.marker-header ~ div .marker-actions {
			position: sticky;
			bottom: 0px;
			margin: 0;
			padding: 10px 0px;
			background: var(--sidebar-background, hsl(var(--si)));
		}
		.marker-header + .gap-3 {
			gap: unset;
		}
	}
}
/* END Scrollable Map Sidebar by Salvatos */

/** plugin: Drawer Sidebar #3.6 code **/
/* BEGIN Drawer Sidebar */
:root {
	--drawer-bg-x: 120px;
	--drawer-w: 45px;
}
@media (min-width:768px) and (max-width: 1920px) {
	body:not(#map-body):not(.sidebar-collapse) {
		/* Tweak content margins to account for smaller sidebar */
		.main-sidebar ~ :is(.content-wrapper, #footer),
		.main-sidebar ~ form .content-wrapper {
			margin-left: var(--drawer-w);
		}
		/* Main sidebar positioning */
		.main-sidebar {
			position: fixed;
			transform: translateX(calc(-1 * (240px - var(--drawer-w))));
			transition: all .5s linear;
			z-index: 801; /* For dashboard map controls */

			.sidebar {
				max-height: calc(100vh - 3rem - 160px);
				padding-bottom: 4rem;
				direction: rtl;
				overflow-y: scroll;
				scrollbar-width: none;

				.pl-4 {
					padding-left: .5rem;
				}
				.px-2 {
					transition: padding-right .5s linear;
				}
			}
			/* Chrome/Safari/Webkit */
			.sidebar::-webkit-scrollbar {
				width: 0px;
			}
		}
		.main-sidebar:hover {
			transform: unset;
		}
		.main-sidebar:not(:hover) {
			background-position-x: var(--drawer-bg-x);

			/* Navigation styling */
			:is(a, div, span) {
				visibility: hidden;
			}
			i {
				visibility: visible;
			}
			li:is(.px-2, .pt-4) { /* pt-4 for Settings */
				padding-right: calc((var(--drawer-w) - 20px) / 4);
				padding-top: 0;
			}

			/* Campaign settings: undo section indentation */
			.sidebar:has(.section-overview) .sidebar-submenu {
				margin-right: calc((var(--drawer-w) - 20px) / -4);
			}
		}
	}
}
/* END Drawer Sidebar */

/** plugin: Horizontal Timelines #2.3 code **/
/* BEGIN Salvatos Horizontal Timeline */
@media (min-width:768px) {
	/* Set vars */
	.kanka-tag-horizontaltimeline {
		--sht-spine-color: #4494c4;
		--sht-spine-width: 5px;
		--sht-gutter: transparent;
		--sht-slider: #4494c4;
		--sht-marker-bg: var(--timeline-element-border); /* replace default grey markers, e.g. var(--sht-gutter) */
		--sht-marker-color: inherit; /* replace default grey markers */
		--sht-min-width: 300px;
		--sht-ideal-width: 15vw;
		--sht-max-width: 600px;
		--sht-hide-description: block; /* none|block */
	}
	/* UL as grid, flipped for scrollbar at the top */
	.kanka-tag-horizontaltimeline ul.timeline {
		display: grid;
		grid-auto-flow: column;
		justify-content: start;
		transform: rotateX(180deg);
		overflow-x: auto;
		scrollbar-color: var(--sht-slider) var(--sht-gutter);
		padding-bottom: 15px;
		margin: 0;
	}
	.kanka-tag-horizontaltimeline ul.timeline::before {
		content: unset;
	}
	/* LI sizing and timeline spine, content reflipped for scrollbar hack */
	.kanka-tag-horizontaltimeline li[id|="timeline-element"] {
		transform: rotateX(180deg);
		width: clamp(var(--sht-min-width), var(--sht-ideal-width), var(--sht-max-width));
		margin-right: 0;
		margin-bottom: 0;
		border-top: var(--sht-spine-width) solid var(--sht-spine-color);
	}
	/* Branch from spine to event marker */
	.kanka-tag-horizontaltimeline li[id|="timeline-element"]::before {
		display: block;
		position: absolute;
		left: 50%; /* centered? */
		left: 18px;
		top: 0px;
		width: 3px;
		height: 20px;
		background: var(--sht-spine-color);
	}
	/* Element marker position and style */
	.kanka-tag-horizontaltimeline li[id|="timeline-element"] > i {
		left: calc(50% - 13px); /* centered? */
		left: 5px;
		top: 15px;
		background-color: var(--sht-marker-bg);
		color: var(--sht-marker-color);
	}
	/* Date position and style */
	.kanka-tag-horizontaltimeline li[id|="timeline-element"] .timeline-item-head .text-neutral-content {
		position: absolute;
		top: -30px;
		left: 45px;
	}
	/* Timeline element styling */
	.kanka-tag-horizontaltimeline li[id|="timeline-element"] > .timeline-item {
		margin-top: 50px;
		margin-left: 0px;
	}
	/* Hide description if desired */
	.kanka-tag-horizontaltimeline .timeline-item-body:not(.hidden) {
		display: var(--sht-hide-description);
	}
	
	/* Get rid of right sidebar */
	.kanka-tag-horizontaltimeline .entity-sidebar {
		display: none;
	}
	.kanka-tag-horizontaltimeline .entity-main-block {
		grid-column: 2/span 2;
	}
  	/* Restrict dropdown to element’s width, because the transforms mess with the stacking context */
	.kanka-tag-horizontaltimeline .timeline-item .dropdown-menu {
		left: 0;
		right: unset;
		float: unset;
		max-width: 100%;
	}
	.kanka-tag-horizontaltimeline .timeline-item .dropdown-menu > li > a {
		white-space: normal;
	}
	/* Webkit scrollbar patch */
	.kanka-tag-horizontaltimeline ul.timeline::-webkit-scrollbar {
		background-color: var(--sht-gutter);
	}
	.kanka-tag-horizontaltimeline ul.timeline::-webkit-scrollbar-thumb {
		background-color: var(--sht-slider);
	}
}
/* END Salvatos Horizontal Timeline */

/** plugin: Entry Box Backgrounds #2.3 code **/
/* BEGIN Entity Box Backgrounds by Salvatos */
@media screen {
    .sidebar-section-box {
        --sidebar-section-background: hsl(var(--b1)/1);
        --sidebar-section-padding: 10px;
        border-radius: .25rem;
        box-shadow: 0 1px 1px rgba(0,0,0,.1);
    }

    /* Post headings */
    .post-header {
        background-color: var(--box-background, hsl(var(--b1)/1));
        border-radius: .25rem;
        padding: .2rem .5rem;
    }
    .post-title {
        margin: 0;
    }
}
/* END Entity Box Backgrounds by Salvatos */

/** plugin: Extraordinary Tooltips #b5 code **/
:root {
	--summernote-insert-extraordinary-tooltips: enabled;
	--ExT-trigger-icon: " \f00e";
	--ExT-trigger-icon-font: "FontAwesome";
}

/* Style the trigger word/phrase */
.ExT-trigger {
	display: block; /* So that standalone triggers don’t occupy full container width */
	width: max-content;
	position: relative;
	color: var(--link-hover); /* Make triggers that aren’t links stand out a little */
}
/* Add invisible space under the trigger so the element doesn’t
lose focus while moving the pointer to the tooltip, in affixed mode */
.ExT-trigger::before {
	position: absolute;
	content: "";
	height: 20px;
	width: 100%;
	bottom: -15px;
	left: 0;
}
/* Add an optional indicator that ExT is active here */
.ExT-trigger::after {
	content: var(--ExT-trigger-icon, " \f00e");
	font-family: var(--ExT-trigger-icon-font, "FontAwesome");
	font-weight: 400;
	font-size: 12px;
}
.ExT-trigger.no-icon::after {
	content: "";
}
/* Hide Kanka tooltips on triggers and the main entity title */
.ExT-trigger > .tooltip,
.ExT-wrapper .entity-mention-name + .tooltip {
	display: none !important;
}

/* Position and toggle affixed tooltips */
.ExT-wrapper.affixed {
	display: none;
}
.ExT-trigger:hover + .ExT-wrapper.affixed,
.ExT-wrapper.affixed:hover {
	display: block;
	position: relative;
	overflow: hidden;
}

/* Position and animate fixed tooltips */
.ExT-wrapper.fixed {
	position: fixed;
	z-index: 10;
	top: 50%;
	left: 50%;
	overflow: hidden;
	transition: 0.5s opacity; /* mouseout transition to allow moving the pointer from trigger to tooltip before it closes */
	opacity: 0;
	z-index: -1;
	/* transform: scale(0); /* don't remember exactly what this was for, but doesn't seem necessary anymore */
}
.ExT-trigger:hover + .ExT-wrapper.fixed,
.ExT-wrapper.fixed:hover {
	opacity: 1;
	z-index: 99;
	transform: translateX(-50%) translateY(-50%);
}

/* Handle scrollbar behaviour within the tooltip */
.ExT-attribute > .attribute-mention,
.ExT-entry > .ExT-wrap {
	display: block;
	overflow: auto;
	max-width: inherit;
	max-height: inherit;
}

/* Style default tooltip container
   (other variants can be created using additional classes) */
.ExT-wrapper {
	border-radius: 10px;
	padding: 10px 10px;
	background-color: #222;
	--body-text: whitesmoke;
	color: var(--body-text);
	max-width: 80vw;
	max-height: 90vh;
	width: auto;
}
/* Entity title */
.ExT-entry .entity-mention-name {
	text-align: center;
	font-size: 18px;
	font-weight: bold;
	line-height: 1.7;
	color: whitesmoke;
}

/* All attribute mentions in tooltips should be innocuous */
.ExT-wrapper .attribute-mention {
	background: none;
}

/* For TOC userscript, hide heading "to top" link */
.ExT-wrapper .to-top {
	display: none;
}

/* Now to handle triggers in text (paragraphs or otherwise)...
To fake inserting block content in a paragraph, we need:
1. an inline p;
2. an inline span to keep the trigger on the same line;
3. an inline p to join the second paragraph;
4. a block ::after for the bottom margin, which is ignored on inlines,
   as well as to break away anything inline that could follow. */

.ExT-inline,
.ExT-inline + .ExT-trigger,
p .ExT-trigger { /* This last one is for a standalone trigger inside a standard paragraph, for tooltips that contain only phrasing content, and won’t work otherwise */
	display: inline;
	margin: 0;
	position: relative;
}
.ExT-inline + .ExT-trigger + .ExT-wrapper + .ExT-inline::after {
	content: "";
	margin-bottom: 11px;
	display: block;
}

/** plugin: Map Sidebar Optimization #5 code **/
/* BEGIN Map Sidebar Optimization by Salvatos */
#map-body {
	--map-sidebar-text-align: justify;
	--map-sidebar-hyphenate: manual;
	--map-sidebar-font-size: 15px; /* Ideal for Source Sans Pro */
	--map-sidebar-scrollbar-track-color: auto;
	--map-sidebar-scrollbar-slider-color: auto;
	--map-sidebar-scrollbar-width: thin;

	/* Legend spacing */
	#sidebar-map {
		.marker-actions {
			padding-block: 1em;
		}
		.map-legend:not(:last-child) {
			padding: 0 10px;
		}
	}
	/* Get rid of empty space between title and Edit button 
		when the map has no entry */
	.marker-header + .marker-entry:not(:has(p, li, img, div, table)) {
		display: none;
	}

	/* Sticky Back/Remove button */
	.map-legend:last-child,
	.marker-header ~ div .marker-actions {
		position: sticky;
		bottom: 0px;
		margin: 0;
		padding: 10px 0px;
		background: var(--sidebar-background, hsl(var(--si)));
		border-top-left-radius: unset;
    	border-top-right-radius: unset;
	}
	.marker-header + .gap-3 {
		gap: unset;
	}
	.marker-tags {
		margin-bottom: .5rem;
	}

	/* Marker text alignment */
	:is(.sidebar, #map-marker-modal) .entity-content :is(p, li) {
		text-align: var(--map-sidebar-text-align);
		hyphens: var(--map-sidebar-hyphenate);
		font-size: var(--map-sidebar-font-size);
	}

	/* Separate marker text and entity entry with a horizontal line
	rather than the default "From entity" header */
	.marker-custom-entry {
		padding-bottom: 10px;
	}
	.marker-custom-entry ~ .marker-entity-entry {
		border-top: 2px solid #eee;
		padding-top: 10px;
	}
	/* mobile modal */ 
	.marker-entry ~ .marker-entry {
		border-top: 1px solid #bbb;
		padding-top: 10px;
	}
	.marker-custom-entry + .marker-entity-entry {
		display: none;
	}

	/* Scrollbar width and colors */
	:is(#sidebar-content, #map-marker-modal article) {
		scrollbar-width: var(--map-sidebar-scrollbar-width);
		scrollbar-color: var(--map-sidebar-scrollbar-slider-color) var(--map-sidebar-scrollbar-track-color);
	}
	/* Webkit patch */
	:is(#sidebar-content, #map-marker-modal article)::-webkit-scrollbar {
		background-color: var(--map-sidebar-scrollbar-track-color);
	}
	:is(#sidebar-content, #map-marker-modal article)::-webkit-scrollbar-thumb {
		background-color: var(--map-sidebar-scrollbar-slider-color);
	}

	/* Prevent scrollbar in main pane */
	@media (min-width:768px) {
		#sidebar-map, .main-sidebar {
			max-height: calc(100vh - 3.1rem);
		}
	}
}
/* END Map Sidebar Optimization by Salvatos */

/** plugin: Simple Lightbox #1 code **/
/* BEGIN Salvatos Simple Lightbox */
.lightbox {
	display: none;
	z-index: 999;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 1em;
	background: rgba(0, 0, 0, 0.8);
}

/* Unhide the lightbox when targeted */
.lightbox:target {
	display: flex;
	flex-wrap: wrap;
	flex-direction: column;
	justify-content: center;
	align-content: center;
}
/* Show caption based on 'title' attribute */
.lightbox::after {
	content: attr(title);
	margin-top: 10px;
	align-self: center;
	color: lightgrey;
	font-style: italic;
	font-size: 16px;
}

/* Full image sizing */
.lightbox img {
	max-width: 100%;
	max-height: 100%;
}

/* Change cursor icon on hover */
a[href^="#lightbox-"]:hover {
    opacity: 0.9;
    cursor: zoom-in;
}
a[id^="lightbox-"]:hover {
    cursor: zoom-out;
}
/* END Salvatos Simple Lightbox */

/** plugin: Mention Type Indicators #3.4 code **/
/* BEGIN Mention Type Indicators by Salvatos */
.entity-mention::after {
	font-size: var(--mention-icon-size, 12px);
	font-family: "Font Awesome 6 Pro";
	font-weight: 900;
}
.entity-mention[data-entity-type="ability"]::after   { content: " \f06d" }
.entity-mention[data-entity-type="calendar"]::after  { content: " \f133" }
.entity-mention[data-entity-type="character"]::after { content: " \f007" }
.entity-mention[data-entity-type="creature"]::after  { content: " \f78e" }
.entity-mention[data-entity-type="event"]::after     { content: " \f1fd" }
.entity-mention[data-entity-type="family"]::after    { content: " \e300" }
.entity-mention[data-entity-type="journal"]::after   { content: " \f5db" }
.entity-mention[data-entity-type="location"]::after  { content: " \f602" }
.entity-mention[data-entity-type="map"]::after 		 { content: " \f279" }
.entity-mention[data-entity-type="note"]::after 	 { content: " \f518" }
.entity-mention[data-entity-type="item"]::after 	 { content: " \f3a5" }
.entity-mention[data-entity-type="organisation"]::after { content: " \f63d" }
.entity-mention[data-entity-type="quest"]::after 	 { content: " \f4d9" }
.entity-mention[data-entity-type="race"]::after 	 { content: " \e608" }
.entity-mention[data-entity-type="tag"]::after 		 { content: " \f02c" }
.entity-mention[data-entity-type="timeline"]::after  { content: " \e1d1" }
/* END Mention Type Indicators by Salvatos */

/** plugin: Pinned Entry Image #0.5 code **/
/* BEGIN Pinned Entity Image */
/* Preset width and heights */
.pinned-attribute[data-attribute^="pinned portrait"] {
  	--pinned-portrait-width: 182px; /* Kanka’s default sidebar width */
  	--pinned-portrait-height: var(--pinned-portrait-width); /* Default to square images like the entity header */
}
.pinned-attribute[data-attribute^="pinned portrait 200"] {
  	--pinned-portrait-height: 200px;
}
.pinned-attribute[data-attribute^="pinned portrait 250"] {
  	--pinned-portrait-height: 250px;
}
.pinned-attribute[data-attribute^="pinned portrait 300"] {
  	--pinned-portrait-height: 300px;
}
.pinned-attribute[data-attribute^="pinned portrait 350"] {
  	--pinned-portrait-height: 350px;
}
.pinned-attribute[data-attribute^="pinned portrait 400"] {
  	--pinned-portrait-height: 400px;
}
.pinned-attribute[data-attribute^="pinned portrait 450"] {
  	--pinned-portrait-height: 450px;
}
.pinned-attribute[data-attribute^="pinned portrait 500"] {
  	--pinned-portrait-height: 500px;
}
/* Set background, dimensions and styles */
.pinned-attribute[data-attribute^="pinned portrait"] {
	padding: 0;
  	display: block; /* To force display on campaigns that hide attributes with empty values */
    border: unset;
}
.pinned-attribute[data-attribute^="pinned portrait"]:not([data-attribute*="caption"])::after,
.pinned-attribute[data-attribute^="pinned portrait"][data-attribute*="caption"]::before {
  	display: block;
	content: "";
    background-image: var(--entity-image-url, url("https://images.unsplash.com/photo-1528731708534-816fe59f90cb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=300&q=80"));
    margin-left: calc(-1 * var(--sidebar-section-padding));
    width: var(--pinned-portrait-width);
    height: var(--pinned-portrait-height);
    background-size: var(--pinned-portrait-width) var(--pinned-portrait-height);
}
/* Hide the attribute’s name */
.pinned-attribute[data-attribute^="pinned portrait"] > strong {
    display: none;
}
/* Style the attribute’s value as a subheading */
.pinned-attribute[data-attribute^="pinned portrait"]:not([data-attribute*="caption"]) > .pull-right {
    display: block;
	float: unset !important;
	text-align: center;
	font-weight: bold;
}
/* Style the attribute’s value as a caption */
.pinned-attribute[data-attribute^="pinned portrait"][data-attribute*="caption"] > .pull-right {
    display: block;
	float: unset !important;
	text-align: center;
	font-style: italic;
}
/* Hide the gap after the attribute’s value */
.pinned-attribute[data-attribute^="pinned portrait"] > .pull-right + .clear {
    display: none;
}
/* Hide the bottom border */
.pinned-attribute[data-attribute^="pinned portrait"] + .pinned-attribute {
    border: unset;
}

/* Force pinned portrait to go above pinned relations */
/* Only applies when the pinned portrait is the first pinned attribute */
#sidebar-pinned-elements .pins {
	display: flex;
	flex-direction: column;
}
.pinned-relation + .pinned-attribute[data-attribute^="pinned portrait"] {
	order: -1;
}
/* Hide attribute from search pane entity preview */
.search-preview .entity-pinned-attributes [data-attribute^="pinned portrait"] {
	display: none;
}
/* END Pinned Entity Image */

/** plugin: Easy Tabs #1.0 code **/
/* BEGIN Easy Tabs */
:root {
	--summernote-insert-easytabs: enabled;
}
.easytabs {
    --border-thickness: 1px;
    --tab-border: hsl(var(--bc));
    --tab-background: hsl(var(--s));
    --tab-text: hsl(var(--sc));
    --tab-hover-background: hsl(var(--sf));
    --tab-content-background: hsl(var(--b2));
}
/* Clickable tabs */
.easytabs-toggles {
	overflow-x: auto;
    display: flex;
}
.easytabs-tab {
	display: block;
    width: max-content;
    overflow: hidden;
    border: var(--border-thickness) solid var(--tab-border);
	background: var(--tab-background);
	padding: 5px 10px;
	color: var(--tab-text);
    font-size: 17px;
}
.easytabs-tab:not(:first-child) {
    margin-left: calc(-1 * var(--border-thickness)); /* fake border-collapse */
}
.easytabs-tab:first-child {
	border-top-left-radius: 5px;
}
.easytabs-tab:last-child {
	border-top-right-radius: 5px;    
}
.easytabs-tab:hover {
	background-color: var(--tab-hover-background);
    color: var(--tab-text);
}
/* Tab containers */
.easytabs-content {
	scroll-margin-top: 40px;
    margin-top: calc(-1 * var(--border-thickness)); /* fake border-collapse */
  	padding: 1em;
    border: var(--border-thickness) solid var(--tab-border);
    background-color: var(--tab-content-background);
}
/* Tab toggle logic: most hidden by default, last-child hidden specifically if another is targeted */
.easytabs-content, .easytabs-content:target ~ .easytabs-content:last-child {
  display: none;
}
/* Tab toggle logic: shown if targeted, or last-child if none is targeted */
.easytabs-content:last-child, .easytabs-content:target {
  display: block;
}
/* Consecutive display in Summernote, since you can’t activate the tabs, and an outline to distinguish each section */
.note-editable .easytabs-content {
	display: block;
	border: 1px dashed var(--tab-border);
}
/* Also show a hint of the tab’s id on hover to tell them apart if empty */
.note-editable .easytabs-content:empty:hover::after {
	content: "#"attr(id);
    display: block;
	font-style: italic;
    text-align: center;
}
/* END Easy Tabs */

/** plugin: Notice Articles #2.0 code **/
/* BEGIN Notice Posts by Salvatos */
/* Hide unwanted elements */
.notice-post :is(.post-header h3, span[id|="visibility-icon"], .element-toggle i, .post-details, .post-footer) {
	display: none;
}
/* Keep box-tools for admins but take them out of the stacking context to keep the box lean */
.notice-post .post-header .dropdown {
	position: absolute;
	top: -3px;
	right: 0;
}
.notice-post .post-header .dropdown > a {
	vertical-align: unset;
	padding: 0 3px 0 0;
}
/* Center paragraphs/blocks vertically */
.notice-post .entity-content *:last-child {
	margin-bottom: 0;
}
/* Center text by default */
.notice-post .post-body {
	text-align: center;
}
/* Set up easy background changes via bg-* classes and style main container */
.notice-post {
	position: relative;
  	background: var(--box-background);
  	border-radius: .25rem;
    gap: 0;
}
.notice-post .bg-box {
	background-color: inherit;
}
/* END Notice Posts by Salvatos */

/** plugin: Longer Titles in Entry Grids #3? code **/
/* BEGIN Longer Titles in Entity Grids by Salvatos */
/* Undo default overflows and replace with multiline overflow */
.entities-grid div.entity.block:not(.entity-stack):hover .truncate.h-12 {
	text-overflow: unset;
	white-space: unset;
	height: auto;
	padding-bottom: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--entity-grid-max-lines, 4);
    overflow: hidden;
}
/* More available height for text when no image */
.entities-grid .block.avatar[style*="images/defaults/"]:hover + .truncate.h-12 {
    -webkit-line-clamp: var(--entity-grid-max-lines-noimg, 5);
}
/* Fix padding */
.entities-grid div.entity.block:not(.entity-stack):hover {
    padding-bottom: 1rem;
}
/* Consistent height for the Back tile in nested pages */
/*a.entity.block:first-of-type > .bg-box {
	height: auto;
}*/
/* Mobile view is %-based, tweak accordingly */
@media(max-width:639px) {
    /* Lines of text with & without image */
    .entities-grid .entity.block:not(.entity-stack) .truncate.h-12 {
        -webkit-line-clamp: var(--entity-grid-mobile-max-lines, 3);
        
    }
    .entities-grid .block.avatar[style*="images/defaults/"] + .truncate.h-12 {
        -webkit-line-clamp: var(--entity-grid-mobile-max-lines-noimg, 4);
    }
    /* More suitable padding */
    .entities-grid .entity.block:not(.entity-stack) {
        padding-bottom: 0.6rem;
    }
}
/* END Longer Titles in Entity Grids by Salvatos */

/** plugin: DnD5 Condition Tooltips #2.1 code **/
/* BEGIN DnD5 Condition Tooltips by Salvatos */
/** Style outer container (requires :has) **/
/* Background */
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box {
	background: url(https://cdn-ugc.kanka.io/entities/files/OnfHKKTT4rtOeeQZLHwv1ddpZtKMJbykZ52WUwsg.jpg), #dbcbae;
	padding: 5px 8px;
}
/* Border and arrow */
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box {
	padding: 0;
	border: 3px solid #333;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="bottom"]>.tippy-arrow:before {
	border-bottom-color: #333;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="top"]>.tippy-arrow:before {
	border-top-color: #333;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="left"]>.tippy-arrow:before {
	border-left-color: #333;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="right"]>.tippy-arrow:before {
	border-right-color: #333;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="top"] > .tippy-arrow {
	bottom: -1px;
}
body:has(a.entity-mention[data-entity-tags~="dd5condition"][aria-expanded="true"]) .tippy-box[data-placement^="bottom"] > .tippy-arrow {
	top: -1px;
}
/* Fallback for :has */
@supports not (body:has(a.entity-mention)) {
	.tooltip-content.kanka-tag-dd5condition {
		background: url(https://cdn-ugc.kanka.io/entities/files/OnfHKKTT4rtOeeQZLHwv1ddpZtKMJbykZ52WUwsg.jpg), #dbcbae;
		padding: 5px 8px;
		border-radius: 3px;
	}
}

/** Style inner container **/
/* Style name */
.tooltip-content.kanka-tag-dd5condition .entity-name {
	font-family: "Andada Pro", serif;
	font-variant: small-caps;
	font-size: 15px;
	font-weight: bold;
	text-align: left;
	text-decoration: underline;
	color: #a4280b;
}
/* Hide tags*/
.tooltip-content.kanka-tag-dd5condition .tooltip-tags {
	display: none;
}
/* Style paragraphs: mimic list items, which are not parsed in tooltips */
.tooltip-content.kanka-tag-dd5condition p::before {
	content: "• ";
}
.tooltip-content.kanka-tag-dd5condition p {
	font-family: "Libre Baskerville", sans-serif;
	font-size: 12px;
	color: #111;
	margin-bottom: 5px;
  	hyphens: auto;
}
/* Tooltip definitions */
.tooltip-content.kanka-tag-dd5condition p a[title] {
	text-decoration: underline dotted;
	font-style: italic;
	color: inherit;
	font-family: inherit;
}
/* Exceptions for Exhaustion */
.tooltip-content.kanka-tag-dd5condition .exhaustion p:first-child::before {
	content: "";
}
.tooltip-content.kanka-tag-dd5condition tr:not(:last-child) {
	border-bottom: 1px dotted #777
}
.tooltip-content.kanka-tag-dd5condition table {
	font-family: "Libre Baskerville", sans-serif;
	font-size: 12px;
	color: #111;
	vertical-align: baseline;
  	margin-bottom: 5px;
}
.tooltip-content.kanka-tag-dd5condition td {
	padding-left: 5px;
}
.tooltip-content.kanka-tag-dd5condition th {
	padding-inline: 2px 5px;
	border-right: 1px dotted #777;
	font-weight: normal;
}
/* END DnD5 Condition Tooltips by Salvatos */

/** plugin: Reasonable Widget Images #1.0 code **/
/* BEGIN Reasonable Widget Images by Salvatos */
:root {
	--RWI-h: 120px;
	--RWI-c: #fff;
}
.widget-image {
	display: block;
	max-height: var(--RWI-h);
	overflow: hidden;
	aspect-ratio: initial;
}
.widget-header:has(.widget-image) {
	position: relative;
}
.widget-image + .flex {
	position: absolute;
	top: 0;
	color: var(--RWI-c);
	text-shadow: rgba(0,0,0,.9) 0 1px 4px;
}
/* END Reasonable Widget Images by Salvatos */

