/* Reading-focused refinements layered on top of the Even theme. */

:root {
  --reading-text: #2d3e4f;
  --reading-muted: #6f7b86;
  --reading-accent: #aa4f43;
  --reading-rule: #e6e9ec;
  --reading-surface: #f7f6f2;
}

.language-selector .languages-list {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.language-selector .language-item a {
  color: var(--reading-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.language-selector .language-item + .language-item::before {
  margin-right: 8px;
  color: #c9cfd3;
  content: "/";
}

.language-selector .language-item.active a {
  color: var(--reading-accent);
  font-weight: 650;
}

@media (max-width: 800px) {
  .mobile-menu .language-selector {
    margin: 24px 20px 0;
    padding-top: 18px;
    border-top: 1px solid var(--reading-rule);
  }
}

body {
  color: var(--reading-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC",
    "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, sans-serif;
}

.post-toc ~ .post-content {
  color: var(--reading-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC",
    "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, sans-serif;
  font-size: 17.5px;
  line-height: 1.82;
  text-rendering: optimizeLegibility;
}

article.post:has(> .post-toc) > .post-header .post-title {
  color: #24384a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC",
    "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, sans-serif;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  font-weight: 650;
  line-height: 1.3;
  text-wrap: balance;
}

.post-toc ~ .post-content h2,
.post-toc ~ .post-content h3,
.post-toc ~ .post-content h4 {
  color: #24384a;
  font-family: inherit;
  font-weight: 650;
  line-height: 1.38;
  text-wrap: pretty;
}

.post-toc ~ .post-content h2 {
  margin: 2.5em 0 0.8em;
}

.post-toc ~ .post-content h3 {
  margin: 2em 0 0.7em;
}

.post-toc ~ .post-content h4 {
  margin: 1.75em 0 0.65em;
}

.post-toc ~ .post-content p {
  margin: 1.05em 0 1.25em;
  text-wrap: pretty;
}

.post-toc ~ .post-content ul,
.post-toc ~ .post-content ol {
  margin: 1em 0 1.35em;
  padding-left: 1.55em;
}

.post-toc ~ .post-content li + li {
  margin-top: 0.32em;
}

.post-toc ~ .post-content li > p {
  margin: 0.4em 0;
}

.post-toc ~ .post-content hr {
  margin: 2.75em 0;
  border-color: var(--reading-rule);
}

.post-toc ~ .post-content .highlight > .chroma,
.post-toc ~ .post-content figure.highlight {
  max-width: 100%;
  margin: 1.5em 0 1.85em;
  overflow-x: auto;
  border: 1px solid #e5e1d7;
  border-radius: 8px;
  box-shadow: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.post-toc ~ .post-content .highlight code,
.post-toc ~ .post-content .highlight pre {
  font-size: 14.5px;
  line-height: 1.65;
  tab-size: 2;
}

.post-toc ~ .post-content .highlight .lntd {
  line-height: 1.65;
}

.post-toc ~ .post-content :not(pre) > code {
  padding: 0.15em 0.35em;
  font-size: 0.88em;
}

.post .post-toc {
  width: 220px;
  max-height: calc(100vh - 40px);
  margin-left: -252px;
  padding: 14px 16px;
  overflow-y: auto;
  color: var(--reading-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC",
    "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: rgba(247, 246, 242, 0.94);
  border: 1px solid #ebe8df;
  border-radius: 8px;
  box-shadow: none;
  scrollbar-width: thin;
}

.post .post-toc .post-toc-title {
  margin: 0 0 10px;
  color: #4d5e6d;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  text-transform: none;
}

.post .post-toc .post-toc-content {
  font-size: 13.5px;
  line-height: 1.55;
}

.post .post-toc .post-toc-content > nav > ul {
  margin: 0;
}

.post .post-toc .post-toc-content ul {
  padding-left: 16px;
}

@media (min-width: 1024px) {
  .main:has(.post > .post-toc) {
    width: min(1280px, calc(100vw - 32px));
    margin-left: calc((800px - min(1280px, calc(100vw - 32px))) / 2);
  }

  article.post:has(> .post-toc) {
    width: calc(100% - 252px);
    max-width: 760px;
    margin-left: 252px;
  }

  .post .post-toc {
    display: block;
    position: fixed !important;
    top: 20px !important;
  }
}

.post-toc ~ .post-content a {
  color: var(--reading-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.post-toc ~ .post-content a:focus-visible {
  outline: 2px solid var(--reading-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.post-toc ~ .post-content blockquote {
  margin: 1.75em 0 2em;
  padding: 0.9em 1.15em;
  color: #4b5c69;
  background: var(--reading-surface);
  border-left: 3px solid #c9aaa3;
  border-radius: 0 6px 6px 0;
  box-shadow: none;
}

.post-toc ~ .post-content blockquote p {
  margin: 0;
}

.post-toc ~ .post-content p:has(> img:only-child),
.post-toc ~ .post-content p:has(> a.fancybox:only-child) {
  margin: 1.75em 0 2em;
  text-align: center;
}

.post-toc ~ .post-content p > img:only-child,
.post-toc ~ .post-content p > a.fancybox:only-child > img,
.post-toc ~ .post-content figure img {
  display: block;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
}

.post-toc ~ .post-content p > a.fancybox:only-child {
  display: block;
  border: 0;
}

.post-toc ~ .post-content .table-wrapper {
  margin: 1.75em 0 2em;
  border: 1px solid var(--reading-rule);
  border-radius: 7px;
}

.post-toc ~ .post-content .table-wrapper > table {
  margin: 0;
  font-size: 0.92em;
  line-height: 1.55;
  box-shadow: none;
}

.post-toc ~ .post-content .table-wrapper > table th,
.post-toc ~ .post-content .table-wrapper > table td {
  padding: 0.65em 0.8em;
  border-color: var(--reading-rule);
}

@media (max-width: 1023px) {
  .post .post-toc {
    display: none;
  }
}

@media (max-width: 767px) {
  .post-toc ~ .post-content {
    font-size: 17px;
    line-height: 1.78;
  }

  .post-toc ~ .post-content .highlight > .chroma,
  .post-toc ~ .post-content figure.highlight {
    margin-right: -8px;
    margin-left: -8px;
  }

  .post-toc ~ .post-content .highlight code,
  .post-toc ~ .post-content .highlight pre {
    font-size: 14px;
  }
}

/* Two-column archive inspired by long-form editorial indexes. */
.blog-archive-layout {
  --archive-accent: #aa4f43;
  --archive-ink: #263949;
  --archive-muted: #71808c;
  --archive-rule: #e6e9ec;
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 72px);
  align-items: start;
  margin: 30px 0 64px;
}

.blog-archive-sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  padding: 4px 20px 8px 2px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c8ced3 transparent;
}

.blog-archive-sidebar-header {
  margin-bottom: 24px;
}

.blog-archive-sidebar-header h1 {
  margin: 0;
  color: var(--archive-ink);
  font-family: inherit;
  font-weight: 700;
  line-height: 1.25;
}

.blog-archive-sidebar-header h1 {
  font-size: 22px;
}

.blog-archive-sidebar-header p {
  margin: 7px 0 0;
  color: var(--archive-muted);
  font-size: 14px;
  line-height: 1.55;
}

.blog-archive-year {
  margin: 24px 0 8px;
  color: var(--archive-ink);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.blog-archive-year:first-child {
  margin-top: 0;
}

.blog-archive-index-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 7px;
  color: #455866;
  font-size: 13.5px;
  line-height: 1.45;
  border-radius: 5px;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.blog-archive-index-item time {
  color: #919ca4;
  font-variant-numeric: tabular-nums;
}

.blog-archive-index-item:hover,
.blog-archive-index-item:focus-visible {
  color: var(--archive-accent);
  background: #f7f5f1;
}

.blog-archive-index-item:focus-visible,
.blog-summary-card a:focus-visible {
  outline: 2px solid var(--archive-accent);
  outline-offset: 2px;
}

.blog-summary-card {
  padding: 34px 0 32px;
  border-bottom: 1px solid var(--archive-rule);
}

.blog-recent-posts > .blog-summary-card:first-child {
  padding-top: 4px;
}

.blog-summary-card h2 {
  margin: 0 0 9px;
  font-family: inherit;
  font-size: clamp(21px, 2.3vw, 27px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.012em;
}

.blog-summary-card h2 a {
  color: var(--archive-ink);
}

.blog-summary-card h2 a:hover {
  color: var(--archive-accent);
}

.blog-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--archive-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.blog-summary-excerpt {
  margin: 21px 0 23px;
  color: #3b4d5b;
  font-size: 16px;
  line-height: 1.75;
  text-wrap: pretty;
}

.blog-summary-excerpt.post {
  padding: 0;
}

.blog-summary-excerpt .post-summary {
  margin-bottom: 0;
}

.blog-summary-excerpt .post-summary > :first-child {
  margin-top: 0;
}

.blog-summary-excerpt .post-summary > :last-child {
  margin-bottom: 0;
}

.blog-summary-footer {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
}

.blog-summary-tags {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-width: 0;
}

.blog-summary-tags-label {
  flex: 0 0 auto;
  padding-top: 4px;
  color: var(--archive-muted);
  font-size: 13px;
  font-weight: 650;
}

.blog-summary-tags ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-summary-tags a {
  display: inline-flex;
  padding: 3px 9px;
  color: #5b6975;
  font-size: 12.5px;
  line-height: 1.4;
  background: #f6f5f2;
  border: 1px solid #e5e2dc;
  border-radius: 999px;
}

.blog-summary-tags a:hover {
  color: var(--archive-accent);
  border-color: #d8bbb5;
}

.blog-summary-read-more {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  padding-bottom: 2px;
  color: var(--archive-accent);
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid transparent;
}

.blog-summary-read-more:hover {
  border-bottom-color: currentColor;
}

.blog-summary-read-more span {
  transition: transform 0.18s ease;
}

.blog-summary-read-more:hover span {
  transform: translateX(3px);
}

@media (min-width: 1024px) {
  .container:has(.blog-archive-layout) {
    width: min(1180px, calc(100vw - 48px));
  }

  .container:has(.blog-archive-layout) .content-wrapper {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 1023px) {
  .blog-archive-layout {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    gap: 34px;
  }
}

@media (max-width: 767px) {
  .blog-archive-layout {
    grid-template-columns: 1fr;
    gap: 38px;
    margin-top: 18px;
  }

  .blog-archive-sidebar {
    position: static;
    max-height: 42vh;
    padding: 18px;
    background: #faf9f6;
    border: 1px solid var(--archive-rule);
    border-radius: 8px;
  }

  .blog-archive-sidebar-header {
    margin-bottom: 18px;
  }

  .blog-summary-card {
    padding: 29px 0 27px;
  }

  .blog-summary-footer {
    display: block;
  }

  .blog-summary-read-more {
    margin-top: 20px;
  }
}
