/* Markdown */
:root {
  --maincolor: red;
  --bordercl: rebeccapurple;
  --callouctcolor: dodgerblue;
  --hovercolor: navy;
  --darkMaincolor: #50fa7b;
}

html {
  color: #232333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    "WenQuanYi Micro Hei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

body {
  display: block;
  margin: 8px;
}

* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

@keyframes intro {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.content {
  animation: intro 0.3s both;
  animation-delay: 0.15s;
}

::selection {
  background: var(--maincolor);
  color: #fff;
}

p {
  /* font-family: 'Fira Sans', sans-serif; */
  line-height: 1.78;
  margin: 1em 0;
}

mark {
  background: #e8f1e6;
  color: inherit;
  font-weight: 600;
  padding: 0.05em 0.18em;
}

hr {
  border: 0;
  border-top: 3px dotted var(--bordercl);
  margin: 1em 0;
}

blockquote {
  border-left: 3px solid var(--bordercl);
  color: #737373;
  margin: 0;
  padding-left: 1em;
}

a {
  border-bottom: 3px solid var(--maincolor);
  color: inherit;
  text-decoration: none;
}

a:hover {
  background-color: var(--hovercolor);
  color: #fff;
}

ul {
  list-style: none;
  padding-left: 2ch;
}

ul li {
  text-indent: -2ch;
}

ul > li::before {
  color: #a05a2c;
  content: "\2022 ";
  font-weight: bold;
}

/* Images */
img {
  border: 3px solid #ececec;
  max-width: 100%;
}

figure {
  box-sizing: border-box;
  display: inline-block;
  margin: 0;
  max-width: 100%;
}

figure img {
  max-height: 500px;
}

@media screen and (min-width: 600px) {
  figure {
    padding: 0 40px;
  }
}

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

figure h4::before {
  content: "↳ ";
}

/* Code blocks */
code {
  font-family: "Roboto Mono", monospace;
  background-color: #f1f1f1;
  padding: 0.1em 0.2em;
}

pre {
  background-color: #ececec;
  line-height: 1.4;
  overflow-x: auto;
  padding: 1em;
}

.highlight pre ::selection {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

pre code {
  background-color: transparent;
  color: inherit;
  font-size: 100%;
  padding: 0;
}

/* Containers */
.content {
  margin-bottom: 4em;
  margin-left: auto;
  margin-right: auto;
  max-width: 800px;
  padding: 0 1ch;
  word-wrap: break-word;
}

/* Header */
header {
  display: flex;
  flex-wrap: wrap;
  font-family: "Roboto Mono", monospace;
  justify-content: space-between;
  margin: 1em 0;
}

header .main {
  font-size: 1.5rem;
}

header nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

header nav a {
  white-space: nowrap;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 1.2rem;
  margin-top: 2em;
}

h1::before {
  color: var(--maincolor);
  content: "# ";
}

h2::before {
  color: var(--maincolor);
  content: "## ";
}

h3::before {
  color: var(--maincolor);
  content: "### ";
}

h4::before {
  color: var(--maincolor);
  content: "#### ";
}

h5::before {
  color: var(--maincolor);
  content: "##### ";
}

h6::before {
  color: var(--maincolor);
  content: "###### ";
}

.meta {
  color: #999;
  font-family: "Roboto Mono", monospace;
  letter-spacing: -0.5px;
}

/* Footer */
footer {
  display: flex;
  align-items: center;
  border-top: 0.4rem dotted var(--bordercl);
  padding: 2rem 0rem;
  margin-top: 2rem;
}

.soc {
  display: flex;
  align-items: center;
  padding-right: 1rem;
  margin-right: 1rem;
  border-right: 2px solid;
  border-bottom: none;
}

.footer-info {
  padding: var(--footer-padding);
}

.footer-sep {
  color: #777;
  margin: 0 0.65rem;
}

.footer-tech {
  color: #777;
  font-family: "Roboto Mono", monospace;
  font-size: 0.78rem;
  margin-top: 0.35rem;
}

#main_title {
  margin-bottom: 10px;
}

/* Common */
.title h1 {
  margin-bottom: 0;
}

time {
  color: grey;
  font-family: "Roboto Mono", monospace;
}

span {
  color: grey;
}

/* Posts */
article .title {
  margin-bottom: 1em;
}

.post-description {
  border-left: 3px solid #d69a6a;
  color: #666;
  font-size: 1rem;
  line-height: 1.72;
  margin: 1.1rem 0 1.7rem;
  padding-left: 1rem;
}

.post-toc {
  font-family: "Roboto Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

.post-toc-title {
  color: #a05a2c;
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.post-toc ul {
  margin: 0;
  padding-left: 0;
}

.post-toc li {
  margin-bottom: 0.45rem;
  text-indent: 0;
}

.post-toc ul > li::before {
  content: none;
}

.post-toc a {
  border-bottom-width: 2px;
}

.post-toc-level-2 {
  font-weight: 600;
  margin-top: 0.75rem;
}

.post-toc-level-2:first-child {
  margin-top: 0;
}

.post-toc-level-3 {
  color: #777;
  padding-left: 1ch;
}

.post-toc-inline {
  margin: 1.2rem 0 1.8rem;
}

.post-toc-sidebar {
  display: none;
}

.featured-posts {
  font-family: "Roboto Mono", monospace;
  font-size: 0.92rem;
  margin: 1.2rem 0 1.8rem;
}

.featured-posts-title {
  color: #a05a2c;
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.featured-posts ul {
  margin: 0;
  padding-left: 0;
}

.featured-posts li {
  line-height: 1.5;
  margin-bottom: 0.55rem;
  text-indent: 0;
}

.featured-posts ul > li::before {
  content: none;
}

.featured-post-title {
  border-bottom-width: 2px;
}

.featured-post-summary {
  color: #777;
  display: block;
  font-size: 0.88rem;
  margin-top: 0;
}

@media screen and (min-width: 1360px) {
  .post-main-with-toc .post-layout {
    align-items: start;
    column-gap: 4.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    width: calc(100% + 4.5rem + 230px);
  }

  .post-main-with-toc article {
    grid-column: 1;
    grid-row: 1;
  }

  .post-toc-inline {
    display: none;
  }

  .post-toc-sidebar {
    display: block;
    grid-column: 2;
    grid-row: 1;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding-right: 0.5rem;
    position: sticky;
    top: 1rem;
  }

  .home-layout {
    align-items: start;
    column-gap: 3.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    width: calc(100% + 3.5rem + 210px);
  }

  .home-posts {
    grid-column: 1;
    grid-row: 1;
  }

  .home-posts > ul {
    margin-top: 0;
  }

  .featured-posts {
    grid-column: 2;
    grid-row: 1;
    margin-top: 1rem;
    position: sticky;
    top: 1rem;
  }
}

@media screen and (min-width: 1600px) {
  .home-layout {
    column-gap: 6rem;
    grid-template-columns: minmax(0, 1fr) 220px;
    width: calc(100% + 6rem + 220px);
  }
}

@media screen and (min-width: 1800px) {
  .home-layout {
    column-gap: 8rem;
    width: calc(100% + 8rem + 220px);
  }
}

/* Callout */
.callout {
  background-color: var(--callouctcolor);
  color: #fff;
  padding: 1em;
}

.callout p {
  /* font-family: 'IBM Plex Mono', monospace; */
  margin: 0;
}

.callout a {
  border-bottom: 3px solid #fff;
}

.callout a:hover {
  background-color: #fff;
  color: var(--callouctcolor);
}

.site-description {
  display: flex;
  justify-content: space-between;
}

.tag-cloud {
  margin: 1.4rem 0 2.4rem;
}

.tag-cloud .tags {
  padding-left: 0;
}

.tag-cloud .tags li {
  line-height: 1.65;
  margin: 0.65rem 0;
  text-indent: 0;
}

.tag-cloud .tags a {
  display: inline-block;
}

.posts {
  padding-left: 0;
}

.posts .post {
  line-height: 1.55;
  margin: 0.8rem 0;
  text-indent: 0;
}

.posts .post::before {
  content: none;
}

.posts .post a {
  display: inline;
}

.posts .post .meta {
  display: block;
  margin-top: 0.15rem;
  white-space: nowrap;
}

.tags li::before {
  content: "🏷 ";
}

.tags a {
  border-bottom: 3px solid var(--maincolor);
}

.tags a:hover {
  color: white;
  background-color: var(--hovercolor);
}

svg {
  max-height: 15px;
}

.soc:hover {
  color: white;
}

.draft-label {
  color: var(--bordercl);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: 6px;
  background-color: #f9f2f4;
}

pre {
  font-family: "Roboto Mono", monospace;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

pre code[class*="language-"] {
  -webkit-overflow-scrolling: touch;
}

pre code[class*="language-"]::before {
  background: black;
  border-radius: 0 0 0.25rem 0.25rem;
  color: white;
  font-size: 12px;
  letter-spacing: 0.025rem;
  padding: 0.1rem 0.5rem;
  position: absolute;
  right: 1rem;
  text-align: right;
  text-transform: uppercase;
  top: 0;
}

pre code[class="language-javaScript"]::before,
pre code[class="language-js"]::before {
  content: "js";
  background: #f7df1e;
  color: black;
}

pre code[class="language-typescript"]::before,
pre code[class="language-ts"]::before {
  content: "ts";
  background: dodgerblue;
  color: black;
}

pre code[class*="language-yml"]::before,
pre code[class*="language-yaml"]::before {
  content: "yaml";
  background: #f71e6a;
  color: white;
}

pre code[class*="language-shell"]::before,
pre code[class*="language-bash"]::before,
pre code[class*="language-sh"]::before {
  content: "shell";
  background: green;
  color: white;
}

pre code[class*="language-json"]::before {
  content: "json";
  background: dodgerblue;
  color: #000000;
}

pre code[class*="language-python"]::before,
pre code[class*="language-py"]::before {
  content: "py";
  background: blue;
  color: yellow;
}

pre code[class*="language-css"]::before {
  content: "css";
  background: cyan;
  color: black;
}

pre code[class*="language-go"]::before {
  content: "Go";
  background: cyan;
  color: royalblue;
}

pre code[class*="language-md"]::before,
pre code[class*="language-md"]::before {
  content: "Markdown";
  background: royalblue;
  color: whitesmoke;
}

pre code[class*="language-rust"]::before,
pre code[class*="language-rs"]::before {
  content: "rust";
  background: #fff8f6;
  color: #ff4647;
}

pre code[class*="language-cpp"]::before,
pre code[class*="language-c++"]::before {
  content: "cpp";
  background: #5e97d0;
  color: #044f88;
}

/* table */
table {
  border-spacing: 0;
  border-collapse: collapse;
}

table th {
  padding: 6px 13px;
  border: 1px solid #dfe2e5;
  font-size: large;
}

table td {
  padding: 6px 13px;
  border: 1px solid #dfe2e5;
}

.footnote-definition {
  display: flex;
  align-items: center;
  grid-column-gap: 10px;
}

/* Zola 0.22+ Giallo highlighting */
pre.giallo {
  background-color: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  box-sizing: border-box;
}

.giallo-l {
  display: inline-block;
  min-height: 1lh;
  width: 100%;
}

.giallo-ln {
  display: inline-block;
  margin-right: 0.4em;
  min-width: 3ch;
  opacity: 0.8;
  padding-right: 0.4em;
  text-align: right;
  user-select: none;
}

pre code[data-lang] {
  display: block;
  padding-top: 0.35rem;
}

pre code[data-lang]::before {
  background: #111;
  border-radius: 0 0 0.25rem 0.25rem;
  color: #fff;
  content: attr(data-lang);
  font-size: 12px;
  letter-spacing: 0.025rem;
  padding: 0.1rem 0.5rem;
  position: absolute;
  right: 1rem;
  text-align: right;
  text-transform: uppercase;
  top: 0;
}

.code-copy-button {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  color: #57606a;
  cursor: pointer;
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  padding: 0.2rem 0.5rem;
  pointer-events: none;
  position: absolute;
  right: 1rem;
  top: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.code-copy-button:hover,
.code-copy-button:focus-visible {
  background: #f3f4f6;
  color: #111;
  opacity: 1;
  pointer-events: auto;
}

.code-copy-button.copied {
  border-color: #2da44e;
  color: #1a7f37;
}

pre.giallo:hover .code-copy-button,
pre.giallo:focus-within .code-copy-button,
pre.giallo.copy-feedback .code-copy-button {
  opacity: 1;
  pointer-events: auto;
}

pre code[data-lang]::before {
  transition: opacity 0.15s ease;
}

pre.has-code-language:hover code[data-lang]::before,
pre.has-code-language:focus-within code[data-lang]::before,
pre.has-code-language.copy-feedback code[data-lang]::before {
  opacity: 0;
}

@media (hover: none) {
  pre.giallo .code-copy-button {
    opacity: 1;
    pointer-events: auto;
  }

  pre.has-code-language code[data-lang]::before {
    opacity: 0;
  }
}

pre code[data-lang="java"]::before,
pre code[data-lang="javascript"]::before,
pre code[data-lang="js"]::before {
  background: #f7df1e;
  color: #111;
}

pre code[data-lang="bash"]::before,
pre code[data-lang="shell"]::before,
pre code[data-lang="sh"]::before {
  background: #17823b;
}

pre code[data-lang="json"]::before {
  background: dodgerblue;
  color: #111;
}

@media screen and (max-width: 600px) {
  header nav {
    width: 100%;
  }

  pre {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding: 0.9rem;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
  }
}
