/* Variables */
:root {
  --bg-body: #fff;
  --fg-body: #333;
  --fg-primary: #20b200;
  --fg-secondary: #ff19c8;

  --font-base: 100%;
  --font-base-large: 150%;
  --font-title: 3.47em;
  --font-tagline: 0.95em;
  --font-nav: 1.15em;
  --font-copy: 0.875em;
  --font-small: 0.75em;
  --font-tiny: 0.6em;
}

/* Fonts */
@font-face {
  font-display: swap;
  font-family: 'Patua One';
  font-style: normal;
  font-weight: 400;
  src: local('Patua One'), local('PatuaOne-Regular'),
    url('/fonts/patua-one-v6-latin-regular.woff2') format('woff2'),
    url('/fonts/patua-one-v6-latin-regular.woff') format('woff'),
    url('/fonts/patua-one-v6-latin-regular.ttf') format('truetype');
}

@font-face {
  font-display: swap;
  font-family: Roboto;
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'),
    url('/fonts/roboto-v16-latin-regular.woff2') format('woff2'),
    url('/fonts/roboto-v16-latin-regular.woff') format('woff'),
    url('/fonts/roboto-v16-latin-regular.ttf') format('truetype');
}

@font-face {
  font-display: swap;
  font-family: Roboto;
  font-style: normal;
  font-weight: 700;
  src: local('Roboto Bold'), local('Roboto-Bold'),
    url('/fonts/roboto-v16-latin-700.woff2') format('woff2'),
    url('/fonts/roboto-v16-latin-700.woff') format('woff'),
    url('/fonts/roboto-v16-latin-700.ttf') format('truetype');
}

/* Reset and base elements */
html {
  font-size: 100.01%;
}

html, body {
  height: 100%;
}

html, body, header, footer, section, article, h1, h2, h3, h4,
p, div, span, pre, code, blockquote, ol, ul, li, dl, dt, dd,
sup, sub, a, picture, img, abbr, time, svg, table, tr, th, td, form, label {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

body {
  padding: 0 5%;
  background-color: var(--bg-body);
  color: var(--fg-body);
  font-family: roboto, tahoma, verdana, freesans, clean, sans-serif;
  font-size: var(--font-base);
}

header, footer, section {
  display: block;
}

h1, h2, h3 {
  font-weight: bold;
}

h1 {
  margin-top: 0.4em;
  font-family: 'Patua One', serif;
  font-size: var(--font-title);
  letter-spacing: 0.027em;
  word-spacing: 0.08em;
  color: var(--fg-primary);
}

h2, h3 {
  font-size: var(--font-small);
  margin-bottom: 1.75em;
}

h4, p, td, dd {
  font-weight: normal;
}

h4, p, dt, dd, th, td, li {
  font-size: var(--font-copy);
  word-spacing: 0.1em;
}

li h3, li h4, li p, li dt, li dd, li th, li td {
  font-size: 1em;
}

h3, h4, p, dl, table, pre {
  margin-bottom: 1.5em;
}

p {
  max-width: 32em;
}

li p {
  max-width: 30em;
}

p img {
  width: 100%;
}

blockquote {
  border-left: 4px solid silver;

  & p {
    font-weight: lighter;
    margin-left: 1em;
  }
}

dt {
  float: left;
  clear: left;
  margin-right: 0.3em;
  font-weight: bold;
}

table {
  box-sizing: border-box;
  border-spacing: 0;
  page-break-inside: avoid;
}

th {
  font-weight: bold;
}

th, td {
  padding: 0.2em 1em 0.2em 0;
  vertical-align: middle;
  text-align: left;

  &:last-child {
    padding-right: 0;
  }
}

li {
  list-style: none;
}

sup, sub {
  font-size: small;
}

sup {
  vertical-align: top;
}

a {
  color: var(--fg-primary);
  text-decoration: none;
  cursor: pointer;

  &:hover, &:active {
    color: var(--fg-secondary);
  }
}

svg {
  margin: 0;
  page-break-inside: avoid;
  width: 100%;
}

form, label, input {
  display: block;
}

form {
  margin-bottom: 2em;
}

label {
  font-size: 0.8em;
}

input, textarea, select {
  margin-bottom: 0.4em;
  font-size: 100%;
  font: inherit;
}

textarea {
  height: 16em;
}

code {
  display: inline-block;
  box-sizing: border-box;
  padding: 0.15em 0.25em 0 0.25em;
  border-radius: 3px;
  background-color: #e9e9e9;
  font-family: consolas, monaco, "lucida console", monospace, serif;
  font-size: 0.8em;
}

pre {
  color: #888;

  & code {
    margin-left: 2em;
    padding: 0;
    background-color: var(--bg-body);
  }
}

/* Utility classes */
.clearfix {
  zoom: 1;

  &:before, &:after {
    content: '.';
    display: block;
    height: 0;
    overflow: hidden;
  }

  &:after {
    clear: both;
  }
}

.invisible {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px 1px 1px 1px);
  clip: rect(1px, 1px, 1px, 1px);
}

.indent {
  margin: 1em 0 1em 1em;
}

.space-below {
  margin-bottom: 2em;
}

.no-space-below {
  margin-bottom: 0;
}

.smallprint {
  margin-top: 3em;
  font-size: var(--font-small);
}

/* Site-specific classes */
.tagline {
  margin: -0.5em 0 -0.2em;
  color: var(--fg-primary);
  font-family: 'Patua One', serif;
  font-size: var(--font-tagline);
}

.nav {
  display: inline;
  float: left;
  margin: 0.8em 3.8em 1.3em 0;
  font-size: var(--font-nav);
  font-weight: bold;
}

a.nav {
  color: var(--fg-body);

  &:hover, &:active {
    color: var(--fg-primary);
  }
}

span.nav {
  color: var(--fg-secondary);
}

li:last-child .nav {
  margin-right: 0;
}

.section-title, .article-title {
  font-size: var(--font-small);
  font-weight: bold;
}

.section-title {
  margin-bottom: 1.75em;
}

.article-title {
  clear: left;
  margin-bottom: 0.2em;

  & a {
    color: var(--fg-body);

    &:hover, &:active {
      color: var(--fg-primary);
    }
  }
}

.article-time {
  font-size: var(--font-tiny);
  margin-bottom: 0.4em;
}

.essay .article-time {
  margin-top: -1.8em;
  margin-bottom: 1.8em;
}

.article-abstract {
  clear: left;
}

.photo-thumbnail {
  clear: left;
}

.photo-thumbnail img {
  max-width: 100%;
}

/* Project/repo display */
.project {
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-start;
  align-items: center;
  align-content: flex-start;
  margin-bottom: 1.6em;
}

.project-details {
  display: flex;
  flex-flow: column wrap;
  justify-content: flex-start;
  align-items: flex-start;
  align-content: flex-start;

  & .project {
    margin-bottom: 0;

    & .detail:first-child {
      margin-right: 0.6em;
    }
  }

  &.text-only {
    margin-bottom: 1em;
  }

  & dl {
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-start;
    align-items: flex-end;
    align-content: flex-start;
    margin-bottom: 0;
  }

  & dt {
    float: none;
    clear: none;
    font-weight: normal;
  }

  & dd {
    margin-right: 0.5em;
  }
}

.detail {
  margin-bottom: 0.5em;
}

.thumbnail {
  display: block;
  box-sizing: border-box;
  min-width: 80px;
  max-width: 80px;
  margin-top: 0.3em;
  margin-right: 1em;
}

.commit-title {
  display: inline;
  float: left;
  margin-right: 0.5em;
}

.responsive {
  width: 100%;
}

/* Charts (preserved for future use) */
.chart-container {
  display: block;
  position: relative;
  width: 100%;
  padding-bottom: 50%;
  margin-bottom: 0.5em;
  vertical-align: middle;
  overflow: hidden;
}

.chart {
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
}

.chart-axis {
  stroke-width: 2;
  stroke: #000;
}

.chart-bar {
  fill: var(--fg-primary);
}

.chart-bar-label {
  fill: #fff;
}

/* Essay styling */
.essay li {
  margin-left: 2em;

  &:last-child {
    margin-bottom: 1.5em;
  }
}

.essay ul li {
  list-style: circle;
}

.essay ol li {
  list-style: decimal;
}

.centered {
  text-align: center;
}

/* Tags */
.tags {
  clear: left;
  max-width: 32em;
}

header .tags {
  position: relative;
  top: -0.7em;
  margin-bottom: 0.6em;
}

.tags li {
  float: left;
}

.tag {
  display: block;
  margin-right: 2px;
  margin-bottom: 2px;
  padding: 0 1em;
  border: 1px solid var(--fg-body);
  border-radius: 5px;
  font-size: var(--font-small);
}

article .tag {
  font-size: var(--font-copy);
}

a.tag {
  border-color: var(--fg-primary);

  &:hover, &:active {
    border-color: var(--fg-secondary);
  }
}

/* Misc */
.icon {
  display: inline;
  vertical-align: middle;
  width: 1em;
}

.jobspam {
  font-style: italic;
}

.aside {
  font-size: var(--font-small);
  font-style: italic;
}

/* Responsive */
@media (min-width: 480px) {
  body {
    padding: 0 10%;
  }

  .nav {
    margin-right: 3.8em;
  }

  .thumbnail {
    margin-top: 0;
  }
}

@media (min-width: 640px) {
  .section {
    display: inline;
    float: left;
    width: 48%;

    &:nth-of-type(2n+1) {
      margin-right: 4%;
      clear: left;
    }
  }
}

@media (min-width: 740px) {
  body {
    font-size: var(--font-base-large);
  }

  th, td {
    font-size: 0.9em;
  }

  .indent {
    font-size: var(--font-small);
  }

  .thumbnail {
    min-width: 100px;
    max-width: 100px;
  }

  .chart-label {
    font-size: 0.6em;
  }

  .tag {
    margin-right: 5px;
    margin-bottom: 5px;
    border-radius: 7px;
  }
}
