:root {
  --bg: #f5f3ee;
  --panel: #eeebe5;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --link: #0645ad;
  --rule: #e1ded4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: 42rem;
  margin: 3rem auto;
  padding: 0 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Times New Roman", "Liberation Serif", "Nimbus Roman", Times, serif;
  font-size: 1.15rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

h1 a {
  color: inherit;
  text-decoration: none;
}

h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.5rem;
}

header {
  margin-bottom: 2rem;
}

header p {
  margin: 0;
  color: var(--muted);
}

.date {
  color: var(--muted);
  font-size: 0.9rem;
}

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

ul.posts li {
  margin: 0.75rem 0;
}

ul.posts .date {
  display: block;
}

/* A wide code block scrolls sideways instead of widening the page. The two pairs of gradients are
   the hint: a shadow at an edge appears only while there is more to scroll to that way. */
pre {
  max-width: 100%;
  background:
    linear-gradient(to right, var(--panel) 30%, transparent) left center / 2rem 100% no-repeat local,
    linear-gradient(to left, var(--panel) 30%, transparent) right center / 2rem 100% no-repeat local,
    linear-gradient(to right, rgba(0, 0, 0, 0.14), transparent) left center / 0.6rem 100% no-repeat scroll,
    linear-gradient(to left, rgba(0, 0, 0, 0.14), transparent) right center / 0.6rem 100% no-repeat scroll,
    var(--panel);
  border: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.45;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}

/* Inline code is smaller than the code block: a monospace face looks larger than the serif at the same size. */
p code,
li code {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0.05em 0.3em;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.back {
  margin-bottom: 1.5rem;
}

.back a {
  text-decoration: none;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Phones: less space above the page, links big enough to tap, and the code block as wide as the
   screen, since the page padding it would otherwise sit inside is what a long line needs most. */
@media (max-width: 40rem) {
  body {
    margin: 1.5rem auto;
  }

  header {
    margin-bottom: 1.5rem;
  }

  ul.posts li {
    margin: 1rem 0;
  }

  ul.posts a,
  .back a,
  footer a {
    display: inline-block;
    padding: 0.4rem 0;
  }

  pre {
    margin-left: -1rem;
    margin-right: -1rem;
    border-left: 0;
    border-right: 0;
  }
}
