:root {
  /* https://qwtel.com/posts/software/the-monospaced-system-ui-css-font-stack/ */
  --font-family-sans-serif: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
    "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  --font-family-monospace: ui-monospace, Menlo, Monaco, "Cascadia Mono",
    "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace",
    "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;

  --base-font-size: 18px;
  --base-line-height: 1.2;

  --color-brand: #91041c;
  --color-brand-dark: #6d0416;
  --color-brand-light: #c13e54;

  --color-background-primary: #fff;
  --color-background-secondary: #f5f6fa;

  --color-text-primary: #000;
  --color-text-invert: #fff;
  --color-text-link: var(--color-brand);
  --color-text-visited: var(--color-brand-dark);

  --color-selection: var(--color-brand);

  --z-search-modal: 10;
  --z-header: 20;

  --header-height: 3rem;
  --border-radius: 0.5rem;
  --box-shadow: 0 0 16px;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  font-family: var(--font-family-sans-serif);
  font-size: var(--base-font-size);
  line-height: var(--base-line-height);

  text-rendering: optimizeSpeed;

  background-color: var(--color-background-secondary);
}

a {
  color: var(--color-text-link);
}

a:visited {
  color: var(--color-text-visited);
}

a:hover {
  text-decoration: underline;
}

a.anchor {
  display: block;
  position: relative;
  top: calc(-1 * (var(--header-height) + 0.5rem));
  visibility: hidden;
}

*::selection {
  color: var(--color-text-invert);
  background-color: var(--color-selection);
}

hr {
  margin: 1rem 0;
}

/* === SPECIFIC === */

.symbol {
  display: inline-block;
  vertical-align: middle;
  height: 1rem;
  margin: 1px;
}

.number {
  font-family: var(--font-family-monospace);
  font-size: small;
}

.container {
  display: flex;
  background-color: var(--color-background-secondary);
  height: 100%;
}

/* --- TABLE OF CONTENTS --- */

.toc {
  height: 100vh;
  min-width: 15rem;
  max-width: 20rem;
  overflow-y: scroll;
  position: sticky;
  top: 0;
  padding: 1rem;
  background-color: var(--color-background-primary);
}

.hide-toc {
  display: none;
}

@media screen and (max-width: 576px) {
  .toc {
    position: fixed;
    margin-top: var(--header-height);
    padding-bottom: calc(var(--header-height) + 10rem);
    box-shadow: var(--box-shadow);
  }
}

@media print {
  .toc {
    display: none;
  }
}

.toc > *:first-child {
  margin-top: 0;
}

.toc-element {
  display: flex;
  flex-direction: row;
  align-items: baseline;
}

.toc-name {
  padding-left: 0.2rem;
}

.toc-part {
  margin-top: 0.5rem;
}

.toc-chapter {
  margin-left: 1rem;
}

.toc-rule {
  margin-left: 2rem;
}

/* --- MAIN CONTENT --- */

.content {
  width: 100%;
}

.header {
  display: flex;
  padding: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;

  z-index: var(--z-header);

  height: var(--header-height);
  width: 100%;
  position: sticky;
  top: 0;

  background-color: var(--color-brand-light);
}

.toggle-toc-button {
  flex-shrink: 1;
  width: 24px;
  height: 24px;
  margin-right: 1rem;
  cursor: pointer;
}

.search {
  width: 50rem;
  height: 2rem;
  padding: 0.2rem 1rem;

  border-radius: 5000px;
  border: 0;
}

.buffer {
  flex-shrink: 1;
  width: 24px;
}

@media screen and (max-width: 1200px) {
  .search {
    width: 100%;
    margin: 0;
  }

  .buffer {
    display: none;
  }
}

.search:focus {
  outline: 2px solid var(--color-brand-dark);
}

.main-container {
  width: 100%;
  padding: 1rem;
}

.main {
  width: 50rem;
  margin: 0 auto;
  padding: 1rem;

  background-color: var(--color-background-primary);

  border-radius: var(--border-radius);
}

@media screen and (max-width: 1200px) {
  .main-container {
    padding: 0;
  }

  .main {
    width: 100%;
    margin: 0;
  }
}

.main-heading {
  padding: 1rem 0 2rem;
  text-align: center;
}

.rules-header {
  margin-bottom: 1rem;
}

.text > *:first-child {
  margin-top: 0;
}

.text > *:last-child {
  margin-bottom: 0;
}

.text > * {
  margin: 1rem 0;
}

.rules-part {
  margin: 2rem 0;
  border-bottom: 1px solid black;
}

.rules-chapter {
  margin: 1rem 0;
}

.rules-rule,
.rules-subrule,
.rules-example {
  padding-left: 1rem;
  text-indent: -1rem;
}

.rules-subrule {
  padding-left: 3rem;
}

.rules-example {
  padding-left: 4rem;
}

.credits {
  font-size: small;
}

/* --- MODAL --- */

#search-modal {
  position: fixed;
  top: var(--header-height);
  width: 48rem;

  z-index: var(--z-search-modal);

  background-color: var(--color-background-secondary);
  padding: 0 0.5rem;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--box-shadow);
}

@media screen and (max-width: 576px) {
  #search-modal {
    left: 0;
    width: 100%;
  }
}

.search-result {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  background-color: var(--color-background-primary);
  cursor: pointer;
}

.search-result-selected,
.search-result:hover {
  background-color: var(--color-brand-light);
  color: var(--color-text-invert);
}

.hide-search-modal {
  display: none;
}
