:root {
  --white: #fefcfc;
  --raisin-black: #181d25;
  --dodger-blue: #3f8efc;
  --scarlet: #ef350b;
  --canary: #fffb94;
  --salmon: #ff6f61;
  --purple: #6100c2;

  --a11y-gray: #707070;
  --a11y-salmon: #ff5a4a;
  --a11y-sockeye-salmon: #e81500;

  --content-width: 300px;
  --side-margin: 20px;
  --max-paragraph-width: 100%;
  --max-content-width: 960px;

  --font-size: 18px;
  --golden-ratio: 1.618;
  --major-sixth: 1.6667;
  --widescreen: 1.7778;
  --type-scale: var(--widescreen);
  --vertical-grid: calc(var(--font-size) / 1.5);
  --headline-font: "League Spartan", sans-serif;
  --body-font: "Newsreader", Palatino, Georgia, serif;
}

html {
  height: 100%;
}

body {
  background-color: var(--white);
  color: var(--raisin-black);
  min-height: 100%;
  display: grid;
  grid-template-rows: [header] auto [main] 1fr [footer] auto;
  grid-template-columns: [left-edge] auto [right-edge];
  grid-auto-flow: row;
  margin: 0;
  padding: 0;
}

::selection {
  background: yellow;
  color: black;
}

::-moz-selection {
  background: yellow;
  color: black;
}

main a {
  color: var(--dodger-blue);
  background: linear-gradient(
    to right,
    transparent,
    transparent 50%,
    var(--canary) 50%
  );
  background-size: 200% 100%;
  background-position: 0;
  transition: background-position 200ms;
}

main a:focus,
main a:hover {
  background-position: -100%;
}

main a:visited {
  color: var(--purple);
}

/* Typography */
body {
  font-family: var(--body-font), serif;
  font-weight: 400;
  font-style: normal;
  font-kerning: normal;
  font-size: var(--font-size);
  line-height: calc(var(--font-size) * var(--type-scale));
  /* 32px / 18px = 1.778 */
  hyphens: manual;
}

h1 {
  font-size: calc(var(--font-size) * var(--type-scale) * var(--type-scale));
  line-height: calc(5 * var(--vertical-grid));
  margin: 0 0 var(--vertical-grid) 0;
}

.homepage h1 {
  font-family: var(--body-font);
  font-size: calc(var(--font-size) * var(--type-scale) * 1.7);
  line-height: 1;
  font-weight: 400;
}

p {
  margin: 0 0 var(--vertical-grid) 0;
}

/* Code blocks (```) */
h5 + pre {
  margin-top: 0;
}

code[class*="language-"],
pre[class*="language-"] {
  font-size: 13px;
  border-radius: 2px;
  border: solid 1px lightgrey;
}

pre[class*="language-"] button {
  display: flex;
  align-items: center;
}

pre[class*="language-"] > code[class*="language-"] {
  border: none;
}

pre[class*="language-"] {
  margin: 0 0 calc(var(--vertical-grid) * 2) 0;
}

/* All code (` or ```) */
code {
  border: solid 1px lightgrey;
  background: whitesmoke;
  border-radius: 4px;
  display: inline-block;
  font-size: 15px;
  line-height: 1.5em;
  padding: 0 0.25em;
}

/* Header */
header {
  font-family: var(--headline-font);
  font-style: normal;
  display: grid;
  grid-row: header / main;
  grid-column: left-edge / right-edge;
  grid-template-columns:
    var(--side-margin) minmax(auto, var(--max-content-width))
    var(--side-margin) 1fr;
  padding: var(--vertical-grid) 0 calc(var(--vertical-grid) * 2);
}

header h1 {
  grid-column: 1 / 2;
  color: var(--dodger-blue);
  margin-bottom: 0;
  font-size: calc(
    var(--font-size) * var(--type-scale) * var(--type-scale) * 0.9
  );
}

header h1 a,
header h1 a:visited,
header h1 a:hover {
  text-decoration: none;
  color: var(--dodger-blue);
  transition: background-color 200ms;
}

header h1 a {
  position: relative;
}

header h1 a::after {
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  content: "";
  display: block;
  height: 5px;
  background-color: var(--dodger-blue);
  width: 0;
  opacity: 0;
  transition:
    width 250ms,
    opacity 250ms;
}

header h1 a:focus,
header h1 a:hover {
  background-color: var(--canary);
}

header h1 a:focus::after,
header h1 a:hover::after {
  opacity: 1;
  width: 100%;
}

header nav {
  display: grid;
  grid-auto-flow: column;
  grid-gap: 10px;
  justify-content: start;
  justify-items: start;
}

header nav a,
header nav a:visited {
  font-weight: 600;
  font-size: 16px;
  background-color: whitesmoke;
  border: solid 1px lightgrey;
  padding: 15px;
  border-radius: 2px;
  color: var(--a11y-gray);
  display: block;
  transition: background-color 200ms;
  line-height: calc(var(--vertical-grid) * 1.5);

  /* This is to disable an undocumented Android Chrome feature named "font boosting" */
  /* Nav links sometimes broke onto two lines */
  /* Until this feature is documented, I have to rely on this hack: */
  /* https://stackoverflow.com/questions/13430897/how-to-override-font-boosting-in-mobile-chrome */
  max-height: 100vh;
}

header nav a:focus,
header nav a:hover {
  background-color: var(--canary);
  color: var(--a11y-gray);
}

header .wrapper {
  display: grid;
  grid-column: 2 / 3;
  grid-auto-flow: row;
  grid-gap: 20px;
  align-items: center;
  grid-template-columns: 1fr;
}

/* Main content */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
}

main {
  grid-column: left-edge / right-edge;
  grid-row: main / footer;
  display: grid;
  margin: 0 var(--side-margin);
  grid-template-columns: minmax(auto, var(--max-paragraph-width));
}

main h2 {
  font-size: calc(var(--font-size) * var(--type-scale));
  margin: 0 0 var(--vertical-grid);
}

p + h2 {
  margin-top: calc(2 * var(--vertical-grid));
}

main h3 {
  margin: 0 0 var(--vertical-grid);
}

main h4,
main h5,
main h6 {
  margin: 0 0 calc(var(--vertical-grid) / 2);
}

main ul,
main ol {
  list-style-position: outside;
}

main article {
  max-width: var(--max-paragraph-width);
  overflow: hidden;
}

.post video,
.post img {
  max-width: 100%;
}

.post video {
  max-height: 50vh;
  width: auto;
  border: solid 1px lightgrey;
  border-radius: 2px;
}

.post img {
  display: block;
}

.post blockquote {
  border-left: solid 4px var(--dodger-blue);
  font-size: 150%;
  line-height: 1.6;
  margin: 1rem 0;
  padding: 0 20px;
}

summary {
  cursor: pointer;
}

/* Article footer */

article.post footer {
  border-top: solid 1px lightgrey;
  padding-top: calc(var(--vertical-grid) * 2);
  margin-top: calc(var(--vertical-grid) * 4);
  font-style: italic;
}

/* Articles Index */
main.articles-index {
  grid-template-columns: minmax(auto, var(--max-content-width));
}

main.articles-index article {
  max-width: 100%;
}

main.articles-index ul {
  padding-left: 0;
  list-style: none;
}

/* Footer */
body > footer {
  display: grid;
  color: var(--white);
  grid-template-columns:
    var(--side-margin) minmax(auto, var(--max-content-width))
    var(--side-margin) 1fr;
  grid-row: footer;
  border-top: solid 1px lightgrey;
  background: var(--raisin-black);
  font-family: var(--headline-font);
  font-style: normal;
  line-height: 1;
  margin-top: 30px;
  padding-top: 30px;
  --font-size: 18px;
}

body > footer .wrapper {
  display: grid;
  grid-column: 2 / 3;
  grid-template-rows: auto;
  grid-template-columns: [left-edge] 1fr [right-edge];
  grid-auto-flow: row;
  grid-gap: 30px;
}

body > footer nav {
  display: grid;
  grid-gap: 0 30px;
}

body > footer a,
body > footer a:visited,
body > footer a svg,
body > footer a:visited svg {
  display: inline-block;
  color: var(--dodger-blue);
  fill: var(--dodger-blue);
  padding: 5px 0;
  transition:
    color 150ms,
    fill 150ms;
}

body > footer a:focus,
body > footer a:hover,
body > footer a:focus .icon svg,
body > footer a:hover .icon svg {
  color: #ffcc00;
  fill: #ffcc00;
  background-position: -100%;
}

body > footer h2 {
  color: var(--white);
  font-size: 1.17em;
  margin-bottom: 5px;
}

body > footer ul {
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

body > footer li {
  min-height: 36px;
  line-height: calc(var(--font-size) * var(--type-scale));
}

body > footer span.active-page {
  padding: 5px 0;
  display: inline-block;
}

footer .icon svg {
  fill: var(--dodger-blue);
}

footer .trophy-shelf {
  display: grid;
  grid-column: 1 / 3;

  grid-template-columns: 1fr auto;
  grid-template-areas:
    "top-left top-right"
    "body body";
}

.trophy-shelf .detail {
  padding: 5px 0;
}

.trophy-shelf .detail a {
  padding: 0;
}

.trophy-shelf #duration-wrapper {
  opacity: 0;
  transition: opacity 1s;
}

.trophy-shelf #duration-wrapper.populated {
  opacity: 1;
}

.trophy-shelf.condensed h2 {
  grid-area: top-left;
}

.trophy-shelf.condensed:hover,
.trophy-shelf.condensed:hover * {
  cursor: pointer;
}

.trophy-shelf.condensed:hover .open-trophy-details .icon {
  color: #ffcc00;
}

.trophy-shelf.condensed .trophies {
  grid-area: body;
}

.trophy-shelf.condensed li {
  display: inline;
}

.trophy-shelf .trophies {
  grid-area: body;
}

.trophy-shelf li {
  padding: 5px 0;
}

.trophy-shelf .controls {
  grid-area: top-right;
}

.trophy-shelf button {
  background: none;
  border: none;
  box-sizing: content-box;
  line-height: 1;
  display: inline-block;
}

.trophy-shelf.condensed .detail {
  display: none;
}

.trophy-shelf .view-report .icon {
  font-size: 18px;
  animation: none;
  cursor: inherit;
}

.trophy-shelf.expanded .open-trophy-details {
  display: none;
}

.trophy-shelf li {
  --stagger: 250ms;
}

.trophy-shelf .icon {
  vertical-align: text-bottom;
  color: var(--dodger-blue);
  cursor: default;
  transition: color 150ms;
  display: inline-block;

  height: 23px;
  width: 23px;
}

.trophy-shelf .icon-small {
  height: 18px;
  width: 18px;
  display: inline-block;
  vertical-align: top;
}

.trophy-shelf .icon-small svg {
  height: 18px;
  width: 18px;
}

.trophy-shelf .trophies li > .icon svg {
  animation: 400ms ease-out calc(var(--index) * var(--stagger)) sizzle;
  animation-fill-mode: both;

  height: 23px;
  width: 23px;
}

.trophy-shelf .duration {
  animation: 400ms ease-out calc(var(--index) * var(--stagger))
    white-text-sizzle;
  animation-fill-mode: both;
}

@keyframes sizzle {
  0% {
    opacity: 0;
    fill: white;
    filter: drop-shadow(0 0 5px #ffffff);
  }

  30% {
    opacity: 1;
    fill: yellow;
  }

  100% {
    fill: var(--dodger-blue);
    filter: drop-shadow(0 0 0 #ffffff);
  }
}

@keyframes white-text-sizzle {
  0% {
    opacity: 0;
    color: white;
    text-shadow: #fff 0 0 5px;
  }

  30% {
    opacity: 1;
    color: yellow;
  }

  100% {
    color: white;
    text-shadow: #fff 0 0 0;
  }
}

/* Dazzler Cards */
.dazzler-cards {
  grid-column: main-start / main-end;
  grid-gap: 20px;
  padding: 30px 0;
  display: grid;
  grid-template-columns: 1fr;
}

.dazzler-card .demo-link {
  transition: background-color 200ms;
  border: solid 1px lightgrey;
  border-radius: 2px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.dazzler-card .demo-link.includes-description {
  border-bottom: none;
}

.dazzler-card .demo-link:hover {
  background-color: var(--canary);
}

.dazzler-card .demo-link h1 {
  text-decoration: underline;
}

.dazzler-card .article-link {
  transition: background-color 200ms;
  border: none;
  background: var(--a11y-salmon);
  overflow: hidden;
  display: block;
  color: var(--white);
  box-sizing: border-box;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
}

.dazzler-card .article-link:hover {
  background: var(--a11y-sockeye-salmon);
}

.dazzler-card .article-link span {
  display: block;
  padding: 10px 20px;
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
}

.dazzler-card h1 {
  margin: 0 0 10px 0;
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 28px;
}

.dazzler-card p {
  display: block;
  text-decoration: none;
  color: inherit;
  margin: 0;
}

.dazzler-card video,
.dazzler-card img {
  width: 100%;
  max-height: 449px;
  object-fit: cover;
  aspect-ratio: 3 / 2;
}

/* Article Cards */
.article-cards {
  grid-column: main-start / main-end;
  grid-gap: 20px;
  padding: 30px 0;
  display: grid;
  grid-template-columns: 1fr;
}

.article-card {
  display: grid;
  grid-auto-rows: auto;
  grid-gap: 20px;
  transition: background-color 200ms;
  border-bottom: solid 1px var(--raisin-black);
  text-decoration: none;
  color: inherit;
  padding: 10px 0;
}

.article-card p:last-child {
  margin-bottom: 10px;
}

.article-card:hover h1 {
  background-color: var(--canary);
}

.article-card:hover {
  text-decoration: none;
}

.article-card h1 {
  color: var(--raisin-black);
  margin: 0 0 var(--vertical-grid) 0;
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 36px;
  text-decoration: underline;
  line-height: calc(var(--vertical-grid) * 3);
}

.article-card p {
  color: var(--raisin-black);
  display: block;
  text-decoration: none;
  margin: 0;
}

.article-card img {
  object-fit: cover;
  width: 100%;
  aspect-ratio: 3 / 2;
}

.article-card .byline {
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 16px;
  color: var(--a11y-gray);
  margin-bottom: 24px;
  border-bottom: none;
}

/** Article */
.byline {
  border-bottom: solid 1px var(--raisin-black);
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 16px;
  color: var(--a11y-gray);
  line-height: 32px;
  margin-bottom: calc(var(--vertical-grid) * 2 - 1px);
}

button {
  cursor: pointer;
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  font-size: 16px;
  background-color: whitesmoke;
  border: solid 1px lightgrey;
  padding: 5px;
  border-radius: 2px;
  color: var(--a11y-gray);
  display: inline-block;
  transition: background-color 200ms;
  line-height: calc(var(--vertical-grid) * 1.5);
}

button:hover {
  background-color: var(--canary);
  color: var(--a11y-gray);
}

/* Form Styles */
form label,
form input[type="submit"] {
  font-family: var(--headline-font);
  font-weight: 600;
  font-style: normal;
  display: block;
  clear: both;
}

form input,
form textarea {
  display: block;
  padding: 0.5rem;
  font-family: var(--body-font), serif;
  font-weight: 400;
  font-style: normal;
  font-kerning: normal;
  font-size: var(--font-size);
  line-height: calc(var(--font-size) * var(--type-scale));
  /* 32px / 18px = 1.778 */
  hyphens: manual;
  width: 100%;
  box-sizing: border-box;
}

form input[type="submit"] {
  border: none;
  padding: 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  background-color: var(--dodger-blue);
  color: var(--white);
  cursor: pointer;
}

/* Resume */
.download-links {
  text-align: right;
  margin-bottom: var(--vertical-grid);
}

.download-links .button {
  font-family: var(--headline-font), sans-serif;
  color: white;
  font-size: 16px;
  font-weight: 600;
  font-size: 16px;
  background-color: whitesmoke;
  border: solid 1px lightgrey;
  padding: 15px;
  border-radius: 2px;
  color: var(--a11y-gray);
  transition: background-color 200ms;
  line-height: calc(var(--vertical-grid) * 1.5);
  max-height: 100vh;
  text-decoration: none;
}

.download-links .button-icon {
  vertical-align: middle;

  /* This chunk fixes gnarly FOUT on the button,
    where the edge of the button gets pushed WAAAAY
    out there because it's trying to show the
    word "download" instead of a little download
    arrow icon thing */
  height: 1em;
  width: 1em;
  overflow: hidden;
}

.download-links .button-text {
  text-decoration: underline;
}

.engagement {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto;
  overflow: visible;
  margin: 0 0 var(--vertical-grid) 0;
}

.engagement .organization {
  margin-bottom: 0;
}

.engagement .location {
  display: block;
  text-align: right;
}

.role {
  display: grid;
  margin-top: 0;
  grid-column-start: 1;
  grid-column-end: 3;
  grid-template-columns: 1fr auto;
}

.role .title {
  display: block;
}

.role .tenure {
  display: block;
  text-align: right;
}

.role ul {
  margin-block-start: 0;
  grid-column-start: 1;
  grid-column-end: 3;
}

/* Responsive Styles */
@media (min-width: 640px) {
  :root {
    --content-width: 600px;
    --side-margin: 75px;
    --max-paragraph-width: 480px;
  }

  .dazzler-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-card {
    grid-template-columns: 180px auto;
    grid-auto-rows: 1fr;
  }

  .article-card img {
    grid-column: 1;
  }

  .article-card div {
    grid-column: 2;
  }

  header .button {
    margin-left: 20px;
    padding: 10px;
  }

  header .wrapper {
    grid-auto-flow: column;
  }

  body > footer .wrapper nav {
    grid-template-columns: [left-edge] repeat(3, 1fr) [right-edge];
  }

  body > footer .speed-stats {
    grid-column: -1 / 1;
  }
}

@media (min-width: 960px) {
  :root {
    --content-width: 900px;
    --side-margin: 170px;
    --max-paragraph-width: 640px;
  }
}
