:root {
  --font-family: "Bookerly" ,'LXGW WenKai',STFangSong, Helvetica, Arial, Vernada, Tahoma, STXihei, "Microsoft YaHei", "Songti SC", SimSun, Heiti, sans-serif;
    --font-code: "Iosevka Web";
  box-sizing: border-box;
  overflow-wrap: break-word;
  line-height: 1.5rem;
  font-size: 1.25rem;
    --background: #232323;
    --foreground: aliceblue;
    --border: #595959;
    --radius: 0;
    --font-size: 1rem;
    --line-height: 1.54em;
    --bg_alt: #21242B;
    --bg_highlight: #3C4048;
    --grey: #5B6268;
    --blue: #51AFEF;
    --green: #98BE65;
    --cyan: #46D9FF;
    --red: #FF6C6B;
    --yellow: #ECBE7B;
    --purple: #ABA1E1;
    --magenta: #C678DD;
    --orange: #DA8548;
    --cerise: #DE3163;
}

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

body {
    background-color: var(--background);
    color: var(--foreground);
}

pre, code, kbd {
  font-family: var(--font-code);
}

pre {
  overflow: auto;
    border-color: var(--border);
}

.content {
  position: relative;
}

h1, h2, h3, h4, h5 {
  margin-block-start: 0.83em;
  margin-block-end: 0.83em;
}

h1 {
  font-size: 1.5em;
}

h2 {
  font-size: 1.4em;
}

h3 {
  font-size: 1.3em;
}

h4 {
  font-size: 1.2em;
}

h5 {
  font-size: 1.1em;
}

@media screen and (min-width: 780px) {
  div > h2::before,
  div > h3::before,
  div > h4::before,
  div > h5::before {
    position: absolute;
    font-size: 1.3em;
    padding-top: 0.1em;
  }

  div > h2::before {
    content:  "* ";
      color: var(--green);
    left: -0.7em;
  }

  div > h3::before {
    content: "** ";
      color: var(--purple);
    left: -1.25em;
  }

  div > h4::before {
    content: "*** ";
      color: var(--magenta);
    left: -1.8em;
  }

  div > h5::before {
    content: "**** ";
    left: -2.4em;
  }
}

figure {
  text-align: center;
  margin: 1em auto;

  figcaption {
    color: gray;
  }
}

sup {
  font-size: 0.8rem;
    color: var(--cyan);
}

a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 0.0625rem dotted;
}

#content a[href^='http']:not([href^="https"]):not([href^='http://thefuzzdog.top']):not([href^='#']):not([href^='/']):not([href^='mailto']):after,
#content a[href^='https']:not([href^='https://thefuzzdog.top']):not([href^='#']):not([href^='/']):not([href^='mailto']):after {
 mask-image: url("/static/external-link.svg");
}

a:hover {
  background-color: var(--bg_highlight);
}

/* TOC */

.toc-marker {
  display: none;
}

@media screen and (min-width: 780px) {
  .toc-marker {
    display: block;
  }
  #table-of-contents {
    position: fixed;
    width: 26vw;
    right: -3vw;
    top: 2vw;
    height: 80vh;
    overflow: auto;
    transform: scale(80%);

     h2 {
      display: none;
    }

    ul {
      list-style: none;
    }

    ul ul {
      padding-inline-start: 20px;
    }

    li a {
      display: inline-block;
      color: var(--foreground);
      text-decoration: none;
      transition: all 0.3s cubic-bezier(0.230, 1.000, 0.320, 1.000);
    }

    li.visible > a {
      color: var(--green);
      transform: translate( 5px );
    }
  }

  .toc-marker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
  }

  path {
    transition: all 0.3s ease;
  }

}

/* content*/
.content {
  width: 50vw;
  max-width: 48em;
  min-height: 84vh;
  margin: 1em auto;
}

@media screen and (max-width: 780px) {
  .content {
    width: 90vw;
  }
}

#postamble .info,
#preamble nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

#postamble .info {
  flex-direction: column;
}

@media screen and (min-width: 780px) {
  #postamble .info {
    flex-direction: row;
  }
}

.timestamp {
  color: gray;
  font-family: monospace;
  font-size: 0.8em;
}

.timestamp-kwd {
  color: var(--purple);
  font-family: monospace;
  font-size: 0.8em;
}

.title, .subtitle {
    text-align: center;
}

/* FOOTNOTES */
#footnotes {
  display: none;
}

/* SIDENOTES */
.sidenote {
  display: none;
  font-size: 0.8rem;
  font-weight: normal;
  margin-top: 1em;
  margin-bottom: 1em;

  p {
    display: inline;
  }
}

#postamble {
  clear: left;
}

sup:hover ~ .sidenote {
  background-color: var(--bg_highlight);
}

.footref-toggle {
  display: none;
}

.footref-toggle:checked + .sidenote {
    display: block;
}

label.footref {
  cursor: pointer;
  text-decoration: none;
  border-bottom: 0.0625rem dotted;
}

@media screen and  (min-width: 780px) {
  .sidenote {
    display: block;
    float: left;
    clear: left;
    margin-left:  -24vw;
    margin-top: 1em;

    width: 18vw;
    text-align: right;
    padding: 1em;
    border-radius: 0.8em;
  }

  label.footref {
    border-bottom: none;
}
}

/* code blocks */
.multilang {
  position: relative;
  width: 100%;
  font-size: 0.8rem;
}


.multilang {
  pre {
    margin-top: 0;
    max-height: 30em;
    min-height: 2em;
  }
  .src-expand-section {
    font-family: monospace;
    border: 1px solid lightgray;
    border-radius: 0.8em 0.8em 0 0;
    border-bottom: none;
    background-color: var(--bg_alt);
    padding-left: 0.5em;
    min-height: 3em;
    display:flex;
    align-items:center;

    .selected {
      border: 2px solid gray;
      border-radius: 1em;
    }
    span {
      color: gray;
      cursor: pointer;
      margin-right: 1em;
      padding: 0 0.6em;
    }
  }
}

.src-expand-section ~ .org-src-container {
  overflow: auto;
  border: 1px solid lightgray;
  border-radius: 0 0 0.8em 0.8em;
  background-color: var(--bg_alt);
}

.org-src-container {
  overflow: auto;
  border: 1px solid lightgray;
  border-radius: 0.8em;
  background-color: var(--bg_alt);

  a:hover {
    color: var(--bg_highlight);
    background-color: gray;
  }
  .linenr {
    user-select: none;
    color: gray;
  }
}

.example {
  overflow: auto;
  border: 1px solid lightgray;
  border-radius: 0.8em;
}

.org-src-container {
  margin-bottom: 2em;

  .copy-code {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--bg_alt);
    border: none;
    cursor: pointer;
  }

  .org-src-name {
    font-size: 0.8rem;
    color: gray;
    position: absolute;
    margin-left: auto;
    margin-right: auto;
    bottom: -2em;
    left: 0;
    right: 0;
    text-align: center;
  }
}

.multilang:hover {
  .copy-code {
    display: inline-block;
  }
}

.src {
  padding: 0.5em;
  line-height: 1.2rem;
  font-size: 0.9em;
}

.src-buttons {
  position: absolute;
  right: 0;
  top: 0.5em
}

.multilang .src-buttons button {
  border: none;
}

.multilang .bx {
  font-size:  20px;
  color: var(--yellow);
}

#back-to-top {
  position: fixed;
  bottom: 1em;
  right: 1em;
  width: 2em;
  height: 2em;
  z-index: 1;
  cursor: pointer;
  font-size: var(--font-size);
  padding: 0.5em;
  border: 1px;
  border-style: solid;
  border-color: var(--border);
  background-color: var(--background);
  border-radius: .25em;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease-in-out, visibility .5s;
}

@media screen and (width >= 1200px) {
   #back-to-top {
     right: calc((100vw - 900px) / 2 - 4em);
   }
 }

 #back-to-top svg {
   display: block;
   width: 100%;
   height: 100%;
   fill: currentColor;
 }

 #back-to-top.show {
   opacity: 0.4;
   visibility: visible;
 }

 #back-to-top.show:hover {
   opacity: 1;
 }


/* org-mode css */

blockquote {
  margin: 1em 2em;
  padding-left: 1em;
  border-left: 5px solid var(--bg_alt);
  color:  gray;

  * {
    color:  gray;
  }
  p:first-child {
    display: inline;
  }
}

blockquote::before, blockquote::after{
    color: var(--bg_alt);
    font-size: 4em;
    line-height: .1em;
    vertical-align: -0.4em;
}

blockquote::before {
  content: open-quote;
}

.verse {
    background-color: transparent;
    border: 0px solid;
    border-color: var(--bg_alt);
    border-left-width: 0.4em;
    border-radius: 1.25em 0.5em 0.5em 1.25em;
    color: gray;
    font-style: italic;
    margin: 0 10px;
    padding: 0.8em;

    width: 80%;
    margin: auto;
}

kbd {
  background-color: var(--bg_alt);
  border-radius: 3px;
  border: 1px solid var(--orange);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.2),
    0 2px 0 0 rgba(255, 255, 255, 0.7) inset;
  color: orange;
  display: inline-block;
  font-size: 0.85em;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}


/* Better tables */
table {
  margin: auto;
  border-collapse: collapse;
  border-spacing: 0;
  width: auto;
  max-width: 100%;
  border-top: 0.15em solid black;
  border-bottom: 0.15em solid black;

  /* Table caption */
  caption {
      color: gray;
    text-align: center;
    font-size: 1em;
    padding: 0 0.25em 0.25em;
    /* .table-number { */
    /*   font-weight: bold; */
    /* } */
  }
}
/* add bottom border on column table headings  */
table tr > th[scope='col'] {
  border-bottom: 1.36px solid black;
}
/* add right border on row table headings  */
table tr > th[scope='row'] {
  border-right: 1.36px solid black;
}
table > tbody > tr:first-child > td,
table > tbody > tr:first-child > th {
  border-top: 1.36px solid black;
}
table > tbody > tr:last-child > td,
table > tbody > tr:last-child > th {
  border-bottom: 1.36px solid black;
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  line-height: 1.1;
}

.TODO, .todo, .DONE, .done, .priority, .tag{
  font-family: monospace;
}

.TODO, .todo,
.DONE, .done {
  border-radius: 0.4em;
  padding: 0.2em 0.3em;
  font-size: 0.5em;
  margin-bottom: 0.4em;
}

.TODO, .todo {
  background-color: #8408a6;
  color: white;
}

.DONE, .done {
  background-color: var(--blue);
  color: white;
}

.priority {
  color: var(--cerise);
}

.tag {
    font-size: 0.8em;
    font-weight: normal;
}

.tag span, .tag span::before {
  color: gray;
}

.tag span::before {
  content: '#';
}

.tag span {
  float: right;
  margin-right: .5em;
}

dt {
  font-weight: bold;
}
dd p:first-child {
  margin-top: 0;
}

code {
  background-color: var(--bg_alt);
  padding: 0.05em 0.2em 0.2em 0.2em;
  border-radius: 0.4em;
  font-size: 0.9em;
    color: var(--yellow);
  /* box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px; */
}

.underline {
  text-decoration: underline;
}


.org-center {
  width: 50%;
  margin: auto;
}

.code-highlighted {
  background-color: lightgray;
}

.abstract {
  margin: 2em 2em;
  padding-left: 1em;
  border-left: 4px solid var(--bg_highlight);
  color:  gray;
  font-size: 0.9em;
}

.post-status {
  color: gray;
  text-align: center;
  font-size: 0.6rem;

  a {
    color: inherit;
  }

  i {
    margin-right: 0.1rem;
  }

  span + span {
    margin-left: 0.3em;
  }
}

@media screen and (min-width: 780px) {
  .post-status {
    font-size: 0.9rem;

    span + span {
      margin-left: 1em;
    }
  }
}

@media screen and (max-width: 780px) {
  .MathJax {
    width: 80% !important;
    font-size: 70% !important;
  }
}


.giscus {
  margin: 5em auto 0;
}

@media screen and (min-width: 780px) {
  .giscus {
    width: 50vw;
  }
}


img, video {
  max-width: 100%;
  border-radius: 0.8em;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

details {
  border: 1px lightgray solid;
  border-radius: 0.8em;
  padding: 0.5em;
  margin-top: 1em;
  margin-bottom: 1em;
  cursor: pointer;
  .detail {
    margin: 1em;
  }
  summary {
    font-weight: bold;
    p {
      display: inline;
    }
  }
}

li:has(.tags) {
  display: none;
}

ul .tags {
  display: none;
  float: right;
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: gray;
}

.content .tags {
  display: none !important;
}


@media screen and (max-width: 540px) {
  ul .tags {
    display: none;
  }
}

@media screen and (min-width: 780px) {
  .tags::after {
    content: attr(data-tags);
  }
}


.filter {
  text-align: center;
  font-size: 0.8em;

  label {
    position: relative;
  }

  .category {
    span:before {
      content:"✓";
      position:absolute;
      top: -0.1em;
      right: 0em;
      font-size: 1.2rem;
      font-weight: bold;
      /* transform:scale(0.5); */
      display: none;
    }

    display: inline-flex;
    input {
      display: none;
    }
    input:checked + span:before {
      display: block;
    }
    input:checked + span {
      color: var(--green);
      border-color: var(--green);
    }
    span {
      border: 1px lightgray solid;
      color: lightgray;
      border-radius: 0.8em;
      padding: 0em 0.7em;
      user-select: none;
      cursor: pointer;
    }
  }
}

.filter ~ ul {
  padding-inline-start: 0.5em;
}

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 0.8em;
  justify-content: center;
  align-items: center;
  padding: 0.5em 0.25em 0.8em;
}

.tag-cloud .category span {
  --weight: 1;
  --angle: 0deg;
  --delay: 0s;
  font-size: calc(0.85rem + var(--weight) * 0.6rem);
  letter-spacing: 0.01em;
  transform: rotate(var(--angle));
  animation: tag-fade-in 600ms ease-out both, tag-float 6s ease-in-out infinite;
  animation-delay: var(--delay), calc(var(--delay) + 200ms);
}

.tag-cloud .category span:hover {
  transform: rotate(var(--angle)) scale(1.06);
}

@keyframes tag-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px) rotate(var(--angle));
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(var(--angle));
  }
}

@keyframes tag-float {
  0% {
    transform: translateY(0) rotate(var(--angle));
  }
  50% {
    transform: translateY(-4px) rotate(var(--angle));
  }
  100% {
    transform: translateY(0) rotate(var(--angle));
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag-cloud .category span {
    animation: none;
  }
}
