@import url("../lib/highlight/styles/github-dark.min.css");

:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --surface-green: #eef8f1;
  --text: #111821;
  --text-soft: #5e6874;
  --text-faint: #8b949f;
  --line: #e5e8e5;
  --line-strong: #d7ddd8;
  --primary: #18a058;
  --primary-hover: #13874a;
  --blue: #2080f0;
  --violet: #8b5cf6;
  --orange: #f08c2e;
  --shadow: 0 18px 50px rgb(26 51 37 / 7%);
  --header-height: 76px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09110d;
  --surface: #101914;
  --surface-soft: #142019;
  --surface-green: #10251a;
  --text: #eff7f1;
  --text-soft: #abb8b0;
  --text-faint: #7d8b82;
  --line: #26332b;
  --line-strong: #33443a;
  --primary: #2bc16e;
  --primary-hover: #43d37e;
  --shadow: 0 20px 55px rgb(0 0 0 / 24%);
}

* {
  box-sizing: border-box;
}

/* 防止移动端被长内容（原文 pre、表格等）撑出水平滚动条；clip 不会影响 sticky 定位 */
html,
body {
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 14px);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

img,
svg {
  display: block;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: 100%;
  align-items: center;
}

.site-brand {
  width: 172px;
}

.site-brand img,
.footer-logo {
  width: 100%;
  height: auto;
}

:root[data-theme="dark"] .site-brand img,
:root[data-theme="dark"] .footer-logo {
  filter: brightness(0) invert(1);
}

.site-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 40px;
}

.site-nav a {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 650;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
}

.site-nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  content: "";
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
}

.icon-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-sun {
  display: none;
}

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

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

.mobile-menu-button {
  display: none;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 600px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  border-bottom: 1px solid var(--line);
}

.hero::before,
.hero::after {
  position: absolute;
  width: 360px;
  height: 360px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: 50%;
  content: "";
}

.hero::before {
  top: -190px;
  left: -180px;
}

.hero::after {
  right: -210px;
  bottom: -210px;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(480px, 1.1fr);
  min-height: 600px;
  align-items: center;
  gap: 40px;
}

.hero-copy {
  padding: 70px 0 64px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 66px);
  line-height: 1.12;
  letter-spacing: -.055em;
}

.hero h1 span {
  color: var(--primary);
}

.hero-lead {
  max-width: 540px;
  margin: 24px 0 0;
  color: var(--text-soft);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 52px;
  padding: 0 25px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button svg,
.text-link svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button-primary {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 22%, transparent);
}

.button-primary:hover {
  color: white;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button-secondary {
  background: var(--surface);
}

.hero-note {
  display: flex;
  margin: 28px 0 0;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 13px;
}

.hero-note span {
  width: 28px;
  height: 1px;
  background: var(--text-faint);
}

.hero-art {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.hero-art img {
  width: min(100%, 680px);
  height: auto;
}

.notes-section {
  padding: 88px 0 100px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading .eyebrow {
  margin-bottom: 9px;
}

.section-heading h2,
.archive-heading h2 {
  margin: 0;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.2;
  letter-spacing: -.04em;
}

.section-heading p:not(.eyebrow),
.archive-heading p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 750;
}

.text-link:hover {
  color: var(--primary-hover);
}

.category-pills {
  display: flex;
  margin: 30px 0 24px;
  flex-wrap: wrap;
  gap: 9px;
}

.category-pill {
  display: inline-flex;
  min-height: 35px;
  padding: 0 17px;
  align-items: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

.category-pill:hover,
.category-pill.is-active {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.home-notes-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.featured-note,
.compact-note,
.archive-note,
.state-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.featured-note {
  display: flex;
  min-height: 430px;
  padding: 36px;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}



.note-index {
  color: color-mix(in srgb, var(--accent, var(--primary)) 18%, transparent);
  font-family: Georgia, serif;
  font-size: 96px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.note-content h3 {
  max-width: 520px;
  margin: 12px 0 15px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.25;
  letter-spacing: -.035em;
}

.note-category {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 8px;
  color: var(--accent, var(--primary));
  font-size: 12px;
  font-weight: 800;
}

.note-category span {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
}

.note-description {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.note-tags {
  display: flex;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 7px;
}

.note-tags span {
  padding: 4px 9px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border-radius: 6px;
  font-size: 11px;
}

.note-date {
  display: flex;
  margin: 22px 0 0;
  align-items: center;
  gap: 7px;
  color: var(--text-faint);
  font-size: 12px;
}

.note-date svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.recent-note-list {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 12px;
}

.compact-note {
  display: grid;
  padding: 21px 24px;
  grid-template-columns: 52px 1fr;
  gap: 18px;
  transition: transform .2s ease, border-color .2s ease;
}

.compact-note:hover,
.archive-note:hover {
  border-color: color-mix(in srgb, var(--accent, var(--primary)) 45%, var(--line));
}

.compact-number {
  color: color-mix(in srgb, var(--accent, var(--primary)) 42%, var(--text-faint));
  font-family: Georgia, serif;
  font-size: 28px;
  font-style: italic;
  line-height: 1.1;
}

.compact-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact-meta time {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.compact-note h3 {
  margin: 6px 0 3px;
  font-size: 17px;
  line-height: 1.35;
}

.compact-note .compact-body>p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.accent-0 {
  --accent: var(--primary);
}

.accent-1 {
  --accent: var(--blue);
}

.accent-2 {
  --accent: var(--violet);
}

.accent-3 {
  --accent: var(--orange);
}

.state-card {
  display: flex;
  min-height: 150px;
  padding: 34px;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.state-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--primary);
  background: var(--surface-green);
  border-radius: 50%;
  font-weight: 850;
}

.state-card strong {
  display: block;
}

.state-card p {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.manifesto-section {
  padding: 0 0 100px;
}

.manifesto-card {
  padding: 72px 30px;
  text-align: center;
  background-color: var(--surface-green);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--primary) 18%, transparent) 1px, transparent 0);
  background-size: 26px 26px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 18px;
}

.manifesto-card blockquote {
  margin: 0 0 24px;
  font-size: clamp(26px, 3.5vw, 42px);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -.04em;
}

.manifesto-card .text-link {
  justify-content: center;
}

.notes-archive-hero {
  background-color: var(--surface-green);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  border-bottom: 1px solid var(--line);
}

.archive-hero-grid {
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.archive-hero-grid .eyebrow {
  margin-bottom: 10px;
}

.archive-hero-grid h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.1;
  letter-spacing: -.055em;
}

.archive-hero-grid>div>p:last-child {
  margin: 18px 0 0;
  color: var(--text-soft);
}

.archive-mark {
  display: flex;
  width: 166px;
  height: 166px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.archive-mark span {
  color: var(--primary);
  font-family: Georgia, serif;
  font-size: 55px;
  font-weight: 700;
  line-height: 1;
}

.archive-mark small {
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .22em;
}

.archive-section {
  padding: 54px 0 100px;
}

.note-search {
  position: relative;
  display: flex;
  height: 54px;
  margin: 0 auto 50px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgb(20 48 33 / 5%);
}

.note-search>svg {
  width: 20px;
  margin-left: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--text-faint);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.note-search input {
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  flex: 1;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.note-search input::placeholder {
  color: var(--text-faint);
}

.note-search button {
  height: 38px;
  margin-right: 7px;
  padding: 0 20px;
  color: white;
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.note-search button:hover {
  background: var(--primary-hover);
}

.archive-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: start;
  gap: 48px;
}

.category-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 28px);
}

.sidebar-title {
  display: flex;
  padding: 0 4px 13px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
}

.sidebar-title small {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
}

.category-sidebar nav {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.category-sidebar nav a {
  display: flex;
  min-height: 48px;
  padding: 10px 12px;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
  border-radius: 9px;
}

.category-sidebar nav a:hover,
.category-sidebar nav a.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.category-sidebar nav a.is-active {
  box-shadow: inset 3px 0 var(--primary), inset 0 0 0 1px var(--line);
}

.category-sidebar nav strong {
  display: block;
  font-size: 13px;
}

.category-sidebar nav small {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 400;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.category-dot {
  display: block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  background: var(--accent);
  border-radius: 50%;
}

.archive-heading {
  margin-bottom: 22px;
}

.archive-heading h2 {
  font-size: 28px;
}

.archive-note-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.archive-note {
  display: flex;
  min-height: 0;
  padding: 16px 22px;
  align-items: center;
  gap: 22px;
  transition: transform .2s ease, border-color .2s ease;
}

.archive-note-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 118px;
}

.archive-note-number {
  color: color-mix(in srgb, var(--accent) 38%, var(--text-faint));
  font-family: Georgia, serif;
  font-size: 17px;
  font-style: italic;
}

.archive-note-main {
  flex: 1;
  min-width: 0;
}

.archive-note h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -.02em;
}

.archive-note .note-description {
  margin: 4px 0 0;
  font-size: 13px;
  -webkit-line-clamp: 1;
}

.archive-note-footer {
  display: flex;
  margin-top: 0;
  padding-top: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.archive-note-footer .note-tags {
  margin: 0;
}

.archive-note-footer time {
  color: var(--text-faint);
  font-size: 10px;
  white-space: nowrap;
}

/* 热门笔记列表（仅展示） */
.hot-list {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  list-style: none;
}

.hot-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
}

.hot-item:hover {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.hot-rank {
  color: color-mix(in srgb, var(--accent, var(--primary)) 38%, var(--text-faint));
  font-family: Georgia, serif;
  font-size: 15px;
  font-style: italic;
  min-width: 22px;
}

.hot-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.hot-body strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-meta {
  color: var(--text-faint);
  font-size: 10px;
}

.hot-empty {
  margin: 12px 4px 0;
  color: var(--text-faint);
  font-size: 12px;
}

.pagination {
  display: flex;
  margin-top: 34px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  color: var(--text-faint);
  font-size: 12px;
}

.pagination a {
  padding: 9px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 650;
}

.pagination a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.site-footer {
  padding: 44px 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

/* ===================== 笔记详情页 ===================== */
.note-detail-section {
  padding: 46px 0 90px;
}

.note-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: start;
  gap: 48px;
}

.note-detail-main {
  min-width: 0;
}

/* 面包屑 */
.note-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
  color: var(--text-faint);
  font-size: 13px;
}

.note-breadcrumb a {
  color: var(--text-faint);
  transition: color .2s ease;
}

.note-breadcrumb a:hover {
  color: var(--primary);
}

.note-breadcrumb .current {
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 标题与元信息 */
.note-detail-header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.2;
  letter-spacing: -.04em;
}

.note-detail-description {
  margin: 16px 0 0;
  color: var(--text-soft);
  font-size: 16px;
}

.note-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 13px;
}

.note-detail-meta svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.meta-date,
.meta-views {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.meta-tag {
  padding: 3px 10px;
  color: var(--primary);
  background: var(--surface-green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.note-body {
  margin-top: 34px;
}

/* 原始 Markdown 原文：长行在内部滚动，避免撑出页面水平滚动条 */
.markdown-source {
  max-width: 100%;
  overflow-x: auto;
  margin: 0;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre;
}

/* 正文排版 */
.note-article {
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}

.note-article h1,
.note-article h2,
.note-article h3,
.note-article h4 {
  margin: 1.7em 0 .6em;
  line-height: 1.4;
  letter-spacing: -.02em;
}

.note-article h1:first-child,
.note-article h2:first-child,
.note-article h3:first-child {
  margin-top: 0;
}

.note-article h2 {
  padding-bottom: .35em;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
}

.note-article h3 {
  font-size: 19px;
}

.note-article p {
  margin: 1em 0;
}

.note-article ul,
.note-article ol {
  margin: 1em 0;
  padding-left: 1.6em;
}

.note-article li {
  margin: .35em 0;
}

.note-article a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note-article a:hover {
  color: var(--primary-hover);
}

.note-article img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.note-article hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.note-article table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 14px;
}

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

.note-article th {
  background: var(--surface-soft);
}

/* 行内代码 */
.note-article :not(pre) > code {
  padding: 2px 7px;
  color: color-mix(in srgb, var(--primary) 72%, var(--text));
  background: var(--surface-green);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
}

/* 引用 / 提示框（绿色信息框） */
.note-article blockquote {
  margin: 1.4em 0;
  padding: 14px 18px;
  color: var(--text);
  background: var(--surface-green);
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
}

.note-article blockquote p {
  margin: .3em 0;
}

/* 代码块（深色主题 + 语言标签 + 复制按钮） */
.code-block {
  margin: 1.5em 0;
  overflow: hidden;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
}

.code-block-header {
  display: flex;
  height: 38px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  background: rgb(255 255 255 / .05);
  border-bottom: 1px solid #30363d;
}

.code-lang {
  color: #8b949e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: lowercase;
}

.code-copy {
  padding: 3px 10px;
  color: #8b949e;
  background: transparent;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: color .2s ease, border-color .2s ease;
}

.code-copy:hover {
  color: #c9d1d9;
  border-color: #57606a;
}

.code-block pre {
  margin: 0;
}

.code-block pre code.hljs {
  padding: 16px 18px;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
}

/* 右侧文章大纲 */
.note-detail-side {
  position: sticky;
  top: calc(var(--header-height) + 28px);
  display: grid;
  gap: 14px;
}

.toc-card {
  max-height: calc(100dvh - var(--header-height) - 102px);
  padding: 18px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* 移动端抽屉用关闭按钮（桌面端隐藏） */
.toc-close {
  display: none;
  width: 30px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.toc-close:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.toc-close svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* 移动端悬浮大纲按钮与遮罩（桌面端隐藏） */
.toc-fab,
.toc-backdrop {
  display: none;
}

.toc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
}

.toc-title svg {
  width: 17px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.toc-list {
  display: grid;
  gap: 2px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.toc-list ol {
  display: grid;
  gap: 2px;
  margin: 2px 0 0;
  padding-left: 12px;
  list-style: none;
}

.toc-list a {
  display: block;
  padding: 6px 10px;
  overflow: hidden;
  color: var(--text-soft);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .2s ease, background-color .2s ease;
}

.toc-list a:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.toc-list li > a.is-active {
  color: var(--primary);
  background: var(--surface-green);
  box-shadow: inset 3px 0 var(--primary);
}

/* 回到顶部 */
.back-to-top {
  display: inline-flex;
  min-height: 44px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, color .2s ease, border-color .2s ease;
}

.back-to-top svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.back-to-top:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* 页脚 */
.note-detail-footer {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.note-detail-footer p {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

/* 笔记卡片整卡可点击 */
.note-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.footer-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.footer-logo {
  width: 144px;
}

.site-footer p {
  margin: 8px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.footer-meta {
  text-align: right;
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr 420px;
    gap: 10px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .home-notes-grid {
    grid-template-columns: 1fr;
  }

  .featured-note {
    min-height: 350px;
  }

  .archive-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 30px;
  }

  .note-detail-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 30px;
  }

  .archive-note-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 66px;
  }

  .shell {
    width: min(100% - 30px, 640px);
  }

  .header-inner {
    grid-template-columns: 1fr auto auto;
  }

  .site-brand {
    width: 145px;
  }

  .mobile-menu-button {
    display: flex;
    width: 40px;
    height: 40px;
    padding: 10px;
    align-items: stretch;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
  }

  .mobile-menu-button span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    display: none;
    padding: 10px 15px 16px;
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    min-height: 44px;
    padding: 0 15px;
    place-items: center start;
    border-radius: 8px;
  }

  .site-nav a.is-active {
    color: var(--primary);
    background: var(--surface-green);
  }

  .site-nav a.is-active::after {
    display: none;
  }

  .header-actions .icon-button:first-child {
    display: none;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid {
    display: flex;
    min-height: auto;
    flex-direction: column;
    gap: 0;
  }

  .hero-copy {
    padding: 60px 0 18px;
  }

  .hero h1 {
    font-size: clamp(38px, 11vw, 52px);
  }

  .hero-lead {
    font-size: 15px;
  }

  .hero-art {
    width: 100%;
    margin: -10px 0 4px;
  }

  .hero-art img {
    width: min(100%, 520px);
  }

  .notes-section {
    padding: 64px 0 72px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading .text-link {
    margin-top: 10px;
    white-space: nowrap;
  }

  .category-pills {
    overflow-x: auto;
    margin-right: -15px;
    padding-right: 15px;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .category-pill {
    flex: 0 0 auto;
  }

  .featured-note {
    min-height: 380px;
    padding: 28px;
  }

  .note-index {
    font-size: 70px;
  }

  .compact-note {
    padding: 20px;
    grid-template-columns: 36px 1fr;
    gap: 12px;
  }

  .compact-number {
    font-size: 22px;
  }

  .compact-meta time {
    display: none;
  }

  .manifesto-section {
    padding-bottom: 72px;
  }

  .manifesto-card {
    padding: 54px 20px;
  }

  .archive-hero-grid {
    min-height: 250px;
  }

  .archive-mark {
    width: 110px;
    height: 110px;
  }

  .archive-mark span {
    font-size: 40px;
  }

  .archive-layout {
    display: flex;
    flex-direction: column;
  }

  .archive-content {
    order: -1;
  }

  .category-sidebar {
    position: static;
    margin-bottom: 42px;
  }

  .category-sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-sidebar nav a {
    align-items: flex-start;
  }

  .archive-note-grid {
    grid-template-columns: 1fr;
  }

  .note-detail-section {
    padding: 30px 0 64px;
  }

  .note-detail-layout {
    display: block;
  }

  .note-detail-side {
    position: static;
    margin-top: 30px;
  }

  /* 宽表格在移动端内部滚动，避免撑破页面 */
  .note-article table {
    display: block;
    overflow-x: auto;
  }

  /* 文章大纲改为从右侧滑出的抽屉 */
  .toc-card {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    width: min(82vw, 330px);
    max-height: none;
    padding: 18px 16px 24px;
    overflow-y: auto;
    background: var(--surface);
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform .3s ease;
  }

  .toc-close {
    display: flex;
  }

  body.toc-open .toc-card {
    transform: translateX(0);
  }

  /* 抽屉遮罩 */
  .toc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    background: rgb(0 0 0 / 42%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }

  body.toc-open .toc-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* 悬浮大纲按钮 */
  .toc-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 70;
    display: inline-flex;
    min-height: 46px;
    padding: 0 15px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: white;
    background: var(--primary);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 32%, transparent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
  }

  .toc-fab:hover {
    background: var(--primary-hover);
  }

  .toc-fab svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }

  /* 回到顶部按钮上移，与大纲按钮同侧堆叠 */
  .back-to-top {
    right: 16px;
    bottom: 76px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-meta {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button {
    width: 100%;
  }

  .section-heading {
    flex-direction: column;
  }

  .section-heading .text-link {
    margin-top: 0;
  }

  .archive-hero-grid {
    align-items: flex-start;
    flex-direction: column;
    gap: 28px;
    padding: 56px 0 36px;
  }

  .archive-mark {
    width: 96px;
    height: 96px;
    align-self: flex-end;
    margin-top: -70px;
  }

  .archive-mark span {
    font-size: 34px;
  }

  .note-search {
    margin-bottom: 36px;
  }

  .note-search button {
    padding: 0 14px;
  }

  .category-sidebar nav {
    grid-template-columns: 1fr;
  }

  .archive-note {
    min-height: 0;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .archive-note-main {
    width: 100%;
  }

  .archive-note-footer {
    align-items: flex-start;
    flex-direction: row;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}