@import url(normalize.css);

:root {
  --bg-light: #e4e4e4;
  --fg-accent-light: #b3e5fc;
  --fg-accent-strong: #039be5;
  --fg-accent-strong-lighten: #039be520;
  --img-shadow: 0px 0px 15px silver;
  --spacing: 8px;
  --darkest: rgb(0, 0, 0);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blend-mode: screen;
    --fg-light: #969696;
    --bg-code-inline: #585858;
    --fg-normal: rgb(207, 207, 207);
    --lightest: rgb(50, 50, 50);
    --background: linear-gradient(90deg, var(--darkest) 50%, var(--lightest) 50%);
    --fg-nav: var(--fg-normal);
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --blend-mode: difference;
    --fg-light: #757575;
    --bg-code-inline: #f0f0f0;
    --fg-normal: #000;
    --lightest: rgb(255, 255, 255);
    --background: linear-gradient(90deg, var(--darkest) 50%, var(--lightest) 50%);
    --fg-nav: var(--lightest);
  }
}

html {
  box-sizing: border-box;
  font-size: 20px;
}

*,
::before,
::after {
  box-sizing: inherit;
}

body {
  color: var(--fg-normal);
  font-family: 'Lato', sans-serif;
  line-height: 1.4;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--background);
}

a.skip-to-content {
  clip: rect(1px, 1px, 1px, 1px);
  overflow: hidden;
  height: 1px;
  width: 1px;
  position: absolute;
  top: 1em;
  left: 1em;
  font-size: 80%;
}

#root nav li {
  text-transform: uppercase;
  display: inline-flex;
  list-style-type: none;
}

.my-name {
  font-weight: bold;
  text-transform: uppercase;
}

@media screen and (min-width: 320px) {
  body {
    font-size: 14px;
  }

  a {
    text-decoration-thickness: 2px !important;

    &:hover {
      /* text-shadow: 0 0 5px var(--lightest); */
      text-shadow: 0 0 2px white;
      /* text-shadow: 0 0 1px white, 0 0 2px white, 0 0 3px white, 0 0 4px white, 0 0 5px white, */
      /* 0 0 6px white, 0 0 1px white; */
    }
  }

  #root nav li {
    color: var(--fg-normal);
    font-size: 0.7em;
  }

  #root > header > h1 > a > span > span:nth-child(2) {
    font-size: 0.5em;
  }

  #root > header {
    position: relative;
    background-color: var(--lightest);
  }

  #root > header::after {
    content: '';
    height: 0.6em;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--lightest) 50%, var(--darkest) 50%);
  }

  #root > header > h1 {
    font-size: 16px;
  }

  #root > footer {
    font-family: 'Lato';
    padding: 2em;
    color: var(--fg-normal);
  }

  #root > footer img {
    width: 1.2em;
    vertical-align: text-bottom;
    margin-left: 0.3em;
  }

  h1 {
    font-size: 1.8em;
  }

  h2 {
    font-size: 1.4em;
  }

  h3,
  h4 {
    font-size: 1em;
  }
  #root > footer {
    background-color: var(--lightest);
  }

  main {
    width: 95%;
  }

  main > article,
  main > section > article {
    padding: 1em 0.5em;
    padding-left: 0.4em; /* Accounts for the 0.6 left white border */
    padding-top: 0.8em;
  }

  main > article > p:first-of-type {
    font-style: italic;
    color: var(--fg-light);
  }

  main > article > p:first-of-type:not(#jump)::before {
    content: open-quote;
  }

  main > article > p:first-of-type::after {
    content: close-quote;
  }

  #root > header {
    margin-bottom: 1em;
  }

  main > section {
    margin-bottom: 1em;
  }

  main > .archive h1,
  main > section h1 {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
  }

  main > .archive h1 {
    margin-bottom: 0.5rem;
  }

  h2 {
    font-size: 0.8rem;
  }

  main > article > header time {
    transform: rotate(90deg);
    position: absolute;
    right: -1.5rem;
    top: 3em;
    font-size: 80%;

    animation: swing 3.5s ease-in-out 1;
    transform-origin: top center;
  }
}

@media screen and (min-width: 1000px) {
  body {
    font-size: 20px;
  }

  main > .archive h1,
  main > section h1 {
    margin: 0;
    font-size: 1.2rem;
    position: absolute;
    color: var(--lightest);
    display: table;
    border: 10px solid var(--lightest);
    padding: 0 8px;
    text-transform: uppercase;
    mix-blend-mode: var(--blend-mode);
    inset: 0;
    left: 2rem;
    top: -21px;
    padding-top: 10px;
  }

  main > .archive {
    padding-top: 3rem;
  }

  #root > header > h1 > a > span > span:nth-child(2) {
    text-transform: uppercase;
    font-size: calc(10px + 6 * ((100vw - 320px) / 1280));
  }

  #root nav li {
    margin-right: 1em;
    color: var(--fg-nav);
    font-size: 0.8em;
  }

  #root > header {
    background: linear-gradient(90deg, var(--lightest) 50%, var(--darkest) 50%);
  }

  #root > header > h1 {
    font-size: 28px;
  }

  h1 {
    font-size: clamp(2rem, 3vw, 3rem);
  }

  h2 {
    font-size: 1.4em;
  }

  h3,
  h4 {
    font-size: 1.2em;
  }

  #root > footer {
    background: linear-gradient(90deg, var(--lightest) 50%, var(--darkest) 50%);
    font-size: calc(6px + 6 * ((100vw - 320px) / 680));
  }

  main > article > header time {
    transform: rotate(90deg);
    display: block;
    position: absolute;
    right: -90px;
    top: 2rem;
    font-size: 100%;
  }

  main > article,
  main > section > article {
    padding: 2em;
    padding-left: 1.4em; /* Accounts for the 0.6 left white border */
    padding-top: 3rem;
  }
  main > article {
    padding-top: 2rem;
  }

  #root > header {
    margin-bottom: 2em;
  }

  main > section {
    margin-bottom: 2em;
  }
}

a {
  color: inherit;
  text-decoration-color: var(--fg-accent-strong);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

h1,
h2,
h3,
h4 {
  font-family: 'Lato', sans-serif;
  line-height: 1.4;
  margin-bottom: 0.2em;
}

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

h1 {
  margin-bottom: 0.8rem;
}

h2 a:visited,
h2 a {
  color: inherit;
  text-decoration-thickness: 1px;
}

article.post-page > h2 {
  margin-top: 1.5em;
}

blockquote {
  box-shadow: var(--darkest) 3px 0px 0px 0px inset;
  font-style: italic;
  margin-left: 0em;
  padding: 0.5em 0 0.5em 1em;
  background-color: var(--fg-accent-strong-lighten);
}

hr {
  border-color: var(--fg-light);
  border-style: dotted;
}
pre,
article pre[class*='language-'],
blockquote,
ol,
ul,
hr,
p {
  margin-bottom: 1em;
}

p {
  overflow-wrap: break-word;
}

p:last-child {
  margin-bottom: 0;
}

ol,
ul {
  margin-left: 1.8em;
}

li {
  list-style-type: disc;
  margin-bottom: 0.5rem;
}

li::marker {
  color: var(--fg-accent-strong);
  font-size: 20px;
}

time {
  color: var(--fg-light);
  font-family: Lato;
}

em {
  font-style: italic;
}

strong,
b {
  font-weight: bold;
}

strong.hi {
  font-size: 120%;
}

main {
  margin: 0 auto;
  max-width: 40em;
  position: relative;
  margin-bottom: 2em;
}

main > article {
  /* easeInOutExpo */
  transition: transform 0.6s cubic-bezier(0.87, 0, 0.13, 1);
  background: var(--lightest);
}

.loading main > article {
  transform: translate(-50px, 0px);
}

article.about-page {
  background-image: url(/assets/mano_3_transparent.png);
  background-repeat: no-repeat;
  background-position: right 1em;
  background-size: 30%;
}

main > article::before,
main > article::after {
  content: '';
  height: 0.6em;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--lightest) 50%, var(--darkest) 50%);
}

main > article::before {
  top: 0;
}

main > article > header {
  position: relative;
  text-align: right;
  margin-bottom: 0.8em;
}

main > article > header > h1 {
  text-align: left;
  margin-bottom: 0;
}

main > section {
  position: relative;
  background: var(--lightest);
}

main > article,
main > section > article {
  border-right: 0.6em solid var(--darkest);
  border-left: 0.6em solid transparent;
}

main > section > article::before,
main > section > article::after {
  content: '';
  height: 0.6em;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--lightest) 50%, var(--darkest) 50%);
}

main > section > article::before {
  top: 0;
}

#root > header {
  display: flex;
  justify-content: space-between;
  padding: 1em;
}

#root > header > h1 {
  font-family: 'Lato', sans-serif;
  margin: 0;
  color: inherit;
}

#root > header > h1 img {
  width: 2em;
  height: 2em;
  vertical-align: middle;
  margin-right: 0.5em;
}

#root > header > h1 > a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

#root > header > h1 > a span {
  display: block;
}

#root nav {
  display: flex;
  align-items: center;
  font-family: 'Lato';
  color: var(--lightest);
}

#root nav ul {
  margin: 0;
}

#root nav li.nav-item-active a {
  color: var(--fg-accent-strong);
}

.pinned-posts li::marker {
  content: '☞ ';
  color: var(--fg-normal);
  font-size: 1.6em;
}

ul.posts-list {
  margin: 0;
}

.pinned-posts ul.posts-list {
  margin-left: 2em;
}

ul.posts-list li {
  list-style-type: none;
  margin-bottom: 0.8em;
}

ol.posts-list li:last-child {
  margin-bottom: 0;
}

article img {
  max-width: 100%;
}

pre,
code {
  font-family: Consolas, Menlo, Monaco, 'Andale Mono WT', 'Andale Mono', 'Lucida Console',
    'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono',
    'Nimbus Mono L', 'Courier New', Courier, monospace;
  font-size: 80%;
  background-color: var(--bg-code-inline);
  padding: 0.1rem 0.2rem;
  border-radius: 0.2rem;
}

pre {
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
  box-shadow: 0px 0px 72px -23px rgba(0, 0, 0, 0.75);
}

/* Utils */

.with-shadow {
  box-shadow: var(--img-shadow);
  width: 97%;
  margin: 0 auto;
  display: inherit;
}

.width-auto {
  width: auto;
}

.width-50 {
  width: 50%;
}

.width-50,
.width-75 {
  transition: width 0.3s ease-in-out 0.5s;
}

.width-75 {
  width: 75%;
}

.width-50:hover,
.width-75:hover {
  width: 100%;
}

.embed-left {
  float: left;
  margin: 0 1em 1em 0;
}

.embed-right {
  float: right;
  margin: 0 0 1em 1em;
}

.embed-left {
  float: left;
}

.with-caption > img + em {
  display: block;
  text-align: center;
  font-style: normal;
  color: var(--fg-light);
  font-size: 80%;
  margin-top: 5px;
}

.mt-2 {
  margin-top: 2em;
}

.center {
  text-align: center;
}

.smaller {
  font-size: 90%;
}

@keyframes swing {
  0% {
    transform: rotate(40deg);
  }
  50% {
    transform: rotate(60deg);
  }
  70% {
    transform: rotate(50deg);
  }
  100% {
    transform: rotate(90deg);
  }
}
