:root {
  --site-header-height: 4rem;
}

body {
  color: #222831;
  font-size: calc(110% + 0.1vw);
  line-height: 1.6;
  background-color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  padding-top: calc(var(--site-header-height) + 0.4rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.reading-progress {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  z-index: 1001;
  background: transparent;
  transition: opacity 0.18s ease;
}

.reading-progress-bar {
  width: 0;
  height: 100%;
  background: #9e1900;
  transition: width 0.1s linear;
}

::-webkit-scrollbar {
  width: 7px;
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #b7b7be;
  border-radius: 4px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #a7abb0;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

.wrap {
  width: 90%;
  max-width: 45em;
  margin: 0 auto;
}

body > .wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-header {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(34, 40, 49, 0.08);
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

.site-header .header-inner {
  width: 90%;
  max-width: 45em;
  margin: 0 auto;
  min-height: var(--site-header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.8rem;
}

body.zoom-preview-open .site-header {
  transform: translateY(calc(-1 * (var(--site-header-height) + 12px)));
  opacity: 0;
  pointer-events: none;
}

body.zoom-preview-open .back-to-top {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
  transform: translateY(12px);
}

body.zoom-preview-open .reading-progress {
  opacity: 0;
}

ul {
  margin: 1rem 0;
}

p {
  letter-spacing: -0.01em;
  line-height: 1.8;
  margin: 1.2em 0;
}

a,
a:active {
  color: #222831;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  letter-spacing: -0.002em;
  font-weight: 600;
  line-height: 1.2;
}

::selection {
  color: #fff;
  background-color: #9e1900;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.site-header .nav-list {
  margin: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.nav-list-link {
  padding-bottom: 0.15em;
  border-bottom: 0.2em solid transparent;
}

.nav-list-link:hover {
  border-bottom: 0.2em solid #9e1900;
  padding-bottom: 0.15em;
  transition: 150ms ease-in-out;
}

.nav-list-link.is-active {
  border-bottom: 0.2em solid #9e1900;
  padding-bottom: 0.15em;
}

.copyright-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 7px;
  a {
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
  }
  .name {
    text-decoration: underline;
    font-weight: bold;
  }
  .x {
    margin-left: 4em;
    margin-top: 2px;
  }
  .rss {
    margin-left: 10px;
  }
  .github {
    margin-left: 10px;
  }
}

code {
  padding: 0.2em 0.4em;
}

iframe,
video {
  max-width: 100%;
  margin: 1rem auto;
}

/*table {
  padding: 0;
}*/
table th {
  font-weight: 600;
  border: 0;
  text-align: left;
  margin: 0;
  padding: 0.4em 0.8em;
}
table thead {
  background-color: #fff;
}
table tbody tr {
  border-top: 0;
  background-color: #fff;
}
table tbody tr:nth-child(2n) {
  background-color: #f6f8fa;
}
table tbody td {
  border: 0.05em solid transparent;
  text-align: left;
}
table tbody th :first-child,
table tbody td :first-child {
  margin-top: 0;
}
table tbody th :last-child,
table tbody td :last-child {
  margin-bottom: 0;
}

.site-header .branding {
  display: inline-block;
  margin: 0;
  position: relative;
  a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }
}

.logo-image:hover {
  animation: sway 1.4s ease-in-out both;
}

@keyframes sway {
  10%,
  90% {
    transform: rotate(-15deg);
  }

  20%,
  80% {
    transform: rotate(15deg);
  }

  30%,
  50%,
  70% {
    transform: rotate(-10deg);
  }

  40%,
  60% {
    transform: rotate(10deg);
  }
}

.logo-image {
  height: 2.9em;
}

.archive {
  margin: 0.45em 0 2.5em;
  /* padding: 0 1.5em 0 2em; */
}

.archive-year {
  margin: 0.5em 0 -0.25em;
  font-size: clamp(5rem, 18vw, 10rem);
  line-height: 0.88;
  letter-spacing: 0.015em;
  color: rgba(34, 40, 49, 0.09);
  font-weight: 800;
  user-select: none;
  pointer-events: none;
}

.site-header .nav-list-item {
  display: inline-block;
  padding: 0.4em 0.65em;
}
.site-header .nav-list-item a {
  font-size: 0.9em;
  line-height: 1.4;
}

@media screen and (max-width: 600px) {
  :root {
    --site-header-height: 3.7rem;
  }

  body {
    padding-top: calc(var(--site-header-height) + 0.3rem);
  }

  .site-header .header-inner {
    min-height: var(--site-header-height);
  }

  .logo-image {
    height: 2.5em;
  }

  .site-header .nav-list-item {
    padding: 0.35em 0.45em;
  }
}

.home.post-list {
  margin: 0;
  list-style: none;
}
.home.post-list .post-list-item {
  padding: 1em 0.4em;
}

.home.post-list .post-content h2:before,
.home.post-list .post-content h3:before,
.home.post-list .post-content h4:before,
.home.post-list .post-content h5:before,
.home.post-list .post-content h6:before {
  content: "";
}
.home.post-list .post-content > ul {
  list-style: initial;
}

.home.post-list .read-more {
  color: #9e1900;
}

.archive .post-item {
  width: 100%;
  flex-wrap: wrap;
  padding-left: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.2em 0 0.5em;
  position: relative;
  z-index: 1;
}
.archive .post-line {
  -webkit-box-flex: 1;
  flex-grow: 1;
  height: 6px;
  margin: 0 15px;
  border-bottom: 1px dashed #ddd;
}
.archive .post-time,
.archive .post-title-link {
  font-size: 1rem;
  color: #222831;
}
.archive .post-title-link:hover {
  border-bottom: 0;
  color: #9e1900;
  text-decoration: underline;
}
.archive .post-info {
  font-size: 0.8em;
  color: #999;
  text-align: right;
}

.post .post-block {
  padding: 1em 0.4em;
}

.post-block .post-title {
  margin: 0.65em 0;
  font-size: 1.5em;
}
.post-block .post-info {
  color: #393e46;
  margin: 1.2em 0;
}
.post-block .post-info span {
  margin-left: 0.5rem;
}
.post-block .post-info a.post-from {
  margin-left: 0.5rem;
  padding: 0.2em 0.3em;
  border-radius: 0.3em;
  font-size: 0.7em;
  color: #fff;
  background-color: #e36b6b;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-bottom: 1em;
}

.post-content h2 a:before,
.post-content h3 a:before,
.post-content h4 a:before,
.post-content h5 a:before,
.post-content h6 a:before {
  content: "#";
  color: #9e1900;
  position: absolute;
  left: -0.8em;
  top: -0.1em;
  font-size: 1.1em;
  font-weight: 500;
}
.post-content h4 a:before,
.post-content h5 a:before,
.post-content h6 a:before {
  content: "";
}

.post-content h1,
.post-block .post-title {
  margin-top: 1.35em;
  font-size: 3em;
}

.post-block .post-title .post-title-link {
  position: relative;
  color: inherit;
}
.post-block .post-title .post-title-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 4px;
  background: #9e1900;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}
.post-block .post-title .post-title-link:hover::after {
  width: 100%;
}

.post-content h2 {
  margin-top: 1.8em;
  font-size: 2.8em;
}

.post-content h3 {
  margin-top: 1.6em;
  font-size: 2.6em;
}

.post-content h4 {
  margin-top: 1.4em;
  font-size: 2.4em;
}

.post-content h5 {
  margin-top: 1.2em;
  font-size: 2.2em;
}

.post-content h6 {
  margin-top: 1em;
  font-size: 2em;
}

a {
  word-break: break-all;
}

.post-content a {
  color: #9e1900;
  word-break: break-all;
}
.post-content a:hover {
  color: #9e1900;
  text-decoration: underline;
}
.post-content blockquote {
  margin: 2em 0;
  padding: 0.5em 1.3em;
  border-radius: 0.1em;
  border-left: 0.3em solid #9e1900;
  background: rgba(148, 148, 149, 0.08);
}

.post-content li {
  margin-left: 1em;
  list-style-type: disc;
}

.post-content blockquote.warning {
  border-left-color: #f0ad4e;
  border-left-width: 4px;
}
.post-content img {
  display: block;
  max-width: 100%;
  margin: 1em auto;
}
.post-content .tip {
  position: relative;
  margin: 2em 0;
  padding: 0.6em 1.2em 0.6em 1.2em;
  border-left: 4px solid #f66;
  border-top-right-radius: 0.06em;
  border-bottom-right-radius: 0.06em;
  background-color: #f8f8f8;
}
.post-content .tip br {
  display: none;
}
.post-content .tip:before {
  position: absolute;
  top: 14px;
  left: -12px;
  content: "!";
  width: 20px;
  height: 20px;
  border-radius: 100%;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  text-align: center;
  background-color: #f66;
  font-family: "Dosis", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
}

#mask {
  position: fixed;
  overflow: scroll;
  width: 100%;
  height: 100%;
  padding: 1em 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10;
}
#mask #mask-image {
  max-width: 95%;
}

.paginator {
  margin: 4em 0 2em;
  display: flex;
  justify-content: space-around;
  user-select: none;
}

.paginator .prev,
.paginator .next {
  position: relative;
  box-shadow: 0 0.3em #801501;
  display: inline-block;
  margin: 0 0.2em;
  padding: 0.3em 1.5em;
  border-radius: 5px;
  color: #fff;
  background-color: #9e1900;
  font-weight: 600;
}
.paginator .prev:hover,
.paginator .next:hover {
  box-shadow: 0 0.2em #801501;
  top: 0.1em;
}

.ds-thread,
#utterances-container {
  margin-bottom: 2em;
}

main.container {
  margin: 1.5em 0.7em 2em;
  min-height: 30vh;
  flex: 1;
}

@media screen and (max-width: 700px) {
  main.container,
  .home.post-list,
  .archive {
    margin-top: 0;
  }
  .ds-thread,
  #utterances-container {
    margin: 2em 0.8em;
  }
}

footer .copyright {
  font-size: 0.8em;
  margin: 4em 4em 2em;
  border-top: 1px solid #eee;
  text-align: center;
}
footer .copyright p,
footer .copyright a {
  /* padding: 1em 0; */
  color: #393e46;
  font-weight: 300;
}
footer .copyright a:hover {
  color: #393e46;
}

code,
pre {
  font-size: 0.8em;
  background-color: #f8f8f8;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
}

.highlight {
  position: relative;
  margin: 1em 0;
  border-radius: 0.02em;
  line-height: 1.1em;
  background-color: #f8f8f8;
  max-width: 100%;
  overflow: hidden;
}

.highlight .code pre {
  overflow-x: auto;
  overflow-y: hidden;
}

.highlight .code pre::-webkit-scrollbar {
  height: 8px;
}
.highlight .code pre::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 5px;
}
.highlight .code pre::-webkit-scrollbar-track {
  background: #f8f8f8;
  border-radius: 5px;
}

.highlight .code pre::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

.highlight table,
.highlight tr,
.highlight td {
  width: 100%;
  border-collapse: collapse;
  padding: 0;
  margin: 0;
}

.highlight table {
  table-layout: fixed;
}

.highlight td {
  min-width: 0;
}

.highlight .code {
  width: 100%;
}
.highlight .gutter {
  display: none;
}

.highlight figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  padding: 0.45em 1.4em 0;
  font-size: 0.76em;
  color: #84878c;
}

.highlight figcaption span {
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.highlight figcaption a {
  color: #9e1900;
  text-decoration: underline;
}

.highlight figcaption + table .code pre {
  padding-top: 0.8em;
}

.highlight .code pre {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 1.2em 1.4em;
  line-height: 1.5em;
  margin: 0;
}
.highlight .code pre .line {
  width: auto;
  height: 1.5em;
}

.highlight.sql:after,
.highlight.ini:after,
.highlight.conf:after,
.highlight.html:after,
.highlight.javascript:after,
.highlight.js:after,
.highlight.bash:after,
.highlight.css:after,
.highlight.scss:after,
.highlight.diff:after,
.highlight.java:after,
.highlight.xml:after,
.highlight.python:after,
.highlight.json:after,
.highlight.swift:after,
.highlight.ruby:after,
.highlight.perl:after,
.highlight.php:after,
.highlight.c:after,
.highlight.cpp:after,
.highlight.ts:after {
  position: absolute;
  top: 0;
  right: 0;
  color: #84878c;
  text-align: right;
  font-size: 0.7em;
  padding: 0.4em 0.7em 0;
  height: 0.9em;
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}

.highlight.sql:after {
  content: "SQL";
}

.highlight.ini:after {
  content: "INI";
}

.highlight.conf:after {
  content: "CONF";
}

.highlight.html:after {
  content: "HTML";
}

.highlight.javascript:after {
  content: "JAVASCRIPT";
}

.highlight.js:after {
  content: "JS";
}

.highlight.bash:after {
  content: "BASH";
}

.highlight.css:after {
  content: "CSS";
}

.highlight.scss:after {
  content: "SCSS";
}

.highlight.diff:after {
  content: "DIFF";
}

.highlight.java:after {
  content: "JAVA";
}

.highlight.xml:after {
  content: "XML";
}

.highlight.python:after {
  content: "PYTHON";
}

.highlight.json:after {
  content: "JSON";
}

.highlight.swift:after {
  content: "SWIFT";
}

.highlight.ruby:after {
  content: "RUBY";
}

.highlight.perl:after {
  content: "PERL";
}

.highlight.php:after {
  content: "PHP";
}

.highlight.c:after {
  content: "C";
}

.highlight.java:after {
  content: "JAVA";
}

.highlight.cpp:after {
  content: "CPP";
}

.highlight.ts:after {
  content: "TS";
}

.highlight.cpp:after {
  content: "C++";
}

pre {
  color: #525252;
}
pre .comment,
pre .quote {
  color: #998;
  font-style: italic;
}
pre .keyword,
pre .selector-tag,
pre .subst {
  color: #222831;
  font-weight: 600;
}
pre .number,
pre .literal,
pre .variable,
pre .template-variable,
pre .tag .attr {
  color: #008080;
}
pre .string,
pre .doctag {
  color: #d14;
}
pre .title,
pre .section,
pre .selector-id {
  color: #900;
  font-weight: 600;
}
pre .subst {
  font-weight: normal;
}
pre .type,
pre .class .title {
  color: #458;
  font-weight: 600;
}
pre .tag,
pre .name,
pre .attribute {
  color: #000080;
  font-weight: normal;
}
pre .regexp,
pre .link {
  color: #009926;
}
pre .symbol,
pre .bullet {
  color: #990073;
}
pre .built_in,
pre .builtin-name {
  color: #0086b3;
}
pre .meta {
  color: #999;
  font-weight: 600;
}
pre .deletion {
  background: #fdd;
}
pre .addition {
  background: #dfd;
}
pre .emphasis {
  font-style: italic;
}
pre .strong {
  font-weight: 600;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #9e1900;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 999;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #801501;
}

.back-to-top:active {
  transform: translateY(1px);
}

@media screen and (max-width: 700px) {
  .back-to-top {
    right: 16px;
    bottom: 18px;
  }
}

.post-content img.previewable-image {
  transition: transform 0.2s ease;
}

.post-content img.previewable-image:hover {
  transform: scale(1.02);
}

#utterances-container + iframe.utterances-frame {
  max-width: 100%;
}

/* 适配常见机型移动端样式 */
@media screen and (max-width: 700px) {
  .post-block .post-title {
    font-size: 1.8em;
  }
  .post-content h1 {
    font-size: 1.6em;
  }
  .post-content h2 {
    margin-top: 1.2em;
    font-size: 1.5em;
  }

  .post-content h3 {
    margin-top: 1em;
    font-size: 1.4em;
  }

  .post-content h4 {
    margin-top: 0.8em;
    font-size: 1.3em;
  }

  .post-content h5 {
    margin-top: 0.6em;
    font-size: 1.2em;
  }

  .post-content h6 {
    margin-top: 0.4em;
    font-size: 1.1em;
  }
  .post-line {
    display: none;
  }
  .archive .post-item {
    flex-direction: column;
    align-items: flex-start;
    margin: 0.2em 0 0.7em;
  }
  footer .copyright {
    margin: 3em 0 1.7em;
  }
  .highlight .code pre::-webkit-scrollbar {
    height: 5px;
  }
  .highlight .code pre {
    padding: 1.5em 1.4em 1.2em;
    position: relative;
  }
}
