:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --text: #152033;
  --muted: #5c6a80;
  --accent: #315fc5;
  --accent-soft: #eaf0fc;
  --line: rgba(44, 64, 98, 0.12);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-edge: rgba(255, 255, 255, 0.95);
  --paper: rgba(255, 255, 255, 0.9);
  --solid: #ffffff;
  --shadow: 0 10px 30px rgba(32, 48, 78, 0.055);
  --highlight: rgba(255, 255, 255, 0.85);
  --code-bg: #f3f5f9;
  --keyword: #7148a3;
  --string: #247045;
  --number: #985520;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151820;
  --text: #e5eaf4;
  --muted: #acb7ca;
  --accent: #a0bdff;
  --accent-soft: #2c3751;
  --line: rgba(193, 208, 236, 0.15);
  --glass: rgba(35, 40, 51, 0.78);
  --glass-edge: rgba(193, 208, 236, 0.18);
  --paper: rgba(31, 36, 47, 0.96);
  --solid: #202531;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --highlight: rgba(225, 234, 255, 0.05);
  --code-bg: #191e29;
  --keyword: #c5a6f5;
  --string: #9aceab;
  --number: #efb98b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #151820;
    --text: #e5eaf4;
    --muted: #acb7ca;
    --accent: #a0bdff;
    --accent-soft: #2c3751;
    --line: rgba(193, 208, 236, 0.15);
    --glass: rgba(35, 40, 51, 0.78);
    --glass-edge: rgba(193, 208, 236, 0.18);
    --paper: rgba(31, 36, 47, 0.96);
    --solid: #202531;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --highlight: rgba(225, 234, 255, 0.05);
    --code-bg: #191e29;
    --keyword: #c5a6f5;
    --string: #9aceab;
    --number: #efb98b;
  }
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 10;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--solid);
  color: var(--accent);
}

.skip-link:focus {
  top: 12px;
}

.site-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 28px 28px;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin-bottom: 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  background: linear-gradient(140deg, #42b9ff, #4255e8);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 26px;
  font-weight: 500;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.3px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.glass-panel {
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  box-shadow:
    var(--shadow),
    inset 0 1px 1px var(--highlight);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  backdrop-filter: blur(24px) saturate(130%);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
}

.top-nav a {
  padding: 7px 17px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.appearance-control {
  position: relative;
  justify-self: end;
}

.theme-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
}

.theme-toggle:hover {
  background: var(--solid);
}

.theme-toggle span {
  display: flex;
}

.theme-toggle .theme-sun,
[data-theme="dark"] .theme-toggle .theme-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-sun {
  display: flex;
}

.icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.theme-toggle .icon {
  width: 21px;
  height: 21px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 24px;
}

.main {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.main:focus {
  outline-offset: 5px;
}

.sidebar {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.discovery-card,
.desktop-toc {
  padding: 24px;
  border-radius: 24px;
}

.widget-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.5;
}

.widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.widget-row + .widget-row {
  border-top: 1px solid var(--line);
}

.widget-row > span {
  display: flex;
  align-items: center;
  gap: 12px;
}

.widget-row > .icon {
  width: 15px;
  color: var(--muted);
}

.widget-row:hover,
.sidebar-links a:hover {
  color: var(--accent);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.7;
}

.tag-chip:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.sidebar-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 13px;
}

.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.sidebar-links a + a {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-heading h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.5px;
}

.page-count {
  color: var(--muted);
  font-size: 12px;
}

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

.article-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 32px;
  align-items: start;
  gap: 16px;
  padding: 24px 0;
}

.article-item + .article-item {
  border-top: 1px solid var(--line);
}

.article-date {
  padding-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.article-copy {
  min-width: 0;
}

.pin {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  line-height: 1.6;
}

.article-title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: -0.35px;
}

.article-title a:hover {
  color: var(--accent);
}

.article-summary {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.article-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 32px;
  min-height: 44px;
  border-radius: 12px;
  color: var(--muted);
}

.article-arrow:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.article-arrow .icon {
  width: 16px;
}

.list-footer {
  display: flex;
  justify-content: center;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.view-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 550;
}

.view-all:hover {
  background: var(--accent-soft);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pagination a {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
}

.pagination a:hover,
.pagination a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.empty {
  padding: 24px 0;
  color: var(--muted);
}

.archive-month {
  margin: 28px 0 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.article-list-compact .article-item {
  padding: 16px 0;
}

.article-list-compact .article-title {
  font-size: 16px;
}

.taxonomy-row,
.taxonomy-count {
  display: flex;
  align-items: center;
  gap: 12px;
}

.taxonomy-row {
  justify-content: space-between;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  border-radius: 4px;
  font-size: 17px;
}

.taxonomy-row:last-child {
  border-bottom: 0;
}

.taxonomy-row:hover {
  color: var(--accent);
}

.taxonomy-count {
  color: var(--muted);
  font-size: 13px;
}

.post-title {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.65px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.post-meta time {
  margin-right: 4px;
}

.post-cover {
  display: block;
  max-width: 100%;
  max-height: 440px;
  margin: 0 auto 28px;
  border-radius: 14px;
  object-fit: contain;
}

.prose {
  font-size: 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.prose p {
  margin: 18px 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 24px 0 10px;
  font-weight: 650;
  line-height: 1.5;
  scroll-margin-top: 24px;
}

.prose h1,
.prose h2 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.prose h1 {
  margin-top: 40px;
  font-size: 28px;
}

.prose h2 {
  margin-top: 32px;
  font-size: 24px;
}

.prose h3 {
  margin-top: 28px;
  font-size: 20px;
}

.prose h4 {
  font-size: 18px;
}

.prose h5,
.prose h6 {
  font-size: 16px;
}

.prose h6 {
  color: var(--muted);
  font-weight: 500;
}

.prose .headerlink {
  display: none;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border-radius: 10px;
}

.prose blockquote {
  margin: 24px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--code-bg);
  color: var(--muted);
}

.prose blockquote > :first-child {
  margin-top: 0;
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li {
  margin: 5px 0;
}

.prose code {
  padding: 0.15em 0.3em;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.88em;
}

.prose pre,
.prose figure.highlight {
  max-width: 100%;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  overflow-wrap: normal;
  tab-size: 4;
}

.prose pre code {
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
}

.prose figure.highlight pre {
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.prose figure.highlight table,
.prose figure.highlight td {
  margin: 0;
  padding: 0;
  border: 0;
}

.prose figure.highlight table {
  display: table;
  max-width: none;
  overflow: visible;
}

.prose table {
  display: block;
  max-width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
  overflow-x: auto;
}

.prose th,
.prose td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.prose th {
  background: var(--code-bg);
}

.prose hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.code-block {
  max-width: 100%;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
}

.prose .code-block > pre,
.prose .code-block > figure.highlight {
  margin: 0;
  border: 0;
  border-radius: 0 0 14px 14px;
}

.code-toolbar {
  position: relative;
  display: flex;
  justify-content: flex-end;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line);
}

.code-copy {
  min-height: 28px;
  padding: 2px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 24px;
}

.code-copy:hover {
  background: var(--solid);
  color: var(--accent);
}

.hljs-comment,
.hljs-quote {
  color: var(--muted);
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-type,
.hljs-literal {
  color: var(--keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition {
  color: var(--string);
}

.hljs-number,
.hljs-built_in,
.hljs-attr {
  color: var(--number);
}

.hljs-title,
.hljs-section {
  font-weight: 600;
}

.mobile-toc {
  display: none;
}

.toc-widget summary {
  cursor: pointer;
}

.toc-widget details:not([open]) summary {
  margin-bottom: 0;
}

.toc-widget nav {
  max-height: min(32svh, 260px);
  overflow-y: auto;
}

.toc-widget ol {
  margin: 4px 0;
  padding-left: 14px;
  list-style: none;
}

.toc-widget .toc {
  padding-left: 0;
}

.toc-widget li {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.65;
}

.toc-widget a:hover {
  color: var(--accent);
}

.updated {
  margin-top: 36px;
  color: var(--muted);
  font-size: 12px;
}

.post-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.post-navigation a {
  padding: 14px;
  border-radius: 12px;
  background: var(--code-bg);
  font-size: 14px;
}

.post-navigation a:hover {
  color: var(--accent);
}

.post-navigation span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.notfound {
  padding: 32px 0 48px;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--accent);
  font-size: 72px;
  font-weight: 650;
  letter-spacing: -4px;
}

.notfound h1 {
  font-size: 24px;
}

.notfound > p:not(.error-code) {
  color: var(--muted);
}

.site-footer,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
}

.site-footer {
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.site-footer a:hover {
  color: var(--accent);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-panel {
    background: var(--solid);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-panel,
  .reading-panel {
    background: var(--solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-height: 750px) {
  .sidebar {
    position: static;
  }
}

@media (max-width: 1050px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
  }

  .top-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: center;
  }

  .appearance-control {
    grid-row: 1;
    grid-column: 2;
  }

  .page-grid {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
  }
}

@media (max-width: 900px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
  }

  .desktop-toc {
    display: none;
  }

  .mobile-toc {
    display: block;
    margin: 24px 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--code-bg);
  }

  .mobile-toc .widget-title {
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .site-shell {
    padding: 24px 16px;
  }

  .site-header {
    gap: 20px;
    margin-bottom: 28px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 23px;
  }

  .brand-name {
    font-size: 17px;
  }

  .brand-subtitle {
    font-size: 11px;
    letter-spacing: 0;
  }

  .top-nav {
    max-width: 100%;
  }

  .top-nav a {
    padding: 7px 12px;
    font-size: 13px;
  }

  .main {
    padding: 22px 20px;
    border-radius: 20px;
  }

  .page-heading h1 {
    font-size: 21px;
  }

  .article-item {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 6px 8px;
    padding: 22px 0;
  }

  .article-date {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .article-copy {
    grid-column: 1;
  }

  .article-arrow {
    grid-row: 2;
    grid-column: 2;
    width: 28px;
  }

  .article-title {
    font-size: 18px;
  }

  .prose {
    font-size: 15px;
  }

  .post-navigation {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-footer {
    margin-top: 28px;
    gap: 14px;
  }
}
