/* The layout defaults Typora applies underneath every theme (its built-in
   base.css), reduced to what a rendered page uses. Loaded before newsprint.css
   so the theme overrides these exactly as it does inside Typora. */

:root {
	--select-text-bg-color: #B5D6FC;
	--select-text-font-color: auto;
	--monospace: "Lucida Console", Consolas, "Courier", monospace;
}

html {
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	padding: 0;
	font-size: 1rem;
	line-height: 1.42857143;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

::selection {
	background: var(--select-text-bg-color);
	color: var(--select-text-font-color);
}

#write {
	margin: 0 auto;
	padding: 36px 30px 100px;
	word-break: normal;
	word-wrap: break-word;
	position: relative;
}

h1, h2, h3, h4, h5, h6, p {
	margin-top: 1rem;
	margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }

p { line-height: inherit; }

a.url { word-break: break-all; }

img {
	max-width: 100%;
	vertical-align: middle;
	image-orientation: from-image;
}

/* An image alone in its paragraph is centred. */
p > img:only-child {
	display: block;
	margin: auto;
}

figure {
	overflow-x: auto;
	margin: 1.2em 0;
	max-width: calc(100% + 16px);
	padding: 0;
}

figure > table { margin: 0; }

table {
	border-collapse: collapse;
	border-spacing: 0;
	width: 100%;
	overflow: auto;
	text-align: left;
}

table tr th { border-bottom: 0; }

blockquote { margin: 1rem 0; }
blockquote > :last-child { margin-bottom: 0; }
blockquote > :first-child,
li > :first-child { margin-top: 0; }

li { margin: 0; position: relative; }
li p { margin: .5rem 0; }

code, pre, samp, tt { font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }

#write pre { white-space: pre-wrap; }

.md-fences {
	font-size: .9rem;
	display: block;
	text-align: left;
	overflow: visible;
	white-space: pre;
}

iframe { max-width: 100%; width: 100%; border: none; }
video { max-width: 100%; display: block; margin: 0 auto; }

mark { background: #ff0; color: #000; }

kbd {
	margin: 0 .1em;
	padding: .1em .6em;
	font-size: .8em;
	color: #242729;
	background: #fff;
	border: 1px solid #adb3b9;
	border-radius: 3px;
	box-shadow: 0 1px 0 rgba(12, 13, 14, .2), 0 0 0 2px #fff inset;
	white-space: nowrap;
	vertical-align: middle;
}

/* Inline maths sits at 95% of the text size, as in Typora. */
mjx-container:not([display="true"]) { font-size: 95%; }
