/* Base styles */
/***************/

:root {
  --teal: #0091ab;
  --lighter-teal: #64d1dd;
  --literally-black: #000000;
  --darker-black: #242424;
  --black: #313131;
  --dark-grey: #888888;
  --medium-grey: #bbbbbb;
  --light-grey: #e1e1e1;
  --white: #fbfbfb;
  --small: 0.7rem;

  --colour: var(--teal);
  --background: var(--white);
  --text: var(--black);
  --muted-text: var(--dark-grey);
  --border: var(--light-grey);
  --shadow: var(--medium-grey);
  --code-background: var(--light-grey);
  --code: var(--black);
}

@media (prefers-color-scheme: dark) {
  :root {
    --colour: var(--lighter-teal);
    --background: var(--black);
    --text: var(--light-grey);
    --muted-text: var(--medium-grey);
    --border: var(--darker-black);
    --shadow: var(--literally-black);
    --code-background: var(--darker-black);
    --code: var(--white);
  }
}

* {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  line-height: 1.7;
  background-color: var(--background);
  font-size: 22px;
}

/* to undo styles in head that prevent fouc */
html {
  visibility: visible;
  opacity: 1;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.constrain {
  max-width: 38rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 1em;
}

.message {
  background: var(--code-background);
  border-radius: 5px;
  box-shadow: 2px 2px var(--shadow);
  font-size: var(--small);
  padding: 0.5rem 1rem;
  color: var(--code);
  display: flex;
  margin: 1rem 0 3rem 0;
}

.message p {
  margin: 0;
}

.message a {
  margin-left: 1rem;
  font-weight: bold;
}

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

.tags code {
  margin: 0 0.5rem;
  font-size: var(--small);
}

.tags li span {
  display: inline-block;
  width: 9rem;
}

.tags li span:first-letter {
  text-transform: capitalize;
}

.tags li .rss {
  font-size: var(--small);
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 2.5rem;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.07rem;
}

h1 {
  font-size: 2.5rem;
}

main {
  flex: 1;
}

time {
  font-size: var(--small);
  color: var(--muted-text);
}

blockquote {
  border-left: 0.5rem solid var(--code-background);
  padding-left: 1rem;
  margin: 2rem 0 2rem 1rem;
}

li > p {
  margin-bottom: 0;
}

.confirm {
  display: inline-block;
}

.confirm span {
  margin-left: 0.5rem;
}

nav[aria-label="breadcrumb"] ul {
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  margin: 0;
}

nav[aria-label="breadcrumb"] ul li {
  display: inline-block;
  color: var(--muted-text);
  margin-right: 0.2rem;
}

nav[aria-label="breadcrumb"] ul li:not(:first-child):before {
  content: " / ";
  color: var(--colour);
  margin-right: 0.2rem;
}

nav[aria-label="breadcrumb"] ul li:last-child:before {
  margin-left: 0.3rem;
}

/* Page breaks */
/***************/

main hr {
  border: 0;
  background: transparent;
  margin: 2rem 0 3.5rem 0;
  text-align: center;
  color: var(--muted-text);
}

main hr::before{
  content: "—\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0—\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0—\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0—\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0—"
}

/* Description lists */
/*********************/

dt {
  margin-top: 2rem;
  font-weight: bold;
}

/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  html {
    font-size: 18px;
  }

  h1 {
    font-size: 2rem;
  }
}

/**********************************************************************/
/* Header
/**********************************************************************/

header {
  padding-top: 2rem;
  line-height: 1;
}

header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header nav a {
  fill: var(--colour);
  display: inline-block;
}

header nav h1 {
  border: none;
  display: inline-block;
}

header nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: inline-block;
}

header nav ul li {
  line-height: 1.5rem;
  margin-right: 1rem;
  text-align: right;
  font-size: 0.8rem;
}

header nav a:hover, header nav a:focus,
header nav a:visited:hover, header nav a:visited:focus {
  fill: var(--background);
  background: var(--colour);
  outline: unset;
}

header h1 svg g {
  transform: matrix(1.25, 0, 0, 1.25, 0, 0);
}

/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  header h1 svg {
    width: 278px;
    height: 50px;
  }

  header nav {
    flex-direction: column;
    align-items: flex-start;
  }

  header h1 svg g {
    transform: matrix(0.7, 0, 0, 0.7, 0, 0);
  }

  header h1 {
    margin-top: 1rem;
  }

  header nav ul {
    align-self: flex-end;
  }

  header nav ul li {
    display: inline;
  }
}

/**********************************************************************/
/* Images
/**********************************************************************/

main img {
  max-width: 100%;
  display: block;
  margin: 2rem auto;
  border: 10px solid var(--border);
  border-radius: 3px;
  box-shadow: 4px 4px var(--shadow);
  box-sizing: border-box;
}

figure {
  margin: 1rem 0;
}

figure img {
  margin: 0 auto;
}

figcaption {
  font-size: var(--small);
  color: var(--muted-text);
  margin: 0.5rem auto;
  text-align: center;
  width: 80%;
  display: block;
}

.gallery {
  display: grid;
  grid-template-rows: masonry;
  grid-template-columns: repeat(2, 1fr);
  grid-column-gap: 1rem;
}

/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  img {
    border-width: 7px;
  }

  figure {
    margin: 0.5rem 0;
  }

  figcaption {
    width: 100%;
  }

  .gallery {
    grid-template-columns: repeat(1, 1fr);
  }
}

/**********************************************************************/
/* Index page
/**********************************************************************/

main section ul:first-child {
  list-style: none;
  margin: 0;
  padding: 0
}

main section ul:first-child li {
  margin-bottom: 0.5rem;
  display: grid;
  grid-template-columns: 7rem 1fr;
  grid-template-areas: "left right";
  align-items: baseline;
  grid-column-gap: 1rem;
}

main section ul:first-child li a {
  letter-spacing: 0.07rem;
  font-weight: 500;
}

/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  main section ul:first-child li {
    margin-bottom: 1rem;
    grid-template: "top" "bottom";
  }

  main section ul:first-child li time {
    grid-area: bottom;
    justify-self: start;
  }
}

/**********************************************************************/
/* Footer
/**********************************************************************/

footer {
  background-color: var(--border);
  color: var(--muted-text);
  font-size: var(--small);
  margin-top: 2rem;
  padding: 2rem 0;
  align-items: center;
}

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

footer .links {
  display: flex;
  justify-content: space-between;
}

footer form {
  margin-bottom: 1.5rem;
}

footer input {
  background-color: var(--border);
}

footer form button {
  color: var(--border);
}

footer p {
  margin: 0;
}

/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  footer .links {
    flex-direction: column;
    align-items: flex-start;
  }

  footer ul {
    margin-bottom: 1.5rem;
  }
}

/**********************************************************************/
/* Links
/**********************************************************************/

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

a:visited {
  color: var(--text);
}

a:focus, a:hover {
  background: var(--colour);
  color: var(--background);
  outline: 3px solid var(--colour);
  text-decoration: none;
}

a:visited:hover, a:visited:focus {
  background: var(--text);
  color: var(--background);
  outline: 3px solid var(--text);
}

/**********************************************************************/
/* Code
/**********************************************************************/

code {
  background: var(--code-background);
  border-radius: 5px;
  box-shadow: 2px 2px var(--shadow);
  font-family: Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;
  font-size: 0.85rem;
  margin: 0 0.1rem;
  padding: 0.1rem 0.45rem;
}

small code {
  font-size: 90%;
}

pre {
  background: var(--code-background);
  border-radius: 5px;
  box-shadow: 2px 2px var(--shadow);
  font-size: var(--small);
  overflow-x: auto;
  padding: 0.5rem 1rem;
  color: var(--code);
}

pre code {
  box-shadow: unset;
  padding: 0;
}

/**********************************************************************/
/* Forms
/**********************************************************************/

form {
  display: flex;
  padding: 1rem 0;
}

form span {
  margin-right: 0.5rem;
  flex: 1;
}

form button {
  background-color: var(--colour);
  border-radius: 3px;
  border: none;
  color: var(--background);
  font-weight: bold;
  padding: 0.5rem;
  cursor: pointer;
}

input {
  background-color: var(--background);
  border-radius: 3px;
  border: 2px solid var(--text);
  color: var(--text);
  padding: 0.4rem;
  width: 100%;
}

::placeholder {
  color: var(--muted-text);
  opacity: 1;
}


/* Screens 750px or smaller */
/****************************/
@media only screen and (max-width: 750px) {
  form {
    flex-direction: column;
  }

  form span {
    margin-right: 0;
    margin-bottom: 1rem;
  }
}
