/* Small reading adjustments; Cactus remains responsible for the layout. */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-400.woff2?v=14425ba9c695') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-600.woff2?v=400c6bfda18d') format('woff2');
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f1e2c4;
  --ink: #1e1913;
  --muted: #65513a;
  --rule: #c9b38d;
  --wash: #ebd8b5;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #241b14;
  --ink: #f3e3c9;
  --muted: #c0a98b;
  --rule: #66513b;
  --wash: #33261b;
}
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'PingFang SC', 'Microsoft YaHei', monospace;
  font-size: .875rem;
  line-height: 1.85;
  background: var(--paper);
  color: var(--ink);
}
body > .content { padding-top: 5rem; padding-bottom: 2rem; }
body.reading-page > .content { padding-top: 3rem; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 5px;
  border-radius: 2px;
}
::selection { color: var(--paper); background: var(--ink); }
.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  padding: .6rem 1rem;
  z-index: 20;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
}
.skip-link:focus { top: 1rem; }
#header { position: relative; margin-bottom: 2.8rem; }
#header h1 { font-size: 1.45rem; letter-spacing: -.035em; }
#header > .u-url { display: inline-flex; align-items: center; gap: 18px; }
#header #title { display: block; margin-right: 0; }
#header #nav { margin-top: .4rem; }
#header #logo { object-fit: contain; float: none; margin-right: 0; flex-shrink: 0; }
#main-content { flex: 1; min-width: 0; }
#about { max-width: 40rem; }
#about p { margin-top: 0; margin-bottom: .9rem; text-align: left; }
#about .social-line { margin-top: 1.2rem; color: var(--muted); font-size: .8125rem; }
.social-line a { margin-left: .5rem; }
#writing { margin-top: 1.5rem; }
#writing > .h1 { font-size: 1rem; margin-top: 2.3rem; margin-bottom: 1.25rem; }
.post-list .post-item { margin-bottom: .8rem; align-items: baseline; }
.post-list .post-item > span { min-width: 0; }
.post-list .post-item .meta { font-size: .75rem; font-variant-numeric: tabular-nums; min-width: 100px; }
.post-list .post-item a { background-image: none; border-bottom: 1px solid transparent; }
.post-list .post-item a:hover { background-image: none; border-color: var(--ink); }
.all-writing { margin-top: 1.5rem; font-size: .75rem; }
.all-writing a { color: var(--muted); }
.appearance-toggle, .paper-toggle {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.appearance-toggle:hover, .paper-toggle:hover { color: var(--ink); background: var(--wash); border-color: var(--rule); }
.appearance-toggle svg, .paper-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.appearance-toggle .sun { display: none; }
[data-theme='dark'] .appearance-toggle .sun { display: block; }
[data-theme='dark'] .appearance-toggle .moon { display: none; }
.reading-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2.7rem; }
.reading-nav a { color: var(--muted); background: none; font-size: .75rem; }
.reading-nav a:hover { color: var(--ink); background: none; }
article header .posttitle { font-size: 1.6rem; line-height: 1.6; letter-spacing: -.025em; margin-bottom: .7rem; }
article header .meta { line-height: 2; margin-bottom: 2.7rem; }
article .content { font-size: .9375rem; line-height: 1.95; }
article .content p { text-align: left; margin: 0 0 1.3em; }
article .content h2,
article .content h3,
article .content h4,
article .content h5,
article .content h6 {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.7;
  margin-top: 2rem;
  margin-bottom: .9rem;
  scroll-margin-top: 2rem;
}
article .content h2 { font-size: 1.12rem; }
article .content h3, article .content h4 { font-size: 1rem; }
article .content h2:before { top: 0; font-size: 1rem; color: var(--muted); }
article .content img { margin: 1.7rem auto; border-radius: 3px; }
article .content blockquote { margin: 1.5rem 0; border-left: 2px solid var(--rule); padding: .2rem 1rem; color: var(--muted); font-weight: 400; }
article .content blockquote:before { content: none; }
article .content blockquote p { margin-bottom: .3rem; }
article .content code, article .content pre, article .content .highlight { font-family: inherit; }
article .content code { background: var(--wash); border-color: var(--rule); font-size: .88em; }
article .content pre { padding-bottom: 12px; border-color: var(--rule); }
article .content figure.highlight { position: relative; border: 1px solid var(--rule); padding: 1rem; font-size: .75rem; line-height: 1.8; }
article .content .highlight pre { padding: 0; background: transparent; }
article .content .highlight .gutter { user-select: none; }
article .content .highlight td { padding-top: 0; padding-bottom: 0; }
article .content table:not(.highlight table) { margin: 1.5rem 0; font-size: .8125rem; }
article .content table:not(.highlight table) td { padding: .6rem .7rem; border-bottom: 1px solid var(--rule); }
article .content table:not(.highlight table) th { padding: .7rem; border-bottom: 1px solid var(--rule); }
article .content hr { border: 0; height: 1px; background: var(--rule); opacity: 1; margin: 2rem 0; }
#header-post { font-size: .8125rem; }
#header-post #menu { max-width: 16rem; }
#header-post #toc { line-height: 1.8; }
#header-post #toc .toc-link { color: var(--muted); }
#footer {
  position: static;
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 4rem;
  text-align: left;
  gap: .7rem 1rem;
  font-size: .6875rem;
  color: var(--muted);
}
#footer .footer-left { height: auto; }
#footer .footer-right { display: flex; gap: 1rem; align-items: center; }
#footer a { text-decoration: none; color: var(--muted); }
#footer a:hover { text-decoration: underline; color: var(--ink); }
.appearance-system { padding: 0; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; }
.appearance-system:hover { text-decoration: underline; color: var(--ink); }
#search input { font-family: inherit; font-size: .875rem; padding: .8rem 0; }
#search-result mark, .search-keyword { color: var(--ink); background: var(--wash); }
#categories .category-list { font-size: .875rem; }
#categories .category-list-count { color: var(--muted); }
@media (max-width: 767px) {
  body > .content { padding-top: 3rem; }
  body.reading-page > .content { padding-top: 1.5rem; }
  article .content { font-size: .875rem; }
  article header .posttitle { font-size: 1.35rem; }
  .reading-nav { margin-bottom: 1.8rem; }
  #footer { padding-top: 3rem; padding-bottom: 1rem; }
  #footer .footer-right { margin-top: .5rem; }
}
@media (max-width: 480px) {
  #header #title { margin-right: 0; min-height: 0; }
  #header h1 { font-size: 1.15rem; }
  #header #logo { margin-right: 0; width: 40px; height: 40px; }
  #header > .u-url { gap: 12px; }
  #header #nav { margin-top: 1.2rem; }
  #header #nav ul li { display: inline-block; border-right: 1px dotted var(--muted); margin-right: 10px; }
  #header #nav ul li a { margin-right: 10px; font-size: .75rem; }
  #header #nav ul li:last-child { margin-right: 0; border: 0; }
  #header #nav ul li:last-child a { margin-right: 0; }
  #header #nav ul li.icon { display: none; }
  #header #nav ul li:not(:first-child) { padding: 0; }
  #header > .u-url { max-width: calc(100% - 32px); }
  .post-list .post-item { display: block; margin-bottom: 1.25rem; }
  .post-list .post-item .meta { margin-bottom: .15rem; font-size: .6875rem; }
  #footer-post #actions-footer { display: flex; justify-content: space-around; }
  #footer-post #actions-footer a { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

#search-result a.search-result-title { text-transform: none; }

/* Wrapping navigation */
#header #nav ul { display: flex; flex-wrap: wrap; align-items: center; row-gap: .8rem; }

/* Keep wide display equations inside the reading column. */
article .content .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: .25em;
}
article .content .katex-display > .katex {
  width: max-content;
  min-width: 100%;
}
