/*
 * AFI Class Browser - dark theme.
 *
 * Dark mode is enabled with data-bs-theme="dark" on <html>, so the palette is
 * applied by overriding Bootstrap 5.3 and DataTables 3 custom properties
 * instead of re-declaring framework selectors.
 */

:root {
	/* Bootstrap 5 defaults to a 16px system-ui stack; this site was designed
	   against Bootstrap 3's 14px Helvetica stack, so restore those metrics. */
	--bs-body-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	--bs-body-font-size: 14px;
	--bs-body-line-height: 1.42857143;

	/* Site palette */
	--afi-navbar-height: 3.5rem;
	--afi-bg: #141414;
	--afi-panel-bg: #272624;
	--afi-card-bg: #312f2c;
	--afi-stripe-bg: #1c1b1b;
	--afi-active-bg: #6f2727;
	--afi-hover-bg: #428bca;
	--afi-text: #C0C0C0;
	--afi-link: #0089ff;
	--afi-border: #888;
	--afi-muted: #9aa0a6;
}

[data-bs-theme="dark"] {
	/* Bootstrap */
	--bs-body-bg: var(--afi-bg);
	--bs-body-color: var(--afi-text);
	--bs-emphasis-color: #fff;
	--bs-link-color: var(--afi-link);
	--bs-link-hover-color: #4da6ff;
	--bs-border-color: var(--afi-border);
	--bs-table-color: var(--afi-text);
	--bs-table-bg: transparent;
	--bs-table-striped-color: var(--afi-text);
	--bs-table-striped-bg: var(--afi-stripe-bg);
	--bs-table-hover-color: #fff;
	--bs-table-hover-bg: var(--afi-hover-bg);
	--bs-card-bg: var(--afi-card-bg);
	--bs-card-border-color: var(--afi-border);
	--bs-nav-link-color: #fff;
	--bs-nav-link-hover-color: #fff;

	/* DataTables */
	--dt-html_background: var(--afi-bg);
	--dt-row_background: transparent;
	--dt-order-arrow_color: rgb(229, 233, 238);
	--dt-order-arrow_color-current: #fff;
}

/*
 * Base structure
 */

/* Move down content because we have a fixed navbar */
body {
	padding-top: var(--afi-navbar-height);
	background-color: var(--afi-bg);
	color: var(--afi-text);
}

a {
	color: var(--afi-link);
}

/*
 * Typography
 *
 * Bootstrap 5 sizes headings, buttons and the navbar brand in rem, which does
 * not follow --bs-body-font-size, so the Bootstrap 3 px values the original
 * design relied on are restored (h1 36, h2 30, h3 24, h4 18, h5 14, h6 12).
 */
h1, h2, h3, h4, h5, h6 {
	font-weight: 500;
	line-height: 1.1;
}

h1 {
	font-size: 36px;
}

h2 {
	font-size: 30px;
}

h3 {
	font-size: 24px;
}

h4 {
	font-size: 18px;
}

h5 {
	font-size: 14px;
}

h6 {
	font-size: 12px;
}

/* .btn and .navbar-brand declare their own sizes at element level, so they
   cannot be changed from :root. */
.btn {
	--bs-btn-font-size: 14px;
	--bs-btn-line-height: 1.42857143;
}

.navbar-brand {
	font-size: 18px;
}

/*
 * The class list grid (src/assets/js/class-list.js), which replaced DataTables.
 *
 * The grid builds its own toolbar above the table: the page size, the status
 * line and the pager. The filters - the class name included - live in the
 * header of the table, so nothing of a list search sits above it. The table
 * keeps Bootstrap's .table-striped striping, so the grid needs no styling of
 * its own for rows.
 */
.afi-list-toolbar {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 gap: 10px;
 margin-bottom: 10px;
 font-size: 14px;
}

.afi-list-size-cell {
	flex: 0 0 auto;
	width: 6em;
}

.afi-list-status {
	flex: 1 1 auto;
	color: var(--afi-muted, #9aa0a6);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* A request is open: the grid has asked for a page and has not rendered it. */
.afi-list-loading::after {
	content: ' …';
}

.afi-list-pager {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
}

.afi-list-page {
	width: 5em;
}

.afi-list-pages {
	color: var(--afi-muted, #9aa0a6);
}

.afi-list-th {
	white-space: nowrap;
}

.afi-list-sort {
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.afi-list-sort:hover,
.afi-list-sort:focus {
	text-decoration: underline;
}

/*
 * The header row of the filter fields: one box per column, the searched class
 * name a box like the others, so the row is a line of equally high inputs.
 */
.afi-list-filter-cell {
	font-weight: normal;
	vertical-align: top;
}

.afi-list-filter-cell .afi-list-filter {
	width: 100%;
	margin-bottom: 4px;
	font-size: 13px;
}

.afi-list-filter-cell .afi-list-filter:last-child {
	margin-bottom: 0;
}

.afi-list-empty {
	text-align: center;
	color: var(--afi-muted, #9aa0a6);
}

.table-responsive { overflow-x: initial; }

/*
 * Global add-ons
 */

/* Class detail picture gallery, between the header and the property table.
    No floats: pictures live in their own in-flow block, capped on both axes,
    flex-wrap for multi-picture rows. */
.afi-class-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.afi-class-picture { max-width: 160px; margin: 0; }
.afi-class-gallery-lg .afi-class-picture { max-width: 320px; }
.afi-class-picture img { display: block; width: auto; height: auto; max-width: 100%; max-height: 120px; border: 1px solid var(--afi-border); background: var(--afi-stripe-bg); }
.afi-class-gallery-lg .afi-class-picture img { max-height: 320px; }
.afi-class-picture figcaption { color: var(--afi-muted); font-size: 12px; margin-top: .25rem; overflow-wrap: anywhere; }

.sub-header {
	padding-bottom: 10px;
	border-bottom: 1px solid var(--afi-border);
}

/*
 * Sidebar
 */

/* Hide for mobile, show later */
.sidebar {
	display: none;
}
@media (min-width: 768px) {
	.sidebar {
		position: fixed;
		top: var(--afi-navbar-height);
		bottom: 0;
		left: 0;
		z-index: 1000;
		display: block;
		padding: 20px;
		overflow-x: hidden;
		overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
		background-color: var(--afi-panel-bg);
		font-weight: bold;
	}
}

.table-responsive  {
	font-weight: bold;
}

/* Sidebar navigation */
.nav-sidebar {
	margin-right: -21px; /* 20px padding + 1px border */
	margin-bottom: 20px;
	margin-left: -20px;
}

.nav-sidebar > li > .nav-link {
	line-height: 20px;
	padding-top: 10px;
	padding-right: 20px;
	padding-bottom: 10px;
	padding-left: 20px;
	color: #fff;
}

.nav-sidebar > li > .nav-link.sub {
	line-height: 8px;
	font-size: 85%;
	padding-right: 40px;
	padding-left: 40px;
}

.nav-sidebar > li > .nav-link.active,
.nav-sidebar > li > .nav-link.active:hover,
.nav-sidebar > li > .nav-link.active:focus {
	color: #fff;
	background-color: var(--afi-active-bg);
}

.nav-sidebar > li > .nav-link:hover,
.nav-sidebar > li > .nav-link:focus {
	background-color: var(--afi-hover-bg);
}

/*
 * The class list striping comes from Bootstrap's .table-striped, whose colour is
 * the --bs-table-striped-bg above. The grid needs no rule of its own here; the
 * inset box-shadow DataTables used to need for its own striping is gone with it.
 */
table.afi-list-table {
	--bs-table-striped-bg: var(--afi-stripe-bg);
}

/*
 * Main content
 */

.main {
	padding: 20px;
	width: 80%;
	background-color: var(--afi-bg);
}
@media (min-width: 768px) {
	.main {
		padding-right: 40px;
		padding-left: 40px;
	}
}

.indentblock {
	margin-left: 40px;
}

.collapse.floating {
	position: fixed;
	top: 0;
	right: 0;
	background-color: var(--afi-bg);
	z-index: 10;
	overflow-y: auto;
	height: 100%;
	width: fit-content;
	padding-left: 10px;
}

.collapse {
	overflow: hidden;
	clear: both;
}

/*
 * Addon select panel. The old BS 3 .checkbox rows had min-height 20px and
 * collapsing margins, i.e. ~20px per row; Bootstrap 5 .form-check is 1.5rem +
 * 2px by default, which makes the long addon list taller than before.
 */
#collapseModSelect .form-check {
	min-height: 20px;
	margin-bottom: 0;
}

#collapseModSelect .form-check + .form-check {
	margin-top: 0;
}

span.b {
	font-weight: bold;
}

div.b {
	font-weight: bold;
}

span.p {
	display: block;
}

div.config {
	padding-left: 30px;
	padding: 2px;
	background-color: var(--afi-panel-bg);
	border: 1px solid var(--afi-border);
	overflow: auto;
}

div.config a {
	color: white !important;
}

.hljs {
	background-color: var(--afi-panel-bg) !important;
	color: white !important;
}