*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
}

:root {
  font-size: 15px;
  --text-ratio: 1.2;
  --text-3: 1rem;
  --text-2: calc(1rem / var(--text-ratio));
  --text-1: calc(var(--text-2) / var(--text-ratio));
  --text-4: calc(1rem * var(--text-ratio));
  --text-5: calc(var(--text-4) * var(--text-ratio));
  --text-6: calc(var(--text-5) * var(--text-ratio));
  --text-7: calc(var(--text-6) * var(--text-ratio));
  --text-8: calc(var(--text-7) * var(--text-ratio));
  --bg: hsl(30, 20%, 98%);
  --logo: #d6f1ff;
  --theme-h: 180;
  --shift: 5;
  --theme: hsl(var(--theme-h), 100%, 25%);
  --theme-light: hsl(
    calc(var(--theme-h) + var(--shift)),
    100%,
    calc(25% + var(--shift) * 1%)
  );
  --theme-dark: hsl(
    calc(var(--theme-h) - var(--shift)),
    100%,
    calc(25% - var(--shift) * 1%)
  );
  --link: var(--theme);
  --text: #344;
  --highlight: rgba(0, 0, 0, 0.1);
  --lighter: #666;
  --width: 45rem;
  --padded-column: calc(var(--width) + 4rem);
  --font-stack: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui,
    helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial,
    sans-serif;
}

@media screen and (min-width: 600px) {
  :root {
    font-size: 16px;
    --text-ratio: 1.3;
  }
}

html {
  background: var(--theme-light);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-stack);
  line-height: 1.6em;
  border: 1em solid var(--theme-light);
  border-bottom-width: calc(1em + env(safe-area-inset-bottom) * 1.5);
  min-height: 100vh;
}

header {
  margin: 3rem auto;
  max-width: var(--padded-column);
  padding: 0 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
}

header h1 {
  font-size: var(--text-8);
  margin: 0;
  line-height: 1.1;
  align-self: center;
}

.header__tagline {
  grid-column: 1/3;
  font-weight: 400;
  position: relative;
  text-align: center;
}

@media screen and (min-width: 600px) {
  .header__tagline {
    grid-column: 2;
    padding-left: 2rem;
    text-align: left;
  }
}

footer {
  margin: 2rem auto 0;
  border-top: 2px dotted teal;
  padding: 2rem;
  max-width: var(--padded-column);
  display: grid;
  grid-gap: 1em;
}

.do-we-still-call-this-a-blogroll {
  display: flex;
  flex-wrap: wrap;
  list-style-type: none;
  padding: 0;
}

.do-we-still-call-this-a-blogroll li:not(:first-child):before {
  content: "•";
  margin: 0 0.5em;
}

.logo-icon {
  display: block;
  font-size: var(--text-7);
  height: 1.5em;
  width: 1.5em;
  margin-right: 0.5em;
  border-radius: 100%;
  box-shadow: inset 0 0 0.25rem rgba(0, 0, 0, 0.1);
  vertical-align: middle;
  background-color: var(--logo);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--header-weight, 600);
  line-height: 1.4;
  color: var(--text-header, var(--text));
  text-wrap: balance;
}

strong {
  font-weight: 600;
}

h1 {
  font-size: var(--text-6);
}

h2 {
  font-size: var(--text-5);
}

h3 {
  font-size: var(--text-4);
}

h4 {
  font-size: var(--text-3);
}

h5 {
  font-size: var(--text-2);
}

h6 {
  font-size: var(--text-1);
}

.title {
  font-size: var(--text-7);
}

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

article,
.fullbg {
  display: grid;
  grid-template-columns: minmax(1rem, 1fr) minmax(auto, var(--width)) minmax(
      1rem,
      1fr
    );
  grid-row-gap: 2em;
  overflow-x: hidden;
}

@media screen and (min-width: 600px) {
  article,
  .fullbg {
    grid-template-columns: minmax(2rem, 1fr) minmax(auto, var(--width)) minmax(
        2rem,
        1fr
      );
  }
}

article > *,
.fullbg > * {
  grid-column: 2;
  margin-top: 0;
  margin-bottom: 0;
}

article > *:first-child {
  margin-top: 0;
}

article img {
  display: block;
  max-height: 90vh;
  object-fit: contain;
  width: 100%;
}

article table {
  border: 1px solid var(--lighter);
}

article tr:nth-child(even),
article thead tr {
  background: var(--highlight);
}

article td,
article th {
  padding: 0.25rem 0.5rem;
}

section {
  margin: 0;
}

section h2 {
  margin: 0;
}

figure {
  margin: 2em 0;
}

figcaption {
  font-size: 0.8em;
  text-align: center;
  font-style: italic;
}

.video-frame {
  border: 0 none;
  display: block;
  margin: 0 auto;
  width: 100%;
  aspect-ratio: 16/9;
}

.present {
  width: 100%;
  max-width: 1200px;
  height: 70vh;
  max-height: var(--prefer-height, 600px);
  border: 0 none;
  display: block;
  margin: 0 auto;
}

.present--frame {
  border: 2px solid teal;
  box-shadow: 0.5rem 0.5rem rgba(0, 0, 0, 0.75);
}

blockquote {
  padding-left: 1em;
  margin: 1em 0;
  border-left: 0.2em solid currentColor;
  font-size: 1rem;
}

blockquote > *:first-child {
  margin-top: 0.5em;
}

blockquote > *:last-child {
  margin-bottom: 0.5em;
}

ul,
ol {
  margin: 1em 0;
  padding-left: 2em;
}

li > p {
  margin: 0;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

header h1 a:hover {
  text-decoration: underline;
}

code {
  background: var(--highlight);
  font-size: calc(1em / var(--text-ratio));
  padding: 0.25em;
}

pre {
  background: var(--highlight);
  line-height: 1;
  padding: 0.5em;
  margin: 1em 0;
}

pre code {
  font-size: var(--text-2);
}

pre.pretty-code {
  grid-column: 1 / -1;
  padding-inline: 1rem !important;
  margin-inline: 0 !important;
  border-radius: 0 !important;
}

pre.pretty-code code {
  padding: 0;
}

@media screen and (min-width: 600px) {
  pre.pretty-code {
    grid-column: 2;
    padding: 1rem !important;
    border-radius: 0.3em !important;
    margin-inline: -1rem !important;
  }

  pre.pretty-code code {
    font-size: var(--text-2);
  }
}

.full,
.fullbg,
.fullpad,
.twocol {
  grid-column: 1 / 4;
}

.fullbg {
  padding: 1em 0;
}

.fullpad {
  padding: 1em;
}

.centered {
  text-align: center;
}

.center {
  margin-inline: auto;
}

.twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.meta {
  font-size: var(--text-2);
  margin: 0;
  color: var(--lighter);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: start;
}

.meta__tag {
  margin-left: 1em;
}

.post-preview {
  margin-top: 2em;
}

.post-preview + .post-preview {
  border-top: 1px solid var(--highlight);
  padding-top: 2em;
}

.post-preview__title {
  text-wrap: balance;
}

.post-preview > * + * {
  margin-top: 1rem;
}

.post-preview__banner {
  display: block;
}

.post-preview__go {
  text-decoration: none;
  overflow: hidden;
  text-indent: -9999px;
  width: 1.5em;
  height: 1.25em;
  display: inline-block;
  background: url(/img/arrow.svg);
  background-size: 1.25em;
  background-repeat: no-repeat;
  background-position: left center;
  vertical-align: text-bottom;
}

.post-preview__go:hover {
  background-position: right center;
}

.elsewhere {
  margin-top: 1em;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  justify-content: center;
  gap: 1em;
}

.elsewhere__link {
  padding: 0.1em 1em;
  font-size: var(--text-3);
  text-decoration: none;
  border: 0.5px solid currentColor;
  text-align: center;
}

@media screen and (min-width: 60rem) {
  header {
    transform: translateX(calc(-2 * var(--text-7)));
  }

  .wide {
    width: calc(100% + 9.76rem);
    transform: translateX(-4.88rem);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c2040;
    --text: #ddd;
    --logo: #445;
    --link: lightcyan;
    --lighter: #aaa;
    --highlight: rgba(255, 255, 255, 0.1);
  }
}
