/* Prefer local STZhongsong, then the bundled CJK webfont. Latin and digits use the browser serif. */
@font-face {
  font-family: "Blog Chinese";
  src: local("STZhongsong"), local("华文中宋");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE10-FE1F, U+FE30-FE4F, U+FF00-FFEF, U+20000-323AF;
}
 
/* general */
:root {
  --site-body-size: clamp(16px, 2.4vw, 21px);
  --article-body-size: calc(var(--site-body-size) - 4px);
  --bg-color: #fafafa;
  --code-bg-color: #f4f4f4;
  --text-color: #212121;
  --secondary-color: #808080;
  --tertiary-color: #b0b0b0;
  --link-color: #b5c8cf;
  --link-hover-color: #618794;
  --link-bg-color: #dae4e7;
  --selection-color: #dae4e7;
  --body-stack: "Blog Chinese", "Blog Chinese Web", serif;
  --secondary-stack: "Blog Chinese", "Blog Chinese Web", serif;
  --title-stack: "Blog Chinese", "Blog Chinese Web", serif;
}

html {
  height: 100%;
}
 
body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--body-stack);
  font-size: 16px;
  font-size: var(--site-body-size);
  margin: auto;
  min-height: 100%;
  position: relative;
  width: 100%;
}
 
/* wrapper */
#wrapper {
  background: none;
  border: none;
  box-sizing: border-box;
  display: block;
  margin: 3rem auto 10rem auto;
  max-width: 100%;
  padding: 1em;
  width: 32em;
}
 
@media all and (max-width:760px) {#wrapper {margin-top: 3rem;}}
@media all and (max-width:520px) {#wrapper {margin-top: 1rem;}}
 
/* header */
#header {
  border-bottom: solid 1px var(--secondary-color);
  line-height: 0.6em;
  padding: 0.25em 0;
}
 
#title {
  line-height: 1.5;
  overflow-wrap: anywhere;
  font-family: var(--title-stack);
  font-size: 2em;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin: 1em 0 0.35em;
  text-align: center;
}

#header nav {
  margin: 2em 0;
  text-align: center;
}

.nav-link, .nav-spacer, .article-more-link {
  font-family: var(--secondary-stack);
  color: var(--secondary-color);
}

.nav-spacer {
  margin: 0 0.5em;
}

/* posts */
.article {
  border-bottom: solid 1px var(--secondary-color);
  margin: 2em 0;
  padding-bottom: 1em;
}

.article-header {
  margin-bottom: 1.75em;
  text-align: center;
}
 
.article-title {
  font-family: var(--title-stack);
  font-size: calc(2em - 6px);
  font-weight: normal;
  letter-spacing: 0.05em;
  margin-bottom: .25em;
}

.article-entry {
  font-size: var(--article-body-size);
  line-height: 1.5;
  margin-bottom: 1em;
  overflow: visible;
}

.article-entry p {
  margin-bottom: 2rem;
  text-indent: 2em;
}

.article-category {
  font-size: calc(1em - 6px);
  line-height: 1.5;
}
 
.article-meta, .archive-article-date, .article-nav, .page-nav, .article-footer, .archive-article-word-count {
  color: var(--secondary-color);
  font-family: var(--secondary-stack);
  font-size: 0.9em;
  height: auto;
  line-height: inherit;
  margin: 0;
  padding: 0;
}

@media all and (max-width:760px) {
  .article-meta, .archive-article-date, .article-nav, .page-nav, .article-footer, .archive-article-word-count {
    font-size: 1em;
  }
}

/* archive */
.archives-wrap {
  margin: 0.25rem 0;
  position: relative;
  top: 0.5rem;
}

@media all and (max-width:620px) {
  .archives-wrap {
    margin-left: 1rem;
  }
}

.month {
  color: var(--secondary-color);
  cursor: pointer;
  font-family: var(--secondary-stack);
}

.hidden, .hidden-input {
  display: none;
  margin-bottom: 1em;
}

.hidden-input ~ .month::before {
  content: "+ ";
  position: absolute;
  left: -1em;
}

.hidden-input:checked ~ .month::before {
  content: "– ";
}

.hidden-input:checked ~ .hidden {
  display: block;
}

.archive-article {
  margin: 0.25em 0;
  position: relative;
}

.archive-article-header {
  align-items: center;
  display: inline-flex;
}

.archive-article-date {
  position: absolute;
  right: calc(100% - 1.5em);
}

.archive-article-title {
  margin-right: 0.5em;
}

.archive-article-title {
  font: inherit;
  left: 2em;
  letter-spacing: 0;
  margin: 0;
  max-width: calc(100vw - 6rem);
  position: relative;
  text-align: left;
  text-decoration: none;
  text-transform: none;
}

.article-nav {
  display: flex;
  margin: 2em 0;
}

#article-nav-older, #article-nav-newer {
  flex-basis: 50%;
}

#article-nav-newer {
  order: 1;
  text-align: right;
}

/* pagination */
.page-nav {
  margin: 1em 0;
  text-align: center;
}

.page-number, .space, .extend {
  font-size: 1.3em;
  margin: 0 0.4em;
}

.current {
  color: var(--text-color);
}
 
/* typography */
a {
  color: inherit;
  text-decoration: none;
}

p, ul, ol, h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem 0;
}

ul, ol {
  padding-left: 1em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: normal;
  letter-spacing: 0.1em;
  text-align: center;
  text-decoration: none;
}

h1, h2 {
  font-size: 2em;
  letter-spacing: 0;
  margin-top: 2rem;
}

h2 {
  font-size: 1.5em;
}

h3, h4, h5, h6 {
  font-size: 1em;
  font-weight: bold;
  margin-top: 1.5rem;
  text-transform: uppercase;
}

h4, h5, h6 {
  font-size: 0.9em;
  margin-top: 1rem;
}

blockquote {
  display: block;
  margin: 0 0 1em;
  padding-left: .75rem;
  border-left: 1px solid var(--tertiary-color);
}

.article .article-entry blockquote footer, .caption {
  color: var(--secondary-color);
  display: block;
  text-align: center;
}

.article .article-entry blockquote footer cite:before {
  content: " — ";
}

.pullquote {
  border: 0;
  color: var(--secondary-color);
  font-size: 1.2em;
  font-family: var(--secondary-stack);
  margin: 0;
  width: 40%;
}

.pullquote p {
  margin: 0;
}

.pullquote.left {
  float: left;
  padding: 1em 1em 1em 0;
  text-align: left;
}

.pullquote.right {
  float: right;
  padding: 0 1em 1em 1em;
  text-align: right;
}

.caption {
  color: #aeb4b9;
  display: block;
  font-size: 0.8em;
  text-align: center;
}

.katex {
  font-size: 1.1em;
}

.article-entry a {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: border-bottom;
  border-bottom: 3px solid var(--link-color);
  transition-duration: .3s;
  transition-property: border-bottom;
}
 
.article-entry a:hover {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: border-bottom;
  border-bottom: 3px solid var(--link-hover-color);
  transition-duration: .3s;
  transition-property: border-bottom;
}

#title a, .article-title a, a.nav-link, .archive-article-title a, .article-nav a, a.page-number, a.extend, .month, .article-footer a, .article-category a, .article-tag a, .article-more-link a {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: background;
  transition-duration: .3s;
  transition-property: background;
}
 
#title a:hover, .article-title a:hover, a.nav-link:hover, .archive-article-title a:hover, .article-nav a:hover, a.page-number:hover, a.extend:hover, .month:hover, .article-footer a:hover, .article-category a:hover, .article-tag a:hover, .article-more-link a:hover {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: background;
  background: var(--link-bg-color) !important;
  transition-duration: .3s;
  transition-property: background;
}

.article-category, .article-tag {
  color: var(--secondary-color);
  font-family: var( --secondary-stack);
  margin-top: 2em;
}

.article-more-link {
  font-size: 0.9em;
  letter-spacing: 0.1em;
  margin-bottom: 1.1em;
  text-align: center;
  text-transform: uppercase;
}
 
/* miscellaneous */
img {
  box-sizing: border-box;
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

a img {
  border: 0;
}

a img:hover {
  border: 0;
}

.article-gallery img, table {
  margin: 1em auto;
}

td, th, table caption, table td, table th {
  border-bottom: 1px solid var(--tertiary-color);
  padding: 0.25em;
}

.video-container {
  position: relative;
  padding-top: 56.25%;
  margin-bottom: 1em;
  height: 0;
  overflow: hidden;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin-top: 0;
}
 
::selection {
  background-color: var(--selection-color);
}

#settings-container {
  background: var(--bg-color);
  border-top: 1px solid var(--tertiary-color);
  bottom: 0;
  position: fixed;
  right: 1rem;
}

#dark-mode {
  background: transparent;
  border: 0;
  color: var(--secondary-color);
  font: inherit;
}

#dark-mode:focus-visible {
  outline: none;
  text-decoration: underline;
}

#sans-font, #dark-mode {
  cursor: pointer;
  float: right;
  padding: 0.5em;
}

/* Custom home sections */
.home-sections {
  margin-top: 2.5rem;
}

.home-section + .home-section {
  margin-top: 3rem;
}

.home-section-heading {
  display: block;
  margin-bottom: 1rem;
}

.home-section-title {
  font-family: var(--secondary-stack);
  font-size: 1.1em;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 1rem;
  text-align: center;
}

.home-section-heading .home-section-title {
  margin-bottom: 0;
}

.home-archive-link, .home-card-label {
  color: var(--secondary-color);
  font-family: var(--secondary-stack);
  font-size: 0.75em;
  line-height: 1.5;
}

.home-list {
  display: flex;
  flex-direction: column;
}

.home-series-list, .home-recent-list {
  gap: 0.75rem;
}

.home-card {
  align-items: center;
  border-bottom: 0;
  box-sizing: border-box;
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  transition: background-color 0.2s;
}

.home-series-card {
  border: 0;
  border-radius: 0;
  position: relative;
}

.home-series-card::after {
  background: var(--tertiary-color);
  bottom: 0;
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  width: 100%;
}

.home-series-card:nth-child(2)::after { width: 78%; }
.home-series-card:nth-child(3)::after { width: 56%; }

.home-card:hover, .home-card:focus-visible {
  background: transparent;
  color: var(--link-hover-color);
  border-bottom-width: 0;
}

.home-series-card:hover, .home-series-card:focus-visible {
  border: 0;
}

.home-card:focus-visible, .home-archive-link:focus-visible {
  outline: none;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.home-series-number {
  color: var(--secondary-color);
  font-family: var(--secondary-stack);
  font-size: 1.25em;
  font-variant-numeric: tabular-nums;
}

.home-card-content {
  flex: 1;
  min-width: 0;
}

.home-card-title {
  font-size: 1.15em;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.4;
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

.home-card-arrow {
  color: var(--secondary-color);
  flex-shrink: 0;
}

.home-recent-item {
  border: 0;
  position: relative;
}

.home-recent-item::after {
  background: var(--tertiary-color);
  bottom: 0;
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  width: 100%;
}

.home-recent-item:nth-child(2)::after { width: 78%; }
.home-recent-item:nth-child(3)::after { width: 56%; }


.home-card-summary {
  color: var(--secondary-color);
  font-size: 0.85em;
  line-height: 1.6;
  margin: 0.65rem 0 0;
  overflow-wrap: anywhere;
}

/* Header location and the independent archive link keep section headings centered. */
.site-location {
  color: var(--secondary-color);
  font-family: var(--secondary-stack);
  font-size: 0.7em;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.6;
  margin: 0;
  text-align: center;
}

.site-location span {
  margin-right: 0.4em;
}

.home-archive-link {
  display: block;
  margin-top: 0.7rem;
  text-align: right;
}

/* Collections use the same typography and horizontal separators as the home page. */
.home-card-label {
  display: block;
}


.collection-page {
  margin-top: 2.5rem;
}

.collection-header {
  border-bottom: 1px solid var(--tertiary-color);
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
}

.collection-subtitle {
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.collection-title {
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}

.collection-description {
  color: var(--secondary-color);
  font-size: 0.85em;
  line-height: 1.8;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.collection-empty {
  color: var(--secondary-color);
  font-size: 0.85em;
  line-height: 1.8;
  text-align: center;
}

/* Smaller collection titles. */
.collection-title { font-size: 1.75em; font-weight: 700; }

.series-breadcrumb { color: var(--secondary-color); font-size: 0.75em; line-height: 1.8; margin: 2rem 0 1rem; text-align: center; }
.series-breadcrumb a:hover { text-decoration: underline; }
.collection-children { margin-bottom: 2.5rem; }
.collection-tags { margin-top: 1rem; font-size: calc(0.75em - 6px); line-height: 1.8; }
.collection-tags a { border-bottom: 1px solid var(--tertiary-color); }

/* Article title and timestamp sizes follow the reading body at every screen width. */
.article-type-post .article-title {
  font-size: calc(var(--article-body-size) + 4px);
  font-weight: 700;
}

.article-type-post .article-meta {
  font-size: calc(var(--article-body-size) - 2px);
}

#header .nav-link {
  font-size: calc(1em - 2px);
}

/* Reading navigation stays within the article's closest collection. */
.series-pagination {
  font-size: var(--article-body-size);
  margin-top: 2em;
}

.series-pagination-context {
  line-height: 1.5;
  text-align: center;
}

.series-pagination .article-nav {
  display: grid;
  font-size: var(--article-body-size);
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  line-height: 1.5;
  margin: 1.5em 0;
}

.article-nav-next {
  text-align: right;
}

.article-nav-title {
  margin-top: 0.35em;
  overflow-wrap: anywhere;
}

/* Recent Updates uses the same type scale as Series with an exact 2px reduction. */
.home-section {
  --home-font-offset: 0px;
  font-size: calc(var(--site-body-size) - var(--home-font-offset));
}

.home-section[aria-labelledby="recent-posts-title"] {
  --home-font-offset: 2px;
}

.home-section .home-section-title {
  font-size: calc(var(--site-body-size) * 1.1 - var(--home-font-offset));
}

.home-section .home-card-title {
  font-size: calc(var(--site-body-size) * 1.15 - var(--home-font-offset));
}

.home-section .home-card-label, .home-section .home-archive-link {
  font-size: calc(var(--site-body-size) * 0.75 - var(--home-font-offset));
}

.home-section .home-card-summary {
  font-size: calc(var(--site-body-size) * 0.85 - var(--home-font-offset));
}

/* Collection lists use equal separators and the Articles heading's text size. */
.collection-page .home-series-card::after,
.collection-page .home-recent-item::after,
.collection-index .home-series-card::after {
  width: 100%;
}

.collection-page .home-card-title,
.collection-index .home-card-title {
  font-size: 1.1em;
  text-transform: none;
}

/* Archives: mother collections, nested series and a final chronological index. */
.archives-directory { margin-top: 2.5rem; }
.archives-directory-title { margin-bottom: 1.75rem; }
.archive-collection { border: 0; }
.archives-by-collection > .archive-collection, .archive-timeline {
  border-bottom: 1px solid var(--tertiary-color);
  padding: 1rem 0;
}
.archive-collection-summary, .archive-month-summary {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  gap: 0.65rem;
  line-height: 1.6;
  list-style: none;
}
.archive-collection-summary::-webkit-details-marker, .archive-month-summary::-webkit-details-marker { display: none; }
.archive-collection-summary::before, .archive-month-summary::before { content: '+'; flex-shrink: 0; width: 0.8em; color: var(--secondary-color); }
.archive-collection[open] > .archive-collection-summary::before, .archive-month[open] > .archive-month-summary::before { content: '−'; }
.archive-collection-summary { font-size: 1.1em; font-weight: 700; }
.archive-count { color: var(--secondary-color); flex-shrink: 0; font-size: 0.7em; font-weight: 400; margin-left: auto; }
.archive-collection-content { padding: 0.5rem 0 0.25rem 1rem; }
.archive-tree-list { font-size: var(--article-body-size); list-style: none; margin: 0; padding: 0; }
.archive-tree-list > li { margin: 0; padding: 0; }
.archive-tree-list .archive-collection { margin: 0.75rem 0; }
.archive-tree-list .archive-collection-summary { font-size: 1em; }
.archive-directory-link { font-size: calc(var(--article-body-size) - 2px); line-height: 1.6; margin: 0.25rem 0 0.6rem; text-align: right; }
.archive-directory-link a { color: var(--secondary-color); }
.archive-directory-post { align-items: baseline; border: 0; display: flex; gap: 1rem; justify-content: space-between; line-height: 1.7; padding: 0.55rem 0; }
.archive-directory-post-title { min-width: 0; overflow-wrap: anywhere; text-transform: none; }
.archive-directory-post-date { color: var(--secondary-color); flex-shrink: 0; font-size: calc(var(--article-body-size) - 2px); }
.archive-directory-post:hover, .archive-directory-link a:hover { color: var(--link-hover-color); text-decoration: underline; text-underline-offset: 0.2em; }
.archives-directory summary:focus-visible, .archives-directory a:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 0.25em; }
.archive-month { margin: 0.75rem 0; }
.archive-month-summary { color: var(--secondary-color); font-size: 0.85em; }
.archive-month > .archive-tree-list { padding-left: 1rem; }
@media (max-width: 520px) {
  .archive-directory-post { align-items: flex-start; flex-direction: column; gap: 0.1rem; }
  .archive-collection-content, .archive-month > .archive-tree-list { padding-left: 0.65rem; }
}

/* Quiet, right-aligned credits and writing license at the end of each page. */
.site-footer {
  color: var(--secondary-color);
  font-family: var(--body-stack);
  font-size: 12px;
  line-height: 1.8;
  margin-top: 4rem;
  text-align: right;
}
.site-footer p { margin: 0 0 0.3em; }
.site-footer a { text-decoration: underline; text-underline-offset: 0.2em; }
.site-footer a:hover { color: var(--link-hover-color); }

/* Optional BGM note below the date; the author's field supplies only the content. */
.article-bgm {
  color: var(--tertiary-color);
  font-family: var(--body-stack);
  font-size: 12px;
  line-height: 1.8;
  margin: 0.5rem 0 0;
  text-align: center;
  overflow-wrap: anywhere;
}

/* The question box shares the site's type, colors, and open horizontal rules. */
.question-box { margin: 3rem 0 2rem; }
.question-box h2 {
  font-family: var(--title-stack);
  font-size: calc(var(--article-body-size) + 4px);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 2.5rem;
  text-align: center;
}
.question-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.question-botcheck { display: none; }
.question-box textarea {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--tertiary-color);
  border-radius: 0;
  box-sizing: border-box;
  color: var(--text-color);
  display: block;
  font-family: var(--body-stack);
  font-size: var(--article-body-size);
  line-height: 1.8;
  min-height: 15rem;
  padding: 0.75rem 0.25rem 1.5rem;
  resize: vertical;
  width: 100%;
}
.question-box textarea::placeholder { color: var(--secondary-color); opacity: 1; }
.question-box textarea:focus { border-bottom-color: var(--text-color); outline: none; }
.question-box textarea:focus-visible { box-shadow: 0 1px 0 var(--text-color); }
.question-actions { align-items: baseline; display: flex; gap: 1.5rem; margin-top: 1rem; }
#question-result { color: var(--secondary-color); flex: 1; font-size: 12px; line-height: 1.8; margin: 0; overflow-wrap: anywhere; }
#question-result[data-error] { color: var(--text-color); }
.question-box button {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--secondary-color);
  cursor: pointer;
  flex-shrink: 0;
  font-family: var(--body-stack);
  font-size: var(--article-body-size);
  line-height: 1.8;
  min-height: 44px;
  padding: 0.25rem 0;
}
.question-box button:hover, .question-box button:focus-visible {
  border-bottom-color: currentColor;
  color: var(--text-color);
  outline: none;
}
.question-box button:disabled { cursor: wait; opacity: 0.55; }
@media (max-width: 520px) {
  .question-box { margin-top: 2.5rem; }
  .question-box h2 { margin-bottom: 1.75rem; }
  .question-box textarea { min-height: 13rem; }
  .question-actions { gap: 0.75rem; }
}
