:root {
  --page-pad: 0.8em;       /* gutter between the viewport and cards */
  --content-pad: 1.25rem;  /* left/right padding inside every card */
}

body {
  font-family:
    "Helvetica Neue", Helvetica, Arial,
    "PingFang TC",   /* macOS/iOS 傳統中文 */
    "PingFang SC",   /* macOS/iOS 簡體中文 */
    "Noto Sans TC",  /* Google 思源黑體繁體 */
    "Noto Sans SC",  /* Google 思源黑體簡體 */
    "Microsoft JhengHei", /* Windows 正黑體 */
    "Microsoft YaHei",    /* Windows 微軟雅黑 */
    sans-serif;
  margin: 0;
  font-size: 17px;
  font-weight: 400;
}

.main {
  margin: auto;
  max-width: 42rem; /* ≈672px */
}

.main .header-bar {
  padding: 1em var(--page-pad) 0.8em;
}

main {
  padding: 0.8em var(--page-pad) 1.2em;
}

main > *:first-child {
  margin-top: 0;
}

img {
  max-width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

figure {
  margin: 0;
}

figcaption {
  text-align: center;
  font-size: 0.9em;
  font-weight: bold;
}

iframe {
  max-width: 100%;
  width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

p {
  line-height: 1.8;
}

li {
  margin: 0.5em;
  line-height: 1.8;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  line-height: 1.35;
}

h1 { font-size: 1.8em; margin-block: 0.67em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.17em; }
h4 { font-size: 1.12em; }
h5 { font-size: .83em; }
h6 { font-size: .75em; }

a:active, a:focus {
  outline-style: solid;
  outline-width: thin;
}

a:focus-visible {
  outline-style: solid;
  outline-width: 2px;
  outline-offset: 2px;
}

/* navigation */
nav {
  display: flex;
  flex-flow: column;
  justify-content: space-between;
  text-align: center;
}

nav > div {
  display: flex;
  gap: 1rem;
}

.nav-item {
  margin: 0;
  padding: 0.5rem 0.1rem;
  text-decoration: none;
  text-transform: lowercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* no outline on mouse click; keyboard focus gets a clear ring */
.nav-item:active,
.nav-item:focus:not(:focus-visible) {
  outline: none;
}

.nav-item:focus-visible {
  outline: 2px solid;
  outline-offset: 2px;
  border-radius: 0.2em;
  opacity: 1;
}

.nav-item-title {
  position: relative;
  padding-bottom: 0.15em;
}

.nav-item-title:hover {
  text-decoration: underline;
}

.nav-item-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  opacity: 0;
  transform: scaleX(0.6);
  transform-origin: left;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-item:hover .nav-item-title::after,
.nav-item.active .nav-item-title::after,
.nav-item:focus-visible .nav-item-title::after {
  opacity: 0.8;
  transform: scaleX(1);
}

pre {
  margin: 1em 0;
  padding: 0.5em;
  overflow-x: auto;
}

code {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  line-height: 1.6;
}

blockquote {
  padding: 0.5em 0.5em 0.5em 1em;
  margin-left: 0.8em;
  margin-right: 0.8em;
}

table {
  margin: 1em auto;
  border-collapse: collapse;
}

th, td {
  padding: 0.5em;
}

/* wide markdown tables scroll sideways instead of overflowing the card */
.post .content > table {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

/* long URLs and words wrap instead of overflowing on narrow screens */
.post .content,
.post .micro-content,
.post-preview .summary {
  overflow-wrap: anywhere;
}

/* site title */
.siteTitle {
  font-size: 25px;
  margin-bottom: 0.2em;
}

.siteTitle a {
  text-decoration: none;
}

/* single post: the card sets the padding, children share its left edge */
.post {
  margin: 0 0 1.5em;
  padding: 1em var(--content-pad) 1.25em;
}

.post .title {
  margin: 0.3em 0;
  font-size: 1.5em;
  text-align: left;
}

.post-title-divider {
  margin: 0;
  height: 1px;
  border: 0;
  opacity: 0.6;
}

.post .metadata {
  padding: 0.6em 0 1em;
  font-size: 0.8em;
  font-weight: 600;
  line-height: 1.6;
  text-align: left;
}

.post-date-line {
  margin-bottom: 0.4em;
}

.metadata .tags .tag a,
.metadata .categories a,
.metadata .series a,
.metadata .syndicate a {
  text-decoration: underline;
}

.post .content {
  padding-top: 0.6em;
}

.post .content h1,
.post .content h2,
.post .content h3,
.post .content h4,
.post .content h5 {
  margin: 1.2em 0;
}

.post .content p {
  margin: 1em 0;
}

/* post footer */
.post-footer hr {
  width: 100%;
  height: 0;
  border: 0;
}

.post-footer-data {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1em 0 0;
}

.post-footer-data .date,
.post-footer-data .updated {
  text-align: right;
  margin-top: 0.3em;
  padding-bottom: 0.2em;
  font-size: 0.8em;
}

.post-footer-data .syndicate {
  margin-top: 0.3em;
  padding-bottom: 0.2em;
  font-size: 0.9em;
  font-weight: bold;
}

.post-footer-data .tag {
  font-weight: bold;
  margin-bottom: 1em;
}

.post-footer-data .categories {
  padding-top: 0.5em;
}

.post-footer-data .category {
  font-weight: bold;
  display: inline-block;
}

.post-footer-data .category a {
  text-decoration: none;
}

.post-footer-data .series {
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

.post-footer-data .series-name {
  display: inline-block;
}

.post-footer-data .series-name a {
  font-weight: bold;
  text-decoration: none;
}

.tag {
  display: inline-block;
}

.tag a {
  text-decoration: none;
}

/* micro post */
.post .micro-content {
  font-size: 1.1em;
}

.micro-footer-data .date {
  text-align: left;
  margin-top: 0.3em;
  padding-bottom: 0.2em;
  font-size: 0.8em;
}

.micro-footer-data .syndicate {
  margin-top: 0.3em;
  padding-bottom: 0.2em;
  font-size: 0.9em;
}

.micro-footer-data .tags {
  display: flex;
  flex-wrap: wrap;
}

.micro-footer-data .tag a {
  font-size: 0.9em;
}

/* summary list on the blog page */
.post-preview {
  margin: 1.5em 0;
  padding: 1em var(--content-pad);
}

.post-preview header {
  padding-bottom: 0.4em;
}

.post-preview .title {
  margin: 0.3em 0;
}

.post-preview a {
  text-decoration: none;
}

.post-preview-date {
  display: block;
  margin: 0 0 0.2em;
  font-size: 0.8em;
  font-weight: 600;
  white-space: nowrap;
}

.post-preview .meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding-top: 0.3em;
  font-size: 0.8em;
  font-weight: bold;
  text-align: left;
}

.post-preview .summary {
  padding-top: 0.5em;
}

.post-preview .summary p {
  margin: 0.5em 0;
}

.rmore {
  margin-top: 0.5em;
  white-space: nowrap;
  text-align: right;
  font-size: 13px;
}

.rmore a {
  border-radius: 0.2em;
  padding: 0.3em;
}

/* section lists (list.html / li.html) */
.content-list {
  font-size: 1.2em;
}

.content-item {
  display: flow-root;
  margin-bottom: 0.8em;
  padding: 0 var(--content-pad) 0.5em;
}

.content-item a {
  text-decoration: none;
}

.content-item a:hover {
  text-decoration: underline;
}

.post-list {
  display: flex;
  justify-content: space-between;
  margin: 0.5em 0;
}

.post-list .title {
  margin: 0;
  font-size: 16px;
}

.post-list .date {
  margin: 0;
  font-size: 13px;
}

.content-item .meta {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  margin-top: 0.5em;
  padding-top: 0.5em;
  font-size: 0.7em;
}

.content-item .tags {
  margin-bottom: 0.3em;
  font-weight: bold;
}

.content-item .categories,
.content-item .series {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

.content-item .category,
.content-item .series-name {
  font-weight: bold;
  display: inline-block;
}

.content-item .date {
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
}

.content-list-title,
.term-list-title {
  text-align: center;
}

.content-list-title {
  margin-bottom: 0;
}

.content-list-title a,
.term-list-title a {
  text-decoration: none;
}

/* home */
.home-section {
  margin-top: 0.8em;
  padding: 0.8em var(--content-pad) 0.4em;
}

.home-heading {
  margin: 0 0 0.4em;
  font-size: 1.25em;
  letter-spacing: 0.04em;
}

/* archive */
.archive-year {
  margin: 1.8em 0 1.4em;
  padding: 0.6em var(--content-pad) 0.8em;
}

.archive-year > h2 {
  margin: 0 0 0.4em;
  text-align: left;
  letter-spacing: 0.06em;
  font-size: 1.05em;
  font-weight: 600;
}

.archive-year-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-year-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin: 0;
  padding: 0.45em 0;
  line-height: 1.6;
}

.archive-item-date {
  flex: none;
  min-width: 3.2em;
  font-size: 0.85em;
  font-weight: 600;
}

.archive-year-list li a {
  text-decoration: none;
}

.archive-year-list li a:hover {
  text-decoration: underline;
}

/* terms list */
.terms {
  width: 50%;
  margin: 0 auto 1em;
}

.terms a {
  font-size: 1.2em;
  text-decoration: none;
}

.terms .term {
  padding: 0.5em var(--content-pad);
}

.page-nav {
  display: flex;
  justify-content: center;
  flex-flow: row wrap;
  padding: 1em;
  font-weight: bold;
}

.page-nav a {
  text-decoration: none;
}

.page-num {
  text-align: center;
  margin-left: 1em;
  margin-right: 1em;
}

.sitemap {
  margin: auto;
  width: 50%;
  font-size: 1.4em;
}

.related-content {
  margin: 2em 0 1.5em;
  padding: 0.5em var(--content-pad);
}

.related-content .title {
  margin-top: 0.5em;
  font-weight: bold;
}

.err-404 {
  margin: 3em;
  text-align: center;
}

/* site footer */
.copyright {
  font-size: smaller;
  text-align: center;
  margin-top: 1em;
}

.poweredby {
  font-size: smaller;
  text-align: center;
}

.poweredby a {
  text-decoration: underline;
}

.social-links-header,
.social-links-footer {
  display: flex;
  justify-content: center;
  flex-flow: row wrap;
}

.social-links-footer {
  margin-top: 0.5em;
  text-align: center;
}

.social-links-header a,
.social-links-footer a {
  text-decoration: none;
}

.social-link {
  margin: 0.2em;
  font-size: 12px;
  font-weight: 300;
}

.social-link:hover {
  text-decoration: underline;
}

/* GitHub-style alerts (render-blockquote.html) */
.alert {
  padding-top: 0.01em;
  padding-bottom: 0.01em;
}

.alert .alert-heading {
  font-weight: bold;
}

details > summary {
  padding: 0.3em;
  text-decoration: underline;
}

@media only screen and (min-width: 400px) {
  nav {
    flex-flow: row wrap;
  }

  .siteTitle {
    flex-grow: 2;
    flex-basis: 0;
    text-align: left;
  }

  .nav-item-title {
    font-size: 14px;
    font-weight: 100;
  }

  .social-links-header {
    justify-content: left;
    font-size: 0.75em;
  }

  .social-link {
    font-weight: bold;
  }

  .social-links-footer {
    font-size: 0.75em;
  }
}

/* phones */
@media only screen and (max-width: 480px) {
  :root {
    --page-pad: 0.5rem;
    --content-pad: 1rem;
  }

  .post .title {
    font-size: 1.35em;
  }

  .post-preview .title {
    font-size: 1.3em;
  }

  blockquote {
    margin-left: 0;
    margin-right: 0;
  }

  .terms,
  .sitemap,
  .err-404 {
    width: auto;
    margin-left: 0;
    margin-right: 0;
  }
}
