/*
 * Modified from https://github.com/matrixk/bitcron-theme-lily by matrixk
 */
@import url("https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap");
:root {
  --primary-hue: 250.5882352941deg;
  --primary-sat: 100%;
  --primary-lit: 93.3333333333%;
  --primary-hsl: var(--primary-hue), var(--primary-sat), var(--primary-lit);
  --primary: hsl(var(--primary-hsl));
  --darken: 30%;
  --lit-base: calc(var(--primary-lit) - var(--darken));
  --lit-dark: calc(var(--lit-base) - var(--darken));
  --primary-bare: hsl(var(--primary-hue), var(--primary-sat), 99%);
  --primary-base: hsl(var(--primary-hue), var(--primary-sat), var(--lit-base));
  --primary-dark: hsl(var(--primary-hue), var(--primary-sat), var(--lit-dark));
  --font-code: "JetBrains Mono", monospace;
  --base-spacing: 2em;
  --minor-spacing: calc(var(--base-spacing) / 2);
  --large-spacing: calc(var(--base-spacing) * 2);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Crimson Pro", "Times New Roman", "Nimbus Roman", serif, "SimSun", "Noto Serif SC";
  font-size: 18px;
  font-size-adjust: from-font;
  display: flex;
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--primary-base);
  background: linear-gradient(to top, var(--primary), var(--primary) 30%, transparent 30%) no-repeat;
  transition: background-size 0.5s, color 0.5s;
  background-size: 0 100%;
  text-decoration: none;
}
a:hover {
  color: var(--primary-dark);
  background-size: 100% 100%;
}

/* Sidebar */
#sidebar {
  display: flex;
  flex-flow: column;
  margin: auto 2em;
}
#sidebar #header {
  height: 100vh;
  /* This min-height is for mobile view. */
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden auto;
  /* Blog title */
  /* Nevigation menu */
}
#sidebar #header .title-container {
  margin: auto;
}
#sidebar #header .title-container .site-title {
  font-size: 50px;
  line-height: 1;
  /* Decoration purpose only */
}
#sidebar #header .title-container .site-title a {
  color: #000000;
  text-decoration: none;
}
#sidebar #header .title-container .site-title::after {
  content: "";
  display: block;
  width: 110px;
  height: 0.4em;
  background-color: var(--primary);
  position: relative;
  left: -50px;
  top: -26px;
  z-index: -1;
}
#sidebar #header #toptranslations h2 {
  font-size: 1.2rem;
}
#sidebar #header ul.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em 1.5em;
  margin-top: 2em;
  padding: 0;
}
#sidebar #header ul.menu li {
  display: inline-block;
}
#sidebar #header .active {
  font-weight: bold;
}
#sidebar #header .social-links a {
  margin: -0.2em;
  padding: 0.2em;
  opacity: 0.8;
}
#sidebar #header .social-links a:hover {
  opacity: 1;
}
#sidebar #header .social-links svg {
  width: 1.4em;
}

/* Basic layout */
#container {
  padding: 0 var(--large-spacing);
  width: calc(100% - var(--large-spacing) * 2);
  max-height: 100vh;
  overflow: auto;
  scroll-behavior: smooth;
  line-height: 1.6;
}
#container #content {
  width: 100%;
  max-width: 60em;
  margin: auto;
  margin-top: 3em;
}
#container article {
  border-bottom: var(--primary) 3px double;
  /* Decoration purpose only. */
}
#container article::after {
  width: 120px;
  height: 17px;
  background-color: var(--primary);
  content: "";
  display: block;
  left: calc(100% - 120px);
  position: relative;
  opacity: 0.5;
}
#container footer {
  font-size: small;
}
#container footer p {
  text-align: center;
  margin-right: 1em;
}

label[for=sidebar-box] {
  display: inline-block;
  color: var(--primary-base);
}

/* Post header */
article header .entry-title {
  /* Decoration purpose only. */
}
article header .entry-title::before {
  content: "";
  display: block;
  width: 60px;
  height: 17px;
  background-color: var(--primary);
  position: relative;
  left: -16px;
  top: 32px;
  z-index: -1;
}

.metadata {
  text-align: right;
  font-size: 0.9em;
}
.metadata > p {
  display: inline-block;
  margin-right: 1em;
}

/* Post listing */
.postindex {
  /* Article title should be smaller in listings. */
}
.postindex h1.entry-title {
  font-size: 1.35rem;
  margin: 0;
}
.postindex .metadata > * {
  margin: 0;
}
.postindex h1, .postindex h2, .postindex h3, .postindex h4, .postindex h5, .postindex h6 {
  font-size: 1.2rem;
}

time.listdate {
  margin-right: 0.5em;
}

ul.postlist {
  display: grid;
  grid-template-columns: auto auto;
  width: fit-content;
}
ul.postlist > li {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: span 2;
  grid-gap: 0.5em;
}

/* Used by JS to hide sidebar */
html.no-sidebar {
  /* Move sidebar to the footer. */
}
html.no-sidebar body {
  flex-direction: column-reverse;
  overflow-x: hidden;
}
html.no-sidebar #sidebar #header {
  /* Override the desktop 100vh height. */
  height: auto;
}
html.no-sidebar #container {
  /* Make it possible to scroll. */
  max-height: unset;
}

/* Mobile */
@media only screen and (max-width: 960px) {
  /* Move sidebar to the footer. */
  body {
    flex-direction: column-reverse;
    overflow-x: hidden;
  }
  #sidebar #header {
    /* Override the desktop 100vh height. */
    height: auto;
  }
  #container {
    /* Make it possible to scroll. */
    max-height: unset;
  }
  label[for=sidebar-box] {
    display: none;
  }
  * {
    word-wrap: break-word;
  }
}
@media only screen and (max-width: 540px) {
  /* Compact */
  :root {
    --base-spacing: 0.5em;
  }
}
@media print {
  #sidebar {
    display: none;
  }
}
/* Basic styles */
blockquote {
  background-color: var(--primary-bare);
  border-left: 4px solid var(--primary);
  padding: 0.2em 1em;
  margin: 1em 0;
}

kbd {
  color: #333333;
  border: 1px solid #333333;
  border-radius: 6px;
  box-shadow: inset 0 -1px 0 #333333;
  padding: 3px 5px;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  color: #000000;
}
h1 a.headerlink, h2 a.headerlink, h3 a.headerlink, h4 a.headerlink, h5 a.headerlink, h6 a.headerlink {
  margin-left: 0.4em;
  padding: 0 0.2em;
  color: var(--primary-base);
  font-size: 0.8em;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.7rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.35rem;
}

h5 {
  font-size: 1.2rem;
}

h6 {
  font-size: 1.1rem;
}

hr {
  max-width: 100px;
  margin: 2em auto;
}

strong {
  background: linear-gradient(to top, var(--primary), var(--primary) 30%, transparent 30%) no-repeat;
  font-weight: 600;
}

del {
  color: #333333;
}

cite {
  background-color: #f8f8f8;
}

code {
  font-family: var(--font-code);
  font-size: 0.9em;
  padding: 1px 3px;
  word-break: break-all;
  background-color: #f8f8f8;
  border-radius: 2px;
}

div.highlight > pre {
  border-radius: 5px;
  white-space: pre;
}

pre {
  font-family: var(--font-code);
  font-size: 0.86em;
  overflow-x: auto;
  margin: 0.5em var(--base-spacing);
  padding: 0.5em 1em;
}
pre code {
  padding: 0;
  border: none;
}

img, video {
  margin: 0 auto;
  display: inline-block;
  max-width: 100%;
  max-height: max(50vh, 15em);
  box-shadow: 0 0 10px #f1f1f1;
}

table {
  border: none;
}
table tr:nth-child(2n+1) {
  background-color: hsla(var(--primary-hsl), 0.3);
}
table tr td, table tr th {
  border: 1px var(--primary) solid;
  padding: 0.5rem;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

/* Input file specific */
/* Org mode */
.footdef {
  display: flex;
  font-size: 0.9em;
  margin: 1em 0;
}
.footdef .footnum {
  margin-right: 1em;
}
.footdef .footpara {
  margin: 0;
  min-width: 0;
}

figure, .figure {
  text-align: center;
}

summary > p {
  display: inline;
}

/* Org mode: Source block output */
div.results > pre, pre.results {
  margin-top: 0.5em;
  padding-left: 2em;
  background-color: var(--primary-bare);
  border-left: 1.2px solid var(--primary-base);
  border-radius: 0;
}
div.results > pre::before, pre.results::before {
  content: "Output:";
  display: block;
  margin-left: -1em;
  color: var(--primary-base);
  font-weight: bold;
}

div.highlight + table {
  margin-left: 1.8em;
  margin-top: 1em;
  box-shadow: -1.6px 0 0 var(--primary-base);
}
