
/*
  Global variables
*/

:root {
  --light-color: #f9f5e8;
  --light-color-transparent: #f9f5e800;
  --light-alt-color: #f3f3f2;
  --dark-color: #363635;
  --dark-alt-color: #2e2e2b;
  --accent-color: #153bbe;
  --accent-color-on-dark: #b8c5da;
  --accent-color-faded: #153bbe44; /* Just copy accent color and put 44 at the end */
  --sans-font: "Calluna Sans", "Trebuchet MS", "Lucida Sans Unicode",
    "Lucida Grande", "Lucida Sans", sans-serif;
  --serif-font: "Calluna", Georgia, "Times New Roman", Times, serif;
  --mono-font: Courier, monospace;
}

/*
  Fonts
*/

@font-face {
  font-family: "Calluna";
  src: url("/assets/fonts/Calluna-Regular-webfont.woff2") format("woff2"),
    url("/assets/fonts/Calluna-Regular-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Calluna";
  src: url("/assets/fonts/Calluna-It-webfont.woff2") format("woff2"),
    url("/assets/fonts/Calluna-It-webfont.woff") format("woff");
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: "Calluna Sans";
  src: url("/assets/fonts/CallunaSansSemiBold-webfont.woff2") format("woff2"),
    url("/assets/fonts/CallunaSansSemiBold-webfont.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: "Calluna Sans";
  src: url("/assets/fonts/CallunaSansRegular-webfont.woff2") format("woff2"),
    url("/assets/fonts/CallunaSansRegular-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

/*
  General styles
*/

* {
  box-sizing: border-box;
}

body,
html {
  background-color: var(--dark-color);
  margin: 0;
}

body {
  background-color: var(--light-color);
  color: var(--dark-color);
  font-size: 24px;
  line-height: 1.5;
  font-family: var(--serif-font);
}

body.dark {
  background-color: var(--dark-color);
  color: var(--light-color);
}

h1 {
  font-family: var(--sans-font);
  font-size: 48px;
  font-weight: normal;
  margin-bottom: 0.5em;
}

h3,
main.blog h1 {
  text-align: center;
  margin: 48px 0 24px;
  text-transform: uppercase;
  font-family: var(--sans-font);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2px;
}

main.blog h1 {
  font-size: 18px;
}

h3::before,
h3::after,
main.blog h1:first-child::before,
main.blog h1:first-child::after {
  content: "–";
  display: inline-block;
  margin: 0 16px;
}

a {
  text-decoration: inherit;
  color: var(--accent-color);
  display: inline;
  vertical-align: baseline;
  border-bottom: solid 1px var(--accent-color-faded);
  transition: border 0.25s ease-in-out, color 0.15s ease-out;
}

a:hover {
  border-bottom-color: var(--accent-color);
  color: var(--accent-color);
}

hr {
  margin: 24px 0 38px;
  border-color: var(--accent-color);
  color: var(--accent-color);
  opacity: 0.3;
}

blockquote {
  margin: 2em 0 1em;
}

blockquote footer {
  font-family: var(--sans-font);
  font-style: normal;
  font-size: 16px;
  margin-top: 0.25em;
}

blockquote footer:before {
  content: "– ";
}

figure,
img {
  max-width: 100%;
}

@media (max-width: 700px) {
  body {
    font-size: 20px;
  }
}

@media (max-width: 440px) {
  header,
  main {
    padding: 0 16px;
  }
}

/* Utilities & global components */

body.dev-preview::before {
  /* CSS Dev mode indicator */
  position: fixed;
  top: 8px;
  left: 8px;
  content: "Using test.css";
  background-color: #000;
  color: #fff;
  padding: 4px;
  border-radius: 4px;
  font-family: var(--sans-font);
  font-size: 12px;
}

header,
main {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 32px;
}

body > header {
  padding: 8px;
}

body > footer {
  background-color: var(--dark-color);
  color: var(--light-color);
  font-family: var(--sans-font);
  margin-top: 64px;
  padding: 24px 32px 48px;
  text-align: center;

  a {
    color: inherit;
    font-size: 20px;
  }

  a:hover {
    border-bottom-color: var(--accent-color-on-dark);
    color: var(--accent-color-on-dark);
    font-size: 20px;
  }

  p {
    margin-top: 0;
  }

  nav {
    margin-bottom: 16px;
  }
}

.logo {
  text-align: center;
  margin: 0.5em 0 0;
}

.logo img {
  width: 240px;
  max-width: 80%;
}

a.home-link {
  border-bottom: none;
  color: inherit;
  display: block;
  font-size: 28px;
  line-height: 1.2;
}

a.home-link svg {
  margin-bottom: 16px;
}

a.home-link span.name {
  display: block;
  font-family: var(--serif-font);
  font-weight: normal;
}

a.home-link span.tag {
  display: block;
  font-family: var(--sans-font);
  font-size: 16px;
}

a.page-link {
  font-size: 14px;
  font-family: var(--mono-font);
  text-transform: uppercase;
  letter-spacing: 3px;
  overflow: hidden;
  display: block;
  margin: 32px auto;
  padding: 8px 16px;
  width: max-content;
  border: solid 1px var(--accent-color);
  border-radius: 3px;

  position: relative;
}

a.page-link::after {
  content: "";
  display: block;
  position: absolute;
  opacity: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--accent-color);
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform 0.1s ease-out, opacity 0.2s ease-out;
}

a.page-link:hover::after {
  opacity: 0.1;
  transform: scaleY(1);
}

a.subtle-link {
  font-size: 16px;
  font-family: var(--mono-font);
  border-bottom-color: transparent;
}

a.subtle-link:hover {
  border-bottom-color: var(--accent-color);
}

button {
  height: 44px;
  width: 44px;
  background: none;
  border: solid 1px transparent;
  border-radius: 3px;
  transition: border-color 0.1s ease-out;
  padding-bottom: 4px; /* Arrow visual alignment */
}

button:hover {
  border-color: var(--accent-color);
}

button:focus {
  outline: solid var(--accent-color-faded) 3px;
}

button:active {
  border-color: var(--accent-color-faded);
}

/* Home page */

.tagline {
  margin: 1em 0 2em;
  text-align: center;
  margin: 64px 0;
  font-size: 25px;
  font-weight: normal;
}

ul.projects-list {
  list-style: none;
  margin-bottom: 64px;
  padding: 0;
}

ul.projects-list li {
  margin-bottom: 0.5em;
  text-align: center;
}

ul.projects-list li .title {
  font-style: italic;
}

ul.projects-list li.overflow {
  font-size: 0;
  line-height: 0;
  opacity: 0;
  transition: font-size 0.2s ease-out, line-height 0.2s ease-out, opacity 0.6s 0.2s ease-out;
}

ul.projects-list.expanded li.overflow {
  display: block;
  font-size: 1em;
  line-height: 1.55;
  opacity: 1;
}

a.home-book-link {
  border-bottom-color: transparent;
  color: inherit;
}

a.home-book-link:hover {
  border-bottom-color: var(--accent-color);
  color: var(--accent-color);
}

cite {
  font-size: 16px;
}

/* Book page */

main.book {
  font-size: 18px;
  line-height: 1.55; /* 18/28 spacing */
}

main.book .cover-images {
  display: flex;
  justify-content: center;
  margin: 64px 0;
}

main.book .cover-images .cover {
  width: 225px;
  height: auto;
  max-width: 50%;
  margin: 0 16px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  transform: rotate(-2deg);
}

main.book .cover-images.single-image .cover {
  width: 500px;
  height: auto;
  transform: rotate(0);
}

main.book .cover-images .cover + .cover {
  margin-left: -64px; /* Keeps things centered */
  transform: rotate(1deg) translateY(10px);
}

main.book .attribution {
  font-family: var(--sans-font);
  font-size: 20px;
  margin-bottom: 0.25em;
}

main.book .source-attribution {
  font-family: var(--sans-font);
  font-size: 14px;
  margin: 0;
}

main.book .intro {
  font-family: var(--sans-font);
  font-size: 22px;
  margin-top: 2em;
}

main.book ul.awards {
  list-style: none;
  padding: 0;
  font-size: 16px;
}

main.book ul.awards li p {
  margin: 0.25em 0;
}

main.book .excerpt-buttons {
  margin-top: 16px;
  text-align: center;
}

main.book .excerpt-buttons button {
  height: 44px;
  width: 44px;
  background: none;
  border: solid 1px transparent;
  border-radius: 3px;
  transition: border-color 0.1s ease-out;
}

main.book .excerpt-buttons button:hover {
  border-color: var(--accent-color);
}

main.book .excerpt-buttons button:focus {
  outline: solid var(--accent-color-faded) 3px;
}

main.book .excerpt-buttons button:active {
  border-color: var(--accent-color-faded);
}

main.book .excerpt-buttons .left {
  transform: scaleX(-1);
}

main.book ul.excerpts {
  list-style: none;
  padding: 0;
  position: relative;
  margin: 0 -16px;
}

main.book ul.excerpts .viewport {
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  display: flex;
  flex-direction: row;
}

main.book ul.excerpts::before,
main.book ul.excerpts::after {
  content: "";
  background-image: linear-gradient(
    to right,
    var(--light-color) 0%,
    var(--light-color-transparent) 100%
  );
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  left: 0;
  z-index: 2;
}

main.book ul.excerpts::after {
  transform: scaleX(-1);
  left: auto;
  right: 0;
}

main.book ul.excerpts li {
  padding: 0 16px;
  flex: 0 0 100%;
  scroll-snap-align: start;
}

/* Portfolio */

main.portfolio h1 {
  font-family: var(--serif-font);
  text-align: center;
  margin-top: 64px;
}

main.portfolio .book-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 180px));
  grid-template-rows: repeat(3, auto);
  grid-row-gap: 32px;
  grid-auto-flow: row;
  list-style: none;
  align-items: stretch;
  justify-content: space-around;
  padding: 64px 0 128px 0;
}

main.portfolio .book-card {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  text-align: center;
  position: relative;
  z-index: 2;
  transition: z-index 0.25s step-end;
}

main.portfolio .book-card a {
  border-bottom: none;
  padding: 16px;
  z-index: 3;
}

main.portfolio .book-card .covers,
main.portfolio .book-card .spacing-covers {
  text-align: center;
  max-width: 140px;
  position: relative;
}

main.portfolio .book-card .covers img.cover,
main.portfolio .book-card .spacing-cover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  max-width: 100%;
  transform-origin: center;
  will-change: transform;
  transition: transform 0.25s ease-in-out, opacity 0.25s ease-out,
    box-shadow 0.25s ease-out;
}

main.portfolio .book-card .covers img.cover + img.cover {
  position: absolute;
  bottom: 0;
  left: -10px;
  max-height: 100%;
  z-index: -1;
  opacity: 0;
}

main.portfolio .book-preview-details {
  font-size: 12px;
  text-align: left;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px;
  opacity: 0;
  transition: transform 0.3s ease-out, padding-top 0.3s ease-out,
    opacity 0.3s ease-in-out, z-index 0.3s step-end;

  /* Dark version colors */
  background-color: var(--dark-alt-color);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
  color: var(--light-color);
}

main.portfolio .spacing-cover {
  visibility: hidden;
}

main.portfolio .book-preview-details h2 {
  color: var(--accent-color-on-dark);
  font-family: var(--sans-font);
  font-weight: normal;
  text-align: center;
  line-height: 1.2;
  margin: 0.5em 0;
}

main.portfolio .book-preview-details h3.attribution {
  font-family: var(--sans-font);
  font-size: inherit;
  font-weight: bold;
  text-transform: none;
  margin: 0;
  letter-spacing: 0;
  color: var(--accent-color-on-dark);
}

main.portfolio .book-preview-details h3::before,
main.portfolio .book-preview-details h3::after {
  content: "";
  display: none;
}

main.portfolio .book-preview-details .award {
  margin: 0.25em 0 0;
}

main.portfolio .book-card:hover {
  z-index: 10;
  transition: z-index 0s;
}

main.portfolio .book-card a.book:hover .covers img.cover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transform: rotate(3deg) translateX(10px);
}

main.portfolio .book-card a.book:hover .covers.unique-cover img.cover {
  transform: scale(1.01);
}

main.portfolio .book-card a.book:hover .covers img.cover + img.cover {
  opacity: 1;
  transform: translateX(-5px) translateY(-4px) rotate(-3deg) scale(0.95);
}

main.portfolio .book-card a.book:hover + .book-preview-details {
  padding-top: 32px;
  display: block;
  opacity: 1;
  transition: padding-top 0.25s ease-out, opacity 0.25s ease-in-out,
    z-index 0.25s step-end;
}

@media (max-width: 430px) {
  main.portfolio .book-cards {
    grid-template-columns: repeat(auto-fill, minmax(160px, 260px));
  }

  main.portfolio .book-card .covers,
  main.portfolio .book-card .spacing-covers {
    text-align: center;
    max-width: 210px;
    position: relative;
  }

  main.portfolio .book-preview-details {
    top: -16px;
    left: -16px;
    right: -16px;
    padding: 16px;
  }
}

/* Blog & articles */

main.blog,
main.article {
  font-size: 18px;
  line-height: 1.55; /* 18/28 spacing */
}

main.blog h1 {
  text-align: center;
}

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

.blog-articles .article {
  margin-bottom: 64px;
}

.blog-articles .article h2 {
  margin-bottom: 8px;
}

.blog-articles .article p {
  margin: 8px 0;
}

.blog-articles .article .tags {
  list-style: none;
  padding: 0;
  margin: 0.25em 0;
}

.blog-articles .article .tags li {
  display: inline-block;
  border: solid 1px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px 1px;
  border-radius: 4px;
  font-family: var(--mono-font);
  font-size: small;
  margin-right: 8px;
}

.blog-articles .article a {
  display: block;
  color: inherit;
  text-decoration: none;
  border: none;
}

.blog-articles .article a:hover h2 {
  color: var(--accent-color);
}

main.article .cover-images {
  display: flex;
  justify-content: center;
  margin: 64px 0;
}

main.article .cover-images .cover {
  width: 225px;
  height: auto;
  max-width: 50%;
  margin: 0 16px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  transform: rotate(-2deg);
}

main.article .cover-images.single-image .cover {
  width: 500px;
  height: auto;
  transform: rotate(0);
}

main.article .cover-images .cover + .cover {
  margin-left: -64px; /* Keeps things centered */
  transform: rotate(1deg) translateY(10px);
}

main.article .attribution {
  font-family: var(--sans-font);
  font-size: 20px;
  margin-bottom: 0.25em;
}

main.article blockquote {
  font-family: var(--sans-font);
  padding-left: 1em;
  margin: 2em 0;
  font-size: 0.9em;
}

.footnotes-list {
  border-top: solid 1px var(--accent-color-faded);
  padding-top: 2rem;
  margin-top: 2rem;
}

span.footnotereverse a {
  font-size: 14px;
  border-bottom: none;
}
