/* Some(website).map(|w| w.stylesheet()).unwrap()
 * Light and dark themes based on one{light,dark} */

body {
  background-color: #fafafa;
  color: #282c34;
}
a {
  color: #0091ea;
}
a:visited {
  color: #651fff;
}

/* This is a fun legacy trick to prevent scaling of the font size, see
 * <https://web.archive.org/web/20120510160350/http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/>
 */
kbd, code, pre {
  font-family: monospace, monospace;
}

kbd {
  border: thin solid;
  padding: 0.1rem 0.2rem;
  border-radius: 5px;
}

var {
  border-bottom: thin dashed;
}
var > code {
  font-style: normal;
}

/* Header/footer */
header {
  font-size: 1.8rem;
  max-width: 70rem;
  margin: 0.2rem auto;
  display: flex;
  justify-content: space-between;
}
.some-website {
  padding-right: 3rem;
}
main {
  margin: 3rem auto;
  max-width: 48rem;
  font-size: 1.2rem;
}
footer {
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 50rem) {
  header {
    display: block;
  }
  .some-website, nav {
    text-align: center;
  }
}

/* Article template */
h1, .subtitle, .published {
  text-align: center;
}
h1 {
  font-size: 2.5rem;
  margin: 0.2rem 0;
}
.subtitle {
  font-size: 1.3rem;
}
.published {
  font-size: 1.1rem;
  margin-top: 1.5rem;
}
article {
  font-size: 1rem;
}

/* Linkable headings */
h2 {
  text-align: center;
  margin-top: 2rem;
}
h2 > a {
  color: inherit;
  text-decoration: none;
}
h2 > a:hover {
  text-decoration: underline solid;
}

/* Block level elements and stuff */
hr {
  color: #9e9e9e;
  margin: 1em 3em;
}

figure {
  position: relative; /* for ::before to be positioned correctly */
  padding: 0.5rem;
  margin: 1.2rem 1rem;
}
figcaption {
  text-align: center;
}

figure > img {
  display: block;
  margin: 0.2rem auto;
  width: 100%;
}

.quote {
  border-left: 0.3rem solid #ccc;
}
.quote > blockquote {
  margin: 0.5rem 2rem;
}
.quote > figcaption {
  text-align: left;
}

pre {
  background-color: #eee;
  border: 0.15rem solid #ccc;
  padding: 1rem;
  margin: 0.2rem 0;
  overflow: auto;
}

/* Only show icons when there's definitely enough space for them, otherwise
 * parts of the shadow can be still seen in the margins (doesn't look good!) */
@media (min-width: 60rem) { /* 60 = 48 + 2 * 6 */
  .quote::before, .code::before {
    position: absolute;
    color: #ababab;
    text-shadow: #ddd 1.1rem 1.1rem;
  }
  .quote::before {
    content: "“";
    font-size: 4rem;
    font-family: serif;
    left: -5rem;
    top: -2rem;
  }
  .code::before {
    content: "{}";
    font-size: 3rem;
    font-family: monospace;
    left: -5rem;
    top: -0.5rem;
  }
  .sh::before {
    content: "$";
  }
}

/* Sidenote rule based on <https://stackoverflow.com/a/48505122> */
.note {
  float: right;
  clear: right;
  margin-right: -21rem;
  margin-bottom: 1rem;
  width: 20rem;
  font-size: 0.95em;
  color: #555;
}
.note-ref {
  font-size: 0.9em;
  padding: 0 0.2em;
  /* This is similar to what WordPress does, this prevents the superscript from
   * expanding the line height */
  vertical-align: baseline;
  position: relative;
  bottom: 0.4em;
}
@media (max-width: 91rem) { /* 91 = 2 * (20 + 1) + 48 + 1 */
  .note {
    float: left;
    clear: left;
    margin: 0;
    width: 90%;
    padding: 1rem 5%;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #2c323c;
    color: #dddddd;
  }
  a {
    color: #61afef;
  }
  a:visited {
    color: #d28fe5;
  }
  hr {
    color: #5c6370;
  }
  pre {
    background-color: #282c34;
  }
  pre, .quote {
    border-color: #5c6370;
  }
  .quote::before, .code::before {
    color: #5c6370;
    text-shadow: #3b4048 1.1rem 1.1rem;
  }
  .note {
    color: #abb2bf;
  }
}
