@font-face {
  font-family: "LM Math";
  src: url("/fonts/latinmodern-math.otf");
}

html,
input {
  font-family: sans-serif;
  font-size: 20px;
  line-height: 1.5;

  color: #222;
}

h1 {
  text-align: center;
  font-weight: normal;

  margin-bottom: 0;

  &+h2 {
    font-weight: normal;
    text-align: center;
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
  }
}

math {
  font-family: "LM Math";
  font-size: 1.25rem;
  display: block;

  p.desc>& {
    padding: 0.5rem;
    background-color: #eaeaea;
    width: fit-content;

    margin: 0 auto;
    border: 1px solid #666;
  }
}

body {
  background-color: #efefef;
  margin: 0;
  padding: 0;
}

main {
  display: grid;
  grid-template-columns: 400px auto;

  >div {
    max-width: 900px;
    margin: 0 auto;
  }

  #navigation {
    border-right: 1px solid #666;
    height: 100%;
    width: 100%;
    position: relative;

    background-color: #eaeaea;

    nav {
      position: fixed;
      top: 0;
      left: 1rem;

      p.chapter {
        margin: 0.25rem 0;
      }

      li li {
        font-size: 0.75rem;
      }

      ul {
        padding-left: 1rem;
      }
    }

    h2 {
      text-align: center;
    }
  }
}


a {
  color: #222;

  &:hover {
    color: #888;
  }
}

input {
  width: 6ch;
  text-align: right;
  background-color: transparent;

  &:invalid {
    outline: 2px solid red;
  }
}

code {
  font-weight: bold;
  white-space: nowrap;

  font-family: 'LM Math', monospace;
  background-color: #ddd;
  padding: 0.2rem;
}

details.example {
  border: 1px solid #444;
  border-radius: 4px;
  background-color: #ddd;

  margin: 1rem 0;

  *:first-child { margin-top: 0; }
  *:last-child { margin-bottom: 0; }

  padding: 0.5rem;

  & .problem {
    font-weight: bold;
  }

  code {
    background-color: #ccc;
  }
}

table {
  border: 1px solid #666;
  font-family: monospace;

  &:not(.plain) td:first-of-type {
    font-family: "LM Math";
  }

  th {
    text-align: center;
    background-color: #ddd;
    color: #222;

    text-transform: lowercase;
    font-variant: small-caps;
  }

  td,
  th {
    border: 1px solid #aaa;
    padding: 0.25rem;
  }

  td {
    text-align: center;
  }

  td,
  tr {
    background-color: #f0f0f0;
  }

  tr:nth-child(odd) {
    td {
      background-color: #e6e6e6;
    }
  }
}

p.header {
  font-size: 1.25rem;
  border-bottom: 1px solid #666;
  margin-bottom: 0;
  margin-top: 2rem;
}

@media (max-width: 1399px) {
  main {
    display: block;

    #navigation {
      border: 1px solid;

      nav {
        position: static;
      }
    }

    padding: 0 0.25rem;
  }

  h1 {
    font-size: 1.4rem;

    &+h2 {
      font-size: 1.2rem;
    }
  }

  math {
    font-size: 16px;
  }

}