/** plugin: Entry Box Backgrounds #2.2.1 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)/var(--tw-bg-opacity)));
        border-radius: .25rem;
        padding: .2rem .5rem;
    }
    .post-title {
        margin: 0;
    }
}
/* END Entity Box Backgrounds by Salvatos */

/** plugin: Longer Titles in Entry Grids #2 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) .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/"] + .truncate.h-12 {
    -webkit-line-clamp: var(--entity-grid-max-lines-noimg, 5);
}
/* Fix padding */
.entities-grid div.entity.block:not(.entity-stack) {
    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: Scrollable Main Sidebar #1.12 code **/
/* BEGIN Scrollable Main Sidebar */
.main-sidebar {
  --sidebar-scrollbar-track-color: auto;
  --sidebar-scrollbar-slider-color: auto;
  --sidebar-scrollbar-width: thin;
}
@media (min-width:768px) {
	.main-sidebar {
		position: fixed;
	}
	.main-sidebar .sidebar-menu {
		margin-bottom: 0;
	}
	/* Main site sidebar */
	body:not(#map-body) .main-sidebar .sidebar {
		height: calc(100vh - (160px + 50px) - 3rem) !important;
		padding-bottom: 1em;
		overflow-y: scroll;
		scrollbar-width: var(--sidebar-scrollbar-width);
		scrollbar-color: var(--sidebar-scrollbar-slider-color) var(--sidebar-scrollbar-track-color);
	}

	/* Webkit patch */
	body:not(#map-body) .main-sidebar .sidebar::-webkit-scrollbar {
		background-color: var(--sidebar-scrollbar-track-color);
	}
	body:not(#map-body) .main-sidebar .sidebar::-webkit-scrollbar-thumb {
		background-color: var(--sidebar-scrollbar-slider-color);
	}
}
/* END Scrollable Main Sidebar */

/** plugin: Scrollable Map Sidebar #2.4 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) {
	/* Page sizing and scrolling */
	#map-body {
		overflow-y: hidden;
	}
	#map-body .content-wrapper {
		min-height: unset !important;
	}
	
	/* Main sidebar sizing and scrolling */
	#map-body #sidebar-map,
	#map-body .main-sidebar {
		max-height: calc(100vh - 3rem);
	}
	#map-body .main-sidebar .sidebar {
		margin-bottom: 0;
		padding: 0;
	}
	#map-body #sidebar-content {
		max-height: unset;
		padding: 0;
		scrollbar-width: var(--map-sidebar-scrollbar-width);
		scrollbar-color: var(--map-sidebar-scrollbar-slider-color) var(--map-sidebar-scrollbar-track-color);
	}
	
	/* Legend */
	#map-body #sidebar-map .map-legend:not(:last-child) {
		padding: 0 10px;
	}
	
	/* Marker */
	#map-body #sidebar-marker {
		max-height: calc(100vh - 3rem);
	}
	#map-body .pull-right.marker-close {
		margin-right: 5px;
	}
	#map-body :is(.entity-title, .entity-content, .marker-entry) {
		padding: 0 10px;
	}
	
	/* Both */
	#map-body .marker-details {
		padding: 0;
	}
	#map-body .marker-details .marker-name {
		position: sticky;
		top: 0;
		padding: 10px 5px;
		margin: 0;
		background: var(--sidebar-background, hsl(var(--si)));
		min-height: 40px;
	}
	#map-body #sidebar-map .map-legend:last-child,
	#map-body #sidebar-marker .marker-actions {
		position: sticky;
		bottom: 0;
		margin: 0;
		padding: 10px 0px;
		background: var(--sidebar-background, hsl(var(--si)));
	}
	
	/* Webkit patch */
	#map-body #sidebar-content::-webkit-scrollbar {
		background-color: var(--map-sidebar-scrollbar-track-color);
	}
	#map-body #sidebar-content::-webkit-scrollbar-thumb {
		background-color: var(--map-sidebar-scrollbar-slider-color);
	}
}
/* END Scrollable Map Sidebar by Salvatos */

/** plugin: Dead Characters #1.2 code **/
.character-dead {
   --background-image: url('https://kanka-mp-assets.s3.amazonaws.com/prod/plugins/227/images/EpXD4a4A1TZMzSxENyFFKQZQsmsGM4lOz0YXBZAt.jpg');
}
@media (prefers-color-scheme: dark) {
   --background-image: url('https://kanka-mp-assets.s3.amazonaws.com/production/plugins/227/images/9N3uePdUbmgeERdgRQ8crZfzXhFMMqBjj1g94z8R.jpg');
}

.character-dead #app {
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: right bottom;
}

.content-wrapper {
  background-image: var(--background-image);
  background-size: auto;
  background-attachment: fixed;
}

/** plugin: Back to top #1.0 code **/
.content-wrapper {
  position: relative;
  padding-bottom: 50px;
}

.back-to-top {
  display: block !important;
}

/** plugin: Calendar: Inverted Full Moon Icons #2 code **/
/* new moon hollow */
.kanka-entity-calendar .calendar .moon.fa-solid.fa-circle::before { font-weight: 400; }
/* full moon filled */
.kanka-entity-calendar .calendar .moon.far.fa-circle::before { font-weight: 900; }

/** plugin: Calendar: Inverted Quarter Moon Icons #1.0 code **/
/* Northern hemisphere moon icons */
/* last quarter on the left */
.kanka-entity-calendar .calendar .moon.fa-solid.fa-circle-half-stroke.fa-flip-horizontal { transform: unset; }
/* first quarter on the right */
.kanka-entity-calendar .calendar .moon.fa-solid.fa-circle-half-stroke { transform: scaleX(-1); }

/** plugin: Cleaner Printing #0.5 code **/
/* BEGIN Cleaner Printing */
@media print {
	:root {
		/* Force entity-content to use grey-on-white Base theme colors */
		--box-background: unset;
		--body-text: #636b6f;
		--header-text: #222;
		--body-background: unset;
	}
  	
  	/* Ensure that the browser uses its default light theme settings */
  	html {
		color-scheme: light;
	}
	
	/* Remove custom overall and section backgrounds and force dark grey font */
	html, body, .wrapper, .content-wrapper, .content, .entity-name, .box, .bg-box, td, th {
		background: none !important;
		background-color: unset !important;
		box-shadow: unset !important;
    	color: #222 !important;
	}
	
	/* Unnecessary space at the top */
	.content {
		padding-top: 0;
	}
	
	/* Remove various unwanted sections from entity Overview and subpages (Attributes, Abilities, etc.) */
	.entity-name-header :not(.entity-name),
	.entity-header .header-buttons,
	.entity-submenu,
	.entity-history,
	.entity-empty-pin,
	#toc, /* For Auto TOC script users */
	.box-header i,
	.btn-new-post,
  	a[role="button"],
  	a[data-toggle="tooltip"],
  	i.fa-chevron-up, i.fa-chevron-down,
	header,
	footer,
  	.main-sidebar,
  	.alert {
		display: none !important;
	}
  
  	/* Sidebar nuisance */
  	#main-content {
		margin-left: 0 !important;
	}
	
	/* Attributes: live edit*/
	.live-edit-parsed::after {
		content: "";
	}
}
/* END Cleaner Printing */

/** plugin: Change Hidden post color #1.2 code **/
:root {
  --mj-bg-color: #b9e3fb;
}

body[data-theme="dark"] {
  --mj-bg-color: #42484e;
}

body[data-theme="midnight"] {
  --mj-bg-color: #092d44;
}

[data-visibility="2"] .post {
  background-color: var(--mj-bg-color);
}

.character-personalities:has(.fa-lock) .bg-box {
    background-color: var(--mj-bg-color);
}

/** plugin: Pin Privacy Icons #2 code **/
/* BEGIN Pinned Attribute Privacy Icons By Salvatos */
:is(.pinned-attribute, .pinned-relation) > strong::after {
	font-family: "Font Awesome 6 Pro";
	font-size: 10px;
	color: hsl(var(--bc) / .5);
}
/* Non-admins will never see anything but public attributes,
   so there’s no use showing them any icon for attributes */
.is-admin .pinned-attribute > strong::after {
	content: var(--public-attribute-icon, " \f3c1");
}
.is-admin .pinned-attribute[data-private="true"] > strong::after {
	content: var(--public-attribute-icon, " \f023");
}
/* Connections matter for everyone */
/* All: unlocked */
.pinned-relation[data-visibility="1"] > strong::after {
	content: var(--public-attribute-icon, " \f3c1");
}
/* Admins: locked */
.pinned-relation[data-visibility="2"] > strong::after {
	content: var(--private-attribute-icon, " \f023");
}
/* Me & Admins: person-lock */
.pinned-relation[data-visibility="3"] > strong::after {
	content: var(--self-admins-connection-icon, "\f502");
}
/* Only Me: spy */
.pinned-relation[data-visibility="4"] > strong::after {
	content: var(--self-only-connection-icon, "\f21b");
}
/* Campaign members: group */
.pinned-relation[data-visibility="5"] > strong::after {
	content: var(--members-only-connection-icon, "\f0c0");
}
/* END Pinned Attribute Privacy Icons By Salvatos */

/** plugin: Compact Inventory #1.0 code **/
/* BEGIN Compact Inventory by Salvatos */
/* Unset fixed height */
.box-entity-inventory .h-60 {
	height: auto;
}
/* Change to display: grid */
.box-entity-inventory [data-position] div[data-toggle="dialog"] {
	display: grid;
	grid-template-columns: 5rem auto;
	grid-template-areas: "topleft topright"
						 "bottomleft bottomright";
	/* Make direct descendants participate in parent grid */
	> div:not(.cover-background) { /* Except custom images which have no children */
		display: contents;
	}
	/* Place and style each piece of info */
	.item-amount {
		grid-area: topleft;
		&::first-letter {
			color: transparent; /* Remove the odd "+" */
		}
		&::after {
			content: "x"
		}
	}
	.text-lg {
		grid-area: topright;
	}
	div.rounded-full {
		grid-area: bottomleft;
      	height: 4rem;
		width: 4rem;
		margin: 0 auto;
		i { /* Center Font Awesome icons */
			margin: inherit;
		}
	}
	.text-xs {
		grid-area: bottomright;
	}
}
/* END Compact Inventory by Salvatos */

