/*
 * unfolded-paper
 *
 * by inopinatus via nanxiaobei
 *
 * updated 2021.01.20
 *
 */

/* Variables */
:root {
  --gap: 24px;
  --content-gap: 12px;
  --nav-width: 1024px;
  --main-width: 800px;
  --header-height: 60px;
  --footer-height: 60px;
  --radius: 8px;
  --rem-size: 17px;

  --primary: rgba(0, 0, 0, 0.88);
  --secondary: rgba(0, 0, 0, 0.56);
  --tertiary: rgba(0, 0, 0, 0.16);
  --pop: hotpink;

  --theme-bg: #ffffff;
  --list-bg: linear-gradient(135deg, #eee, #f8f4f2, #fffefe);
  --article-bg: linear-gradient(135deg, #fffefe, #ffffff, #fffefc);
  --list-silcrow-bg: #f3f1f0;
  --single-silcrow-bg: #fffefe;

  --chroma-bg: #1c1d21;
  --code-bg: #e5e5e5;
  --border: #eee;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: rgba(240, 240, 240, 0.88);
    --secondary: rgba(240, 240, 240, 0.56);
    --tertiary: rgba(240, 240, 240, 0.16);

    --theme-bg: #090909;
    --list-bg: linear-gradient(135deg, #1c1c1c, #262020, #111);
    --article-bg: linear-gradient(135deg, #090909, #191111, #090909);
    --list-silcrow-bg: #221e1e;
    --single-silcrow-bg: #0c0a0a;

    --chroma-bg: #2a2a2a;
    --code-bg: #3f3f3f;
    --border: #5f5f5f;
  }
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  -webkit-tap-highlight-color: transparent;
  font-size: var(--rem-size);
}
body {
  margin: 0;
  color: var(--primary);
  background-color: var(--theme-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  word-break: break-word;
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section, address {
  display: block;
  font-style: normal;
}
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.2;
}
p {
  margin-top: 0;
  margin-bottom: 0;
}
strong, b {
  font-weight: 500;
}
ul {
  margin: 0;
  padding: 0;
}
a {
  color: var(--primary);
  text-decoration: none;
}
figure {
  margin: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
button, input, textarea {
  padding: 0;
  font: inherit;
  background: transparent;
  border: 0;
}
button, input[type='button'], input[type='submit'] {
  cursor: pointer;
}
input, textarea {
  padding: 0;
  border: 0;
  outline: 0;
}
input:-webkit-autofill, textarea:-webkit-autofill {
  box-shadow: 0 0 0 50px #fff inset;
}
img {
  display: block;
  max-width: 100%;
}

/* Body */
body.list { background: var(--list-bg) }
body.single { background: var(--article-bg) }

/* Main */
main {
  position: relative;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin-left: auto;
  margin-right: auto;
  padding: var(--gap);
}

/* Navigations */
header > nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: calc(var(--nav-width) + var(--gap) * 2);
  margin-left: auto;
  margin-right: auto;
}
header > nav a {
  display: block;
  line-height: var(--header-height);
  margin-left: var(--gap);
}

header > nav h3 {
  font-size: 1.8rem;
  font-weight: 700;
}

nav a {
  color: var(--primary);
}

ul.menu {
  margin-left: var(--gap);
  margin-right: var(--gap);
}
ul.menu {
  display: flex;
  list-style: none;
  word-break: keep-all;
  overflow-x: auto;
}
ul.menu li + li {
  margin-left: var(--gap);
}
ul.menu a {
  font-size: 0.9rem;
}
nav.pagination {
  display: flex;
}
nav.pagination a {
  color: var(--primary);
  font-size: 0.75rem;
  line-height: 2rem;
  background: var(--theme-bg);
  border-radius: calc(36px / 2);
  border-width: 1px;
  border-style: dotted;
  border-color: var(--theme-bg);
}
nav.pagination a:hover {
  border-color: var(--pop);
  color: var(--pop);
}
nav.pagination a.prev {
  padding-left: 16px;
  padding-right: 18px;
}
nav.pagination a.next {
  margin-left: auto;
  padding-left: 18px;
  padding-right: 16px;
}

/* Indices */
header h1 {
  margin-top: calc(var(--gap) * 2);
  margin-bottom: var(--gap);
}

article#hero {
  padding: unset;
  background: inherit;
  margin-bottom: var(--header-height);
}
article#hero header h1 {
  font-size: 2.5rem;
}
article.card:hover header h1 {
  color: var(--pop);
}
article#hero section {
  margin-top: 14px;
  margin-bottom: 14px;
  font-size: 1rem;
  color: var(--secondary);
  display: block;
}
article#hero footer {
  font-size: 0.85rem;
  color: var(--secondary);
}

article.card {
  position: relative;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--article-bg);
  border-radius: var(--radius);
  transition: transform 0.1s;
}
article.card:active {
  transform: scale(0.99);
}
article.card header h2 {
  font-size: 1.5rem;
}
article.card:hover header h2 {
  color: var(--pop);
}
article.card section {
  margin-top: 8px;
  margin-bottom: 8px;
  color: var(--secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
article.card p {
  margin-top: 0;
  margin-bottom: 0;
}
article.card footer {
  color: var(--secondary);
  font-size: 0.75rem;
}
article.card header a {
  color: inherit;
}
article.card header a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

/* Posts */
body.single article header {
  margin-top: 24px;
  margin-bottom: var(--content-gap);
}
summary h1 {
  margin-bottom: 2px;
  font-size: 2.5rem;
  color: var(--primary);
  transform: translateX(-2px);
}
details {
  display: block;
  color: var(--pop);
  font-size: 0.85rem;
  font-weight: 700;
}
details time + address::before {
  content: ' · ';
}
details address {
  display: inline-block;
}
details summary {
  display: block;
  outline: none;
}
details summary::-webkit-details-marker {
  display: none;
}
section h1 {
  margin-top: 40px;
  margin-bottom: 32px;
}
section h2 {
  margin-top: 32px;
  margin-bottom: 24px;
}
section h3,
section h4,
section h5,
section h6 {
  margin-top: 24px;
  margin-bottom: 16px;
}
section a {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: var(--pop);
}
section a code {
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
  box-shadow: 0 -1px 0 var(--pop) inset;
}
section aside {
  font-size: 0.9rem;
  font-style: italic;
}
section del {
  text-decoration: none;
  background: linear-gradient(to right, var(--primary) 100%, transparent 0) 0 50% / 1px 1px repeat-x;
}
section p,
section ul,
section ol,
section dl {
  margin-bottom: var(--content-gap);
}
section ul,
section ol {
  padding-left: 20px;
}
section li p {
  margin-bottom: 0;
}
section dl {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
}
section dt {
  width: 25%;
  font-weight: 700;
}
section dd {
  width: 75%;
  margin-left: 0;
  padding-left: 10px;
}
section dt ~ dt,
section dd ~ dd {
  margin-top: 10px;
}
section table {
  margin-bottom: 32px;
}
section table th,
section table:not(.highlighttable) td {
  min-width: 80px;
  padding: 12px 8px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
section table th {
  font-size: 0.75rem;
  text-align: left;
}
section table:not(.highlighttable) td code:only-child {
  margin-left: 0;
  margin-right: 0;
}
section .highlight,
section pre {
  margin-left: calc(var(--radius) * -1);
  margin-right: calc(var(--radius) * -1);
  margin-bottom: 32px;
  background: var(--chroma-bg) !important;
  border-radius: var(--radius);
}
section ul pre {
  margin-left: calc(var(--gap) * -2)
}
section .highlight pre {
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
}
/* table */
section .highlighttable {
  table-layout: fixed;
}
section .highlighttable td:first-child {
  width: 40px;
}
section .highlighttable td .linenodiv {
  padding-right: 0 !important;
}
section .highlighttable td .linenodiv pre,
section .highlighttable td .highlight {
  margin-bottom: 0;
}
section .highlighttable td .highlight pre code::-webkit-scrollbar {
  display: none;
}
/* inline */
section .highlight span {
  background: transparent !important;
}

.single section code {
  margin-left: 2px;
  margin-right: 2px;
  padding: 2px 3px;
  font-family: 'Go Mono', Menlo, Monaco, 'Courier New', Courier, monospace;
  font-size: 0.78em;
  background: var(--code-bg);
  border-radius: 1px;
}
.single section pre code {
  display: block;
  margin-left: 0;
  margin-right: 0;
  overflow-x: auto;
  padding: var(--gap);
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  border-radius: 0;
}
section blockquote {
  margin: 0 0 0 calc(var(--gap) * -1);
  padding: 0 0 0 21px;
  border-left: 3px solid var(--primary);
}

/* Decorations */
article hr {
  height: 1px;
  margin-top: calc(var(--content-gap) * 2);
  margin-bottom: calc(var(--content-gap) * 2);
  background: var(--pop);
  border-top: 1px solid var(--pop);;
  text-align: center;
  overflow: visible;
  width: 100%;
}
article hr::after {
  content: '§';
  display: inline-block;
  position: relative;
  top: -14px;
  padding: 0 10px 3px 8px;
  background: var(--theme-bg);
  color: var(--pop);;
  font-size: 1rem;
  -webkit-transform: rotate(90deg);
  -moz-transform: rotate(90deg);
  transform: rotate(90deg);
}
body.list article hr::after {
  position: relative;
  background: var(--list-silcrow-bg);
}
body.single article hr::after {
  background: var(--single-silcrow-bg);
}

.lambent:hover, .lambent:active {
  -webkit-mask-image: linear-gradient(-75deg, rgba(0,0,0,.6) 30%, #000 50%, rgba(0,0,0,.6) 70%);
  -webkit-mask-size: 200%;
  animation: lambent 2s linear infinite;
}

@keyframes lambent {
  from { -webkit-mask-position: 150% }
  to { -webkit-mask-position: -50% }
}

section iframe {
  max-width: 100%;
}


/* Tags under post */
nav.tags {
  margin-top: 56px;
}
nav.tags li {
  display: inline-block;
}
nav.tags li + li {
  margin-left: 3px;
}
nav.tags a {
  display: block;
  padding: 0 14px;
  margin-bottom: 8px;
  color: var(--secondary);
  font-size: 0.85rem;
  line-height: 2.5;
  background: var(--code-bg);
  border-radius: 2px;
}
nav.tags a:hover {
  background: var(--border);
  color: var(--pop);
}

/* Page footer */
body > footer {
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin-left: auto;
  margin-right: auto;
  padding: calc((var(--footer-height) - var(--gap)) / 2) var(--gap);
  color: var(--secondary);
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.5;
}
body > footer address::before {
  content: '©' ' ' attr(data-year) ' ';
}
body > footer address {
  margin-left: 1px;
  margin-right: 1px;
}
body > footer a {
  color: inherit;
}

a:hover {
  color: var(--pop);
  text-decoration-style: dotted;
  text-decoration-skip-ink: none;
  text-decoration-color: var(--pop);
}

/* 404 */
article.not-found {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80%;
  font-size: 10rem;
  font-weight: 700;
}

/* Syntax highlights */
.chroma { color: #f8f8f2; background-color: #272822 }
.chroma .err { color: #960050; background-color: #1e0010 }
.chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
.chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
.chroma .hl { display: block; width: 100%;background-color: #ffffcc }
.chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
.chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
.chroma .k { color: #66d9ef }
.chroma .kc { color: #66d9ef }
.chroma .kd { color: #66d9ef }
.chroma .kn { color: #f92672 }
.chroma .kp { color: #66d9ef }
.chroma .kr { color: #66d9ef }
.chroma .kt { color: #66d9ef }
.chroma .na { color: #a6e22e }
.chroma .nc { color: #a6e22e }
.chroma .no { color: #66d9ef }
.chroma .nd { color: #a6e22e }
.chroma .ne { color: #a6e22e }
.chroma .nf { color: #a6e22e }
.chroma .nx { color: #a6e22e }
.chroma .nt { color: #f92672 }
.chroma .l { color: #ae81ff }
.chroma .ld { color: #e6db74 }
.chroma .s { color: #e6db74 }
.chroma .sa { color: #e6db74 }
.chroma .sb { color: #e6db74 }
.chroma .sc { color: #e6db74 }
.chroma .dl { color: #e6db74 }
.chroma .sd { color: #e6db74 }
.chroma .s2 { color: #e6db74 }
.chroma .se { color: #ae81ff }
.chroma .sh { color: #e6db74 }
.chroma .si { color: #e6db74 }
.chroma .sx { color: #e6db74 }
.chroma .sr { color: #e6db74 }
.chroma .s1 { color: #e6db74 }
.chroma .ss { color: #e6db74 }
.chroma .m { color: #ae81ff }
.chroma .mb { color: #ae81ff }
.chroma .mf { color: #ae81ff }
.chroma .mh { color: #ae81ff }
.chroma .mi { color: #ae81ff }
.chroma .il { color: #ae81ff }
.chroma .mo { color: #ae81ff }
.chroma .o { color: #f92672 }
.chroma .ow { color: #f92672 }
.chroma .c { color: #75715e }
.chroma .ch { color: #75715e }
.chroma .cm { color: #75715e }
.chroma .c1 { color: #75715e }
.chroma .cs { color: #75715e }
.chroma .cp { color: #75715e }
.chroma .cpf { color: #75715e }
.chroma .gd { color: #f92672 }
.chroma .ge { font-style: italic }
.chroma .gi { color: #a6e22e }
.chroma .gs { font-weight: bold }
.chroma .gu { color: #75715e }

