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

:root {
  --text: #1a1a1a;
  --bg: #fffff8;
  --accent: #a00;
  --gray: #555;
  --rule: #ccc;
  --font-serif: 'Latin Modern Roman', Georgia, serif;
  --font-sans: 'Latin Modern Sans', sans-serif;
  --font-mono: 'Latin Modern Mono', monospace;
  --font-size: 14pt;
  --line-height: 1.45;
  --max-width: 36em;
}

html {
  font-size: var(--font-size);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

body {
  font-family: var(--font-serif);
  color: var(--text);
  background: var(--bg);
  line-height: var(--line-height);
  padding: 2rem 1rem;
}

main { max-width: var(--max-width); margin: 0 auto; }

/* Site header */
main > header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--text);
}

main > header h1 {
  font-size: 2.2rem;
  font-weight: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-variant: small-caps;
  margin-bottom: 0.2rem;
}

main > header h2 {
  font-style: italic;
  color: var(--gray);
  font-size: 0.92rem;
  font-weight: normal;
}

/* Entry */
article {
  margin-bottom: 3.5rem;
}

article header {
  font-size: 0.8rem;
  color: var(--gray);
  font-family: var(--font-sans);
  margin-bottom: 0.3rem;
}

article header a {
  color: var(--gray);
}

article header a:hover {
  color: var(--accent);
}

article header .tag {
  font-size: 0.78rem;
  background: #f0f0eb;
  padding: 0.1em 0.4em;
  border-radius: 2px;
  margin-left: 0.3em;
}

/* Back link */
nav {
  margin-bottom: 1.5rem;
}

nav a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

/* Paragraphs */
p {
  text-align: justify;
  hyphens: auto;
  margin-bottom: 0;
}

/* Inline styles */
.textbf { font-weight: bold; }
.textit { font-style: italic; }
.textsc { font-variant: small-caps; }
.textrm { font-family: var(--font-serif); }
.texttt { font-family: var(--font-mono); }
.textsf { font-family: var(--font-sans); }
.textsl { font-family: 'Latin Modern Roman Slanted'; }

/* Sizes */
.tiny         { font-size: 0.5rem; }
.scriptsize   { font-size: 0.6rem; }
.footnotesize { font-size: 0.75rem; }
.small        { font-size: 0.85rem; }
.large        { font-size: 1.15rem; }
.Large        { font-size: 1.35rem; }
.LARGE        { font-size: 1.7rem; }

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #f4f4ef;
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

pre {
  background: #f4f4ef;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  margin: 0.8rem 0;
  border-left: 3px solid var(--rule);
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code { background: none; padding: 0; }

/* Blockquote */
blockquote {
  margin: 0.8rem 0 0.8rem 2em;
  padding-left: 1em;
  border-left: 2px solid var(--rule);
  font-style: italic;
  color: var(--gray);
}

/* Lists */
ul, ol { margin: 0.6rem 0 0.6rem 2em; }
li { margin-bottom: 0.2rem; }

/* Table */
table {
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.95rem;
}

thead { border-top: 2px solid var(--text); border-bottom: 1px solid var(--text); }
tbody { border-bottom: 2px solid var(--text); }
th, td { padding: 0.25rem 1rem; text-align: left; }
th { font-weight: bold; }

/* Theorem environments */
.theorem, .definition, .lemma, .proof {
  margin: 0.8rem 0;
  padding: 0.6rem 0;
}

.theorem, .lemma { font-style: italic; }
.env-title { font-style: normal; font-weight: bold; margin-right: 0.4em; }

.proof { font-style: normal; }
.proof .env-title { font-style: italic; font-weight: normal; }
.proof::after { content: " □"; float: right; }

/* HR */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 1rem 0;
}

/* Links */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
