@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 400;
  font-display: fallback;
  src: local('Roboto Mono'), local('RobotoMono-Regular'),
      url(/RobotoMono.woff2) format('woff2');
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1rem; /* 16px */
  line-height: 1.5;
  color: #333;
  width: 100%;
}

a, a:link {
  color: #5079bf;
  text-decoration: none;
  font-weight: 600;
}

a:visited {
  color: #7a71e2;
}

a:hover {
  text-decoration: underline;
}

a[target="_blank"]:not(.button):after {
  content: url(/external_link.png);
  margin: -8px -2px 0 1px;
  vertical-align: super;
  display: inline-block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  color: #111;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }

.page-header {
  background-color: #ed7670;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 3px solid #d85b5b;
}

.nomsu-title {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nomsu-title .prefix, .nomsu-title .suffix {
  font-size: 0.85rem;
  color: #7a4242;
  font-weight: 600;
}

.nomsu-title .prefix a, .nomsu-title .suffix a {
  color: inherit;
  font-weight: inherit;
}

.nomsu-title .prefix { margin-bottom: -0.4rem; margin-right: 170px; }
.nomsu-title .suffix { margin-top: -0.4rem; margin-left: 70px; }

.nomsu-logo {
  height: 50px;
  width: auto;
}

.content {
  padding: 0;
  position: relative;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
  max-width: 1350px;
}

.sidebar-container {
  flex: 0 0 auto;
  position: relative;
  display: flex;
}

.sidebar-toggle {
  list-style: none;
  cursor: pointer;
  user-select: none;
  z-index: 100;
}

.sidebar-toggle::-webkit-details-marker {
  display: none;
}

/* Toggle icon logic */
.sidebar-container[open] .icon-closed { display: none; }
.sidebar-container:not([open]) .icon-opened { display: none; }

.desktop-toggle { display: block; }
.mobile-toggle { display: none; }

:root {
  --sidebar-full-width: 220px;
  --sidebar-toggle-width: 20px;
  --sidebar-width: var(--sidebar-full-width);
}

.sidebar-container:not([open]) {
  --sidebar-width: var(--sidebar-toggle-width);
}

@media screen and (min-width: 1066px) {
  .content {
    max-width: none;
    margin: 0;
    width: 100%;
    justify-content: center; /* Center the article/asidebar unit */
    padding-left: var(--sidebar-width);
    transition: padding-left 0.2s ease;
  }

  article {
    margin: 0; /* Let flex centering handle it */
    flex: 0 1 750px;
  }

  .sidebar-container {
    border-right: 1px solid #eee;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    width: var(--sidebar-width);
    transition: width 0.2s ease;
  }
  
  .sidebar-container[open] {
    flex: 0 0 var(--sidebar-width);
  }
  
  .sidebar-container:not([open]) {
    flex: 0 0 var(--sidebar-width);
  }

  .sidebar-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-toggle-width);
    background-color: #f8f9fa;
    border-left: 1px solid #eee;
    z-index: 10;
  }

  .desktop-toggle {
    display: block;
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    text-align: center;
    font-size: 18px;
    color: #999;
    pointer-events: none;
  }

  .sidebar-toggle:hover {
    background-color: #e9ecef;
  }
  
  .sidebar-toggle:hover .desktop-toggle {
    color: #7a4242;
  }

  .sidebar-container:not([open]) .sidebar {
    display: none;
  }
}

.sidebar {
  flex: 1 1 auto;
  width: calc(var(--sidebar-full-width) - var(--sidebar-toggle-width));
  padding: 20px;
  padding-top: 10px;
  background-color: #fdfdfd;
  font-size: 16px;
  line-height: 1.8;
  overflow-y: auto;
  height: 100%;
}

.sidebar ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 4px;
}

.sidebar a {
  font-weight: normal;
  color: #606c71;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
}

.sidebar a:hover {
  color: #5079bf;
  background-color: #f0f4f8;
  text-decoration: none;
}

.sidebar a:focus-visible {
  outline: 2px solid #5079bf;
  outline-offset: -2px;
}

.sidebar-toggle:focus-visible {
  outline: 2px solid #ed7670;
  outline-offset: -4px;
}

.sidebar .active {
  font-weight: bold;
  color: #ed7670;
  background-color: #fff0ef;
}

.sidebar hr {
  border: 0;
  border-top: 1px solid #eee;
  margin: 15px 0;
}

.prev-next {
  display: flex;
  justify-content: space-between;
  font-style: italic;
  color: #999;
  text-align: left;
  margin-top: 0px;
  margin-left: -8px;
  padding: 0;
}

  .prev-next a {
    color: #a2b6d8;
  }

article {
  color: #444;
  flex: 0 1 750px;
  max-width: 750px;
  padding: 1rem 1.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #DDD;
  overflow-x: auto;
}

article h1:first-child {
  margin-top: 0;
}

article h1 {
  padding-left: 0.75rem;
  border-left: 10px solid #ed7670;
  margin-left: -1.5rem;
}

article h2 {
  padding-left: 0.75rem;
  border-left: 6px solid #ed7670;
  margin-left: -1.25rem;
}

p {
  margin-top: 0;
  margin-bottom: 1.5em;
}

.byline {
  color: #aaa;
  margin-top: -1.0em;
  margin-bottom: 1.2em;
}

.byline a {
  color: #aaa;
}

.asidebar {
  flex: 0 0 300px;
}

  aside {
    margin-top: .7em;
    margin-bottom: .7em;
    color: #868279;
    background-color: #f9f7f7;
    padding: 8px;
    box-shadow: 2px 2px 7px rgba(0,0,0,.2);
    position: absolute;
    width: 300px;
    border-left: 6px solid #B8B8B0;
    right: 0;
    z-index: 999;
  }

pre.sourceCode, code.sourceCode {
  color: black;
  background-color: #eeece7;
  font-size: 0.9em;
}
pre.sourceCode {
  padding: 12px;
}
code.sourceCode:not(pre code) {
  padding-left: 4px;
  padding-right: 4px;
}

.sourceCode.lua {
  background-color: #f7f8ff;
}
pre.sourceCode.lua {
  border-left: 6px solid #959bc7;
}
code.sourceCode.lua:not(pre code){
  border-left: 2px solid #959bc7;
  border-bottom: 2px solid #959bc7;
}

.sourceCode.nomsu {
  background-color: #fcf4f2;
}
pre.sourceCode.nomsu {
  border-left: 6px solid #e69b97;
}
code.sourceCode.nomsu:not(pre code) {
  border-left: 2px solid #e69b97;
  border-bottom: 2px solid #e69b97;
}

.sourceCode.bash {
  background-color: #e4e8e3;
}
pre.sourceCode.bash {
  border-left: 6px solid #778a75;
}
code.sourceCode.bash:not(pre code) {
  border-left: 2px solid #778a75;
  border-bottom: 2px solid #778a75;
}

/* ===== Buttons ===== */
a.button {
  border:2px solid #CC796C;
  border-radius: 5px;
  font-size:15px;
  padding: 20px;
  text-decoration:none;
  display:inline-block;
  text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
  font-weight:bold;
  color: #FFFFFF;
  background-image: linear-gradient(to bottom, #ed957b, #db544c);
  font-size: 150%;
  white-space: nowrap;
}

a.button:hover {
  border:2px solid #BD7064;
  background-image: linear-gradient(to bottom, #ed7670, #C94F47);
  text-decoration:none;
}

/* ===== Boxes with arrows on one side ===== */
.arrow-box, .end-box {
	position: relative;
  color: #303836;
	background: #d5cec8;
	border: 3px solid #b09790;
  border-radius: 5px;
  box-shadow: 2px 2px 4px rgba(71, 51, 31, 0.3);
  margin-bottom: 5px;
  width: auto;
  padding: 10px;
  display: inline-block;
  text-align: center;
}

.arrow-box:after, .arrow-box:before {
	top: 100%;
	left: 50%;
	border: solid transparent;
	content: " ";
	height: 0;
	width: 0;
	position: absolute;
	pointer-events: none;
}

.arrow-box:after {
	border-color: rgba(213, 206, 200, 0);
	border-top-color: #d5cec8;
	border-width: 15px;
	margin-left: -15px;
}

.arrow-box:before {
	border-color: rgba(176, 151, 144, 0);
	border-top-color: #b09790;
	border-width: 19px;
	margin-left: -19px;
}

/* ===== Syntax Tree Diagrams ===== */
.syntax-tree {
  border-radius: 3px;
  box-shadow: 4px 4px 4px rgba(71, 51, 31, 0.3);
  background: #fef8f8;
  display: inline-block;
  padding: 10px;
  margin: 10px;
  text-align: left;
}

p.tree,
ul.tree,
ul.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.tree ul {
  margin-left: 1.0em;
}

ul.tree li {
  margin-left: 0.35em;
  border-left: thin solid #000;
}

ul.tree li:last-child {
  border-left: none;
}

ul.tree li:before {
  width: 0.9em;
  height: 0.6em;
  margin-right: 0.1em;
  vertical-align: top;
  border-bottom: thin solid #000;
  content: "";
  display: inline-block;
}

ul.tree li:last-child:before {
  border-left: thin solid #000;
}

.next-page {
  margin-top: 3rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  text-align: center;
  font-weight: 700;
}

.page-footer {
  width: 100%;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-style: italic;
  color: #aaa;
  border-top: 1px solid #eee;
}

.page-footer a {
  color: #aaa;
}

@media screen and (max-width: 1065px) {
  .page-header {
    flex-direction: row;
    justify-content: center;
    padding: 10px 0;
  }

  .nomsu-title .prefix { margin-right: 140px; }
  .nomsu-title .suffix { margin-left: 60px; }
  .nomsu-logo { height: 45px; }

  .nomsu-title {
    margin: 0;
  }

  .sidebar-toggle {
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 2100;
  }

  .desktop-toggle { display: none; }
  .mobile-toggle { 
    display: block;
    font-size: 24px;
    color: #f7c7c5;
  }

  .mobile-toggle:hover {
    color: white;
  }

  .content {
    display: block;
    padding-left: 0;
  }

  article {
    margin-left: auto;
    margin-right: auto;
    padding: 1.5rem;
  }

  article h1 { margin-left: -1.5rem; }
  article h2 { margin-left: -1.5rem; }

  .sidebar {
    display: none;
    width: var(--sidebar-full-width);
  }

  .sidebar-container[open] .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    background: white;
    z-index: 2000;
    width: var(--sidebar-full-width);
    height: 100%;
    overflow-y: auto;
    box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    border: none;
    padding-top: 60px;
  }

  .sidebar-container[open]::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
  }

  .asidebar {
    display: none;
  }

  aside {
    position: relative;
    right: auto;
    left: auto;
    width: auto;
  }
}

@media screen and (max-width: 700px) {
  .prev-next {
    flex-direction: column;
    text-align: center;
    margin-top: 0;
  }

  article h1 {
    margin-top: .2em;
  }
}
