/* Reset */
* {
  box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
h5,
ul,
p,
ol,
li {
  margin: 0;
  padding: 0;
}

/* Variables */

:root {
  --main-width: 800px;

  --color-pale-blue: #c0e1ea;
  --color-salmon: #ffa77a;
  --color-bold-blue: #0075ff;

  --color-gray-darkest: #333;
  --color-gray-dark: #555;
  --color-gray-medium: #aaa;
  --color-gray-light: #ddd;
  --color-gray-lightest: #eee;

  --color-main-bg: #fff;
  --color-main-fg: var(--color-gray-darkest);
}

/* Fonts */

@font-face {
  font-family: "iA Writer Duospace";
  font-weight: normal;
  font-style: normal;
  src: url("/fonts/iAWriterDuospace/iAWriterDuospace-Regular.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Regular.woff2")
      format("woff2"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Regular.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Duospace";
  font-weight: normal;
  font-style: italic;
  src: url("/fonts/iAWriterDuospace/iAWriterDuospace-Italic.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Italic.woff2") format("woff2"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Italic.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Duospace";
  font-weight: bold;
  font-style: normal;
  src: url("/fonts/iAWriterDuospace/iAWriterDuospace-Bold.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Bold.woff2") format("woff2"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-Bold.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Duospace";
  font-weight: bold;
  font-style: italic;
  src: url("/fonts/iAWriterDuospace/iAWriterDuospace-BoldItalic.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-BoldItalic.woff2")
      format("woff2"),
    url("/fonts/iAWriterDuospace/iAWriterDuospace-BoldItalic.woff")
      format("woff");
}

@font-face {
  font-family: "iA Writer Quattro S";
  font-weight: normal;
  font-style: normal;
  src: url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Regular.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Regular.woff2")
      format("woff2"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Regular.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Quattro S";
  font-weight: normal;
  font-style: italic;
  src: url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Italic.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Italic.woff2") format("woff2"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Italic.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Quattro S";
  font-weight: bold;
  font-style: normal;
  src: url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Bold.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Bold.woff2") format("woff2"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-Bold.woff") format("woff");
}

@font-face {
  font-family: "iA Writer Quattro S";
  font-weight: bold;
  font-style: italic;
  src: url("/fonts/iAWriterQuattroS/iAWriterQuattroS-BoldItalic.eot")
      format("embedded-opentype"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-BoldItalic.woff2")
      format("woff2"),
    url("/fonts/iAWriterQuattroS/iAWriterQuattroS-BoldItalic.woff")
      format("woff");
}

/* Global */
html {
  font-size: 16px;
  font-family: "ia writer quattro s", sans-serif;
}

body {
  font-size: 1rem;
  line-height: 1.65rem;
  background: var(--color-main-bg);
  color: var(--color-main-fg);
}

a,
a:visited {
  text-decoration: none;
  border-bottom: 1px solid var(--color-gray-dark);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-main-fg);
}

a:hover {
  background: var(--color-pale-blue);
}

a:active {
  background: var(--color-salmon);
}

table {
  width: 100%;
}

table th {
  text-align: left;
}
table td {
  vertical-align: top;
}

/* Layout */

#banner {
  width: var(--main-width);
  margin: auto;
  background: var(--color-pale-blue);
  border-radius: 4px;
  padding: 0.6rem 1rem;
  margin-top: 1.5rem;
  border: none;
  display: block;
  font-size: 0.875rem;
}

#banner:hover {
  background: var(--color-salmon);
}

#banner strong {
  border-bottom: 1px solid var(--color-gray-dark);
}

#layout {
  width: var(--main-width);
  margin: 3.5rem auto;
  display: flex;
}

main {
  display: flex;
  flex-direction: column;
}

footer {
  width: var(--main-width);
  margin: 0 auto;
  margin-bottom: 1.8rem;
  padding-top: 1rem;
  font-size: 0.9rem;
  color: var(--color-gray-medium);
  text-align: right;
}

aside {
  width: 7rem;
  margin-right: 4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}

aside hr {
  margin: 1.5rem 0;
  align-self: center;
}

aside a {
  border-bottom: none;
}

aside a:hover {
  background: transparent;
  color: var(--color-bold-blue);
}

aside a:active {
  background: transparent;
  color: var(--color-salmon);
}

nav {
  display: flex;
  flex-direction: column;
}

#logo {
  margin-bottom: 2rem;
}

#logo:hover {
  transform: scale(1.05);
  background: none;
}

hr {
  border: 0;
  height: 3px;
  background: var(--color-gray-light);
  width: 2rem;
  margin: 2rem 0;
}

article {
  font-family: "iA Writer Duospace", serif;
  position: relative;
}

article h1 {
  font-size: 1.5rem;
}

article h2 {
  font-size: 1.2rem;
}

article h3 {
  font-size: 1rem;
}

article h4 {
  font-size: 1rem;
}

article h4 {
  font-size: 1rem;
}

article h1,
article h2,
article h3,
article h4,
article h5 {
  margin-bottom: 1rem;
}

article p {
  margin-bottom: 1.5rem;
}

article ul {
  margin-left: 1.5rem;
}

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

article aside {
  margin-right: -340px;
  position: absolute;
  right: 0;
  top: auto; /* default */
  width: 300px;
  text-align: left;
  font-size: 12px;
}

/* Home */

#more-projects {
  margin-top: 3rem;
}

/* Reads */
.books td {
  padding: 0.5rem 0;
}

.books .month {
  font-size: 0.857rem;
  width: 2.5rem;
}

.books .book {
  width: 31rem;
}
.books .book .title {
  width: 31rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.books .rating {
  width: 2rem;
}

.books .more {
  width: 2rem;
  text-align: right;
}

.books .title {
  font-weight: bold;
}

.books .by {
  font-size: 0.75rem;
  color: var(--color-gray-medium);
}
.books .by a {
  color: var(--color-gray-dark);
  border-color: var(--color-gray-medium);
}

.books .note {
  position: relative;
}

.books .note .content {
  text-align: left;
  position: absolute;
  right: 0;
  transition: all 0.2s;
  background: var(--color-main-bg);
  border: 1px solid var(--color-gray-light);
  width: 30rem;
  display: none;
  opacity: 0;
  z-index: 1;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
}

.books .note:hover .content {
  display: block;
  opacity: 1;
}

/* Media Queries */

/* avoid scroll jumping */
@media screen and (min-width: 960px) {
  html {
    margin-left: calc(100vw - 100%);
    margin-right: 0;
  }
}

@media only screen and (max-width: 600px) {
  body {
    padding: 2rem;
  }

  #layout,
  #banner,
  footer {
    flex-direction: column;
    margin: 0;
    width: 100%;
  }

  #banner {
    margin-bottom: 2rem;
  }

  aside {
    width: 100%;
    display: flex;
    flex-direction: row;
    margin: 0;
    margin-bottom: 2rem;
    align-items: center;
    line-height: 1em;
    justify-content: space-between;
  }

  aside hr {
    display: none;
  }

  aside nav {
    flex-direction: row;
    margin-left: 1rem;
    align-items: center;
  }

  #primary-nav {
    margin: 0;
  }

  #primary-nav a {
    border-bottom: 1px solid var(--color-gray-dark);
    margin-right: 1rem;
  }

  #primary-nav #logo {
    margin-bottom: 0;
    border-bottom: 0;
  }

  #logo img {
    width: 20px;
    height: 32px;
  }

  #secondary-nav {
    justify-self: flex-end;
  }

  #secondary-nav a {
    margin-right: 1rem;
  }

  footer {
    margin-top: 1rem;
  }
}
