@charset "UTF-8";

/* ==========================================================================
   设计令牌
   配色走 OKLCH：蓝调中性色 + 单一品牌蓝 + 一个罕用的暖色点缀
   ========================================================================== */
:root {
  color-scheme: light;

  --brand:        oklch(52% 0.135 235);
  --brand-strong: oklch(42% 0.145 235);
  --brand-weak:   oklch(94% 0.040 235);
  --brand-line:   oklch(84% 0.075 235);
  --accent:       oklch(62% 0.150 45);

  --bg:           oklch(96.6% 0.024 245);
  --bg-deep:      oklch(93.5% 0.040 245);
  --surface:      oklch(99.2% 0.008 245);
  --surface-mute: oklch(97.4% 0.016 245);
  --glass:        oklch(100% 0.006 245 / 0.72);

  --text:         oklch(26% 0.022 245);
  --text-2:       oklch(42% 0.020 245);
  --text-3:       oklch(57% 0.015 245);
  --text-4:       oklch(69% 0.012 245);

  --line:         oklch(89% 0.020 245);
  --line-soft:    oklch(93% 0.014 245);

  --shadow-sm: 0 1px 2px oklch(30% 0.03 245 / 0.05);
  --shadow-md: 0 2px 6px -1px oklch(30% 0.03 245 / 0.07),
               0 8px 24px -12px oklch(30% 0.04 245 / 0.10);

  --font-display: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC",
                  "STSong", "SimSun", Georgia, serif;
  --font-body: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
               "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.10vw, 0.84rem);
  --step-0:  clamp(0.92rem, 0.89rem + 0.16vw, 1.00rem);
  --step-1:  clamp(1.06rem, 1.00rem + 0.30vw, 1.22rem);
  --step-2:  clamp(1.28rem, 1.14rem + 0.66vw, 1.66rem);
  --step-3:  clamp(1.60rem, 1.30rem + 1.40vw, 2.40rem);

  --gap:     clamp(1.25rem, 0.9rem + 1.4vw, 2.25rem);
  --rail:    15.5rem;
  --radius:  14px;

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:    cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 140ms;
  --dur-mid:  260ms;
  --dur-slow: 520ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --brand:        oklch(72% 0.120 235);
    --brand-strong: oklch(82% 0.100 235);
    --brand-weak:   oklch(30% 0.045 235);
    --brand-line:   oklch(42% 0.075 235);
    --accent:       oklch(74% 0.140 55);

    --bg:           oklch(17.5% 0.026 245);
    --bg-deep:      oklch(13.5% 0.032 245);
    --surface:      oklch(21.5% 0.020 245);
    --surface-mute: oklch(24% 0.018 245);
    --glass:        oklch(21% 0.022 245 / 0.80);

    --text:         oklch(93% 0.012 245);
    --text-2:       oklch(80% 0.014 245);
    --text-3:       oklch(68% 0.014 245);
    --text-4:       oklch(56% 0.014 245);

    --line:         oklch(32% 0.020 245);
    --line-soft:    oklch(27% 0.018 245);

    --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.30);
    --shadow-md: 0 2px 6px -1px oklch(0% 0 0 / 0.40),
                 0 8px 24px -12px oklch(0% 0 0 / 0.50);
  }
}

/* ==========================================================================
   基础
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景：极淡蓝底 + 两层缓慢漂移的柔光 + 一层噪点 */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(46vmax 46vmax at 18% 12%, oklch(88% 0.075 235 / 0.55), transparent 62%),
    radial-gradient(38vmax 38vmax at 84% 78%, oklch(90% 0.060 205 / 0.45), transparent 64%),
    linear-gradient(168deg, var(--bg-deep), var(--bg) 58%);
  animation: drift-a 46s var(--ease-in-out) infinite alternate;
}
body::after {
  z-index: -1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/>\
<feColorMatrix type='saturate' values='0'/></filter>\
<rect width='180' height='180' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

@keyframes drift-a {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 2%, 0) scale(1.08); }
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--text);
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   顶栏
   ========================================================================== */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-mid) var(--ease-out-quart),
              background-color var(--dur-mid) var(--ease-out-quart),
              backdrop-filter var(--dur-mid) var(--ease-out-quart);
}
.masthead[data-stuck="true"] {
  background: var(--glass);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
}

.masthead__inner {
  max-width: 82rem;
  margin-inline: auto;
  padding: clamp(0.7rem, 0.5rem + 0.7vw, 1.05rem) var(--gap);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.brand__mark {
  width: 2.35rem;
  height: 2.35rem;
  flex: none;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
  padding: 0.22rem;
  transition: transform var(--dur-mid) var(--ease-out-quart),
              box-shadow var(--dur-mid) var(--ease-out-quart);
}
.brand:hover .brand__mark {
  transform: translateY(-2px) rotate(-3deg);
  box-shadow: var(--shadow-md);
}
.brand__text { min-width: 0; }
.brand__name, .brand__tag { display: block; }
.brand__name {
  font-size: var(--step-1);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__tag {
  font-size: var(--step--1);
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead__spacer { flex: 1; }

.masthead__date {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
}

/* 汉堡按钮（仅窄屏出现） */
.menu-btn {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: var(--step--1);
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out-quart),
              border-color var(--dur-fast) var(--ease-out-quart);
}
.menu-btn:hover { border-color: var(--brand-line); background: var(--brand-weak); }
.menu-btn__bars { display: grid; gap: 3px; }
.menu-btn__bars i {
  display: block;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--dur-mid) var(--ease-out-quart);
}
body[data-menu="open"] .menu-btn__bars i:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
body[data-menu="open"] .menu-btn__bars i:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }
body[data-menu="open"] .menu-btn__bars i:nth-child(2) { opacity: 0; }

/* 阅读进度条 —— 没有小节的页面（首页、板块页）走这条整条的线 */
.progress:not([data-progress]) {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  will-change: transform;
}

/* 分段进度条 —— 按小节切开，点一段直接滑到那个小节 */
.progress[data-progress] {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 3px;
  display: flex;
  gap: 2px;
  padding: 0 1px;
}
.progress__seg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--brand-line);
  overflow: hidden;
}
/* 3px 太细，手指和鼠标都点不准。用伪元素把命中区上下各撑 8px */
.progress__seg::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}
.progress__fill {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  will-change: transform;
}
.progress__seg[data-on] { background: var(--brand-weak); }

@media (hover: hover) and (pointer: fine) {
  .progress[data-progress] { height: 4px; }
  .progress__seg:hover { background: var(--brand); }
}

@media (prefers-reduced-motion: reduce) {
  .progress__fill { will-change: auto; }
}

/* ==========================================================================
   站内搜索
   索引由 build.py 生成（assets/search-index.js），纯前端检索，无后端、无数据库
   ========================================================================== */
.search { position: relative; flex: 0 1 15rem; min-width: 0; }

.search__field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color var(--dur-fast) var(--ease-out-quart),
              box-shadow var(--dur-fast) var(--ease-out-quart);
}
.search__field:focus-within {
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-weak);
}
.search__icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  font: inherit;
  font-size: var(--step--1);
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}
.search__input::placeholder { color: var(--text-4); }
.search__kbd {
  flex: none;
  padding: 0.05rem 0.34rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-4);
  background: var(--surface-mute);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.search__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(27rem, 90vw);
  max-height: min(62vh, 27rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: search-in var(--dur-mid) var(--ease-out-expo) both;
}
@keyframes search-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
}
.search__panel[hidden] { display: none; }
.search__empty {
  margin: 0;
  padding: 0.85rem 0.7rem;
  font-size: var(--step--1);
  line-height: 1.7;
  color: var(--text-3);
}
.search__empty--note {
  padding: 0.45rem 0.7rem 0.3rem;
  font-size: 0.72rem;
  color: var(--text-4);
}

.hit {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
.hit[aria-selected="true"] { background: var(--brand-weak); }
.hit:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.hit__title {
  display: block;
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1.45;
}
.hit__meta {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}
.hit__snip {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 0.25rem;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-2);
}
mark {
  padding: 0 0.08em;
  color: var(--text);
  background: oklch(88% 0.09 88 / 0.7);
  border-radius: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .hit:hover { background: var(--brand-weak); }
}

/* ==========================================================================
   主体栅格
   ========================================================================== */
.shell {
  max-width: 82rem;
  margin-inline: auto;
  padding: clamp(1.1rem, 0.8rem + 1.4vw, 2.1rem) var(--gap) 0;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

/* ==========================================================================
   左侧导航
   ========================================================================== */
.rail {
  position: sticky;
  top: calc(4.6rem + var(--gap));
  padding: 0.35rem 0 1.5rem;
}

.rail__label {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  padding-inline: 0.85rem;
  margin-bottom: 0.6rem;
}

.nav { display: grid; gap: 2px; }

.nav__item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.62rem 0.85rem;
  border-radius: 10px;
  color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease-out-quart),
              color var(--dur-fast) var(--ease-out-quart),
              transform var(--dur-mid) var(--ease-out-quart);
}
/* 左侧指示条：用 scaleY 做，避免动画化布局属性 */
.nav__item::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.55rem;
  bottom: 0.55rem;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
  transform: scaleY(0);
  transform-origin: 50% 50%;
  transition: transform var(--dur-mid) var(--ease-out-quart);
}

@media (hover: hover) and (pointer: fine) {
  .nav__item:hover { background: var(--surface-mute); color: var(--text); transform: translateX(2px); }
  .nav__item:hover::before { transform: scaleY(0.55); }
}
.nav__item[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.nav__item[aria-current="page"]::before { transform: scaleY(1); }

.nav__name {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 600;
}
.nav__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--text-4);
}

/* 左侧小节目录（只有文章页有，由编辑器按正文里的 ## / ### 生成） */
.rail__toc {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}
.toc__list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc__item > a {
  display: block;
  padding: 0.42rem 0.85rem 0.42rem 1.5rem;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-3);
  text-decoration: none;
}
.toc__item--sub > a {
  padding-left: 2.35rem;
  font-size: calc(var(--step--1) * 0.94);
  color: var(--text-4);
}
@media (hover: hover) and (pointer: fine) {
  .toc__item > a:hover { color: var(--brand); background: var(--brand-weak); }
}
.toc__item[data-on] > a {
  color: var(--brand-strong);
  border-left-color: var(--brand);
  font-weight: 600;
}
.toc__item[data-on] > a:hover { background: none; }

/* 顶栏是吸顶的，直接跳到小标题会被它盖住，留出这条缝 */
.prose h2[id],
.prose h3[id] { scroll-margin-top: 5.6rem; }

.rail__foot {
  margin-top: 1.4rem;
  padding: 0.85rem;
  border-top: 1px solid var(--line-soft);
  font-size: var(--step--1);
  color: var(--text-3);
  line-height: 1.75;
}

/* ==========================================================================
   右侧内容区
   ========================================================================== */
.main { min-width: 0; padding-bottom: 3rem; }

.page-head { margin-bottom: 1.6rem; }
.page-head__kicker {
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.4rem;
}
.page-head__title {
  font-size: var(--step-2);
  letter-spacing: -0.01em;
}
.page-head__desc {
  margin-top: 0.5rem;
  color: var(--text-3);
  max-width: 46ch;
  font-size: var(--step-0);
}

/* 列表：行式，不用卡片套卡片 */
.feed {
  border-top: 1px solid var(--line);
}

.entry {
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out-quart),
              transform var(--dur-slow) var(--ease-out-quart);
  transition-delay: calc(var(--i, 0) * 45ms);
}
.entry.is-in { opacity: 1; transform: none; }

.entry__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem clamp(1rem, 0.6rem + 2vw, 2.4rem);
  align-items: baseline;
  padding: clamp(0.95rem, 0.8rem + 0.5vw, 1.35rem) 0.6rem;
  margin-inline: -0.6rem;
  border-radius: var(--radius);
  transition: background-color var(--dur-mid) var(--ease-out-quart);
}
@media (hover: hover) and (pointer: fine) {
  .entry__link:hover { background: var(--surface); }
  .entry__link:hover .entry__title { color: var(--brand-strong); }
}

.entry__head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }

.entry__title {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: color var(--dur-fast) var(--ease-out-quart);
}

.entry__excerpt {
  margin-top: 0.3rem;
  color: var(--text-3);
  font-size: var(--step-0);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry__meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  text-align: right;
  display: grid;
  gap: 0.3rem;
  padding-top: 0.15rem;
  white-space: nowrap;
}
.entry__date {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  letter-spacing: -0.02em;
}

/* 板块标签：色点 + 文字 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-size: var(--step--1);
  color: var(--text-3);
  padding: 0.08rem 0.5rem 0.08rem 0.42rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-mute);
  line-height: 1.5;
}
.tag__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tag-color, var(--brand));
  flex: none;
}
.tag[data-cat="zhuangxiu"] { --tag-color: oklch(62% 0.130 50); }
.tag[data-cat="ruanjian"]  { --tag-color: oklch(58% 0.140 250); }
.tag[data-cat="yueqi"]     { --tag-color: oklch(56% 0.130 150); }

/* 「新」标记 */
.flag-new {
  font-size: var(--step--1);
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 40%, transparent);
  background: color-mix(in oklch, var(--accent) 10%, transparent);
  border-radius: 999px;
  padding: 0.02rem 0.45rem;
  letter-spacing: 0.04em;
}

/* 空状态 */
.empty {
  padding: 3rem 0;
  text-align: center;
  color: var(--text-3);
  font-family: var(--font-display);
}

/* ==========================================================================
   页脚 / 备案
   ========================================================================== */
.footer {
  margin-top: clamp(2rem, 1rem + 3vw, 4rem);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, oklch(93% 0.030 245 / 0.55));
}
@media (prefers-color-scheme: dark) {
  .footer { background: linear-gradient(180deg, transparent, oklch(13% 0.030 245 / 0.55)); }
}
.footer__inner {
  max-width: 82rem;
  margin-inline: auto;
  padding: clamp(1.4rem, 1rem + 1vw, 2.2rem) var(--gap);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.2rem;
  font-size: var(--step--1);
  color: var(--text-3);
}
.footer__icp a { color: var(--text-2); border-bottom: 1px solid var(--line); }
.footer__icp a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.footer__sep { color: var(--text-4); }
.footer__push { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   移动端：导航变抽屉
   ========================================================================== */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: oklch(20% 0.02 245 / 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-mid) var(--ease-out-quart),
              visibility var(--dur-mid) linear;
}
body[data-menu="open"] .scrim { opacity: 1; visibility: visible; }

@media (max-width: 62rem) {
  .menu-btn { display: inline-flex; }
  .masthead__date { display: none; }
  /* 窄屏把剩余宽度让给搜索框 */
  .search { flex: 1 1 auto; }

  .shell { grid-template-columns: minmax(0, 1fr); }

  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(19rem, 82vw);
    padding: 1.2rem 1rem 2rem;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    transform: translateX(-102%);
    transition: transform var(--dur-mid) var(--ease-out-expo);
  }
  body[data-menu="open"] .rail { transform: none; }
  .rail__foot { border-top-color: var(--line); }
}

@media (min-width: 62.0625rem) {
  body[data-menu="open"] .scrim { opacity: 0; visibility: hidden; }
}

/* 窄屏：时间移到标题下方，右侧不再挤 */
@media (max-width: 34rem) {
  .entry__link {
    grid-template-columns: minmax(0, 1fr);
  }
  .entry__meta {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.25rem;
  }
  .entry__excerpt { -webkit-line-clamp: 3; }
  .brand__tag { display: none; }
  .search { flex: 1 1 5.5rem; }
  .search__kbd { display: none; }
  .search__panel { width: min(27rem, calc(100vw - 2 * var(--gap))); }
}

/* ==========================================================================
   降低动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .entry { opacity: 1; transform: none; }
  body::before { animation: none; }
}

/* ==========================================================================
   文章页排版
   ========================================================================== */
.article { max-width: 68ch; }

.article__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--step--1);
  color: var(--text-3);
  margin-bottom: 1rem;
}
.article__nav a { color: var(--text-2); }
.article__nav a:hover { color: var(--brand); }

.article__head { margin-bottom: 1.8rem; }
.article__title {
  font-size: var(--step-3);
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
}
.article__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-top: 0.9rem;
  font-size: var(--step--1);
  color: var(--text-3);
}
.article__sub time { font-variant-numeric: tabular-nums; }

.prose { font-size: var(--step-0); line-height: 1.85; }

.prose > * + * { margin-top: 1.15em; }

.prose h2 {
  font-size: var(--step-1);
  margin-top: 2.2em;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line-soft);
  letter-spacing: -0.005em;
}
.prose h3 {
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 600;
  margin-top: 1.8em;
  color: var(--text);
}
.prose p { color: var(--text-2); text-wrap: pretty; }

.prose strong { color: var(--text); font-weight: 600; }

.prose a {
  color: var(--brand);
  border-bottom: 1px solid var(--brand-line);
  transition: border-color var(--dur-fast) var(--ease-out-quart);
}
.prose a:hover { border-bottom-color: var(--brand); }

.prose ul, .prose ol { padding-left: 1.3em; color: var(--text-2); }
.prose li + li { margin-top: 0.4em; }
.prose ul { list-style: none; padding-left: 0.2em; }
.prose ul > li { position: relative; padding-left: 1.1em; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-line);
}
.prose ol { list-style: decimal; }
.prose ol > li::marker { color: var(--text-4); font-variant-numeric: tabular-nums; }

.prose blockquote {
  margin-inline: 0;
  padding: 0.2em 0 0.2em 1.1em;
  border-left: 3px solid var(--brand);
  color: var(--text-3);
  font-family: var(--font-display);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.1em 0.38em;
  border-radius: 5px;
  background: var(--surface-mute);
  border: 1px solid var(--line-soft);
}
.prose pre {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  background: var(--surface-mute);
  border: 1px solid var(--line);
  overflow-x: auto;
  line-height: 1.7;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: var(--step--1); }

/* 配图 */
.figure {
  margin: 1.9em 0;
  padding: 0;
}
.figure img,
.figure svg {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.figure figcaption {
  margin-top: 0.6rem;
  font-size: var(--step--1);
  color: var(--text-3);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   配图放大：缩略图 → 点击载入大图 / 动图
   用法：<figure class="figure"><img src="缩略图" data-full="大图或动图" …>
   不写 data-full 时直接放大 src 本身（SVG 场景）
   -------------------------------------------------------------------------- */
.figure { position: relative; }
.figure img { cursor: zoom-in; }

.figure__hint {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  padding: 0.18rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-2);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out-quart);
}
.figure:hover .figure__hint { opacity: 1; }
/* 触屏没有 hover，常驻一个淡的提示 */
@media (hover: none) {
  .figure__hint { opacity: 0.85; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap);
  background: oklch(20% 0.02 245 / 0.88);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-mid) var(--ease-out-quart),
              visibility var(--dur-mid) linear;
}
.lightbox[data-open="true"] { opacity: 1; visibility: visible; }

.lightbox__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  max-width: 100%;
}
.lightbox__media {
  display: block;
  max-width: min(100%, 64rem);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity var(--dur-mid) var(--ease-out-quart),
              transform var(--dur-mid) var(--ease-out-expo);
}
.lightbox[data-loading="false"] .lightbox__media { opacity: 1; transform: none; }
/* 大图路径写错时，别留一个破图图标在屏幕中间 */
.lightbox[data-error="true"] .lightbox__media { display: none; }
.lightbox[data-error="true"] .lightbox__cap::before {
  content: "大图载入失败，检查一下 data-full 路径：";
  color: var(--accent);
}

.lightbox__cap {
  max-width: 44rem;
  font-size: var(--step--1);
  line-height: 1.7;
  text-align: center;
  color: oklch(94% 0.02 245);
}
.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  color: oklch(94% 0.02 245);
  background: oklch(100% 0 0 / 0.12);
  border: 1px solid oklch(100% 0 0 / 0.22);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out-quart);
}
.lightbox__close:hover { background: oklch(100% 0 0 / 0.24); }
.lightbox__close:focus-visible { outline: 2px solid oklch(100% 0 0 / 0.8); outline-offset: 2px; }

.lightbox__spin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.lightbox__spin::after {
  content: "";
  width: 1.7rem;
  height: 1.7rem;
  border: 2px solid oklch(100% 0 0 / 0.28);
  border-top-color: oklch(100% 0 0 / 0.92);
  border-radius: 50%;
  animation: lb-spin 0.7s linear infinite;
}
.lightbox[data-loading="false"] .lightbox__spin { display: none; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* 表格：外层可横向滚动，窄屏不撑破布局 */
.table-wrap {
  margin: 1.6em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  min-width: 30rem;
}
.table-wrap caption {
  caption-side: top;
  text-align: left;
  padding: 0.7rem 0.9rem 0.5rem;
  font-size: var(--step--1);
  color: var(--text-3);
}
.table-wrap th,
.table-wrap td {
  padding: 0.62rem 0.9rem;
  text-align: left;
  vertical-align: top;
}
.table-wrap thead th {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--brand-line);
  white-space: nowrap;
}
.table-wrap tbody tr + tr td { border-top: 1px solid var(--line-soft); }
.table-wrap tbody td { color: var(--text-2); }
.table-wrap tbody th {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.table-wrap td:first-child,
.table-wrap tbody th { font-variant-numeric: tabular-nums; }

/* 结论框 */
.callout {
  margin: 1.6em 0;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius);
  background: var(--surface-mute);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  font-size: var(--step-0);
  color: var(--text-2);
}
.callout__label {
  display: block;
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.25rem;
}

/* 文末返回 */
.article__foot {
  margin-top: 2.8rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  font-size: var(--step--1);
  color: var(--text-3);
}
.article__foot a { color: var(--text-2); }
.article__foot a:hover { color: var(--brand); }
.article__foot .push { margin-left: auto; }

/* 打印 */
@media print {
  .masthead, .rail, .scrim, .progress, .menu-btn, .search, .lightbox { display: none !important; }
  body::before, body::after { display: none; }
  .shell { grid-template-columns: 1fr; }
}

/* ==== 板块色标（站点编辑器维护，勿手改） ====
.tag[data-cat="cat1"] { --tag-color: oklch(60% 0.130 20); }
.tag[data-cat="cat2"] { --tag-color: oklch(58% 0.130 300); }
/* ==== 板块色标 结束 ==== */
