:root {
  --bg: #212737;
  --text: #f3f4f6;
  --muted: #c2bbab;
  --accent: #8fb7ff;
  --border: #2a3c63;
  --title: #c6d68a;
  --link-visited: #9cae6a;
  --code-bg: #1d1f24;
  --code-inline-bg: #2a2d34;
  --code-token-comment: #75715e;
  --code-token-keyword: #f92672;
  --code-token-string: #e6db74;
  --code-token-number: #ae81ff;
  --code-token-func: #a6e22e;
  --code-token-operator: #f8f8f2;
  --code-token-punctuation: #f8f8f2;
  --code-token-constant: #66d9ef;
  --code-token-property: #a6e22e;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfcff;
    --text: #1b2230;
    --muted: #4f5e73;
    --accent: #385ea8;
    --border: #d7deea;
    --title: #6f8a2d;
    --link-visited: #587123;
    --code-bg: #f1f4fa;
    --code-inline-bg: #e5ebf5;
    --code-token-comment: #6a737d;
    --code-token-keyword: #d73a49;
    --code-token-string: #22863a;
    --code-token-number: #6f42c1;
    --code-token-func: #005cc5;
    --code-token-operator: #24292e;
    --code-token-punctuation: #24292e;
    --code-token-constant: #0366d6;
    --code-token-property: #005cc5;
    color-scheme: light;
  }
}

:root[data-theme="dark"] {
  --bg: #212737;
  --text: #f3f4f6;
  --muted: #c2bbab;
  --accent: #8fb7ff;
  --border: #2a3c63;
  --title: #c6d68a;
  --link-visited: #9cae6a;
  --code-bg: #1d1f24;
  --code-inline-bg: #2a2d34;
  --code-token-comment: #75715e;
  --code-token-keyword: #f92672;
  --code-token-string: #e6db74;
  --code-token-number: #ae81ff;
  --code-token-func: #a6e22e;
  --code-token-operator: #f8f8f2;
  --code-token-punctuation: #f8f8f2;
  --code-token-constant: #66d9ef;
  --code-token-property: #a6e22e;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fbfcff;
  --text: #1b2230;
  --muted: #4f5e73;
  --accent: #385ea8;
  --border: #d7deea;
  --title: #6f8a2d;
  --link-visited: #587123;
  --code-bg: #f1f4fa;
  --code-inline-bg: #e5ebf5;
  --code-token-comment: #6a737d;
  --code-token-keyword: #d73a49;
  --code-token-string: #22863a;
  --code-token-number: #6f42c1;
  --code-token-func: #005cc5;
  --code-token-operator: #24292e;
  --code-token-punctuation: #24292e;
  --code-token-constant: #0366d6;
  --code-token-property: #005cc5;
  color-scheme: light;
}

@supports (view-transition-name: none) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

a {
  color: var(--title);
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16rem;
}

a:focus-visible {
  outline: 2px solid var(--title);
  outline-offset: 2px;
  border-radius: 2px;
}

li::marker {
  color: var(--title);
}

blockquote {
  margin: 1rem 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--title);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.post-page-content figure {
  margin: 1.25rem auto;
  text-align: center;
}

.post-page-content figure img {
  margin: 0 auto;
}

.post-page-content figure figcaption {
  margin-top: 0.55rem;
  font-size: 0.83rem;
  color: var(--text);
}

.zoomable-image {
  cursor: zoom-in;
}

.image-zoom-open {
  overflow: hidden;
}

.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 11, 17, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.image-zoom-overlay[hidden] {
  display: none;
}

.image-zoom-preview {
  max-width: min(1200px, 92vw);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  cursor: zoom-out;
}

.image-zoom-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 0;
  background: transparent;
  color: #f3f4f6;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--title);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 1000;
}

.container {
  width: min(760px, 92%);
  margin: 0 auto;
}

.site-header,
.site-footer {
  background: var(--bg);
}

.site-footer {
  border-bottom: 0;
  margin-top: 3rem;
}

.site-header .container,
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.site-header .container {
  border-bottom: 1px solid var(--title);
}

.site-footer .container {
  border-top: 1px solid var(--title);
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.45rem;
}

.brand:visited {
  color: var(--text);
}

nav a {
  color: var(--text);
  text-decoration: none;
}

nav a:visited {
  color: var(--text);
}

nav a:hover {
  color: var(--title);
}

nav a:focus-visible {
  text-decoration: underline;
  text-decoration-style: solid;
  text-underline-offset: 0.16rem;
}

nav a.is-current {
  color: var(--title);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 0.22rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.7rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-link.is-current {
  color: var(--title);
  text-decoration: none;
}

.nav-search-icon {
  width: 1.35rem;
  height: 1.35rem;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.nav-rss-icon {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-icon {
  width: 1.4rem;
  height: 1.4rem;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-icon-moon {
  display: block;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin-top: 2rem;
}

h1 {
  font-size: 1.95rem;
}

h2 {
  font-size: 1.55rem;
}

h3 {
  font-size: 1.24rem;
}

h4 {
  font-size: 1.08rem;
}

.home-intro-title,
.about-title,
.archive-title {
  display: inline-block;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--title);
  font-weight: 600;
}

.tag-index-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.tag-index-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.tag-index-link {
  color: var(--title);
  text-decoration: none;
}

.tag-index-link:hover {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 0.22rem;
}

.tag-index-count {
  color: var(--muted);
  font-size: 0.88rem;
}

.tag-page-count {
  margin-top: 0.3rem;
  font-size: 0.92rem;
  color: var(--text);
}

.posts-search-wrap {
  margin: 1.2rem 0 1rem;
}

.posts-search-input-wrap {
  position: relative;
  width: 100%;
}

.posts-search-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.posts-search-input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.2rem;
  border: 1px solid var(--title);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.search-field-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  pointer-events: none;
  opacity: 0.95;
}

.posts-search-empty {
  margin: 0.4rem 0 1.2rem;
  font-size: 0.95rem;
}

.posts-search-count {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.9rem;
}

.archive-year {
  margin-top: 2.2rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--title);
  color: var(--text);
}

.archive-month {
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.count-sup {
  margin-left: 0.55rem;
  font-size: 0.62em;
  font-weight: 500;
  opacity: 0.85;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.post-list a {
  color: var(--title);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.15rem;
}

.home-post-list a {
  font-size: 1.22rem;
}

.post-list a:hover {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 0.3rem;
}

.meta {
  color: var(--text);
  font-size: 0.95rem;
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

.meta-read-time {
  color: var(--text);
  opacity: 0.84;
  font-size: 0.9em;
}

.meta-icon {
  width: 1.14rem;
  height: 1.24rem;
  margin-right: 0.24rem;
  vertical-align: -0.2rem;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}

.post-excerpt {
  margin-top: 0.4rem;
}

.post-page-title {
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--title);
  font-size: 1.95rem;
}

.post-page-meta {
  margin-top: 0.1rem;
}

.post-page-excerpt {
  font-size: 1.05rem;
  margin: 0.55rem 0 1rem;
}

.post-tags-row {
  margin: 1.35rem 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.post-tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
}

.post-tag-item {
  color: var(--text);
  font-size: 0.86rem;
}

.post-tag-link {
  color: var(--text);
  text-decoration: underline;
}

.post-tag-link:visited,
.post-tag-link:hover,
.post-tag-link:active {
  color: var(--text);
}

.post-top-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  white-space: nowrap;
}

.post-top-link:hover {
  text-decoration: underline;
}

.post-page-content p {
  margin-top: 1rem;
}

.post-page-content {
  border-bottom: 1px dashed var(--title);
  padding-bottom: 1.15rem;
  font-size: 1.03rem;
  line-height: 1.72;
}

.post-page-content h2,
.post-page-content h3,
.post-page-content h4 {
  margin-top: 1.8rem;
  margin-bottom: 0.55rem;
}

.post-page-content ul,
.post-page-content ol {
  margin-top: 0.7rem;
  margin-bottom: 1rem;
  padding-left: 1.2rem;
}

.post-page-content li + li {
  margin-top: 0.35rem;
}

.post-page-content code {
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.post-page-content :not(pre) > code {
  background: var(--code-inline-bg);
  border: 0;
  border-radius: 4px;
  padding: 0.08rem 0.34rem;
}

.post-page-content pre {
  padding: 0.95rem 1rem;
  background: var(--code-bg);
  border: 0;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.94rem;
  tab-size: 2;
}

.post-page-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.post-page-content pre[class*="language-"],
.post-page-content code[class*="language-"] {
  color: var(--text);
  text-shadow: none;
}

.post-page-content pre[class*="language-"] .token.comment,
.post-page-content pre[class*="language-"] .token.prolog,
.post-page-content pre[class*="language-"] .token.doctype,
.post-page-content pre[class*="language-"] .token.cdata {
  color: var(--code-token-comment);
}

.post-page-content pre[class*="language-"] .token.keyword {
  color: var(--code-token-keyword);
}

.post-page-content pre[class*="language-"] .token.string,
.post-page-content pre[class*="language-"] .token.char,
.post-page-content pre[class*="language-"] .token.attr-value {
  color: var(--code-token-string);
}

.post-page-content pre[class*="language-"] .token.number,
.post-page-content pre[class*="language-"] .token.boolean {
  color: var(--code-token-number);
}

.post-page-content pre[class*="language-"] .token.function,
.post-page-content pre[class*="language-"] .token.class-name {
  color: var(--code-token-func);
}

.post-page-content pre[class*="language-"] .token.constant,
.post-page-content pre[class*="language-"] .token.symbol {
  color: var(--code-token-constant);
}

.post-page-content pre[class*="language-"] .token.property {
  color: var(--code-token-property);
}

.post-page-content pre[class*="language-"] .token.operator {
  color: var(--code-token-operator);
}

.post-page-content pre[class*="language-"] .token.punctuation {
  color: var(--code-token-punctuation);
}

.post-page-content table {
  width: 100%;
  display: table;
  border-collapse: collapse;
  margin: 1rem 0;
  border: 1px solid var(--title);
  border-radius: 10px;
  font-size: 0.96rem;
}

.post-page-content th,
.post-page-content td {
  border: 1px solid var(--title);
  padding: 0.52rem 0.65rem;
  text-align: left;
}

.post-page-content thead th {
  font-weight: 600;
}


.post-pagination {
  margin-top: 1rem;
  padding-top: 1rem;
  padding-bottom: 0;
  min-height: 2.55rem;
  border-top: 1px solid var(--title);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.post-pagination-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  opacity: 0.88;
  transition: opacity 0.18s ease;
}

.post-pagination-link-next {
  margin-left: auto;
  align-items: flex-end;
  text-align: right;
}

.post-pagination-link:hover {
  opacity: 1;
}

.post-pagination-label {
  color: var(--text);
}

.post-pagination-title {
  color: var(--title);
}

@media (max-width: 640px) {
  .site-header .container,
  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
  }

  nav a {
    margin: 0;
  }

  nav {
    flex-wrap: wrap;
    gap: 0.7rem;
  }
}
