/*
Theme Name: White
Theme URI: https://github.com/example/white
Description: 极简衬线中文博客主题，仿 https://skywt.cn 的排版与交互。支持亮/暗色、文章目录、代码高亮、自定义时间线与友链。
Version: 1.0.0
Author: White
Author URI: https://skywt.cn
Tags: 极简, 衬线, 博客, 暗色模式, 目录
*/

/* ==========================================================================
   1. Design tokens — shadcn/ui "stone" palette
   ========================================================================== */
:root {
  --radius: .625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --background: #fff;
  --foreground: #0c0a09;
  --card: #fff;
  --card-foreground: #0c0a09;
  --popover: #fff;
  --popover-foreground: #0c0a09;
  --primary: #1c1917;
  --primary-foreground: #fafaf9;
  --secondary: #f5f5f4;
  --secondary-foreground: #1c1917;
  --muted: #f5f5f4;
  --muted-foreground: #79716b;
  --accent: #f5f5f4;
  --accent-foreground: #1c1917;
  --destructive: #e40014;
  --border: #e7e5e4;
  --input: #e7e5e4;
  --ring: #a6a09b;

  /* article typography (prose-stone) */
  --prose-body: #44403b;
  --prose-headings: #1c1917;
  --prose-links: #1c1917;
  --prose-bold: #1c1917;
  --prose-bullets: #d6d3d1;
  --prose-hr: #e7e5e4;
  --prose-quotes: #1c1917;
  --prose-quote-borders: #e7e5e4;
  --prose-captions: #79716b;
  --prose-code: #1c1917;
  --prose-th-borders: #d6d3d1;
  --prose-td-borders: #e7e5e4;
  --hljs-bg: #f6f8fa;
  --hljs-fg: #24292e;

  /* layout */
  --font-sc: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "Songti TC",
             Georgia, "Nimbus Roman", "Times New Roman", STSong, SimSun, serif;
  --font-en: "Source Serif 4", "Source Serif Pro", Georgia, "Nimbus Roman",
             "Times New Roman", "Noto Serif SC", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  --container-max: 1280px;
  --gutter: 1rem;
  --prose-width: 36rem;
  --header-height: 3rem;
  --main-pad-y: 8rem;
  --toc-width: 12rem;
  --toc-offset-top: 4rem;
}

.dark {
  --background: #0c0a09;
  --foreground: #fafaf9;
  --card: #1c1917;
  --card-foreground: #fafaf9;
  --popover: #1c1917;
  --popover-foreground: #fafaf9;
  --primary: #e7e5e4;
  --primary-foreground: #1c1917;
  --secondary: #292524;
  --secondary-foreground: #fafaf9;
  --muted: #292524;
  --muted-foreground: #a6a09b;
  --accent: #292524;
  --accent-foreground: #fafaf9;
  --destructive: #ff6568;
  --border: #ffffff1a;
  --input: #ffffff26;
  --ring: #79716b;

  --prose-body: #d6d3d1;
  --prose-headings: #fff;
  --prose-links: #fff;
  --prose-bold: #fff;
  --prose-bullets: #57534d;
  --prose-hr: #44403b;
  --prose-quotes: #f5f5f4;
  --prose-quote-borders: #44403b;
  --prose-captions: #a6a09b;
  --prose-code: #fff;
  --prose-th-borders: #57534d;
  --prose-td-borders: #44403b;
  --hljs-bg: #22272e;
  --hljs-fg: #adbac7;
  color-scheme: dark;
}

/* ==========================================================================
   2. Reset + base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
  background: var(--background);
}
html.dark { color-scheme: dark; }
body {
  position: relative;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sc);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }
hr { border: 0; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
::selection { background: color-mix(in oklab, var(--foreground) 14%, transparent); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-prose {
  max-width: var(--prose-width);
  margin-inline: auto;
}
@media (min-width: 40rem) { .container { max-width: 640px; } }
@media (min-width: 48rem) { .container { max-width: 768px; } }
@media (min-width: 64rem) { .container { max-width: 1024px; } }
@media (min-width: 80rem) { .container { max-width: 1280px; } }
@media (min-width: 96rem) { .container { max-width: 1440px; } }

/* ==========================================================================
   3. Icon font helpers
   ========================================================================== */
[class^="ri-"], [class*=" ri-"] {
  font-family: "remixicon" !important;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  display: inline-block;
  vertical-align: -0.0625em;
  speak: never;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   4. Header
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-height);
  transition: background-color .3s ease, backdrop-filter .3s ease;
}
.site-header.is-scrolled {
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  font-size: 14px;
  line-height: 20px;
}
.brand {
  color: var(--foreground);
  white-space: nowrap;
  transition: opacity .3s ease;
}
a.brand:hover { opacity: .7; }
.site-nav {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  gap: 24px;
  color: var(--muted-foreground);
}
.site-nav a { transition: color .15s ease; }
.site-nav a:hover { color: var(--foreground); }
.site-nav a.is-active { color: var(--foreground); }
.site-header__actions {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.header-link {
  color: var(--foreground);
  transition: color .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.header-link:hover { color: var(--muted-foreground); }
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  margin: -8px;
  color: var(--foreground);
  font-size: 16px;
}
@media (min-width: 40rem) {
  .site-nav { display: flex; }
  .menu-btn, .mobile-menu { display: none !important; }
}

/* mobile sheet */
.mobile-menu {
  position: fixed;
  inset: var(--header-height) 0 0 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  overflow-y: auto;
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  padding: 10px 0;
  color: var(--muted-foreground);
  font-size: 16px;
  line-height: 24px;
  border-bottom: 1px solid var(--border);
}
.mobile-menu a.is-active { color: var(--foreground); }
.mobile-menu .mobile-menu__foot {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-foreground);
  font-size: 14px;
}

/* ==========================================================================
   5. Main + page shell
   ========================================================================== */
.site-main {
  padding-top: var(--main-pad-y);
  padding-bottom: var(--main-pad-y);
  min-height: 80svh;
}
.page-title {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  margin: 32px 0;
}
.page-desc {
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 20px;
  margin: -16px 0 32px;
}

/* ==========================================================================
   6. Home / about
   ========================================================================== */
.hero-title {
  font-family: var(--font-en);
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  margin-top: 144px;
}
.hero-bio { margin-top: 16px; }
.hero-bio p { margin: 0; }
.social-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0 -10px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted-foreground);
}
.social-row a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s ease, background-color .15s ease;
}
/* Font Awesome 前缀图标：固定宽度，保证几行的文字左边缘对齐 */
.social-row .social-icon {
  width: 1.1em;
  font-size: .92em;
  text-align: center;
  opacity: .9;
}
/* 末尾外链箭头：比文字小一号、压低一点，别抢视线 */
.social-row .social-arrow {
  font-size: .62em;
  line-height: 1;
  opacity: .55;
  transform: translateY(-1px) rotate(-45deg);
}
.social-row a:hover .social-arrow { opacity: .9; }
.social-row a:hover { color: var(--foreground); }
.social-row a.pill {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 500;
  gap: 5px;
}
.social-row a.pill:hover {
  background: color-mix(in oklab, var(--secondary) 95%, var(--foreground));
  color: var(--secondary-foreground);
}

.home-sections {
  display: flex;
  flex-direction: column;
  gap: 64px;
  margin: 64px 0;
}
.home-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.section-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--foreground);
}

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 32px; }
.timeline-row {
  display: flex;
  flex-direction: column;
  margin-left: 16px;
}
.timeline-date {
  position: relative;
  margin-right: 36px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.timeline-date::after { content: "0000 — 0000"; visibility: hidden; }
.timeline-date > span { position: absolute; left: 0; top: 0; }
.timeline-body { display: flex; flex-direction: column; flex: 1 1 auto; }
.timeline-title { font-weight: 500; }
.timeline-sub { color: var(--muted-foreground); }
.timeline-note { color: var(--muted-foreground); margin-top: 8px; }
.timeline-note p { margin: 16px 0; }
.timeline-note p:first-child { margin-top: 0; }
.timeline-note p:last-child { margin-bottom: 0; }
@media (min-width: 40rem) {
  .timeline-row { flex-direction: row; margin-left: 0; }
}

/* map card */
.map-card {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
}
.map-card img, .map-card iframe, .map-card__canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}
.map-card__canvas { display: block; color: var(--border); }
.map-card__canvas svg { width: 100%; height: 100%; display: block; fill: none; }
.map-card__grid path { stroke: currentColor; stroke-width: 1; opacity: .55; }
.map-card__river { stroke: color-mix(in oklab, var(--ring) 45%, transparent); stroke-width: 14; stroke-linecap: round; }
.map-card__road { stroke: currentColor; stroke-width: 2; opacity: .8; }
.map-card__pin-halo { fill: color-mix(in oklab, var(--foreground) 10%, transparent); stroke: color-mix(in oklab, var(--foreground) 18%, transparent); }
.map-card__pin { fill: var(--foreground); stroke: var(--background); stroke-width: 3; }
/* 云影：两层柔光横向漂移，压在底图之上、文字之下（亮色下是「云影」，暗色下是「云」）
   循环方式：background-size 固定成整数像素的「瓷砖」，动画把 background-position 移动正好一个
   瓷砖宽度——首尾像素完全对齐，所以不会「啪一下跳回左边」。两层瓷砖宽度/时长不同，形成视差。 */
.map-card__clouds {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  opacity: .85;
}
/* 示意地图是白底，同样的云影会显得发脏，单独压低一档 */
.map-card:not(.map-card--maplibre) .map-card__clouds { opacity: .5; }
/* 底色的「空气层」：云不只有阴影，还有被照亮的薄雾；压在两层云影下面，不参与漂移 */
.map-card__clouds {
  background-image:
    radial-gradient(900px 420px at 28% 22%, rgba(255, 255, 255, .07), transparent 72%),
    radial-gradient(700px 380px at 74% 72%, rgba(255, 255, 255, .05), transparent 74%);
  background-repeat: repeat-x;
  background-size: 1200px 100%;
}
html.dark .map-card__clouds {
  background-image:
    radial-gradient(900px 420px at 28% 22%, rgba(255, 255, 255, .05), transparent 72%),
    radial-gradient(700px 380px at 74% 72%, rgba(255, 255, 255, .035), transparent 74%);
}

.map-card__clouds::before,
.map-card__clouds::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  pointer-events: none;
  will-change: background-position, opacity;
}

/* 大团云块：慢、厚、糊得开 */
.map-card__clouds::before {
  background-image:
    radial-gradient(520px 300px at 190px 30%, rgba(12, 10, 9, .15), rgba(12, 10, 9, .1) 38%, rgba(12, 10, 9, 0) 74%),
    radial-gradient(420px 240px at 430px 46%, rgba(12, 10, 9, .12), rgba(12, 10, 9, .08) 34%, rgba(12, 10, 9, 0) 70%),
    radial-gradient(300px 190px at 300px 54%, rgba(12, 10, 9, .1), rgba(12, 10, 9, .06) 32%, rgba(12, 10, 9, 0) 68%),
    radial-gradient(560px 300px at 900px 66%, rgba(12, 10, 9, .14), rgba(12, 10, 9, .09) 36%, rgba(12, 10, 9, 0) 72%),
    radial-gradient(380px 220px at 1130px 28%, rgba(12, 10, 9, .12), rgba(12, 10, 9, .08) 34%, rgba(12, 10, 9, 0) 70%),
    radial-gradient(260px 160px at 1260px 56%, rgba(12, 10, 9, .09), rgba(12, 10, 9, .05) 30%, rgba(12, 10, 9, 0) 68%);
  background-size: 1400px 100%;
  filter: blur(11px);
  animation: white-cloud-drift-a 260s linear infinite, white-cloud-breathe 43s ease-in-out infinite alternate;
}

/* 轻薄的碎云：快一些、方向相反，位移一个较小的瓷砖 */
.map-card__clouds::after {
  background-image:
    radial-gradient(300px 130px at 140px 34%, rgba(12, 10, 9, .1), rgba(12, 10, 9, .06) 34%, rgba(12, 10, 9, 0) 72%),
    radial-gradient(220px 100px at 360px 18%, rgba(12, 10, 9, .08), rgba(12, 10, 9, .05) 30%, rgba(12, 10, 9, 0) 70%),
    radial-gradient(260px 120px at 560px 62%, rgba(12, 10, 9, .09), rgba(12, 10, 9, .05) 32%, rgba(12, 10, 9, 0) 72%),
    radial-gradient(200px 90px at 730px 40%, rgba(12, 10, 9, .07), rgba(12, 10, 9, .04) 30%, rgba(12, 10, 9, 0) 70%),
    radial-gradient(240px 100px at 840px 76%, rgba(12, 10, 9, .08), rgba(12, 10, 9, .04) 28%, rgba(12, 10, 9, 0) 70%);
  background-size: 900px 100%;
  filter: blur(6px);
  opacity: .85;
  animation: white-cloud-drift-b 168s linear infinite reverse, white-cloud-breathe 31s ease-in-out infinite alternate;
}

html.dark .map-card__clouds::before {
  background-image:
    radial-gradient(520px 300px at 190px 30%, rgba(255, 255, 255, .13), rgba(255, 255, 255, .09) 38%, rgba(255, 255, 255, 0) 74%),
    radial-gradient(420px 240px at 430px 46%, rgba(255, 255, 255, .11), rgba(255, 255, 255, .07) 34%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(300px 190px at 300px 54%, rgba(255, 255, 255, .09), rgba(255, 255, 255, .05) 32%, rgba(255, 255, 255, 0) 68%),
    radial-gradient(560px 300px at 900px 66%, rgba(255, 255, 255, .12), rgba(255, 255, 255, .08) 36%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(380px 220px at 1130px 28%, rgba(255, 255, 255, .11), rgba(255, 255, 255, .07) 34%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(260px 160px at 1260px 56%, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04) 30%, rgba(255, 255, 255, 0) 68%);
}
html.dark .map-card__clouds::after {
  background-image:
    radial-gradient(300px 130px at 140px 34%, rgba(255, 255, 255, .09), rgba(255, 255, 255, .05) 34%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(220px 100px at 360px 18%, rgba(255, 255, 255, .07), rgba(255, 255, 255, .04) 30%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(260px 120px at 560px 62%, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04) 32%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(200px 90px at 730px 40%, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03) 30%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(240px 100px at 840px 76%, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03) 28%, rgba(255, 255, 255, 0) 70%);
}

/* 移动量必须正好等于对应层的 background-size 宽度，才能首尾无缝 */
@keyframes white-cloud-drift-a {
  from { background-position: 0 0; }
  to   { background-position: -1400px 0; }
}
@keyframes white-cloud-drift-b {
  from { background-position: 0 0; }
  to   { background-position: -900px 0; }
}
@keyframes white-cloud-breathe {
  from { opacity: .7; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .map-card__clouds::before,
  .map-card__clouds::after { animation: none; }
}

.map-card__label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.map-card__credit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 0 5px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  font-size: 11px;
  line-height: 16px;
  color: var(--muted-foreground);
  text-decoration: none;
}
.map-card__credit:hover { color: var(--foreground); }

/* 交互地图（MapLibre）：就绪前显示示意地图兜底，就绪后淡入 */
.map-card--maplibre { background: var(--background); }
/* 注意：MapLibre 会给容器加上 .maplibregl-map 类，其自带的
   `position:relative` 与本规则同权重但在后面加载，故这里用两级选择器。 */
.map-card > .map-card__map {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity .35s ease;
}
.map-card.is-ready .map-card__map { opacity: 1; }
.map-card.is-ready .map-card__canvas { visibility: hidden; }

/* 静态封面 + 点击加载：首屏零跨境请求，点了才建图 */
.map-card__cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .35s ease;
}
.map-card__cover--dark { display: none; }
html.dark .map-card__cover--light { display: none; }
html.dark .map-card__cover--dark { display: block; }
.map-card.is-ready .map-card__cover { opacity: 0; visibility: hidden; }
.map-card__load {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 2;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  backdrop-filter: blur(8px);
  color: var(--foreground);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.map-card__load:hover { background: var(--background); transform: translateX(-50%) scale(1.02); }
.map-card__load:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.map-card__load[hidden] { display: none; }
.map-card.is-loading .map-card__load { display: none; }
.map-card.is-loading .map-card__cover { opacity: .6; }
.map-card[data-map-state="error"] .map-card__cover { opacity: 1; visibility: visible; }
.map-card__map .maplibregl-canvas { outline: none; }
.map-card__map .maplibregl-ctrl-group {
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  background: var(--background);
}
.map-card__map .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
.map-card__map .maplibregl-ctrl-attrib {
  font-size: 11px;
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
}
.map-card__map .maplibregl-ctrl-attrib a { color: var(--muted-foreground); }
.site-map-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
}
.site-map-marker__halo {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: color-mix(in oklab, var(--foreground) 22%, transparent);
  animation: white-map-halo 2.6s ease-out infinite;
}
.site-map-marker__dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  background: var(--muted-foreground);
  box-shadow: 0 0 0 3px var(--background);
}
@keyframes white-map-halo {
  0% { transform: scale(.6); opacity: .85; }
  100% { transform: scale(3.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .site-map-marker__halo { animation: none; }
}

/* collapsible */
.collapsible > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.collapsible > summary .section-title { cursor: pointer; }
.collapsible__icon {
  font-size: 14px;
  color: var(--muted-foreground);
  transition: color .15s ease;
}
.collapsible > summary:hover .collapsible__icon { color: var(--foreground); }
.collapsible__body { margin-top: 24px; }

/* ==========================================================================
   7. Post list (blog index / archive / search)
   ========================================================================== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 64px;
}
.post-list__row { display: flex; flex-direction: column;  }
/* 置顶文章 */
.post-meta__pin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted-foreground);
}
.post-meta__pin .ri-pushpin-2-fill { font-size: 11px; }

.post-list__row--sticky {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
}
.post-list__row--sticky > a {
  flex: 0 1 auto;
  min-width: 0;
}
.post-list__pin {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  transform: translateY(-1px);
}
.post-list__pin .ri-pushpin-2-fill { font-size: 10px; }

.post-list__row a {
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  transition: color .15s ease;
}
.post-list__row a:hover { color: var(--muted-foreground); }
.archived-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 64px;
  color: var(--muted-foreground);
  transition: color .15s ease;
  font-size: 16px;
  line-height: 24px;
}
.archived-link:hover { color: var(--foreground); }
.post-list__empty { color: var(--muted-foreground); }

/* archive groups */
/* 归档：年份 + 「日期 ｜ 标题」两列，日期列用不可见占位撑宽，保证竖向对齐 */
.archive { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.archive-group { display: flex; flex-direction: column; gap: 16px; }
.archive-year {
  margin: 32px 0 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--foreground);
}
.archive-group:first-child .archive-year { margin-top: 0; }
.archive-list { display: flex; flex-direction: column; gap: 16px; }
.archive-row { display: flex; align-items: baseline; }
.archive-row__date {
  position: relative;
  margin-right: 36px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.archive-row__date::after { content: '0000/00/00'; visibility: hidden; }
.archive-row__date > span { position: absolute; left: 0; top: 0; }
.archive-row__title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  transition: color .15s ease;
  overflow-wrap: anywhere;
}
.archive-row__title:hover { color: var(--muted-foreground); }

/* 「加载更多」：参考站的描边按钮尺寸（36px 高 / 14px 字 / 8px 圆角） */
.archive-more-wrap { margin-top: 40px; }
.archive-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--foreground);
  transition: background-color .15s ease, border-color .15s ease;
  cursor: pointer;
}
.archive-more:hover { background: var(--muted); border-color: var(--ring); }
.archive-more.is-loading { opacity: .6; pointer-events: none; }
.archive-more.is-done { display: none; }

/* 手机上日期换到标题上方，整行缩进 16px，跟参考站一致 */
@media (max-width: 639px) {
  .archive-row { flex-direction: column; margin-left: 16px; }
  .archive-row__date { margin-right: 0; }
}

/* ==========================================================================
   8. Forms / buttons / inputs
   ========================================================================== */
.input-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-group:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 25%, transparent);
}
.input-group textarea,
.input-group input[type="text"],
.input-group input[type="email"],
.input-group input[type="url"] {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
  resize: vertical;
}
.input-group textarea { min-height: 96px; }
.input-group__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px 8px;
}
.input-group--inline {
  flex-direction: row;
  align-items: center;
  height: 36px;
  padding-inline: 10px;
  gap: 8px;
}
.input-group--inline input {
  border: 0;
  outline: 0;
  background: transparent;
  height: 100%;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
}
.input-group--inline .ri-mail-line { color: var(--muted-foreground); font-size: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
  transition: background-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { background: color-mix(in oklab, var(--accent) 60%, var(--background)); }
.btn--sm { height: 32px; padding: 0 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* toggle group (theme switch) */
.toggle-group {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
  overflow: hidden;
}
.toggle-group button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 8px;
  color: var(--muted-foreground);
  font-size: 16px;
  transition: background-color .15s ease, color .15s ease;
}
.toggle-group button:hover { color: var(--foreground); }
.toggle-group button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* language select */
.lang-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-select__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: background-color .15s ease;
}
.lang-select__btn:hover,
.lang-select.is-open .lang-select__btn { background: color-mix(in oklab, var(--accent) 60%, transparent); }
.lang-select__btn .ri-arrow-down-s-line {
  color: var(--muted-foreground);
  transition: transform .15s ease;
}
.lang-select.is-open .lang-select__btn .ri-arrow-down-s-line { transform: rotate(180deg); }

/* 自定义下拉：跟主题同一套圆角/描边/底色，替代浏览器原生的 select 弹层 */
.lang-select__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  min-width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  box-shadow: 0 8px 24px color-mix(in oklab, var(--foreground) 12%, transparent);
}
.lang-select__menu li { margin: 0; }
.lang-select__menu a,
.lang-select__menu .is-current {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 20px;
  color: var(--foreground);
  text-decoration: none;
  white-space: nowrap;
}
.lang-select__menu a:hover { background: var(--secondary); }
.lang-select__menu .is-current { color: var(--muted-foreground); }

/* ==========================================================================
   9. Footer
   ========================================================================== */
.site-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-block: 32px;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 20px;
}
.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.site-footer__copy { flex: 1 1 auto; }
.site-footer__controls { display: flex; flex-wrap: wrap; gap: 8px; }
.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  opacity: .7;
}
.site-footer__legal a { transition: color .15s ease; }
.site-footer__legal a:hover { color: var(--foreground); }
.site-footer__legal .ri-arrow-right-up-line { font-size: .9em; }
.site-footer__legal img {
  display: inline;
  width: 14px;
  height: 14px;
  position: relative;
  top: -2px;
  left: -2px;
}

/* ==========================================================================
   10. Article page
   ========================================================================== */
.post-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
  row-gap: 8px;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 20px;
}
.post-meta a { color: inherit; transition: color .15s ease; }
.post-meta a:hover { color: var(--foreground); }
.post-meta span, .post-meta a { display: inline-flex; align-items: center; gap: 2px; }
.post-title {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  color: var(--foreground);
  font-family: var(--font-sc);
}
.post-wrap { position: relative; }

/* table of contents */
.toc-rail {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  transform: translateX(100%);
  display: none;
}
.toc {
  position: sticky;
  top: var(--toc-offset-top);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--toc-width);
  margin-left: 32px;
  max-height: calc(100svh - 112px);
  overflow-y: auto;
  padding-bottom: 8px;
  font-size: 14px;
  line-height: 20px;
  scrollbar-width: thin;
}
.toc-label {
  opacity: 0;
  color: var(--muted-foreground);
  transition: opacity .2s ease;
  white-space: nowrap;
}
.toc:hover .toc-label { opacity: 1; }
.toc a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-foreground);
  transition: color .15s ease;
}
.toc a:hover { color: var(--foreground); }
.toc a.is-active { color: var(--foreground); }
.toc-bar {
  flex: 0 0 auto;
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background-color .15s ease;
}
.toc a.is-active .toc-bar { background: var(--muted-foreground); }
.toc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s ease;
}
.toc:hover .toc-text,
.toc a.is-active .toc-text { opacity: 1; }
.toc a[data-level="3"] .toc-text { padding-left: 1rem; }
@media (min-width: 64rem) {
  .toc-rail { display: block; }
}
@media (min-width: 80rem) {
  .toc { width: 16rem; margin-left: 64px; }
}

/* prose */
.prose {
  font-size: 16px;
  line-height: 28px;
  font-weight: 450;
  color: var(--prose-body);
  overflow-wrap: break-word;
}
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 16px 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: var(--prose-headings);
  font-weight: 700;
  scroll-margin-top: 64px;
  line-height: 1.4;
}
.prose h1 { font-size: 24px; margin: 2em 0 1em; }
.prose h2 { font-size: 20px; line-height: 28px; font-weight: 700; margin: 40px 0 20px; }
.prose h3 { font-size: 18px; line-height: 28px; font-weight: 600; margin: 28.8px 0 10.8px; }
.prose h4 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 24px 0 8px; }
.prose h5, .prose h6 { font-size: 16px; margin: 24px 0 8px; }
.prose strong { font-weight: 600; color: var(--prose-bold); }
.prose em { font-style: italic; }
.prose a {
  color: var(--prose-links);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color .15s ease;
}
.prose a:hover { color: var(--muted-foreground); }
.prose ul, .prose ol { margin: 20px 0; padding-left: 26px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 8px 0; padding-left: 6px; }
.prose li::marker { color: var(--prose-bullets); }
.prose li > ul, .prose li > ol { margin: 12px 0; }
.prose li p { margin: 8px 0; }
.prose blockquote {
  margin: 25.6px 0;
  padding-left: 16px;
  border-left: 4px solid var(--prose-quote-borders);
  color: var(--prose-quotes);
  font-style: normal;
  font-weight: 500;
}
.prose blockquote p::before, .prose blockquote p::after { content: ""; }
.prose code {
  font-family: var(--font-mono);
  font-size: .875em;
  font-weight: 600;
  color: var(--prose-code);
  background: transparent;
  padding: 0;
}
.prose code::before, .prose code::after { content: ""; }
.prose pre {
  margin: 24px 0;
  padding: 12px 16px;
  border-radius: 6px;
  background: var(--hljs-bg);
  color: var(--hljs-fg);
  font-size: 14px;
  line-height: 24px;
  overflow-x: auto;
  position: relative;
}
.prose pre code {
  display: block;
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  color: inherit;
  background: transparent;
  padding: 0;
  white-space: pre;
}
.prose table {
  width: 100%;
  margin: 28px 0;
  font-size: 14px;
  line-height: 24px;
  border-collapse: collapse;
  text-align: left;
}
.prose thead { border-bottom: 1px solid var(--prose-th-borders); }
.prose tbody tr { border-bottom: 1px solid var(--prose-td-borders); }
.prose th, .prose td { padding: 8px; text-align: start; }
.prose th:first-child, .prose td:first-child { padding-left: 0; }
.prose th:last-child, .prose td:last-child { padding-right: 0; }
.prose th { font-weight: 600; color: var(--prose-headings); }
.prose img { margin: 28px 0; border-radius: 2px; cursor: zoom-in; }
.prose figure { margin: 28px 0; }
.prose figure img { margin: 0; }
.prose figcaption {
  margin-top: .857143em;
  font-size: 14px;
  line-height: 20px;
  color: var(--prose-captions);
  text-align: center;
}
.prose hr { margin: 48px 0; border-top: 1px solid var(--prose-hr); }
.prose iframe, .prose video { max-width: 100%; }
.prose .katex { font-size: 1.11em; }
.prose > p:first-of-type { margin-top: 0; }

/* code copy button */
.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 14px;
  color: var(--muted-foreground);
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease;
}
.prose pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--foreground); }

/* post tail blocks */
.post-sep { margin: 32px 0; border-top: 1px solid var(--border); }
/* ---------- 文章密码 ---------- */
.prose--locked { margin-top: 8px; }
.prose .protected {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 380px;
  margin: 32px 0 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.prose .protected p { margin: 0; }
.prose .protected .word {
  margin-bottom: 12px;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 22px;
}
.prose .protected p:last-child {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.prose .protected input[type="password"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.prose .protected input[type="password"]:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 25%, transparent);
}
.prose .protected input[type="submit"] {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.prose .protected input[type="submit"]:hover { opacity: .9; }

.post-license {
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
  row-gap: 8px;
  margin: 32px 0;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 20px;
}
.post-license > * { display: inline-flex; align-items: center; gap: 2px; }
.post-license .chip { border-bottom: 1px solid; cursor: default; }
.post-nav {
  display: flex;
  gap: 16px;
  margin: 32px 0;
  font-size: 14px;
  line-height: 20px;
}
.post-nav__col { display: flex; flex: 1 1 0; flex-direction: column; gap: 4px; min-width: 0; }
.post-nav__col--next { align-items: flex-end; text-align: right; }
.post-nav__label { color: var(--muted-foreground); }
.post-nav__link { color: var(--foreground); transition: color .15s ease; }
.post-nav__link:hover { color: var(--muted-foreground); }

/* ==========================================================================
   11. Comments
   ========================================================================== */
.comments { margin: 16px 0; display: flex; flex-direction: column; gap: 16px; }
.comments__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
  color: var(--foreground);
}
.comment { display: flex; gap: 8px; }
.comment--reply { margin-left: 24px; }
.avatar {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  user-select: none;
  box-shadow: inset 0 0 0 1px var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.comment__main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 8px; min-width: 0; }
.comment__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; }
.comment__author { font-weight: 500; color: var(--foreground); }
.comment__date { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.comment__body { font-size: 16px; line-height: 28px; color: var(--prose-body); }
.comment__body p { margin: 8px 0; }
.comment__body p:first-child { margin-top: 0; }
.comment__body p:last-child { margin-bottom: 0; }
.comment__body a { border-bottom: 1px solid currentColor; }
.comment__reply {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted-foreground);
  transition: color .15s ease;
}
.comment__reply:hover { color: var(--foreground); }
.comment__children { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }

.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.comment-form__fields .input-group { flex-direction: row; align-items: center; height: 36px; padding-inline: 10px; }
.comment-form__fields input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 20px;
}
.comment-form__hint { font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.comment-form .input-group textarea { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.comment-reply-title {
  font-size: 14px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.comment-reply-title a { border-bottom: 1px solid currentColor; }
@media (min-width: 40rem) {
  .comment-form__fields { grid-template-columns: repeat(3, 1fr); }
}

/* ==========================================================================
   12. Friends
   ========================================================================== */
.friend-list { display: flex; flex-direction: column; gap: 16px; }
.friend {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 16px;
  line-height: 24px;
}
.friend > a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  transition: color .15s ease;
}
.friend__name {
  flex: 0 0 auto;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--foreground);
}
.friend__desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-foreground);
  transition: color .15s ease;
}
.friend__arrow { flex: 0 0 auto; color: var(--muted-foreground); font-size: .9em; transition: color .15s ease; }
.friend > a:hover .friend__desc,
.friend > a:hover .friend__arrow { color: color-mix(in oklab, var(--muted-foreground) 70%, transparent); }

/* ==========================================================================
   13. Pagination / lightbox / misc
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in oklab, var(--foreground) 14%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 4px; box-shadow: 0 24px 64px rgb(0 0 0 / .25); }

.empty-state {
  color: var(--muted-foreground);
  text-align: left;
  padding-top: 32px;
}
.empty-state a { border-bottom: 1px solid currentColor; }

/* search */
.search-form { margin-top: 32px; display: flex; gap: 8px; max-width: 100%; }
.search-form .input-group { flex: 1 1 auto; }

/* 404 */
.notfound { display: flex; flex-direction: column; gap: 16px; }
.notfound__code { font-family: var(--font-en); font-size: 48px; line-height: 1; font-weight: 700; }
/* ---------------------------------------------------------------- extras */
/* meta separators */
.post-meta__sep { opacity: .5; }

/* body lock while overlays open */
html.menu-open body,
body.is-locked { overflow: hidden; }

/* guestbook */
.guestbook { display: flex; flex-direction: column; gap: 16px; }
.guestbook__intro { color: var(--muted-foreground); }
.guestbook__intro p { margin: 0; }
.comments--guestbook { margin-top: 8px; }

/* comment form main column */
.comment-form__main { display: flex; flex-direction: column; gap: 12px; }

/* pagination */
.page-navigator, .pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 20px;
}
.page-navigator li, .pagination li { display: inline-flex; }
.page-navigator a, .pagination a,
.page-navigator > li > span, .pagination > li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  transition: color .15s ease, background-color .15s ease;
}
.page-navigator a:hover, .pagination a:hover { color: var(--foreground); background: var(--accent); }
.page-navigator li.current > a, .pagination li.current > a,
.page-navigator li.current > span, .pagination li.current > span {
  color: var(--foreground);
  background: var(--secondary);
  font-weight: 500;
}
.page-navigator .prev, .pagination .prev,
.page-navigator .next, .pagination .next { color: var(--muted-foreground); }

/* code copy feedback */
.code-copy.is-done { color: var(--foreground); }
.btn.is-loading { opacity: .6; pointer-events: none; }


/* print */

/* --------------------------------------------------------------- 页头搜索 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.icon-btn:hover { color: var(--foreground); background: var(--secondary); }
.icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.site-search {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: 48px;
  display: flex;
  align-items: center;
  background: color-mix(in oklab, var(--foreground) 14%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.site-search.is-open { opacity: 1; transform: none; }
.site-search__form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}
.site-search__icon {
  position: absolute;
  left: 30px;
  color: var(--muted-foreground);
  font-size: 16px;
  pointer-events: none;
}
.site-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  padding: 0 10px 0 40px;
  border: 0;
  border-radius: 8px;
  background: color-mix(in oklab, var(--foreground) 8%, transparent);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.site-search__input::placeholder { color: var(--muted-foreground); }
.site-search__input::-webkit-search-decoration,
.site-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.site-search__close { flex: 0 0 auto; }

html.search-open .site-header { background: transparent; }
html.search-open .site-header__inner { visibility: hidden; }
@media (max-width: 639px) {
  .site-search__icon { left: 26px; }
  .site-search__input { padding-left: 36px; }
}

@media print {
  .site-header, .site-footer, .toc-rail, .mobile-menu, .post-nav, .comments { display: none !important; }
  .site-main { padding: 0; }
}

/* ---------- 友人头像（图片） ---------- */
.avatar--img {
  overflow: hidden;
  padding: 0;
  background: var(--secondary);
}
.avatar--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* ---------- 搜索表单 ---------- */
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 40px;
}
.search-form__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}
.search-form__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  color: var(--muted-foreground);
  font-size: 16px;
  pointer-events: none;
}
.search-form__input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-form__input::-webkit-search-decoration,
.search-form__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-form__input::placeholder { color: var(--muted-foreground); }
.search-form__input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--ring) 20%, transparent);
}
.search-form__submit { flex: 0 0 auto; }

/* ---------- 实验室（单栏列表，不分栏） ---------- */
.page-intro,
.lab-intro { margin: 24px 0 40px; }

/* 实验室分组 tab */
.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 40px 0 0;
}
.lab-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.lab-tab:hover { color: var(--foreground); border-color: var(--ring); }
.lab-tab:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.lab-tab.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}
.lab-tab__count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: .65;
}
.lab-panel { margin-top: 32px; }
.lab-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.lab-row__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.lab-row__title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
}
a.lab-row__title:hover { text-decoration: underline; text-underline-offset: 4px; }
.lab-row__arrow {
  margin-left: 2px;
  font-size: 13px;
  color: var(--muted-foreground);
  opacity: .45;
  transition: opacity .15s ease;
}
a.lab-row__title:hover .lab-row__arrow { opacity: 1; }
.lab-row__tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--tag-bg, var(--secondary));
  color: var(--tag-fg, var(--muted-foreground));
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}
.lab-row__tag--gray   { --tag-fg: #57534e; --tag-bg: #f5f5f4; }
.lab-row__tag--red    { --tag-fg: #b91c1c; --tag-bg: #fee2e2; }
.lab-row__tag--orange { --tag-fg: #c2410c; --tag-bg: #ffedd5; }
.lab-row__tag--amber  { --tag-fg: #a16207; --tag-bg: #fef3c7; }
.lab-row__tag--green  { --tag-fg: #15803d; --tag-bg: #dcfce7; }
.lab-row__tag--teal   { --tag-fg: #0f766e; --tag-bg: #ccfbf1; }
.lab-row__tag--blue   { --tag-fg: #1d4ed8; --tag-bg: #dbeafe; }
.lab-row__tag--violet { --tag-fg: #6d28d9; --tag-bg: #ede9fe; }
.lab-row__tag--pink   { --tag-fg: #be185d; --tag-bg: #fce7f3; }

.dark .lab-row__tag--gray   { --tag-fg: #d6d3d1; --tag-bg: rgba(255, 255, 255, .13); }
.dark .lab-row__tag--red    { --tag-fg: #fca5a5; --tag-bg: rgba(248, 113, 113, .16); }
.dark .lab-row__tag--orange { --tag-fg: #fdba74; --tag-bg: rgba(251, 146, 60, .16); }
.dark .lab-row__tag--amber  { --tag-fg: #fcd34d; --tag-bg: rgba(251, 191, 36, .16); }
.dark .lab-row__tag--green  { --tag-fg: #86efac; --tag-bg: rgba(74, 222, 128, .16); }
.dark .lab-row__tag--teal   { --tag-fg: #5eead4; --tag-bg: rgba(45, 212, 191, .16); }
.dark .lab-row__tag--blue   { --tag-fg: #93c5fd; --tag-bg: rgba(96, 165, 250, .16); }
.dark .lab-row__tag--violet { --tag-fg: #c4b5fd; --tag-bg: rgba(167, 139, 250, .16); }
.dark .lab-row__tag--pink   { --tag-fg: #f9a8d4; --tag-bg: rgba(244, 114, 182, .16); }
.lab-row__desc {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 24px;
}

/* ---------- 导航里的自定义链接 ---------- */
.nav-ext {
  margin-left: 2px;
  font-size: 11px;
  opacity: .55;
  vertical-align: 1px;
}

/* ---------- 页面切换：淡入淡出 ---------- */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: white-fade-out 200ms ease both;
}
::view-transition-new(root) {
  animation: white-fade-in 240ms ease both;
}
@keyframes white-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes white-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 不支持跨文档视图过渡时的兜底（由 app.js 加类） */
html.page-leaving body {
  opacity: 0;
  transition: opacity 160ms ease;
}
body {
  transition: opacity 200ms ease;
}

@media print {
  @view-transition { navigation: none; }
}

/* 数学公式：长公式在窄屏横向滚动，不要把版心撑破 */
/* —— HTML 兼容层：正文里手写的 HTML（Obsidian / 大模型生成的示意图） ——
 * 这类片段大量引用 Obsidian 的 CSS 变量，主题里没有这些名字，边框/底色/强调色会全部失效。
 * 在 .prose 作用域内把它们映射到主题 token；有自定义值时 inline style 仍然优先。
 */
.prose {
  --text-normal: var(--foreground);
  --text-muted: var(--muted-foreground);
  --text-faint: color-mix(in oklab, var(--muted-foreground) 72%, transparent);
  --text-accent: var(--primary);
  --text-on-accent: var(--primary-foreground);
  --background-primary: var(--background);
  --background-primary-alt: var(--background);
  --background-secondary: var(--muted);
  --background-secondary-alt: var(--muted);
  --background-modifier-border: var(--border);
  --background-modifier-hover: var(--accent);
  --interactive-accent: var(--primary);
  --interactive-accent-hover: var(--primary);
  --color-red: #d93b41;
  --color-orange: #d9730d;
  --color-yellow: #b28a00;
  --color-green: #2f8f5b;
  --color-cyan: #0a8fa6;
  --color-blue: #2f6fdb;
  --color-purple: #7c4dbc;
  --color-pink: #c0399a;
}
html.dark .prose {
  --color-red: #ff6b6f;
  --color-orange: #ff9f45;
  --color-yellow: #ffd54f;
  --color-green: #4ade80;
  --color-cyan: #38d0e8;
  --color-blue: #7aa7ff;
  --color-purple: #b98cff;
  --color-pink: #ff8ecb;
}
/* 手写 HTML 里的内联 padding + border 会把宽度撑破容器 */
.prose * { box-sizing: border-box; }
.prose .raw-html { margin: 28px 0; }
.prose .raw-html > div { max-width: 100%; }
.prose .raw-html small { font-size: 13px; color: var(--muted-foreground); }
/* flex 行里的长代码/长链接不要撑破卡片 */
.prose .raw-html [style*="display:flex"] { max-width: 100%; }
.prose .raw-html [style*="display:flex"] > * { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 639px) {
  .prose .raw-html { font-size: .95em; }
  .prose .raw-html [style*="min-width:240px"] { min-width: 0 !important; }
  .prose .raw-html [style*="min-width:280px"] { min-width: 0 !important; }
}
.prose .katex { font-size: 1.02em; }
.prose .katex-display {
  margin: 24px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 4px;
}
.prose .katex-display > .katex { white-space: normal; }
html.dark .prose .katex { color: var(--foreground); }

/* 窄屏上把公式整体再收一点，尽量不出现横向滚动 */
@media (max-width: 639px) {
  .prose .katex { font-size: .95em; }
  .prose .katex-display > .katex { font-size: .92em; }
}
