/**
 * Gongbi Skin
 * © 2015-2021 Issara
 * © 2022-2024 WaitSpring
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@import 'variables.less';

/* Page layout */
html,
body {
	padding: 0;
	margin: 0;
}

body {
	background: @base80;
	color: @text;
	font-family: @fonts;
	font-size: @font-size;
	line-height: 1.5;
}

/* Scroll bar */
html {
	scrollbar-color: @base70 @background;
	scrollbar-width: thin;

	::-webkit-scrollbar-track {
		background-color: @background;
	}

	::-webkit-scrollbar-thumb {
		background: @base70;
	}

	::-webkit-scrollbar-button {
		display: none;
		width: 0;
		height: 0;
	}

	::-webkit-scrollbar-corner {
		background-color: transparent;
	}
}

#mw-content {
	padding: 1em 1.5em 2em;
	background: @background;

	.ve-activated & {
		padding-top: 1em;
	}

	.toc {
		border: 1px solid @base70;
		background: @base90;

		& > ul {
			margin: 1em 0;
		}
	}
}

#bodyContentOuter {
	/* Set a z-index for the content to group it away from any nav stuff (extensions) - T200148 */
	position: relative;
	z-index: 0;
}

.mw-footer-container {
	background-color: @base80;
	color: #000;
	font-size: 0.925em;

	ul {
		margin: 0;
	}
}

#p-logo {
	margin: auto;
	text-align: center;
}

#p-logo-text {
	line-height: 1;
	text-align: center;

	a {
		display: block;
		color: @text;
		font-family: @fonts-secondary;
		font-size: 1.5em;
		font-variant: small-caps;

		/* 7+ character names */
		&.long {
			padding: 0 0.75em 0 0;
			font-size: 1.5em;
			line-height: 0.8;
			text-overflow: ellipsis;
		}
	}
}

/* Search */

#simpleSearch {
	position: relative;
	border: solid 1px @base70;
	background: @background;
}

#searchInput {
	width: 100%;
	height: 2.1em;
	min-height: 0;
	padding: 0.25em 4.5em 0.25em 2.5em;
	border: 0;
	margin: 0;
	background: transparent;
	box-shadow: none;
	font-family: inherit;
}

#searchButton,
#mw-searchButton {
	position: absolute;
	top: 0;
	right: 1.5em;
	width: 2.25em;
	height: 2.25em;
	padding: 0;
	margin: 0;
	background-image: url( images/search-ltr.svg );
	/* @noflip */
	background-position: center;
	box-shadow: none;
	.icon();
}

.suggestions {
	background: @background;
	box-shadow: 0 2px 2px 1px rgba( 0, 0, 0, 0.05 );

	.suggestions-special {
		padding: 0.75em 2em;
		border: 1px solid @base80;
		border-bottom-width: @border;
		background-color: @background;
	}

	.suggestions-results {
		border: 1px solid @base80;
		border-bottom-width: @border;
		background-color: @background;
	}

	.suggestions-result {
		padding: 0.65em 2em 0.35em;
		color: @text;
	}

	.suggestions-result-current {
		background-color: @blue;
		color: @background;
	}
}

.dropdown-toggle {
	.dropdown-header();
}

/* Footer */

.mw-footer {
	padding: 1.25em 3em;
	margin: auto;

	ul,
	li {
		padding: 0;
		margin: 1em 0;
		list-style: none;
	}

	#footer-icons {
		margin: auto;
	}

	.footer-icons {
		display: inline-block;
		margin: 1em auto;
	}

	.footer-icons img {
		margin: 5px;
	}

	#footer-info li {
		margin: 0.5em 0;
	}

	#footer-places li {
		display: inline-block;
		margin: 0 1em 0 0;
	}

	#lastmod,
	#credits,
	#copyright {
		display: block;
	}
}

/* Content */

#mw-content-container {
	background: @base95;
}

.tools-inline,
.tools-inline & {
	div,
	ul,
	li {
		display: inline-block;
		padding: 0;
		margin: 0;
		list-style: none;
	}
}

.tools-inline li {
	border-bottom: solid 3px transparent;
	margin: 0.5em 0;

	&:hover {
		border-bottom-color: @base70;
	}

	&.selected {
		border-bottom-color: @blue;

		a {
			color: @text;
		}
	}

	a {
		.ca-icon( 'images/page-tools-grey' );

		&:hover {
			text-decoration: none;
		}
	}
}

#p-views,
#p-more {
	float: right;

	li {
		margin-left: 1em;
	}
}

#ca-watch a {
	.ca-icon( 'images/star' );
	.ca-icon-only();
}

#ca-unwatch a {
	.ca-icon( 'images/star-filled' );
	.ca-icon-only();
}

#ca-unwatch.mw-watchlink-temp a {
	.ca-icon( 'images/star-half-filled' );
	.ca-icon-only();
}

#ca-edit a {
	.ca-icon( 'images/pencil-grey' );
}

#ca-history a,
#ca-undelete a {
	.ca-icon( 'images/clock-grey' );
}

#ca-talk a {
	.ca-icon( 'images/talk-grey' );
}

#ca-addsection a {
	.ca-icon( 'images/plus-grey' );
}

#ca-viewsource a {
	.ca-icon( 'images/wikitext-grey' );
}

#ca-view a,
#ca-view-foreign a {
	.ca-icon( 'images/eyeball-grey' );
}

#ca-view {
	.hidden();
}

#ca-nstab-special {
	.hidden();
}

/* Wikiplus */
#Wikiplus-Edit-TopBtn a {
	.ca-icon( 'images/wikiplus-grey' );
}

/* ToolsRedirect */
#ca-redirect a {
	.ca-icon( 'images/redirect-grey-ltr' );
}

.mw-content-rtl #ca-redirect a {
	.ca-icon( 'images/redirect-grey-rtl' );
}

/* MassEditRegex */
#ca-masseditregex a {
	.ca-icon( 'images/pencil-batch-grey' );
}

/* Namespaces */
#p-namespaces {
	float: left;

	li {
		margin-right: 1em;
	}
}

/* Fallback */
.tools-inline li[ id^='ca-nstab-' ] a {
	.ca-icon( 'images/page-grey' );
}

#siteNotice {
	margin: 0.5em 1em 1.5em;
	font-size: 95%;
}

#localNotice {
	padding: 0;
	text-align: center;

	p {
		margin-right: 1em;
		margin-left: 1em;
	}
}

/* Misc */

a {
	color: @link;
	text-decoration: none;

	&:hover {
		color: darken( @link, 10% );
		text-decoration: underline;
	}

	&:visited {
		color: @link-visited;

		&:hover {
			color: darken( @link-visited, 10% );
		}
	}
}

a.new,
.new a {
	color: @link-red;

	&:hover {
		color: darken( @link-red, 10% );
	}

	&:visited {
		color: @link-red-visited;

		&:hover {
			color: darken( @link-red-visited, 10% );
		}
	}
}

.mw-parser-output a.extiw,
.mw-parser-output a.extiw:active,
.mw-parser-output a.external {
	padding-right: 14px;
	background-image: url( images/external-ltr.svg );
	background-position: center right;
	background-repeat: no-repeat;
	background-size: 12px;
	color: @link-ext;

	&:hover {
		color: darken( @link-ext, 10% );
	}

	&:visited {
		color: @link-ext-visited;

		&:hover {
			color: darken( @link-ext-visited, 10% );
		}
	}
}

.mw-content-rtl .mw-parser-output a.extiw,
.mw-content-rtl .mw-parser-output a.extiw:active,
.mw-content-rtl .mw-parser-output a.external {
	background-image: url( images/external-rtl.svg );
}

a.mw-selflink {
	color: inherit;
	font-weight: bold;
	text-decoration: inherit;
}

.mw-editsection {
	display: inline-block;
	padding-top: 0.5em;
	padding-left: 20px;
	background-image: url( images/pencil-grey.svg );
	background-position: left bottom;
	background-repeat: no-repeat;
	font-family: @fonts;

	a {
		display: inline-block;
		padding: 0.5em 0 0.25em;
		margin-right: 1em;

		&:first-of-type {
			/* make the icon part of the first link */
			padding-left: 20px;
			margin-left: -20px;
		}
	}
}

.mw-editsection-bracket {
	display: none;
}

.mw-indicators {
	display: flex;
	padding: 0.5rem 0 0;
	gap: 0.5rem;
	margin-top: 0.25em;
	margin-left: 1em;
	float: right;

	img {
		/* Line up to baseline; expected indicator icon size is 20px */
		margin-top: -0.5em;
	}
}

.mw-indicator {
	display: inline-block;
	/* margin: 0.65em 0 0 0.25em; */
}

div.magnify a {
	display: block;
	overflow: hidden;
	width: 20px;
	height: 20px;
	margin: 0 0 0.5em 0.5em;
	background-image: url( images/magnify-ltr.svg );
	text-indent: 20px;
	white-space: nowrap;
}

/* Subtitle area
 * @see https://phabricator.wikimedia.org/T173951
 */
#contentSub {
	color: @base20;
	font-size: 84%;

	/* This forces "redirect page" (on a redirect page) etc. on a new line */
	.subpages {
		display: block;
	}
}

/**
 * Old-school "you have new messages" notification bar for when the Echo
 * extension isn't installed
 * Styles copied from /resources/src/mediawiki.skinning/interface.css@REL1_34
 * @see https://phabricator.wikimedia.org/T294679
 */
.usermessage {
	padding: 0.5em 1em;
	border: 1px solid #ffa500;
	margin: 2em 0 1em;
	background-color: #ffce7b;
	color: #000;
	font-weight: bold;
	vertical-align: middle;
}

/* pre and code styles copypasted from core
 * /resources/src/mediawiki.skinning/elements.css and modified a bit
 * @see https://phabricator.wikimedia.org/T177142
 */

.screenplay,
code,
tt,
kbd,
pre,
samp,
.skin-gongbi .monospace {
	font-family: @fonts-mono;
}

.skin-gongbi .serif {
	font-family: @fonts-serif;
}

.skin-gongbi .sans-serif {
	font-family: @fonts-sans;
}

code,
pre,
.mw-code {
	border: 1px solid @base80;
	background-color: @base90;
	color: #000;
}

code {
	padding: 1px 4px;
}

pre,
.mw-code {
	padding: 1em;
	/* Wrap lines in overflow. T2260, T103780 */
	white-space: pre-wrap;
}

.mw-body {
	word-wrap: break-word;

	h1,
	h2,
	h3,
	h4,
	h5,
	h6 {
		margin: 1.25em 0 0.5em;
		font-family: @fonts-secondary;
		font-weight: normal;
		line-height: 1.125;
	}

	h1.firstHeading {
		display: block;
		padding: 0 0 0.125em;
		border-bottom: solid 4px @blue;
		margin: 0.25em 0 0.5em;
	}

	h1 {
		border-bottom: solid 3px @base70;
		font-size: 2em;
	}

	h2 {
		border-bottom: solid 2px @base70;
		font-size: 1.8em;
	}

	h1,
	h2 {
		// Introduce a "block formatting context" so that the border-bottom underline doesn't overlap
		// thumbnails, infoboxes and other floated content.
		// https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
		//
		// It also allows floated content inside the heading to not be affected by those other floats
		// (e.g. [edit] links when floated by gadgets, or [subscribe] links in DiscussionTools T318872).
		//
		// Other skins commonly use 'overflow: hidden' for this, but in our case it causes text in
		// languages with tall scripts to be cut off (T195822). 'display: flow-root' works in all
		// browsers supported by MediaWiki except IE 11 (https://caniuse.com/?search=flow-root).
		display: flow-root;
	}

	h3 {
		font-size: 1.75em;
	}

	h4 {
		font-size: 1.5em;
	}

	h5 {
		font-size: 1.25em;
	}

	h6 {
		font-size: 1.2em;
	}

	dt {
		margin: 0.5em 0;
		font-family: @fonts-secondary;
		font-weight: bold;
		line-height: 1.125;
	}

	dl {
		margin: 0.5em 0;
	}

	dd {
		margin: 0 0 0 2em;
	}

	form dt {
		margin: 0 0.5em 0 0;
	}

	/* overflow:hidden on the header itself breaks tall scripts, but we need to hide
	 * overflow on the border itself in output for proper thumb handling. Too weird to
	 * change this everywhere, so we'll just do it for parser output for now.
	 */
	.mw-parser-output {
		h1,
		h2 {
			border-bottom: 0;

			&::after {
				display: block;
				overflow: hidden;
				border-bottom: solid 2px @base70;
				content: '';
			}
		}

		h1::after {
			border-bottom-width: 3px;
		}

		ul,
		ol {
			padding: 0;
			margin-top: 0.25em;
			margin-bottom: 0.25em;
			margin-left: 2em;
		}
	}
}

/* Keep images from overflowing */
.mw-body-content a > img,
.mw-body-content .floatnone > img {
	height: auto !important;
}

a > img,
.floatnone > img {
	/* Hopefully these are only templates or something sane to begin with */
	/* See: T269970 */
	.mw-body-content table & {
		max-width: unset !important;
		height: unset !important;
	}
}

#siteSub {
	display: none;
	margin: -0.5em 0 0.5em 0;
	font-family: @fonts-secondary;
}

hr {
	border-width: 1px;
	border-style: solid none;
	border-color: @base70;
	margin: 0.5em 0;
}

pre {
	overflow: auto;
	white-space: pre-wrap;
}

p {
	margin: 0.25em 0;
}

ul,
ol {
	padding-left: 0;
	margin: 0.25em 0 0.25em 2em;
}

/* body */
.mw-hide-empty-elt .mw-parser-output:not( .mw-show-empty-elt ) .mw-empty-elt {
	display: none;
}

.center {
	margin-right: auto;
	margin-left: auto;
	text-align: center;
}

/* Thumbnails */
/* @noflip */
.floatright,
.tright {
	padding: 0 0 1em 1.5em;
	margin: 0 0 0.5em 0.5em;
}

/* @noflip */
.floatleft,
.tleft {
	padding: 0 1.5em 1em 0;
	margin: 0 0.5em 0.5em 0;
}

.thumbinner {
	overflow: hidden;
	padding: 0.75em;
	border: 1px solid @base70;
	margin-right: auto;
	/* Properly center framed thumbnail images (T219717) */
	margin-left: auto;
	background: @base90;
}

.thumbcaption {
	/* For the magnify link on empty captions */
	min-height: 1em;
	padding: 0.5em 0 0;
	font-size: 95%;

	&:empty {
		min-height: 0;
		padding: 0;
	}
}

.thumbinner .thumbimage,
.thumbborder {
	border: solid 1px @base80;
}

.mw-body li.gallerybox div.thumb {
	padding: 0;
	background: @base90;
}

/* Tables of contents */
ul#filetoc,
.toc,
.toccolours,
.mw-warning {
	display: table;
	padding: 1.25em 1.5em;
	margin-top: 1em;
	margin-bottom: 1em;
	background: @base90;
	font-size: 100%;
}

.toc {
	line-height: 1.2;

	ul {
		margin: 1em 0 0;
		list-style: none;
		text-align: left;
	}

	li {
		margin: 0.25em 0;

		&:last-child {
			margin-bottom: 0.5em;
		}
	}
}

ul#filetoc {
	display: block;
	margin-bottom: 2em;
}

.mw-body .toctitle {
	text-align: unset;

	h2 {
		display: inline;
		border-bottom: 0;
		margin: 0;
		font-family: @fonts-serif;
		font-size: 1.125em;
		font-weight: bold;

		&::after {
			display: none;
			border-bottom: 0;
		}
	}
}

.toctogglespan {
	float: right;
}

/* Remove brackets around the show/hide button of the TOC
The selectors have a higher specifity than in core */
body :not( :checked ) > .toctogglespan::before,
body :not( :checked ) > .toctogglespan::after {
	content: '';
}

.toctogglelabel {
	padding-left: 0; /* Overwrite label { padding-left: 0.5em; } from forms.less */
	margin-left: 0.5em; /* Create new distance to the TOC title without increasing the focus ring */
}

.toclevel-1 {
	margin-bottom: 0.25em;
}

.tocnumber {
	color: @base20;
}

.skin-gongbi .mw-body .oo-ui-tagMultiselectWidget-handle,
.skin-gongbi .mw-body .oo-ui-capsuleMultiselectWidget-handle {
	margin: 0; /* wat */
}

.mw-body .mw-rcfilters-ui-changesListWrapperWidget .mw-changeslist-legend, /* wat */
.mw-changeslist-legend,
.mw-body .mw-search-profile-tabs,
.mw-body fieldset#mw-searchoptions,
.mw_metadata,
.wikitable,
.mw-datatable {
	background: @base90;
	color: @text;
}

.mw-body .mw-search-profile-tabs {
	padding: 0.5em;
}

.mw_metadata,
.mw-datatable,
.wikitable {
	border-color: @base70;
	margin: 1em auto;
	background: @base90;

	> tr > th,
	> tr > td,
	> * > tr > th,
	> * > tr > td {
		padding: 0.5em;
		border: 1px solid @base70;
	}
}

.mw-datatable th {
	background: @blue-bright;
}

.mw_metadata th,
.wikitable th {
	background: @base90;
}

.mw_metadata {
	border-bottom-width: 3px;
}

/* Portlets */
.emptyPortlet,
#mw-page-header-links .emptyPortlet {
	display: none;
}

#p-lang.emptyPortlet {
	display: inherit;
}

/* Hidden stuff */

#p-namespaces h3,
#p-views h3,
#p-more h3,
#p-search h3 {
	.hidden;
}

/* Categories on bottom of page */
#catlinks-sidebar {
	.nav-block();
}

#catlinks {
	.nav-block();
	padding: 1.25em 2.5em;

	&::before {
		display: block;
		padding: 0.5em 0;
		border-top: solid 0.5px @base80;
		content: '';
	}

	li {
		padding: 0.25em 0.5em;
		border-left: 0;
	}

	div {
		margin: 0 0 0.35em;
	}

	div:last-of-type {
		margin: 0;
	}

	.catlinks-allhidden {
		display: none;
	}
}

/* Code for Special:Recentchanges */
.mw-rcfilters-ui-filterWrapperWidget-showNewChanges span {
	white-space: break-spaces !important;
	word-break: break-word;
}

.mw-changeslist-legend dt {
	margin: 0 0.5em 0 0;
}

.mw-changeslist-legend dd {
	margin-bottom: 0;
	white-space: break-spaces !important;
	word-break: break-word;
}

.mw-changeslist-line-inner {
	word-break: break-word;
}
