:root {
  /* colors */
  --gray0: hsl(0, 0%, 8%);
  --gray1: hsl(0, 0%, 20%);
  --gray2: hsl(0, 0%, 35%);
  --gray3: hsl(0, 0%, 50%);
  --gray4: hsl(0, 0%, 65%);
  --gray5: hsl(0, 0%, 80%);
  --gray6: hsl(0, 0%, 95%);
  --yellow: hsl(51, 30%, 73%);
  --brighter-yellow: hsl(51, 70%, 80%);
  --blue: hsl(195, 50%, 48%);
  color-scheme: dark light;
}

html {
  font-size: 20px;
  font-family: "Fira Mono", sans-serif;
  height: 100vh;
}

body {
  margin: 0 auto;
  min-height: 100%;
  display: grid;
  grid-template-columns: 320px calc(100vw - 320px);
  grid-template-areas: "header main";
  background: var(--gray1);
  width: 100vw;
  color: var(--yellow);
}

header {
  grid-area: header;
  position: fixed;
  top: 0;
  height: 100vh;
  width: 320px;
}

header nav {
  font-size: 1.2rem;
}

header ul {
  list-style-type: none;
}

header img {
  padding-left: 5px;
  padding-right: 5px;
  width: 32px;
  height: 32px;
}

header svg {
  padding-left: 5px;
  padding-right: 5px;
  width: 1.5rem;
  height: 1.5rem;  
	color: var(--blue);
}

a svg:hover {
  color: var(--bright-yellow);
}

svg {
  width: .75rem;
  height: .75rem;
}

main {
  grid-area: main;
  padding: 0 50px 10px 50px;
  border-left: 3px solid var(--yellow);
  line-height: 1.5;
}

section {
  display: grid;
  gap: 20px;
  grid-template-columns: 4fr 1fr;
  grid-template-areas: "content extras";
}

h1, h2, h3 {
  color: var(--brighter-yellow);
  text-align: left;
}

h1 {
  font-size: 2rem;
  margin: 1rem 0;
  padding: 0;
}

h2, h3 {
  margin-bottom: 0;
}

[role="doc-subtitle"] {
  margin-top: 0;
  padding-top: 0;
  font-size: 1.5em;
  font-style: italic;
}

/* help with breaking long links from 
   <https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/> */
a {
  text-decoration: none;
  color: var(--blue);
  overflow-wrap: break-word;
  word-wrap: break-word;
  -ms-word-break: break-all;
  /* This is the dangerous one in WebKit, as it breaks things wherever */
  word-break: break-all;
  /* Instead use this non-standard one: */
  word-break: break-word;
  /* Adds a hyphen where the word breaks, if supported (No Blink) */
  -ms-hyphens: auto;
  -moz-hyphens: auto;
  -webkit-hyphens: auto;
  hyphens: auto;
}

a:hover {
  text-decoration: underline;
  color: var(--brighter-yellow);
}

p {
  margin-top: 0;
}

figure {
  margin: 2rem auto;
}

figcaption {
  font-size: .75rem;
  line-height: 1rem;
  font-style: italic;
}

/* style in-line code differently than what's in blocks */
code:not(pre *) {
  color: #bf6a6a;
}

/* code blocks will be nested in pre */
pre {
  font-size: 14px;
  padding: 8px;
  line-height: 1.2;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 3px;
}

#site-title { 
  font-size: 2rem; 
  text-align: center;
  font-weight: 700;
  margin: 1rem 0;
  padding: 0;
}

#site-title a, #site-title a:hover {
  color: var(--blue);
  text-decoration: none;
}

.extras {
  grid-area: extras;
  font-size: .8rem;
  line-height: 1.6;
}

.bold { font-weight: bold; }
.italic { font-style: italic; }
.underline { text-decoration: underline; }
.center { text-align: center; }
.left { text-align: left; }
.right { text-align: right; }
.small { font-size: 0.9rem; }
.smaller { font-size: 0.8rem; }
.bigger { font-size: 1.2rem; }
.quote { line-height: 1.5rem; }
.quote::before {
  content: "“";
  font-size: 2rem;
}
.quote::after {
  content: "”";
  font-size: 2rem;
}
.toc-link-back { 
  font-size: 0.6rem;
  text-align: right;
}
.toc-date {
  margin-bottom: 0;
  padding-bottom: 0;
  margin-top: 0;
  padding-top: 0;
}
.toc-title {
  padding-left: 10px;
  vertical-align: top;
  margin-top: -2mm;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.toc {
  column-count: 3;
  width: 100%;
}

/* Limit width of content */
.content-body {
  max-width: 700px; 
}

.lang-logo {
  height: 1rem;
  vertical-align: middle;
}

/* Responsive layout */

/* these rules will apply to both breakpoints since there's only a max */
@media (max-width: 1300px) {
  section {
    grid-template-columns: 1fr;
    grid-template-areas:
      "content"
      "extras";
  }
  img {
    max-width: 100%;
  }
  .extras {
    width: 100%;
    font-size: .8rem;
    line-height: 1.5;
  }
  .toc {
    column-count: 2;
  }
}

@media (max-width: 915px) {
  body {
    margin: 0 auto;
    grid-template-columns: auto;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
      "header"
      "main";
    word-break: break-word;
  }
  header {
    position: relative;
    height: auto;
    width: auto;
    padding: .75rem .75rem .5rem .75rem;
  }
  header ul {
    margin: 0;
    padding: 0;
    font-size: .9em;
    text-align: center;
    display: block;
  }
  header li {
    display: inline-block;
    padding: 5px;
  }
  header img {
    width: 25px;
    height: 25px;
  }
  header p {
    margin-bottom: 0;
  }
  main {
    padding: 0 0.5rem;
    border-top: 3px solid var(--yellow);
    border-left: none;
  }
  section {
    grid-template-columns: 1fr;
    grid-template-areas:
      "extras"
      "content";
  }
  h1 {
    margin-top: 0.5rem;
  }
  pre {
    padding: 5px;
  }
  #site-title { 
    margin: 0 auto;
    padding-bottom: .5rem; 
  }
  .content-body {
    max-width: 92vw;
  }
  .toc {
    column-count: 1;
  }
}
