
@font-face {
  /* ubuntu-regular - latin */
  font-family: 'Ubuntu';
  src: local(''), url('/static/fonts/ubuntu-v15-latin-regular.woff2') format('woff2'), url('/static/fonts/ubuntu-v15-latin-regular.woff') format('woff'), url('/static/fonts/ubuntu-v15-latin-regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --header-height: 4rem;
  --content-inline-padding: 1.3rem;
  --content-max-width: 80ch;
  /* define our palette for all themes */
  --white: #fff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --brand-purple: #5555ff;
  --brand-pink: #ff55dd;
  /* light-theme vars */
  --c-bg: var(--gray-100);
  --c-bg-secondary: var(--white);
  --c-text: var(--gray-800);
  --c-border: var(--gray-300);
  --c-hl: var(--brand-pink);
  --c-hl-secondary: var(--brand-purple);
  --c-text-on-hl: var(--gray-800);
  --c-text-on-hl-secondary: var(--white);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: var(--gray-800);
    --c-bg-secondary: var(--gray-900);
    --c-text: var(--gray-200);
    --c-border: var(--gray-400);
  }
}

* {
  color: var(--c-text);
  box-sizing: border-box;
  font-family: Ubuntu, sans-serif;
  letter-spacing: .1ch;
}

main *, .hero * {
  line-height: 1.5;
}

body {
  background-color: var(--c-bg);
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--header-height) min-content auto auto min-content;
  grid-template-columns: 1fr;
  grid-template-areas: "header" "hero" "main" "aside" "footer";
}

a {
  text-decoration: underline;
  text-underline-offset: .05rem;
}

a:hover {
  text-underline-offset: .25rem;
  color: var(--c-hl);
}

h1, h2, h3, h4, h5, h6, p {
  word-break: break-word;
  scroll-margin-block-start: 4.5rem;
}

h1, h2, h3, h4, h5, h6, strong {
  font-weight: 500;
}

em {
  font-style: italic;
}

h2, h3, h4, h5, h6 {
  margin-block-end: 0;
}

h1+*, h2+*, h3+*, h4+*, h5+*, h6+* {
  margin-block-start: 0;
}

main h1 {
  font-size: 2.25rem;
}

main h2 {
  font-size: 1.5rem;
}

main h3 {
  font-size: 1.25rem;
}

main :is(h2, h3, h4, h5, h6) a {
  text-decoration: none;
  position: relative;
}

main :is(h2, h3, h4, h5, h6) a:hover::before {
  content: '#';
  position: absolute;
  left: -1.5ch;
  bottom: 0;
  font-weight: normal;
  font-size: 1rem;
}

@media screen and (min-width: 800px) {
  body {
    grid-template-columns: min-content 8fr;
    grid-template-rows: 4rem min-content auto min-content;
    grid-template-areas: "header header" "hero hero" "aside main" "footer footer";
  }
}

.skiplink {
  z-index: 9999;
  transform: translateY(calc(-100% - 1rem));
  display: block;
  position: absolute;
  height: 4rem;
  padding: var(--content-inline-padding);
  background-color: var(--c-bg);
  border-inline-end: 1px solid var(--c-border);
  border-block-end: 1px solid var(--c-border);
}

.skiplink:focus {
  z-index: 9999;
  transform: translateY(0);
}

header {
  grid-area: header;
  height: var(--header-height);
  border-block-end: 1px solid var(--c-border);
  background-color: var(--c-bg-secondary);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
}

header a {
  text-decoration: none;
}

header .logo {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  height: 100%;
  padding-inline-start: var(--content-inline-padding);
}

header .logo img {
  padding-block-end: .3rem;
}

header .logo h1 {
  margin: 0;
  margin-bottom: -.4rem;
  font-size: 1.7rem;
  line-height: 1;
  font-family: Comfortaa, Ubuntu, sans-serif;
  font-weight: bold;
}

header .nav-toggle {
  display: block;
  border-inline-start: 1px solid var(--c-border);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}

header nav details summary, header nav a {
  border-block-end: 1px solid var(--c-border);
  padding: 1rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
}

header nav details summary::before {
  content: "►";
  padding-inline-end: .3rem;
}

header nav details[open] summary::before {
  content: "▼";
}

header nav .nav-close {
  display: none;
}

header nav.show .nav-close {
  display: flex;
}

header nav {
  transform: translateY(calc(-100% - 1rem));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: var(--c-bg-secondary);
  min-width: 20rem;
  max-width: 30rem;
  border-inline-start: 1px solid var(--c-border);
  z-index: 10000;
}

header nav.show, header nav:focus-within {
  transform: translateY(0);
}

header nav details summary.highlight, header nav a.highlight {
  background-color: var(--c-hl);
  color: var(--c-text-on-hl);
  font-weight: 500;
}

header nav details summary:hover, header nav a:hover {
  background-color: var(--c-bg);
}

header nav details summary.highlight:hover, header nav a.highlight:hover {
  background-color: var(--c-hl-secondary);
  color: var(--c-text-on-hl-secondary);
}

header nav details {
  display: flex;
  flex-direction: column;
  position: relative;
}

header nav details a {
  padding-inline-start: 2.5rem;
}

@media screen and (min-width: 800px) {
  header .nav-toggle, header .nav-close, header nav.show .nav-close {
    display: none;
  }
  header nav {
    transform: initial;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    position: initial;
    background-color: initial;
    min-width: unset;
    max-width: unset;
    border-inline-start: none;
  }
  header nav.show, header nav:focus-within {
    transform: initial;
  }
  header nav details summary, header nav a {
    border-block-end: none;
    border-inline-start: 1px solid var(--c-border);
    border-inline-end: 1px solid var(--c-border);
    padding: 0 1rem;
    display: flex;
    margin-inline-start: -1px;
    align-items: center;
    height: 100%;
  }
  header nav details:last-of-type summary {
    border-inline-end: none;
  }
  header nav details[open] summary {
    border-block-end: 1px solid var(--c-border);
    height: calc(100% + 1px);
  }
  header nav details div {
    position: absolute;
    right: 0;
  }
  header nav details div a {
    background-color: var(--c-bg-secondary);
    border-block-end: 1px solid var(--c-border);
    padding: 1rem;
  }
}

main {
  grid-area: main;
  padding: 0 var(--content-inline-padding);
  max-width: var(--content-max-width);
  min-width: 0;
  width: 100%;
  margin: 2rem auto;
}

nav.article-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
}

nav.article-nav div {
  width: 33%;
  text-align: center;
}

footer {
  grid-area: footer;
  align-self: end;
  background-color: var(--c-bg-secondary);
  border-block-start: 1px solid var(--c-border);
  padding: .5rem var(--content-inline-padding);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
}

footer div:last-of-type {
  padding-inline-start: 1rem;
}
