/* Base Styles */
body {
  font-family: 'Michroma', sans-serif;
  color: #111;
  max-width: 960px;
  margin: 0 auto;
  padding: 1em;
  background-color: #f4f4f4;
  background-image:
    linear-gradient(to top, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0) 60%),
    url('images/circuitry.svg');
  background-repeat: repeat-x;
  background-position: bottom;
  background-size: 100% auto;
}

/* Header */
.site-header {
  margin-bottom: 1em;
}
.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

/* Headings */
h1 {
  margin: 0;
  font-size: 2em;
  color: #2a4764;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-bottom: 0.25em;
  font-family: 'Michroma', sans-serif;
}
h2, h3 {
  color: #2a4764;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Michroma', sans-serif;
}
h2 {
  border-bottom: 1px solid #333;
  padding-bottom: 0.5em;
}

/* Section layout */
.section {
  font-family: 'Saira', sans-serif;
}
.small {
  font-size: 80%;
  font-weight: 400;
}
.author img {
  border-radius: 128px;
}

/* Book Layout */
.book-block {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 2em;
  border-bottom: 1px solid #333;
  padding-top: 2em;
  padding-bottom: 3em;
  transition: all 0.3s ease;
}
.book-cover {
  flex: 0 0 20em;
  padding-right: 1em;
}
.book-cover img {
  max-width: 100%;
  height: auto;
  border: 1px solid #00e5ff;
  box-shadow: 0 0 10px #00e5ff33;
  border-radius: 8px;
}
.book-series {
  font-family: 'Saira', sans-serif;
}
.book-info {
  flex: 1;
  font-family: 'Saira', sans-serif;
}
.book-info h3 {
  margin-top: 0;
}
.book-info p {
  margin: 0.5em 0;
  line-height: 1.6;
}
.book-text p {
  font-family: 'Saira', sans-serif;
  word-wrap: break-word;
}

/* Buy Links */
.buy-info {
  max-width: 25%;
  font-family: 'Saira', sans-serif;
  padding: 0 0 0 1em;
}
.buy-links {
  list-style: none;
  padding: 0;
  margin: 0.5em 0 0;
  font-family: 'Saira', sans-serif;
  word-wrap: break-word;
}
.buy-links li {
  margin-bottom: 0.3em;
}
.buy-links a {
  text-decoration: none;
  color: #00e5ff;
  background-color: #1c1c1c;
  padding: 2px;
  border-radius: 16px;
  border: 1px solid #00e5ff;
  display: inline-block;
  transition: background 0.2s ease;
}
.buy-links img {
  border-radius: 12px;
  max-width: 100%;
  display: block;
  height: auto;
}
.buy-links a:hover {
  background-color: #00e5ff;
  color: #101010;
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.9em;
  color: #888;
  margin-top: 3em;
}

/*
 * Responsive ADA/Screenreader compliant navigation menu
 * This took forever, and a lot of guides
 * No Javascript, this is all just CSS, and aria-compliant
 */
.nav-links {
  display: flex;
  flex-direction: row;
  padding: 0;
  margin: 0;
  list-style: none;
}
.nav-links li {
  list-style: none;
}
.nav-links a {
  text-decoration: none;
  color: #2a4764;
  font-weight: bold;
  transition: color 0.2s ease;
  padding: 0.5em;
}
.nav-links a:hover {
  color: #00bcd4;
}

/* Burger Menu Icon for the screenreader menu */
.nav-menu {
  position: relative;
  align-items:flex-end;
}
.nav-toggle {
  cursor: pointer;
  list-style: none;
  border: none;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
}
.burger-icon {
  width: 30px;
  height: 3px;
  background: #2a4764;
  position: relative;
  display: inline-block;
  transition: background 0.3s ease;
  margin-top: -3.5em;
}
.burger-icon::before,
.burger-icon::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 3px;
  background: #2a4764;
  left: 0;
  transition: transform 0.3s ease, top 0.3s ease;
}
.burger-icon::before {
  top: -8px;
}
.burger-icon::after {
  top: 8px;
}

/* When menu is open, transform into X */
.nav-menu[open] .burger-icon {
  background: transparent;
}
.nav-menu[open] .burger-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-menu[open] .burger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Media queries for the menu and reflow */

/* Narrow desktop/portrait table */
@media (max-width: 850px) {
  .buy-info {
    max-width: 100%;
    padding: 1em 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
  }
  .buy-links {
    max-width: 75%;
  }
}

/* Mobile/Tablet */
@media (max-width: 799px) {
  h2, h3 {
    text-align: center;
  }
  .header-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
  }
  .book-block {
    flex-direction: column;
  }
  .book-cover {
    flex: 0 0 10em;
    align-items: center;
    padding: 0.5em;
  }
  .author {
    max-width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
  }
  h1 {
    margin: 0;
    font-size: 1.5em;
  }
  .nav-menu summary {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    padding: 0.5em 0;
  }
  .nav-links {
    flex-direction: column;
    background: #f4f4f4;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 1em;
    max-height: 0;
    transform: scaleY(0.95);
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transform-origin: top;
    transition:
      max-height 0.2s ease,
      transform 0.2s ease,
      opacity 0.2s ease,
      visibility 0.2s ease;
  }
  .nav-menu[open] .nav-links {
    max-height: 7em;
    transform: scaleY(1);
    opacity: 1;
    visibility: visible;
    padding: 1em;
  }
}

/* Desktop: always open menu, hide burger */
@media (min-width: 800px) {
  .nav-menu summary {
    display: none;
  }
  .nav-links {
    display: flex;
    flex-direction: row;
    padding: 1em;
    margin: 0;
    list-style: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: none;
  }
}
/* End menu */
