:root {
  --font-family: Dank Mono, Inconsolata, Fira Mono, Fira Code, monospace;

  --border-thickness: 10px;
  --color-a: hsl(44, 86%, 52%);
  --color-a-alt: hsl(44, 86%, 42%);
  --color-b: hsl(325, 62%, 56%);
  --color-b-alt: hsl(325, 62%, 46%);
  --color-c: hsl(140, 72%, 41%);
  --color-c-alt: hsl(140, 72%, 31%);
  --color-d: hsl(201, 90%, 41%);
  --color-d-alt: hsl(201, 90%, 31%);

  --theme-light-background: #fff;
  --theme-light-color: #111;
  --theme-light-color-dark: hsl(241, 85%, 70%);
  --theme-light-color-light: hsl(241, 85%, 90%);

  --theme-dark-background: #111;
  --theme-dark-color: rgb(217, 217, 217);
  --theme-dark-color-dark: hsl(241, 57%, 23%);
  --theme-dark-color-light: hsl(241, 89%, 14%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html[data-theme='light'] {
  --background: var(--theme-light-background);
  --color: var(--theme-light-color);
  --color-dark: var(--theme-light-color-dark);
  --color-light: var(--theme-light-color-light);
}
html[data-theme='dark'] {
  --background: var(--theme-dark-background);
  --color: var(--theme-dark-color);
  --color-dark: var(--theme-dark-color-dark);
  --color-light: var(--theme-dark-color-light);
}

body {
  font-size: 16px;
  line-height: 1.4;
  position: relative;
  padding: var(--thickness);
  background: var(--background);
  color: var(--color);
  font-family: var(--font-family);
}

img {
  max-width: 100%;
  height: auto;
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}
#jump-to-main:focus {
  position: fixed;
  clip: initial;
  height: auto;
  width: auto;
  margin: 0;
  background: var(--color);
  color: var(--background);
  z-index: 99;
  font-size: 1rem;
  padding: 0.5rem;
}

.splash-borders {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  z-index: -1;
  --thickness: var(--border-thickness);
}
.splash-borders > div {
  width: 100%;
  position: absolute;
}
.splash-borders > div::after {
  content: '';
  display: block;
  height: var(--thickness);
  left: calc(50% - var(--thickness) * 2.5);
  position: absolute;
  top: 0;
  width: calc(var(--thickness) * 5);
}
.splash-borders > div,
.splash-borders > div::after {
  background: linear-gradient(
    var(--angle),
    var(--color-1) 0,
    var(--color-1) 50%,
    var(--color-2) 0,
    var(--color-2)
  );
}
.splash-borders .top {
  --angle: 90deg;
  --color-1: var(--color-a);
  --color-2: var(--color-b);
}
.splash-borders .top::after {
  --angle: 25deg;
}
.splash-borders .right {
  --angle: 180deg;
  --color-1: var(--color-b);
  --color-2: var(--color-c);
  right: 0;
  top: 0;
}
.splash-borders .right::after {
  --angle: -55deg;
  --color-1: var(--color-c);
  --color-2: var(--color-b);
}
.splash-borders .bottom {
  --angle: 90deg;
  --color-1: var(--color-d);
  --color-2: var(--color-c);
  bottom: 0;
  top: auto;
}
.splash-borders .bottom::after {
  --angle: 25deg;
}
.splash-borders .left {
  --angle: 180deg;
  --color-1: var(--color-a);
  --color-2: var(--color-d);
  left: 0;
  top: 0;
}
.splash-borders .left::after {
  --angle: -55deg;
  --color-1: var(--color-d);
  --color-2: var(--color-a);
}
.splash-borders .top,
.splash-borders .bottom {
  height: var(--thickness);
}
.splash-borders .right,
.splash-borders .left {
  height: 100%;
  width: var(--thickness);
}
.splash-borders .right::after,
.splash-borders .left::after {
  height: calc(var(--thickness) * 5);
  left: auto;
  right: 0;
  top: calc(50% - var(--thickness) * 2.5);
  width: var(--thickness);
}

.subnav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(1em + var(--border-thickness));
}
.subnav button {
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  padding: 0.4rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color);
}
.subnav button svg {
  height: 24px;
  width: 24px;
  margin-right: 6px;
  fill: var(--color);
}
@media (max-width: 640px) {
  .subnav button span {
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
}

.header,
.projects,
.pref {
  max-width: calc(100% - 2 * var(--border-thickness));
  margin: 0 auto;
}

.header {
  text-align: center;
  line-height: 1.2;
  padding: 3vmin 1vmin;
}
.header .title {
  font-size: 8vmin;
  text-transform: uppercase;
}
.header .title a {
  text-decoration: none;
  color: var(--color);
}
.header .title span:nth-child(2) {
  font-weight: 400;
}
.header .subtitle {
  font-size: 5vmin;
}

.button {
  --bg-color: #eeb81d;
  --bg-color-alt: #eeb81d;
  --text-color: #000;
  outline: none;
  text-decoration: none;
  background-color: var(--bg-color);
  display: inline-block;
  padding: 0.8rem;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text-color);
  box-shadow: 8px 7px 0px 0px var(--bg-color-alt);
  transition: all 0.2s cubic-bezier(0.18, 0.74, 0.27, 0.86);
}
.button:hover,
.button:active,
.button:focus {
  cursor: pointer;
  right: 2px;
  top: 2px;
  box-shadow: -8px -7px 0px 0px var(--bg-color-alt);
}
nav.primary {
  display: flex;
  flex-wrap: wrap;
  padding: 1rem;
  justify-content: center;
}
nav.primary a {
  margin: 0 0.8rem;
}
nav.primary a:first-child {
  margin-left: 0;
}
nav.primary a:last-child {
  margin-right: 0;
}
nav.primary a:nth-child(1) {
  --bg-color: var(--color-b);
  --bg-color-alt: var(--color-b-alt);
}
nav.primary a:nth-child(2) {
  --bg-color: var(--color-a);
  --bg-color-alt: var(--color-a-alt);
}
nav.primary a:nth-child(3) {
  --bg-color: var(--color-c);
  --bg-color-alt: var(--color-c-alt);
}
@media (max-width: 640px) {
  nav.primary a {
    padding: 0.4rem;
  }
}

/* projects */
.projects {
  max-width: calc(100% - 2 * var(--border-thickness));
  margin: 0 auto;
  padding: 1em;
  font-size: 1.5rem;
  font-size: calc(16px + (24 - 16) * (100vw - 320px) / (750 - 320));
}

@media (min-width: 750px) {
  .projects {
    font-size: 24px;
  }
}

.projects h2 {
  font-size: 2em;
  display: flex;
  width: 100%;
  margin: 1em auto;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.projects h2:before,
.projects h2:after {
  content: '';
  border-top: 1rem double var(--color-dark);
  margin: 0 1rem 0 0;
  flex: 1 0 1rem;
}

.projects h2:after {
  margin: 0 0 0 1rem;
}

.projects ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(30ch, 1fr));
}

.projects li {
  text-align: right;
  padding: 1em;
}

.projects p {
  max-width: 80ch;
  margin-left: auto;
  padding: 0 0.5em;
}

.projects h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 1.2em;
  line-height: 1.1;
}

.projects h3:before {
  content: '';
  display: block;
  flex: 1;
  height: 1em;
  background: transparent;
}

.projects:not(:focus-within) li:hover h3:before,
.projects li:focus-within h3:before {
  background: var(--color-dark);
}

.projects:hover li:hover,
.projects li:focus-within {
  background: var(--color-light);
}

.projects h3 a {
  text-transform: uppercase;
  color: var(--color);
  background: transparent;
  padding: 0.2em 0.5em;
  text-decoration: none;
}

.projects:not(:focus-within) li:hover h3 a,
.projects h3 a:focus {
  color: var(--background);
  background: var(--color);
  outline: none;
}

@media (max-width: 640px) {
  .projects {
    padding: 0;
  }
  .projects li {
    text-align: left;
    padding: 2em 0;
  }
  .projects li:last-of-type {
    padding-bottom: 1em;
  }
  .projects p {
    width: 100%;
  }
  .projects h3:before {
    order: 2;
  }
}

@media (max-width: 28em) {
  header section {
    padding-right: 0;
  }
}

.social {
  display: grid;
  grid-template-columns: repeat(6, max-content);
  grid-gap: 0.5rem;
  gap: 0.5rem;
  justify-content: end;
  overflow-x: auto;
}
.social a {
  padding: 0.5em;
  display: flex;
  justify-content: center;
  align-content: center;
  background: var(--background);
  border: 4px solid var(--icon-color);
  border-radius: 50%;
  transition: background-color 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}
html[data-theme='dark'] .social a {
  border-color: var(--color-light);
}
.social a svg {
  width: 24px;
  height: 24px;
  fill: var(--color);
}
.social a:hover,
.social a:focus {
  background-color: var(--icon-color);
}
.social a:hover svg,
.social a:focus svg {
  fill: #000;
}
.social a.icon-twitter {
  --icon-color: #1ca2f2;
}
.social a.icon-github {
  --icon-color: #0366d6;
}
.social a.icon-dev {
  --icon-color: #4e57ef;
}
.social a.icon-stackoverflow {
  --icon-color: #f48024;
}
.social a.icon-linkedin {
  --icon-color: #0084bf;
}
.social a.icon-codepen {
  --icon-color: #fcd000;
}

@media (max-width: 640px) {
  .social {
    justify-content: center;
  }
  .social a {
    border-width: 2px;
  }
  .social a svg {
    width: 16px;
    height: 16px;
  }
}

fieldset {
  border: none;
}
.pref {
  display: block;
  position: relative;
  top: var(--border-thickness);
  width: 100%;
  background: var(--color-light);
  color: var(--color);
  padding: 2vmin;
}
.pref[hidden] {
  display: none;
}
.pref label {
  position: relative;
}
.pref input[type='radio'] {
  height: 100%;
  left: 0;
  opacity: 0.0001;
  position: absolute;
  top: 0;
  width: 100%;
}
.pref label:focus-within,
.pref label:hover,
.pref input:focus + span {
  outline: 1px dashed;
  cursor: pointer;
}
#theme span {
  display: inline-block;
  color: var(--text-color);
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  padding: 0.5rem;
}
#theme input[value='light'] + span {
  --bg-color: var(--theme-light-background);
  --text-color: var(--theme-light-color);
  --border-color: var(--theme-light-color-dark);
}
#theme input[value='dark'] + span {
  --bg-color: var(--theme-dark-background);
  --text-color: var(--theme-dark-color);
  --border-color: var(--theme-dark-color-light);
}

html[data-theme='dark'] .splash-borders > div,
html[data-theme='dark'] nav.primary a {
  filter: saturate(85%);
}
