/* general */
:root {
  --bg-color: #fafafa;
  --code-bg-color: #f4f4f4;
  --text-color: #212121;
  --secondary-color: #707070;
  --tertiary-color: #b0b0b0;
  --link-color: #b5c8cf;
  --link-hover-color: #618794;
  --link-bg-color: #dae4e7;
  --selection-color: #dae4e7;
  --body-stack: "Lora", "Georgia", "Times New Roman", "Noto Serif TC", "Noto Serif SC", "Noto Serif JP", "Songti SC", "Songti TC", "STSong", serif;
  --secondary-stack: "Lato", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Verdana", sans-serif;
  --title-stack: "Playfair Display SC", "Georgia", "Noto Serif TC", "Noto Serif SC", "Noto Serif JP", "Songti SC", "Songti TC", "STSong", serif;
}

html {
  height: 100%;
}
 
body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--body-stack);
  font-size: 16px;
  font-size: clamp(16px, 2.4vw, 21px);
  margin: auto;
  min-height: 100%;
  position: relative;
  width: 100%;
}
 
/* wrapper */
#wrapper {
  background: none;
  border: none;
  box-sizing: border-box;
  display: block;
  margin: 2rem auto 10rem auto;
  max-width: 100%;
  padding: 1em;
  width: 32em;
}

@media all and (max-width:760px) {#wrapper {margin-top: 2rem;}}
@media all and (max-width:520px) {#wrapper {margin-top: 1rem;}}
 
/* header */
#header {
  border-bottom: solid 1px var(--secondary-color);
  padding: 0.25em 0 1.5em 0;
}
 
#title {
  font-family: var(--title-stack);
  font-size: 2em;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin: 0.8em 0 0.8em 0;
  text-align: center;
}

#header nav {
  margin: 0 0 0.4em 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: 1.5em;
  font-weight: normal;
  letter-spacing: 0.05em;
  margin-bottom: .25em;
}

.article-entry {
  line-height: 1.5;
  margin-bottom: 1em;
  overflow: visible;
}

.article-entry hr {
  border: 0;
  border-top: 1px solid var(--tertiary-color);
  margin: 2em 1em;
  opacity: .65;
}

.article-category {
  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,
.month,
.multiline-link-text {
  -webkit-box-decoration-break: clone;
  background-image: linear-gradient(hsla(0,0%,50%,.33), hsla(0,0%,50%,.33));
  background-position: 50% 100%;
  background-repeat: no-repeat;
  background-size: 0 3px;
  box-decoration-break: clone;
  transition: background-size .3s;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible,
.month:hover,
.article-nav-link-wrap:hover .multiline-link-text,
.article-nav-link-wrap:focus-visible .multiline-link-text {
  background-size: 100% 3px;
}

p, ul, ol {
  margin: 0 0 1rem 0;
}

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

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

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

.article-entry h1:after, .article-entry h2:after {
  content: "";
  display: block;
  position: relative;
  top: 0.1em;
  border-bottom: 1px solid hsla(0,0%,50%,.33);
}

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;
  background-image: none;
  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;
}
 
.article-nav-link-wrap {
  background-image: none;
}

.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;
}

/* untitled posts */
.article-type-note {
  border-bottom: 0;
  margin: 1em clamp(1em, 5vw, 2em) 1.6em;
  padding-bottom: 0;
}

.article-type-note .article-header {
  margin-bottom: .6em;
}

.article-type-note .article-meta {
  font-size: 0.75rem;
}

.article-type-note .article-entry {
  margin-bottom: 0;
}

.article-date-link {
  display: inline-block;
}

.note-group {
  border-bottom: solid 1px var(--secondary-color);
  margin-bottom: 1.5em;
}

.note-group > .article-type-note {
  margin-top: 0;
}

.article:has(+ .note-group) {
  margin-bottom: 1.5em;
}

.note-group + .article {
  margin-top: 1.5em;
}

.note-group-expandable > .article-type-note {
  margin-bottom: .5em;
}

.note-group-fold {
  --note-control-edge-gap: 1rem;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  position: relative;
}

.note-group-fold:has(.note-group-more[open]) {
  overflow: visible;
}

.note-group-fold[data-animating="true"]::after {
  background: linear-gradient(to bottom, transparent, var(--bg-color));
  bottom: 0;
  content: "";
  height: 3em;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  z-index: 1;
}

.note-group-preview {
  height: 4.15em;
  margin: 0 clamp(1em, 5vw, 2em);
  mask-image: linear-gradient(to bottom, #000 20%, rgba(0, 0, 0, .16) 100%);
  order: 1;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, rgba(0, 0, 0, .16) 100%);
}

.note-group-preview .article-header {
  margin-bottom: .6em;
}

.note-group-preview .article-meta {
  font-size: 0.75rem;
  text-align: center;
}

.note-group-preview .article-entry {
  margin-bottom: 0;
}

.note-group-more {
  margin-top: -3rem;
  order: 2;
  position: relative;
}

.note-group-more summary {
  align-self: center;
  background: var(--bg-color);
  border: 1px solid var(--tertiary-color);
  border-radius: 999px;
  color: var(--secondary-color);
  cursor: pointer;
  font-family: var(--secondary-stack);
  font-size: 0.75rem;
  list-style: none;
  margin: 0 auto var(--note-control-edge-gap);
  padding: .35em .9em;
  text-align: center;
  transition: background-color .3s, border-color .3s, color .3s;
  width: max-content;
}

.note-group-more summary:active,
.note-group-more summary:focus-visible {
  background-color: var(--text-color);
  border-color: var(--text-color);
  color: var(--bg-color);
}

@media (hover: hover) and (pointer: fine) {
  .note-group-more summary:hover {
    background-color: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
  }
}

.note-group-more summary::marker {
  content: "";
}

.note-group-more summary::-webkit-details-marker {
  display: none;
}

.note-group-collapse-label {
  display: none;
}

.note-group-more[open] {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  order: 1;
  padding-bottom: var(--note-control-edge-gap);
}

.note-group-more[open] + .note-group-preview {
  display: none;
}

.note-group-more[open] summary {
  bottom: var(--note-control-edge-gap);
  margin: 0 auto;
  order: 2;
  position: sticky;
  z-index: 2;
}

.note-group-fold[data-animating="true"] .note-group-more[open] summary {
  left: 50%;
  margin: 0;
  position: fixed;
  transform: translateX(-50%);
}

.note-group-more[open] .note-group-more-label {
  display: none;
}

.note-group-more[open] .note-group-collapse-label {
  display: inline;
}

.note-group-expanded {
  order: 1;
}

.note-group-expanded .article-type-note {
  margin-bottom: .5em;
  margin-top: .5em;
}

.note-group-expanded .article-type-note:first-child {
  margin-top: 0;
}

.note-group-more .article-type-note:last-child {
  margin-bottom: 1em;
}

 
/* miscellaneous */
img {
  box-sizing: border-box;
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

a img {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: border;
  border: 3px solid var(--bg-color);
  transition-duration: .3s;
  transition-property: border;
}

a img:hover {
  -webkit-transition-duration: .3s;
  -webkit-transition-property: border;
  border: 3px solid var(--secondary-color);
  transition-duration: .3s;
  transition-property: border;
}

.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 {
  bottom: 0;
  position: fixed;
  right: 0;
  width: 4em;
  height: 4em;
  border-radius: 2em;
}

#dark-mode {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  user-select: none;
  padding: 0.5em;
  font-size: 2em;
}
