@font-face {
  font-family: "JetBrains Mono";
  src:
    local("JetBrains Mono Regular"),
    local("JetBrains Mono"),
    url("./fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #fbfaf6;
  --text: #282620;
  --muted: #6f695f;
  --soft: #91897c;
  --line: #d2cbbf;
  --line-strong: #8f887b;
  --accent: #8f3e2c;
  --accent-soft: #f0dfd7;
  --code-bg: #ece8df;
  --code-text: #292720;
  --syntax-comment: #817a70;
  --syntax-keyword: #9b3927;
  --syntax-string: #55733f;
  --syntax-number: #8156a0;
  --syntax-title: #315e78;
  --max: 1120px;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Liberation Mono", Consolas, monospace;
  --code-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", "Liberation Mono", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171613;
  --surface: #1d1b18;
  --text: #e9e4da;
  --muted: #aaa296;
  --soft: #7f786e;
  --line: #3b3832;
  --line-strong: #70695e;
  --accent: #d18169;
  --accent-soft: #38241f;
  --code-bg: #24211d;
  --code-text: #eee8dd;
  --syntax-comment: #8e877d;
  --syntax-keyword: #e28a73;
  --syntax-string: #a8c97f;
  --syntax-number: #c5a0e8;
  --syntax-title: #86b9d5;
}

:root[data-theme="paper"] {
  color-scheme: light;
  --bg: #f2eadc;
  --surface: #f8f0e2;
  --text: #30291f;
  --muted: #766b5d;
  --soft: #978a78;
  --line: #d3c2a8;
  --line-strong: #9c8b72;
  --accent: #873d2b;
  --accent-soft: #ead4c4;
  --code-bg: #e6dac8;
  --code-text: #30291f;
  --syntax-comment: #887c6c;
  --syntax-keyword: #963c29;
  --syntax-string: #56713d;
  --syntax-number: #80548f;
  --syntax-title: #345f75;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
  transition: background-color 220ms ease, color 220ms ease;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 48%, transparent);
  text-underline-offset: 4px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

button {
  font: inherit;
}

main > section {
  animation: page-rise 360ms ease both;
}

.site-header,
.site-footer,
main {
  width: min(var(--max), calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 76px;
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  min-width: 0;
  text-decoration: none;
}

.brand strong {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1;
}

.nav,
.meta-line,
.tag-cloud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.nav {
  gap: 24px;
}

.nav a {
  position: relative;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.nav a::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 1px;
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-search {
  position: relative;
  width: min(220px, 24vw);
  margin-left: auto;
}

.search-input {
  width: 100%;
  height: 34px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--text);
  font-family: var(--serif);
  font-size: 13px;
  outline: 0;
}

.search-input:focus {
  border-bottom-color: var(--accent);
}

.search-input::placeholder {
  color: var(--soft);
}

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(440px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--text) 12%, transparent);
}

.search-results[hidden] {
  display: none;
}

.search-result,
.search-empty {
  display: block;
  padding: 13px 16px;
}

.search-result {
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result.is-active,
.search-result:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.search-result strong,
.search-result span,
.search-result small {
  display: block;
}

.search-result span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result small,
.search-empty {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 10px;
}

.search-result small {
  margin-top: 7px;
}

.intro-editorial {
  padding: 68px 0 38px;
}

.classic-source {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.intro-editorial h1 {
  max-width: 850px;
  margin: 14px 0 24px;
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 620;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.intro-about {
  display: grid;
  grid-template-columns: 70px minmax(0, 620px);
  gap: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}

.intro-about > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-about p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.latest-update {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 190px;
  gap: 30px;
  align-items: end;
  padding: 34px 0 38px;
  border-bottom: 1px solid var(--line);
}

.section-label,
.eyebrow,
.meta-line,
.post-row time,
.latest-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.025em;
}

.section-label {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
}

.latest-copy h2 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 620;
  line-height: 1.3;
}

.latest-copy h2 a,
.post-title {
  text-decoration: none;
}

.latest-copy p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
}

.latest-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.8;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 60px;
  padding: 50px 0 84px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.section-heading h2,
.topic-index h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.section-heading > a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
}

.section-heading span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.post-list {
  display: grid;
}

.pagination,
.pagination-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  margin-top: 34px;
  font-family: var(--mono);
  font-size: 12px;
}

.pagination a,
.pagination-page,
.pagination-ellipsis {
  display: inline-grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
}

.pagination a,
.pagination-page {
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.pagination a:hover,
.pagination a:focus-visible,
.pagination-page.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pagination-direction {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
}

.pagination [aria-disabled="true"] {
  color: var(--soft);
  cursor: default;
  opacity: 0.65;
}

.pagination-ellipsis {
  color: var(--soft);
}

.post-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  transition: border-color 180ms ease, transform 180ms ease;
}

.post-row:hover {
  border-bottom-color: var(--line-strong);
  transform: translateX(4px);
}

.post-row time {
  padding-top: 5px;
}

.post-title-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.post-title {
  display: inline-block;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.4;
}

.post-badge {
  border: 1px solid var(--line);
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
}

.post-row p {
  max-width: 660px;
  margin: 7px 0 10px;
  color: var(--muted);
}

.meta-line {
  gap: 14px;
}

.meta-line a,
.meta-line span {
  color: var(--muted);
}

.topic-index {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.topic-index h2 {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.topic-index a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.topic-index small {
  color: var(--soft);
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
}

.empty-state {
  padding: 36px 0;
  border-block: 1px solid var(--line);
}

.empty-state strong {
  font-size: 20px;
  font-weight: 650;
}

.empty-state p,
.page-intro {
  color: var(--muted);
}

.empty-state p {
  margin: 6px 0 0;
}

.narrow-page {
  max-width: 860px;
  min-height: calc(100vh - 148px);
  padding: 64px 0 88px;
}

.narrow-page > .eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
}

.narrow-page h1,
.article h1 {
  max-width: 760px;
  margin: 10px 0 20px;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.narrow-page .section-heading {
  align-items: flex-end;
}

.narrow-page .section-heading h1 {
  margin-bottom: 0;
}

.page-intro {
  max-width: 620px;
  margin: -6px 0 30px;
  font-size: 17px;
}

.tag-cloud {
  gap: 10px;
  margin: 24px 0 28px;
}

.tag-cloud a {
  border: 1px solid var(--line);
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tag-cloud a:hover,
.tag-cloud a.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.category-cloud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  column-gap: 36px;
  margin: 24px 0 32px;
  border-top: 1px solid var(--line-strong);
}

.category-cloud a {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.category-cloud a:hover,
.category-cloud a.active {
  color: var(--accent);
}

.category-cloud small {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
}

.menu-list {
  margin-top: 36px;
  border-top: 1px solid var(--line-strong);
}

.menu-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 28px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.menu-row strong {
  font-size: 20px;
}

.menu-row span {
  color: var(--muted);
}

.menu-row small,
.menu-summary,
.menu-section-heading span {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
}

.menu-page {
  padding: 64px 0 96px;
}

.menu-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 240px;
  gap: 80px;
}

.menu-page h1 {
  margin: 8px 0 12px;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.15;
}

.menu-summary {
  margin: 18px 0 0;
}

.menu-path {
  margin-top: 42px;
}

.menu-path-section {
  padding: 28px 0 34px;
  border-top: 1px solid var(--line-strong);
  scroll-margin-top: 24px;
}

.menu-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.menu-section-heading h2 {
  margin: 0;
  font-size: 21px;
}

.menu-path-list {
  margin: 18px 0 0;
  padding-left: 2.8em;
  list-style-position: outside;
}

.menu-path-list li {
  padding: 7px 0 7px 0.4em;
  color: var(--soft);
  font-family: var(--mono);
}

.menu-path-list a {
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  text-decoration: none;
}

.menu-path-list a:hover {
  color: var(--accent);
}

.menu-section-empty {
  color: var(--muted);
}

.menu-section-nav {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.menu-section-nav strong {
  margin-bottom: 10px;
}

.menu-section-nav a {
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.menu-section-nav .menu-category-link {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

.archive-year {
  margin-top: 42px;
}

.archive-year h2 {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
}

.article-page {
  display: grid;
  grid-template-columns: minmax(0, 760px) 240px;
  gap: 80px;
  padding: 64px 0 96px;
}

.article {
  min-width: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.82;
}

.menu-article-nav {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
}

.menu-article-nav > p,
.menu-article-nav > div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.menu-article-nav > p {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.menu-article-nav > div {
  margin-top: 18px;
}

.menu-article-nav > div a {
  display: flex;
  flex-direction: column;
  max-width: 46%;
  text-decoration: none;
}

.menu-article-next {
  margin-left: auto;
  text-align: right;
}

.menu-article-nav small {
  color: var(--soft);
  font-family: var(--mono);
}

.back-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.article-desc {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
}

.article-meta {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.article h1,
.article h2,
.article h3,
.article h4 {
  font-family: var(--serif);
}

.article strong {
  font-weight: 600;
}

.article h2 {
  margin: 44px 0 12px;
  padding-top: 4px;
  scroll-margin-top: 24px;
  font-size: 24px;
  line-height: 1.35;
}

.article h3 {
  margin: 34px 0 10px;
  padding-top: 4px;
  scroll-margin-top: 24px;
  font-size: 20px;
  line-height: 1.4;
}

.article h4 {
  margin: 28px 0 8px;
  padding-top: 4px;
  scroll-margin-top: 24px;
  font-size: 17px;
  line-height: 1.45;
}

.article p {
  max-width: 660px;
  margin: 18px 0;
}

.article blockquote {
  max-width: 660px;
  margin: 28px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
}

.article blockquote p {
  margin: 10px 0;
}

.article ul,
.article ol {
  max-width: 660px;
  margin: 18px 0;
  padding-left: 1.6em;
}

.article li {
  margin: 6px 0;
  padding-left: 0.25em;
}

.article li::marker {
  color: var(--accent);
}

.article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 28px 0;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.article table {
  display: block;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
}

.article th,
.article td {
  min-width: 120px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.article th {
  background: var(--surface);
  font-weight: 650;
}

.article hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.article code {
  font-family: var(--code-mono);
  font-size: 14px;
}

.article p code {
  padding: 2px 5px;
  background: var(--code-bg);
  color: var(--code-text);
}

pre {
  overflow-x: auto;
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--code-text);
  line-height: 1.6;
}

.article pre {
  tab-size: 4;
}

pre code {
  display: block;
  min-width: max-content;
  white-space: pre;
}

.code-block {
  overflow: hidden;
  margin: 28px 0;
  border: 1px solid var(--line);
  background: var(--code-bg);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.code-copy {
  border: 0;
  padding: 4px 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
}

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

.code-block pre {
  min-width: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.code-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.code-line-numbers {
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  color: var(--soft);
  font-family: var(--code-mono);
  font-size: 14px;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  white-space: pre;
}

.mermaid-diagram {
  overflow-x: auto;
  margin: 28px 0;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mermaid-diagram pre.mermaid {
  overflow: visible;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  white-space: pre-wrap;
}

.mermaid-diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.mermaid-diagram.mermaid-error {
  border-color: var(--accent);
}

.mermaid-diagram.mermaid-error::after {
  display: block;
  margin-top: 14px;
  color: var(--accent);
  content: "Mermaid 图表渲染失败，请检查语法。";
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
}

.hljs-comment,
.hljs-quote {
  color: var(--syntax-comment);
  font-style: italic;
}

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

.hljs-string,
.hljs-regexp,
.hljs-attribute,
.hljs-attr {
  color: var(--syntax-string);
}

.hljs-number,
.hljs-symbol,
.hljs-bullet {
  color: var(--syntax-number);
}

.hljs-title,
.hljs-section,
.hljs-function .hljs-title,
.hljs-name,
.hljs-property {
  color: var(--syntax-title);
}

.hljs-built_in,
.hljs-variable,
.hljs-template-variable,
.hljs-selector-class,
.hljs-selector-id {
  color: var(--accent);
}

.hljs-meta,
.hljs-params {
  color: var(--muted);
}

.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  padding: 0 8px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.toc strong {
  display: block;
  margin-bottom: 14px;
  color: var(--text);
}

.toc-list,
.toc-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-children {
  display: none;
  padding: 2px 0 6px;
}

.toc-section.is-current .toc-children {
  display: flex;
}

.toc a {
  text-decoration: none;
}

.toc a.is-active {
  color: var(--accent);
}

.toc-level-3 {
  padding-left: 12px;
  font-size: 13px;
}

.toc-level-4 {
  padding-left: 24px;
  font-size: 12px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.site-footer > * {
  flex: 1;
}

.site-footer > :nth-child(2) {
  text-align: center;
}

.site-footer > :last-child {
  text-align: right;
}

.icp-link {
  color: inherit;
  opacity: 0.62;
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease, text-decoration-color 180ms ease;
}

.icp-link:hover,
.icp-link:focus-visible {
  color: var(--muted);
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 3px;
}

html.lightbox-open {
  overflow: hidden;
}

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

.image-lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 66px 24px 28px;
  background: rgb(10 10 10 / 88%);
}

.image-lightbox-figure {
  display: grid;
  place-items: center;
  gap: 12px;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}

.image-lightbox-image {
  display: block;
  width: auto;
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 132px);
  border: 1px solid rgb(255 255 255 / 20%);
  object-fit: contain;
  box-shadow: 0 18px 60px rgb(0 0 0 / 38%);
}

.image-lightbox-caption {
  max-width: min(80vw, 760px);
  color: rgb(255 255 255 / 68%);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 34%);
  border-radius: 50%;
  background: rgb(20 20 20 / 54%);
  color: rgb(255 255 255 / 78%);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
  border-color: rgb(255 255 255 / 72%);
  color: #fff;
}

.theme-fab,
.back-to-top {
  position: fixed;
  right: 22px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.theme-fab {
  bottom: 22px;
}

.back-to-top {
  bottom: 68px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-fab:hover,
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.theme-fab:active,
.back-to-top:active {
  transform: translateY(0) scale(0.96);
}

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    padding: 18px 0 16px;
  }

  .nav {
    width: 100%;
  }

  .nav {
    gap: 18px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

  .site-search {
    width: 100%;
    margin-left: 0;
  }

  .search-results {
    right: auto;
    left: 0;
    width: 100%;
  }

  .latest-update,
  .content-layout,
  .article-page,
  .menu-layout {
    grid-template-columns: 1fr;
  }

  .latest-update {
    gap: 12px;
  }

  .latest-meta {
    margin-top: 4px;
  }

  .content-layout,
  .article-page {
    gap: 38px;
  }

  .topic-index,
  .toc {
    position: static;
    max-height: min(65vh, 520px);
    border-left: 0;
    padding-left: 0;
  }

  .menu-layout {
    gap: 30px;
  }

  .menu-section-nav {
    position: static;
    grid-row: 1;
    border-bottom: 1px solid var(--line);
    border-left: 0;
    padding: 0 0 18px;
  }

  .post-row {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 20px;
  }
}

@media (max-width: 560px) {
  .site-header,
  .site-footer,
  main {
    width: min(calc(100% - 28px), var(--max));
  }

  .intro-editorial {
    padding-top: 48px;
  }

  .intro-editorial h1 {
    font-size: 40px;
  }

  .intro-about {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .latest-copy h2 {
    font-size: 25px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .post-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .post-row time {
    padding-top: 0;
  }

  .menu-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .menu-article-nav > div {
    flex-direction: column;
  }

  .menu-article-nav > div a {
    max-width: 100%;
  }

  .menu-article-next {
    margin-left: 0;
    text-align: left;
  }

  .pagination {
    justify-content: flex-start;
    gap: 6px;
  }

  .pagination-pages {
    display: contents;
  }

  .narrow-page h1,
  .article h1 {
    font-size: 34px;
  }

  .narrow-page {
    padding-top: 48px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-height: 128px;
  }

  .site-footer > * {
    flex: 0 0 auto;
  }

  .site-footer > :nth-child(2),
  .site-footer > :last-child {
    text-align: left;
  }

  .image-lightbox {
    padding: 62px 14px 22px;
  }

  .image-lightbox-image {
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 120px);
  }

  .image-lightbox-close {
    top: 12px;
    right: 12px;
  }

  .theme-fab {
    right: 14px;
    bottom: 14px;
  }

  .back-to-top {
    right: 14px;
    bottom: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .post-row:hover,
  .theme-fab:hover,
  .theme-fab:active,
  .back-to-top:hover,
  .back-to-top:active {
    transform: none;
  }
}
