/**
 * 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';

/* Override default here because mobile narrow */
@content-padding: 0.5em;

/* Layout */

#mw-data-after-content {
	padding: 0 @content-padding;
}

#p-variants-desktop,
#mw-page-header-links #ca-view,
#page-tools h2,
#page-more h2,
#other-languages h2,
#p-logo {
	display: none;
}

#mw-header-container {
	border-bottom: solid 4px @blue;
	background: @background;
}

#mw-header {
	.flex-display;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	padding-top: 0.25em;
	gap: 0.25em 1.25em;
}

#p-search {
	.flex(1, 1, 100%, 4);
	margin: 0.125em auto;

	.sidebar-inner {
		left: 1.25em;
		padding-top: 0.5em;
		max-width: 100%;
	}
}

/* Dropdowns */
.sidebar-inner,
.dropdown {
	position: absolute;
	z-index: 100;
	top: 2.25em;
	right: 0.75em;
	display: none;
	overflow: visible;
	min-width: 9em;
	max-width: 320px;
	max-height: calc( 90vh - 5em );
	padding: 1em 2.5em;
	margin: 0;
	background: @background;
	box-shadow: 0 2px 3px 1px rgba( 0, 0, 0, 0.05 );
	.nav-block();

	h3 {
		margin: 0.5em 0 1.5em;
	}

	ul {
		margin: 1em 0;
	}

	li {
		display: inline-block;
		margin: 0.5em 1em 0.5em 0;
		white-space: nowrap;
		word-break: keep-all;
	}
}

#menus-cover {
	position: fixed;
	z-index: 99;
	top: 0;
	left: 0;
	display: none;
	overflow: hidden;
	width: 100%;
	height: 100%;
	background: @base80;
	opacity: 0.8;
}

/* Dropdown toggles */
#site-functions {
	.flex-display;
	align-items: center;
	.flex(0, 1, 11vw, 1);
	margin-left: 1.5em;
	margin-right: 1.5em;
	gap: 1.5em;

	#sidebar-tools {
		.flex(0, 1, auto, 1);
	}

	#search-button {
		.flex(0, 1, auto, 2);
	}
}

#user-tools {
	.flex-display;
	align-items: center;
	flex-direction: row-reverse;
	.flex(0, 1, 19vw, 3);
	margin-right: 1.25em;

	#personal {
		.flex(1, 1, auto, 1);
	}
}

#user-tools h2,
#sidebar-tools h2,
#search-button h2,
.sidebar-chunk h2 {
	width: 20px;
	height: 20px;
	padding-bottom: 0;
	margin: 0;
	background-position: center center;
	background-repeat: no-repeat;
	cursor: pointer;
	font-size: 1em;

	span {
		display: inline-block;
		.icon();
	}
}

#user-tools h2,
#sidebar-tools h2 {
	align-items: center;
}

#user-tools h2 {
	margin-left: 0.5em;
	background-image: url( images/user-grey.svg );
	background-size: 18px;
}

#sidebar-tools h2,
#search-button h2,
.sidebar-chunk h2 {
	background-size: 20px;
}

#sidebar-tools h2 {
	background-image: url( images/menu-grey.svg );
}

#search-button h2 {
	background-image: url( images/search-ltr.svg );
}

.mw-content-rtl #search-button h2 {
	background-image: url( images/search-rtl.svg );
}

#site-navigation {
	h2 {
		display: none;

		&::after {
			display: none;
		}
	}

	.sidebar-inner {
		right: auto;
		left: 1.25em;
	}
}

/* Toggle buttons */

.mobile-close-button {
	position: absolute;
	z-index: 100;
	display: none;
	width: 2em;
	margin: 0;
	background-color: @background;
	background-image: url( images/close-grey.svg );
	background-position: center center;
	background-repeat: no-repeat;
	background-size: 18px;
	box-shadow: 0 2px 3px 1px rgba( 0, 0, 0, 0.05 );
	cursor: pointer;
	.nav-block();
	padding: 1em 0;
}

/* Logo */

#p-logo-text {
	.flex-display;
	align-items: center;
	.flex(1, 1, auto, 2);

	a {
		display: inline;
		max-width: 6em;
		margin: auto;
		line-height: 1;
	}
}

.wordmark img {
	width: auto;
	height: 1.25em;
	object-fit: contain;
}

/* Notifications */

div.mw-notification-area {
	top: @fixed-header-height + 3.25em;
}

/* Page actions */

#p-namespaces li {
	margin-right: 1.5em;
}

.tools-inline li a,
.tools-inline li[ id^='ca-nstab-' ] a {
	.ca-icon-only();
	background-position: center top !important;
}

#ca-tools,
#ca-more,
#ca-languages {
	&::after {
		margin-left: -0.35em;
	}

	span {
		.ca-icon-only();
		display: inline-block;
		overflow: visible;
		width: 20px;
		height: 20px;
		margin-right: 7.5px;
	}
}

#ca-tools span {
	background-image: url( images/gear-grey.svg );
	background-repeat: no-repeat;
	background-size: 20px;
}

#ca-more span {
	background-image: url( images/more-grey.svg );
	background-repeat: no-repeat;
	background-size: 20px;
}

#ca-languages span {
	background-image: url( images/languages-grey.svg );
	background-repeat: no-repeat;
	background-size: 20px;
}

/* Full-width thumbnails */

div.thumb {
	float: none;
}

.thumb {
	margin: 1em auto;
}

.floatright,
.tright {
	padding-left: 0;
	margin-left: 0;
}

.floatleft,
.tleft {
	padding-right: 0;
	margin-right: 0;
}

.thumbinner {
	width: 100% !important;
	box-sizing: border-box;
	padding: 1em 1.5em;
}

.thumbimage {
	display: block;
	max-width: 100%;
	margin: 0 auto 0.5em;
}

figure[ typeof~='mw:File/Thumb' ],
figure[ typeof~='mw:File/Frame' ] {
	width: 100% !important;

	> a:first-child,
	> span:first-child {
		> *:first-child {
			margin: 1em 1.5em;
		}
	}

	> figcaption {
		padding: 0 1.5em 1em 1.5em;
	}
}

// FIXME: Clear the magnify clip for now
figure[ typeof~='mw:File/Thumb' ]:not( [ typeof~='mw:Error' ] ) {
	> figcaption::before {
		content: none;
	}

	> a::after {
		content: none;
	}
}

.mw-body {
	border: 0;

	table {
		width: 100%;
		margin-right: 0;
		margin-left: 0;

		table {
			/* HOLD ON WHAT ABORT ABORT */
			width: unset;
			margin-right: unset;
			margin-left: unset;
		}
	}
}

#mw-content {
	border-width: 0;
}

#mw-content-block {
	background: @background;
}

/* Table of contents */
.toc,
.mw-warning {
	width: 100%;
	box-sizing: border-box;
}

/* Misc */
.nomobile {
	display: none;
}

/* Recent changes */
.mw-changeslist-legend {
	width: 200px;
	margin: 0 0 0 auto;
	float: none;
}

.mw-changeslist-line {
	margin-left: 0 !important;
}

td.mw-enhanced-rc-nested {
	padding-left: 0 !important;
}

/* File pages */
#file img {
	max-width: 100%;
	-o-object-fit: contain;
	object-fit: contain;
}
