:root {
  --color-default: #323232;
  --color-black: #1B1B1B;
  --color-grey: #8F8F8F;
  --color-light-grey: #d8d8d8;
  --color-light-bg: #f8f8f8;
  --color-brand: var(--ghost-accent-color);
  --link-color: var(--color-brand);
  --page-bg: #fff;
  --input-bg: var(--page-bg);
  --font-default: 'Helvetica Neue', 'Helvetica', sans-serif;
  --font-alt: var(--font-default);
  --border-radius: 5px;
  --border-radius-large: 10px;
}


@media (prefers-color-scheme: dark) {
  /* Dark mode colours */
  :root {
    --color-default: #ccc;
    --color-black: #efefef;
    --color-grey: #aaa;
    --color-light-grey: #3c3c3c;
    --color-light-bg: #2a2a2a;
    --color-white: #222;
    --page-bg: #1f1f1f;
  }
}


html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  /*font: inherit;*/
  vertical-align: baseline;
}
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  font: 16px/1.5 var(--font-default);
}

body { 
  margin: 0;
  padding: 0;
  color: var(--color-default);
  background-color: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


h1 {font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-alt); color: var(--color-black) }

hr { 
  border: 0;
  border-top: 1px solid var(--color-light-grey);
}

a { 
  color: var(--link-color);
  transition: color 0.3s, text-decoration 0.3s;
  text-decoration: none;
}
a.nolink, .nolinks a { text-decoration: none; }

img { 
  width: 100%; border-radius: var(--border-radius);
}

h1, h2, h3, h4, h5, h6, p, pre {
  margin-bottom: 1.5em;
}


/* Styling utility classes */

.relative { position: relative; }
.db { display: block; }

/* based off 16px */
.fs14 { font-size: 0.875rem; }
.fs16 { font-size: 1rem; }
.fs18 { font-size: 1.125rem; }
.fs20 { font-size: 1.25rem; }
.fs24 { font-size: 1.5rem; }
.fs32 { font-size: 2rem; }
.fs40 { font-size: 2.5rem; }
.fs48 { font-size: 3rem; }
.fs60 { font-size: 3.75rem; }

.normal { font-weight: normal; }
.b { font-weight: bold; }

.pt2 { padding-top: 2rem; }
.pt3 { padding-top: 3rem; }
.pt5 { padding-top: 5rem; }
.pb2 { padding-bottom: 2rem; }
.pb3 { padding-bottom: 3rem; }
.pb5 { padding-bottom: 5rem; }
.mt0 {margin-top: 0;}
.mt1 { margin-top: 1rem }
.mt2 { margin-top: 2rem }
.mt3 { margin-top: 3rem }
.mt4 { margin-top: 4rem }
.mt6 { margin-top: 6rem }
.mb0 {margin-bottom: 0}
.mb1 { margin-bottom: 1rem }
.mb2 { margin-bottom: 2rem }
.mb3 { margin-bottom: 3rem }
.mb4 { margin-bottom: 4rem }
.mb6 { margin-bottom: 6rem }

.tc { text-align: center; }
.tr { text-align: right; }

.ttu { text-transform: uppercase; }
.lhtitle { line-height: 1.2; }

.color-black { color: var(--color-black); }
.color-grey { color: var(--color-grey); }
.bg-light { background-color: var(--color-light-bg) }

.avatar {
  width: 96px;
  border-radius: 50%;
}

/* Layout */

.container {
  max-width: 1132px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  position: relative;
}
.container--mid {
  max-width: 928px;
}
.container--narrow {
  max-width: 720px;
}

.flex {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}
.flex-col {
  flex-direction: column;
  justify-content: start;
  align-items: start;
}
.flex-col > * {
  width: 100%;
}

.cols {
  display: grid;
  grid-template-columns: 1fr; 
  grid-gap: 2rem; /* To define the gap between rows/columns */
  grid-auto-rows: 1fr;
}

@media (min-width: 601px) {
  .cols.thirds {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 701px) {
  .cols, .cols.thirds {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 801px) {
  .cols.thirds {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1101px) {
  .cols.thirds {
    grid-template-columns: 1fr 1fr 1fr;
  }
}


/* Forms */

input, select, button, .button {
  display: inline-block;
  margin-bottom: 0.5rem; 
  appearance:none; 
  -webkit-appearance: none; 
  -moz-appearance: none;
  color: currentColor;
  border-radius: var(--border-radius);
  line-height: 2em;
  padding: 0.25rem 1rem;
  box-shadow: 0px 2px 10px rgba(0,0,0,.06)
}
input, select, button {
  border: 1px solid var(--color-grey);
  background-color: var(--input-bg);
  font-size: inherit;
  font-family: inherit;
}
input:focus, select:focus, button:focus {
  outline:none;
  border-color: var(--color-brand);
}
button, .button {
  border: 1px solid var(--color-brand);
  cursor: pointer; 
  background-color: var(--color-brand);
  color: #fff !important;
  white-space: nowrap;
  font-weight: bold;
}
button:not([disabled]):hover,
.button:not([disabled]):hover {
  transition: background-color 0.3s, border-color 0.3s; 
}


/* Header / Nav */

@media (max-width: 800px) {
  body {
    padding-top: 5rem;
  }
  #sidebar {
    position: fixed;
    top: 0;
    padding: 1rem;
    background: var(--page-bg);
    width: 100%;
    box-shadow: 0px 2px 10px rgb(0 0 0 / 10%);
    z-index: 1000;
  }
  #menu-trigger {
    position: absolute;
    top: 0;
    right: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    height: 100%;
  }
  #trigger-check:checked ~ #menu {
    display: block;
  }
  #menu {
    display: none;
    width: 100%;
    background: var(--page-bg);
    padding: 1rem;
    left: 0;
    box-shadow: 0px 10px 10px -10px rgb(0 0 0 / 10%);
    position: absolute;
  }
  #main, footer {
    padding: 1rem;
  }
}
@media (min-width: 801px) {
  #page {
    height: 100%;
  }
  #sidebar, footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 240px;
    padding: 1.5rem;
    border-right: 1px solid var(--color-light-grey);
    z-index: 1;
  }
  #sidebar {
    top: 0;
  }
  #menu-trigger {
    display: none;
  }
  #menu {
    display: block;
    margin-top: 1rem;
  }
  #main {
    margin-left: 250px;
    max-width: 1200px;
    padding: 2rem;
  }
  .page-template #main {
    max-width: 900px;
  }
}


.nav a {
  display: block;
  padding: 0.2rem 0;
  color: currentColor;
}
.nav-current a {
  font-weight: bold;
}
#sidebar .nav a {
  padding: 0.2rem 0;
  padding: 0.25rem 0.5rem;
  margin: 0 -0.5rem;
}
#sidebar .nav a:hover {
  background: var(--color-light-bg);
}

.nav-header {
  padding: 1rem 0 0.5rem;
  text-transform: uppercase;
  color: var(--color-grey);
  font-size: 0.87rem;
  font-weight: bold;
}

@media (max-width: 800px) {
  footer .nav a {
    display: inline-block;
    padding: 0.2rem 0;
    margin-right: 0.5rem;
  }
}

#logo-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
@media (max-width: 800px) {
  #logo-block {
    margin-right: 2rem;
}
}

.logo {
  width: var(--logo-width);
  height: auto;
  max-width: 100%;
}
.logo--dark {
  display: none;
}
@media (prefers-color-scheme: dark) {
  .logo {
    display: none;
  }
  .logo--dark, .logo--both {
    display: block;
  }
}

.logo-text {
  font-weight: bold;
  color: currentColor;
}


/* Search */

#search {
  cursor: pointer;
  line-height: 1;
  padding-left: 1rem;
}
#search-box {
  display: none;
  opacity: 0;
  position: fixed;
  top: 6rem;
  width: 88vw;
  left: 6vw;
  background-color: var(--page-bg);
  overflow: auto;
  z-index: 1000;
  padding: 1rem;
  box-shadow: 0 0 30px rgb(0 0 0 / 20%);
  border-radius: 10px;
  transition: all 0.3s;
  transform: scale(0.9);
  -webkit-animation-duration: 0.3s;
  animation-duration: 0.3s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
@media (prefers-color-scheme: dark) {
  #search-box {
    box-shadow: 0 0 30px rgb(0 0 0 / 60%);
  }
}
#search-bar {
  flex-grow: 1;
  margin-bottom: 0;
}
#search-results {
  max-height: 200px;
  overflow-y: auto;
}
.search-results-wrapper li:first-of-type {
  margin-top: 0.5rem;
}
.search-results-wrapper a {
  display: block;
  padding: 0.25rem 0;
}
@media (min-width: 701px) {
  #search-box {
    top: 20vh;
    max-height: 60vh;
    width: 60vw;
    left: 20vw;
  }
}
#search-box__close {
  cursor: pointer;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@-webkit-keyframes fadeIn {
  0% {opacity: 0; transform: scale(0.9)}
  100% {opacity: 1; transform: scale(1);}
}

@keyframes fadeIn {
  0% {opacity: 0; transform: scale(0.9)}
  100% {opacity: 1; transform: scale(1);}
}

@-webkit-keyframes fadeOut {
  100% {opacity: 0; transform: scale(0.9)}
  0% {opacity: 1; transform: scale(1);}
}

@keyframes fadeOut {
  100% {opacity: 0; transform: scale(0.9)}
  0% {opacity: 1; transform: scale(1);}
}

#search-box.active {
  display: block;
  -webkit-animation-name: fadeIn;
  animation-name: fadeIn;
}
#search-box.inactive {
  display: block;
  -webkit-animation-name: fadeOut;
  animation-name: fadeOut;
}

/* Home */

.home-content .kg-card {
  margin-top: 0;
}
.home-content img {
  width: 120px;
}
@media (max-width: 700px) {
  .home-hero {
    order: -1;
  }
}

.home-blocks {
  max-width: 480px;
  margin: auto;
}
.home-block {
  border-radius: var(--border-radius-large);
  transition: transform box-shadow 0.2s ease-in-out;
  box-shadow: 0px 2px 10px rgba(0,0,0,0.05);
}
.home-block:hover {
  transform: translateY(-8px);
  box-shadow: 0px 6px 20px rgba(0,0,0,0.05);
}
@media (min-width: 801px) {
  .home-blocks {
    max-width: none;
    display: flex;
    justify-content: space-between;
  }
  .home-block {
    width: 30%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}


/* Footer */

footer {
  background-color: var(--page-bg);
}
@media (max-width: 800px) {
  footer {
    margin-top: 2rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--color-light-grey);
  }
}
@media (max-width: 800px) {
  footer .flex > div {
    width: 100%;
    max-width: 400px;
    padding: 0 2rem;
    margin: 1rem auto;
    text-align: center;
  }
}
@media (min-width: 801px) {
  footer .subscribe-col {
    min-width: 500px;
  }
  footer .subscribe-col div {
     width: 130px;
     margin-right: 8px;
  }
  footer .subscribe-col input {
     width: 24vw;
     margin-right: 8px;
  }
  footer .subscribe-col button {
    width: auto;
  }
}


/* Post lists */

.post-card:not(.post-card--newsletter) {
  border: 1px solid var(--color-light-grey);
}
.post-card__image {
  background-size: cover;
  background-position: center;
  padding-bottom: 67%;
}

.post-card__info {
  padding: 1rem;
}
.post-card__tag {
  padding: 1rem;
}

.post-card--newsletter {
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  grid-gap: 0;
  transition: transform 0.2s;
}
.post-card--newsletter:hover {
  transform: translateY(-3px);

}

.post-card--newsletter .post-card__info {
  order: 2;
  padding: 1rem 0;
}
@media (min-width: 601px) {
  .post-card--newsletter {
    max-width: none;
    grid-template-columns: 4fr 1fr;
  }
  .post-card--newsletter .post-card__info {
    order: 0;
    padding-right: 3rem;
  }
}
.post-card--newsletter .post-card__image {
  padding-bottom: 76%;
  border-radius: var(--border-radius-large);
}

.post-card .kg-embed-card {
  margin: 0;
}


/* Posts and Pages */

.post-hero {
  width: 100%;
}

.toc-box-container {
  background-color: var(--color-light-bg);
  padding: 1rem;
  border-radius: var(--border-radius);
}

@media (max-width:  900px) {
  .toc-box-container { display: none; }
}
@media (min-width: 901px) {
  .toc-container {
    display: grid;
    grid-template-columns: calc(100% - 300px) 240px;
    justify-content: space-between;
  }
  .toc-box-container {
    position: sticky;
    top: 2rem;
    right: 0;
  }
}

.toc-box {
  position: relative;
  margin-top: 0.5rem;
  overflow-y: hidden;
}
.toc-list {
  overflow-y: hidden;
  padding-left: 0 !important;
}
.toc-list .toc-list {
    margin-left: 0.5rem;
}
.toc-link {
  display: block;
  padding: 0.25rem 0.5rem 0.25rem 1rem;
  text-decoration: none;
}
.toc-link::before {
  background-color: var(--color-light-grey);
}
.toc-link:hover::before {
  background-color: var(--color-grey);
}
.toc-link.is-active-link::before {
  background-color: var(--color-brand);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  padding-top: 1rem; /* Creates gap when clicking link in TOC */
}

.post-content hr {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content table {
  margin-bottom: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  padding: 1.5rem;
  border-left: 4px solid var(--color-brand);
  background: var(--color-light-bg);
  border-top-right-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
}

.post-content img,
.post-content pre {
  max-width: 100%;
}
.post-content pre {
  overflow: auto;
  padding: 0.5rem 1rem;
  margin-bottom: 1.5rem !important;
}
.post-content pre,
.post-content code {
  background-color: var(--color-light-bg);
  border: 1px solid var(--color-light-grey);
  border-radius: 5px;
  font-size: 0.875rem;
}
.post-content code {
  padding: 0.125rem 0.25rem;
}
.post-content pre > code {
  padding: 0;
  background-color: transparent;
  border: none;
}

.post-content ol,
.post-content ul {
  list-style: initial;
  margin-left: 1rem;
}

.post-content table {
  border-spacing: 0;
  border-collapse: collapse;
  width:100%;
  font-size: 0.88em;
}
.post-content table th,
.post-content table td {
  padding: 0.5rem;
  border: 1px solid var(--color-light-grey);
}
.post-content table tr:nth-of-type(2n) {
  background-color: var(--color-light-bg);
}

.medium-zoom-image--opened {
  z-index: 100000;
  border-radius: 0;
}
.medium-zoom-overlay {
  z-index: 100000;
  background-color: var(--page-bg) !important;
}

/* Post cards */

.kg-card {
  margin: 3rem 0;
}

.kg-card img {
  height: auto;
}

.kg-width-wide,
.kg-width-full {
  position: relative;
  width: 63vw;
  min-width: 100%;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  transform: translateX(calc(50vw - 50%));
}

.toc-content .kg-width-wide,
.toc-content .kg-width-full {
  width: auto;
  margin-left: 0;
  margin-right: 0;
  transform: initial;
}

.kg-width-full {
  width: 90vw;
}


.kg-bookmark-card {
  width: 100%;
  margin: 3rem 0;
  position: relative;
}

a.kg-bookmark-container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row-reverse;
  color: currentColor;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: var(--border-radius);
  color: var(--color-default);
}

a.kg-bookmark-container:hover {
  text-decoration: none;
  color: var(--color-grey)
}

.kg-bookmark-content {
  width: 100%;
  padding: 1rem;
  order: 1;
  color: var(--dark-grey);
  background-color: var(--color-light-bg);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.kg-bookmark-title {
  font-weight: 600;
}

.kg-bookmark-metadata,
.kg-bookmark-description {
  margin-top: .5em;
}

.kg-bookmark-metadata {
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kg-bookmark-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.kg-bookmark-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: text-bottom;
  margin-right: .5em;
  margin-bottom: .05em;
}

.kg-bookmark-thumbnail {
  display: flex;
  width: 100%
}

.kg-bookmark-thumbnail img {
  max-width: 100%;
  height: auto;
  max-height: 370px; /* Fix weird heights mobile */
  vertical-align: bottom;
  object-fit: cover;
  box-shadow: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

@media (min-width: 601px) {

  .kg-bookmark-thumbnail {
    width: 36%;
  }
  .kg-bookmark-content {
    width: 64%;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
  }

  .kg-bookmark-thumbnail img {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
  }
}


.kg-bookmark-author {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.kg-bookmark-publisher::before {
  content: "•";
  margin: 0 .5em;
}

.kg-image-card figcaption,
.kg-gallery-card figcaption {
    margin: 0 0 1.5em;
    font-size: 0.88em;
    text-align: center;
}

.kg-embed-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5em 0 3em;
    min-width: 100%;
}

.kg-embed-card iframe {
  border-radius: var(--border-radius);
}

.kg-embed-card figcaption {
    margin: 0.5em 0 0;
}

.kg-embed-card .fluid-width-video-wrapper {
    margin: 0;
}


.kg-image-full + figcaption {
    padding: 0 1.5em;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: 1.5em auto;
    max-width: 1040px;
    width: 100%;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}
.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
}

.kg-gallery-row:not(:first-of-type) {
    margin: 0.75em 0 0 0;
}

.kg-gallery-image:not(:first-of-type) {
    margin: 0 0 0 0.75em;
}


/* Authors */

.author-avatar {
  width: 64px;
  border-radius: 32px;
}