/*
 * Wikipedia — a theme in the manner of Wikipedia's Vector 2022 skin.
 *
 * The colours are the ones measured from en.wikipedia.org's stylesheet rather
 * than picked by eye:
 *
 *   text #202122 · headings #101418 · links #3366cc
 *   red links #bf3c2c · borders #a2a9b1 · subtle surfaces #f8f9fa
 *
 * What is borrowed is a set of reading conventions, not the furniture: a narrow
 * measure, blue for a page that exists and red for one that does not, a rule
 * under each section heading, and a calm typographic scale. There is no sidebar
 * and no tab bar, because this wiki has nothing to put in them.
 *
 * This file layers over default.css: it sets no sizes that default.css already
 * gets right, and it does not repeat the layout.
 */

:root {
	--wp-text: #202122;
	--wp-heading: #101418;
	--wp-link: #3366cc;
	--wp-link-visited: #6b4ba1;
	--wp-red: #bf3c2c;
	--wp-border: #a2a9b1;
	--wp-rule: #c8ccd1;
	--wp-subtle: #f8f9fa;
	--wp-surface: #fff;      /* the article's own surface, inside the page */
	--wp-code: #f1f2f4;
	--wp-muted: #54595d;
}

/* Orphaned black on a dead-flat page is what reads as unfinished; a very
 * slightly cool surface gives the article something to sit on. */
html { background-color: var(--wp-subtle); }

body {
	font-family: "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--wp-text);
	font-size: 15px;
	line-height: 1.6;
}

/* ---- Header --------------------------------------------------------- */

/* One alignment system. The bar loses its grey slab, gains a hairline, and the
 * navigation shares the article's left edge instead of starting somewhere of
 * its own. */
header {
	background-color: var(--wp-surface);
	color: var(--wp-text);
	border-bottom: 1px solid var(--wp-border);
}

.top-bar { padding: .35rem 0 .1rem; }

.top-bar__home-link,
.top-bar__home-link-wrapper {
	font-family: Georgia, "Times New Roman", serif;
	font-size: 1.15rem;
	letter-spacing: .2px;
	color: var(--wp-heading);
	text-decoration: none;
}

@media screen and (min-width: 801px) {
	.top-bar__wrapper { width: 800px; margin: 0 auto; padding: 0; }
	.top-bar__highlights { padding-left: 0; }
}

.top-bar__highlight-link {
	color: var(--wp-link);
	font-size: .9rem;
}
.top-bar__highlight-link:hover { text-decoration: underline; }

.top-bar__search-bar {
	border: 1px solid var(--wp-border);
	border-radius: 2px;
	font-size: .9rem;
	padding: .2rem .4rem;
}

.auth-links__link, .auth-links__login-link {
	color: var(--wp-link);
	font-size: .9rem;
}

/* ---- Article -------------------------------------------------------- */

/* main.main-width, not main: the base sets the page's padding on .main-width,
 * a class, and a bare element selector loses to it however late this file is
 * loaded. The padding declared here has never applied above 800px — the width
 * at which the base stops being a phone layout — which is the opposite of what
 * was meant, since that is where a wider measure wants more room. */
main.main-width {
	background-color: var(--wp-surface);
	color: var(--wp-text);
	border: 1px solid var(--wp-rule);
	border-radius: 0;
	padding: 1.5rem 2rem 1.25rem;
}

/* The page name becomes a small label above the title, the way a wiki puts its
 * provenance out of the way, instead of a mushroom and a colon half the size of
 * the heading. */
.navi-title {
	border-bottom: 1px solid var(--wp-border);
	padding-bottom: .25rem;
	margin-bottom: 1rem;
	font-size: .8rem;
	font-weight: normal;
	text-transform: uppercase;
	letter-spacing: .06em;
}
.navi-title a { color: var(--wp-border); }

/* The colon joined the icon to the page name. In the label above the title it is
   noise — but it was also the only thing between the icon and the first word,
   and the markup trims whitespace, so hiding it alone left "🔗FRUIT" as one
   blob. The margin replaces the space the colon was taking. */
.navi-title__colon { display: none; }
.navi-title > a:first-child { margin-right: .3rem; }

/* The separator is not noise: without it a nested page name runs together.
   "fruit/apple/seeds" came out as one word, because the slash sits in a span of
   its own and hiding the span removed the only thing between the parts. It reads
   as a breadcrumb now, with a chevron in place of the slash. */
.navi-title__separator {
	/* The glyph is replaced, not merely restyled: a slash set in uppercase
	   small capitals with letter-spacing reads as another letter. Hiding the
	   original and drawing the chevron in its place keeps the markup — the span
	   carries aria-hidden, so nothing here is read aloud either way. */
	font-size: 0;
}

.navi-title__separator::after {
	content: "\203A";
	display: inline-block;
	/* In rem, not em: the span it hangs off has font-size: 0 to hide the slash,
	   so an em here would resolve against zero and draw nothing. .8rem is the
	   label's own size, which puts the chevron level with the capitals. */
	font-size: .8rem;
	line-height: 1;
	letter-spacing: 0;
	color: var(--wp-border);
	margin: 0 .35rem;
	vertical-align: .12em;
}

.mojomarkup-doc { font-size: 1rem; }

/* A rule under each section heading is the strongest encyclopedia cue on the
 * page, and the cheapest to get right. */
.mojomarkup-doc h1,
.mojomarkup-doc h2 {
	font-size: 1.5rem;
	font-weight: normal;
	color: var(--wp-heading);
	border-bottom: 1px solid var(--wp-border);
	padding-bottom: .17em;
	margin: 1.2em 0 .6em;
}
.mojomarkup-doc h3,
.mojomarkup-doc h4 {
	font-size: 1.15rem;
	font-weight: bold;
	color: var(--wp-heading);
	margin: 1em 0 .4em;
}
.mojomarkup-doc h2:first-child,
.mojomarkup-doc h3:first-child { margin-top: 0; }

.heading__link { color: inherit; }

/* Blue for a page that exists, red for one that does not. The renderer already
 * marks the difference with wikilink_internal and wikilink_new; the theme only
 * gives it Wikipedia's colours. */
a, .wikilink_internal { color: var(--wp-link); text-decoration: none; }
a:hover, .wikilink_internal:hover { text-decoration: underline; }
a:visited, .wikilink_internal:visited { color: var(--wp-link-visited); }
.wikilink_new, .wikilink_new:visited { color: var(--wp-red); }

/* ---- Code ----------------------------------------------------------- */

article code {
	background-color: var(--wp-code);
	border: 1px solid var(--wp-rule);
	border-radius: 2px;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: .875em;
	padding: .05rem .25rem;
}

article .codeblock {
	background-color: var(--wp-code);
	border: 1px solid var(--wp-rule);
	border-radius: 2px;
	line-height: 1.5;
}

/* ---- Tables --------------------------------------------------------- */

/* The structure — collapsed borders, a th rule, cells that share the border
 * colour — comes from default.css now, so this only sets the colours and the
 * slightly roomier padding the skin wants. Anything repeated here would be a
 * second copy to keep in step. */
table {
	border-color: var(--wp-rule);
	background-color: #fff;
	font-size: .9375rem;
}

th, td {
	border-color: var(--wp-rule);
	padding: .3rem .55rem;
}

th {
	background-color: var(--wp-code);
	color: var(--wp-heading);
}

caption { caption-side: top; font-size: .875rem; color: var(--wp-muted); }

blockquote {
	border-left: 3px solid var(--wp-border);
	color: var(--wp-muted);
	padding-left: .8rem;
	margin-left: 0;
}

/* ---- Footer of the article ------------------------------------------ */

.prevnext {
	border-top: 1px solid var(--wp-rule);
	margin-top: 1.5rem;
	padding-top: .5rem;
	font-size: .875rem;
}

.page-info__link { color: var(--wp-link); }
.page-info__link:hover { text-decoration: underline; }

/* ---- Cards ---------------------------------------------------------- */

.layout-card {
	background-color: var(--wp-subtle);
	color: var(--wp-text);
	border: 1px solid var(--wp-rule);
	border-radius: 2px;
}

.layout-card__title {
	background-color: #eaecf0;
	border-bottom: 1px solid var(--wp-rule);
	color: var(--wp-heading);
	font-size: .9rem;
}

/* ---- Dark ----------------------------------------------------------- */

/* Dark mode keeps the relationships and lifts the colours: blue and red have to
 * come up to stay readable, and the borders drop to a quiet grey rather than a
 * bright line. */
@media (prefers-color-scheme: dark) {
	:root {
		--wp-text: #eaecf0;
		--wp-heading: #f8f9fa;
		--wp-link: #6e9ef7;
		--wp-link-visited: #b89ce8;
		--wp-red: #f07a6a;
		--wp-border: #54595d;
		--wp-rule: #43464a;
		--wp-subtle: #101418;
		--wp-surface: #1b1e21;
		--wp-code: #27292d;
		--wp-muted: #a7adb5;
	}

	html { background-color: var(--wp-subtle); }
	header { background-color: #16191c; border-bottom-color: var(--wp-border); }
	.top-bar__home-link, .top-bar__home-link-wrapper { color: var(--wp-heading); }

	/* default.css paints article a shade lighter than main, which shows as a
	 * band between the elements inside it. One surface. */
	article { background-color: transparent; color: var(--wp-text); }

	table { background-color: #1b1e21; }
	th, td { border-color: var(--wp-border); }
	th { background-color: var(--wp-code); }
	caption, blockquote { color: var(--wp-muted); }

	.layout-card { background-color: #16191c; }
	.layout-card__title { background-color: #27292d; }
}
