/* The colors are sepia; some drawn from here: https://www.color-hex.com/color-palette/92457 */
html, body {
  margin: 0;
}

:root {
  --padding: 20px;
  --width: 900px;
  --link-color: #1e6ade;
  --text-color: black;
  background-color: white;
  color: var(--text-color);
}

body {
  font-size: 18px;
  /* Palatino is available on MacOS, iOS, and Windows. */
  font-family: "Palatino", "Palatino Linotype", "Georgia", "Serif";
  padding: 20px 0;
  padding-top: 0;
}

/* Center each of the main sections on the page. */
#content, h1, nav, footer {
  margin: 0 auto;
  box-sizing: border-box;
  padding: 0 var(--padding);
  max-width: var(--width);
}

h1 {
  font-size: 20px;
}

a, nav a:visited {
  color: var(--link-color);
}

a:visited {
  color: #551a8b; /* The browser's default. */
}

nav {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

a#github {
  width: 40px;
  border: 0;
  /* Artifically reduce the layout height of this github icon. Otherwise it will make the nav
     taller than it needs to be, consuming too much vertical space. */
  margin-top: -8px;
  margin-bottom: -8px;
}

#title {
  background-color: #f8f5f0;
  padding: 20px 0;
  border-bottom: 1px solid #ece6da;
}

li, p {
  text-align: justify;
  line-height: 1.5;
  margin: 1em 0;
  list-style-type: none;
}

ul {
  margin: 0;
  padding-left: 3em;
}

#content > ul {
  padding-left: 0;
}

hr {
  height: 1px;
  width: 80%;
  border: 0;
  border-color: #b98f0d;
  border-top-width: 1px;
  border-style: dashed;
  margin: 24px auto;
}

footer {
  font-style: italic;
}

/* Styles specificalaly for the index page. */
#index-page a#home, #index-page footer {
  display: none;
}
/* We move the github icon down to be next to the page title. This CSS is a bit fragile
 * if the height of the h1 changes due to other style changes. */
#index-page nav {
  position: absolute;
  height: 80px; /* The empirical height of the h1 */
  margin: 0 auto;
  inset: 0; /* Center this absolutely positioned element. */
  pointer-events: none; /* Disable pointer events because this now sits on top of the h1 */
  top: var(--padding);
}

#index-page nav a#github {
  pointer-events: auto;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    background-color: #242220;
    --link-color: #fbab7e;
    /* --text-color: #DEC2AF; */
    --text-color: #e5dbd5;
    color: var(--text-color);
  }
  a#github img {
    /* The icon is black; invert it to white. */
    filter: invert(100%);
    /* Tone down the opacity so it's not so bright. */
    opacity: 0.66;
  }
  a:visited {
    color: var(--text-color);
  }
  a:hover, nav a:hover {
    color: #ff725c;
  }

  a#github:hover img {
    opacity: 1.0;
  }
  li, p {
    /* Slightly more space between lines. */
    line-height: 1.6;
    margin: 1.1em 0;
  }
  #title {
    color: #eadbcb;
    background-color: #1b1b1b;
    border-bottom: 0;
  }
  h2 {
    color: #ffd586;
  }
}

/* Styles for phones in portrait mode. */
@media screen and (max-device-width: 500px) {
  /* Show less indentation in lists so there is less wrapping and better text justification. */
  ul {
    padding-left: 1.5em;
  }
}
