/* Bits and Pieces is licensed under MIT 
 * https://github.com/lostkeys/Bits-and-Pieces-Theme-for-Pico/blob/master/LICENSE
 */

/* Variables
 */

:root {
  --bg-color: #282828;
  --text-color: #bebebe;
  --border-color: #505051;
  --code-bg-color: #212122;
  --link-color: #ACD330;
  --link-color-hover: #C9F553;
  --white: #ffffff;

  /* e.g. # before h2, h3 */
  /* also for active link */
  /* and captions */
  --accent-color: #828282;

  /* e.g. about box */
  --box-bg-color: #323232;
  --box-border-color: #646464;
  --box-text-color: #D1DCDC;

  /* Common spacing */
  --main-content-margin: 0 auto;
  --main-content-max-width: 730px;
  --nav-width: 300px;

  /* Highlight.js */
  --hljs-background-color: #282828;
  --hljs-alt-background-color: #313131;
  --hljs-text-color: #bebebe;
  --lines-color: #545454;
  --comments-color: #697070;
  --punctuations-color: #444A44;
  --tags-color: #444444;
  --strings-color: #758FBD;
  --titles-color: #E9AE49;
  --variables-color: #B854D4;
  --literals-color: #7DB9B9;
  --codes-color: #F0F070;
  --metas-color: #E26436;
  --meta-strings-color: #5CB1DC;
}

/* Font-face
 */

@font-face {
  font-weight: 400;
  font-style: normal;
  font-family: 'source-sans-pro';
  src: url('../font/SourceSansPro-Regular.eot'); /* IE9 Compat Modes */
  src: url('../font/SourceSansPro-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../font/SourceSansPro-Regular.otf.woff') format('woff'), /* Pretty Modern Browsers */
  url('../font/SourceSansPro-Regular.ttf') format('truetype'); /* Safari, Android, iOS */
}

@font-face {
  font-weight: 400;
  font-style: italic;
  font-family: 'source-sans-pro';
  src: url('../font/SourceSansPro-It.eot'); /* IE9 Compat Modes */
  src: url('../font/SourceSansPro-It.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../font/SourceSansPro-It.otf.woff') format('woff'), /* Pretty Modern Browsers */
  url('../font/SourceSansPro-It.ttf') format('truetype'); /* Safari, Android, iOS */
}

@font-face {
  font-weight: 700;
  font-style: normal;
  font-family: 'source-sans-pro';
  src: url('../font/SourceSansPro-Semibold.eot'); /* IE9 Compat Modes */
  src: url('../font/SourceSansPro-Semibold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../font/SourceSansPro-Semibold.otf.woff') format('woff'), /* Pretty Modern Browsers */
  url('../font/SourceSansPro-Semibold.ttf') format('truetype'); /* Safari, Android, iOS */
}

@font-face {
  font-weight: 700;
  font-style: italic;
  font-family: 'source-sans-pro';
  src: url('../font/SourceSansPro-SemiboldIt.eot');
  /* IE9 Compat Modes */
  src: url('../font/SourceSansPro-SemiboldIt.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../font/SourceSansPro-SemiboldIt.otf.woff') format('woff'), /* Pretty Modern Browsers */
  url('../font/SourceSansPro-SemiboldIt.ttf') format('truetype'); /* Safari, Android, iOS */
}

/* Block styling
 */

html {
  font-family: "source-sans-pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
}

p {
  margin-bottom: 20px;
  max-width: var(--main-content-max-width);
}

p.nomb {
  margin-bottom: 0;
}

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

img[src*="#thumb"] {
  margin-right: 4px;
  width: auto;
  max-height: 180px;
}

/* For image caption */
img + em {
  margin-bottom: 20px;
  font-style: normal;
  display: inherit;
  font-size: 90%;
  color: var(--accent-color);
}
/* And image caption if using lightbox */
a + em {
  margin-bottom: 20px;
  font-style: normal;
  display: inherit;
  font-size: 90%;
  color: var(--accent-color);
}

article ul {
  max-width: var(--main-content-max-width);
  margin-bottom: 20px;
  margin-left: 20px;
}

article ul li {
  list-style: circle;
  margin-left: 20px;
}

article ol {
  margin-bottom: 20px;
}

article ol li {
  max-width: var(--main-content-max-width);
  margin-left: 20px;
}

/* For infobox */
h5 + blockquote {
  max-width: var(--main-content-max-width);
  display: block;
  margin-block-start: 0;
  margin-block-end: 0;
  margin-inline-start: 0;
  margin-inline-end: 0;
  background-color: var(--box-bg-color);
  padding: 20px;
}

h5 + blockquote p, 
h5 + blockquote ul {
  margin-bottom: 0;
}

/* Structure
 */

.main-content {
  /* margin: var(--main-content-margin); */
  margin-top: 35px;
  margin-right: 35px;
  margin-bottom: 80px;
  margin-left: 35px;
  /* max-width: var(--main-content-max-width); */
}

.subcolor {
  color: var(--accent-color);
}

.centertext {
  max-width: var(--main-content-max-width);
  text-align: center;
}

.righttext {
  max-width: var(--main-content-max-width);
  text-align: right;
}

/* Basic styling
 */

a,
a:link,
a:visited {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:active,
a:focus {
  text-decoration: underline;
  outline: none !important;
}

hr {
  border-color: var(--border-color);
  border-style: solid;
  border-width: 1px 0 0 0;
  margin: 1rem 0;
}

h1 {
  font-size: 2.5rem;
  font-weight: normal;
  margin-bottom: 1.5rem;
  margin-top: 1rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: bold;
  padding-bottom: 0.5rem;
  padding-top: 1.5rem;
  top: 0;
}

h3 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-top: 1.5rem;
}

h4 {
  font-size: 1rem;
  margin: 1rem 0;
}

h5 {
  font-size: 1.5rem;
  font-weight: bold;
  padding-bottom: 0.5rem;
  padding-top: 1.5rem;
  top: 0;
}

h6 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-top: 1.5rem;
}

h2::before,
h3::before {
  -webkit-font-smoothing: antialiased;
  color: var(--accent-color);
  content: '#';
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 400;
  padding-right: .5rem;
  text-align: right;
  width: 1.5rem;
}

.main-content h1:first-of-type {
  margin-top: 0;
}


h2 + h3 {
  margin-top: 1.5rem;
}

h6 + p {
  margin-left: 1.5rem;
}

table {
  border-collapse: collapse;
  margin: 1rem 0;
  max-width: var(--main-content-max-width);
}

table td,
table th {
  border-color: var(--border-color);
  border-style: solid;
  border-width: 1px;
  padding: .3rem;
  text-align: left;
  min-width: 4rem;
}

tr td {
  width: 1%;
  white-space: nowrap;
}

thead {
  font-size: 1.25rem;
  font-weight: bold;
}

/* Highlight.js stuff
 */
.hljs-ln-numbers {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  text-align: center;
  color: var(--lines-color);
  vertical-align: top;
  padding-right: 5px;
}

pre code.hljs {
  display:block;
  overflow-x:auto;
  padding:1em;
}

code.hljs{
  padding: 0;
}

.hljs {
  background: var(--hljs-background-color);
  color: var(--hljs-text-color);
}

.hljs-comment{color: var(--comments-color)}
.hljs-punctuation,.hljs-tag{color: var(--punctuations-color)}
.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color: var(--tags-color)}
.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color: var(--strings-color)}
.hljs-section,.hljs-title{color: var(--titles-color)}
.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color: var(--variables-color)}
.hljs-literal{color: var(--literals-color)}
.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color: var(--codes-color)}
.hljs-meta{color: var(--metas-color)}
.hljs-meta .hljs-string{color: var(--meta-strings-color)}

.hljs-section,.hljs-title{font-weight:700}
.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}
.hljs-emphasis{font-style:italic}
.hljs-strong{font-weight:700}

.hljs tr td {
  width: initial;
  border: none;
  white-space: pre;
  margin-right: 20px;
  padding-right: 20px;
}

.hljs tr:nth-child(even) {
    background-color: var(--hljs-alt-background-color);
}

code {
  max-width: var(--main-content-max-width);
  background-color: var(--code-bg-color);
  border-radius: 1px;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: inline-block;
  font-size: .875rem;
  padding: 0 3px;
}
pre code {
  display: block;
  padding: 5px 10px;
}

.code-block-container {
  position: relative;
  margin: 1rem 0;
}

hr {
  max-width: var(--main-content-max-width);
}

/* Main navigation
 */

.main-nav {
  margin: 35px;
}

.main-nav a {
  color: var(--link-color);
  overflow: hidden;
}

.main-nav a:hover {
  color: var(--link-color-hover);
}

.main-nav nav ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.main-nav nav li {
  margin-left: 0px;
}

.main-nav nav > ul > li {
  padding-left: 0px;
}

.main-nav nav li.active > a {
  font-weight: bold;
  color: var(--accent-color);
}

.main-nav nav li.active > a:hover {
  text-decoration: none;
}

/* Class to contain example code for example if
 * used as a styleguide or pattern library
 */

.example {
  border: 1px solid var(--border-color);
  padding: 1rem;
}

.example + pre {
  margin-top: 0;
}

.example + pre code {
  border-top: 0;
}

/* Personal styling
 */

.site-logo {
  width: 94px;
  font-size: 1.5em;
  font-weight: 600;
  text-align: center;
}

.site-logo img {
  border: 2px solid var(--white);
  margin-bottom: 0;
}

.about-box {
  width: 100%;
}

.about {
  display: inline-block;
  padding: 10px;
  background-color: var(--box-bg-color);
  border: 1px solid var(--box-border-color);
  color: var(--box-text-color);
  max-width: var(--main-content-max-width);
}

.about p {
  margin-bottom: 0;
}

.aboutresize {
  display: -ms-flex;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-evenly;
  margin: 0;
  font-size: 14px;
}

.contacts ul {
  list-style: none;
  padding: 0;
}

.contacts li {
  margin-top: 2px;
}

.tiny {
  height: 15px;
}

.heading {
  display: block;
  margin-top: 50px;
  margin-bottom: 25px;
  font-size: 4em;
  line-height: 1em;
}

.spacer {
  display: block;
  height: 75px;
}

/* Scroll to top in pure JS
 */
#toTop {
  display: none;
  cursor: pointer;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
}

img#toTop {
  transition: all 150ms ease-out;
  -moz-transition: all 150ms ease-out;
  -webkit-transition: all 150ms ease-out;
  -o-transition: all 150ms ease-out;
  opacity: 0.5;
}

img#toTop:hover {
  opacity: 1;
}

#lightbox #close, 
#lightbox #next, 
#lightbox #prev {
  opacity: 0.5;
}

.collection {
  display: -ms-flex;
  display: -webkit-flex;
  display: flex;
  flex-direction: column;
}

.collection > div {
  flex-basis: 100%;
  margin-bottom: 45px;
}

.feed {
  max-width: 800px;
  display: -ms-flex;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-evenly;
  margin: 0;
}

.feed > div {
  flex-basis: 45%;
  margin-bottom: 10px;
  margin-left: 1px;
  margin-right: 1px;
}

.flexwidth {
  max-width: var(--main-content-max-width);
}

main > aside.main-nav {
  display: -ms-flex;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
}

main > aside.main-nav div {
  flex-grow: 1;
  flex-basis: 35%;
  margin: 0;
}

main > aside.main-nav div.site-logo {
  margin-left: 0;
}

/* Media queries
 */

@media all and (min-width: 992px) {
  main {
    display: -ms-flex;
    display: -webkit-flex;
    display: flex;
  }

  main > aside {
    width: 17%;
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 35px;
    align-self: flex-start;
  }

  main > aside.main-nav {
    display: -ms-flex;
    display: -webkit-flex;
    display: flex;
    flex-direction: column;
  }

  main > article {
    width: 84%;
    padding-left: 20px;
  }

  nav {
    margin-top: 20px;
  }

  .collection {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .collection > div {
    flex-basis: 45%;
  }

  .feed > div {
    flex-basis: 28%;
    margin-left: 1px;
    margin-right: 1px;
  }
}

@media all and (min-width: 1700px) {
  .collection > div {
    flex-basis: 30%;
  }

  .flexwidth > div {
    flex-basis: 45%;
  }

}
