/* ==========================================================================
   内容页（文章详情）样式 —— 对照 cai.im/blog/finding-a-room-in-zurich/ 复刻
   关键尺存：根字号 15px（原站 html{font-size:15px}），所有 rem 值按此换算。
   与参考站的一处工程取舍：正文栏宽用定值 604.72px（= 该站在 15px 根字号下
   的 65ch），避免中文字体回退时 ch 变小导致整栏抖动。
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308, U+329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+??, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --spacing: 0.25rem;
  --side-gap: clamp(1rem, 5vw, 4rem);
  --container-prose: 604.72px;

  --accent-color: #528292;
  --accent-color-darker: #395b66;
  --mist-500: #67787c;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-900: #171717;
  --neutral-300: #d4d4d4;

  --font-stylish: "Bricolage Grotesque", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --is-scrolled: 0;
}

@property --is-scrolled {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

/* 必须注册成 <number>，否则自定义属性不参与过渡：
   头像/箭头的 opacity 会「瞬移」而不是像参考站那样弹一下。 */
@property --hover-trigger {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scrollbar-gutter: stable;
  scroll-padding-top: 2rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--font-stylish);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 触屏点链接时不要出现系统灰色高亮块（各端表现不一，还压住自带的过渡） */
  -webkit-tap-highlight-color: transparent;
}

img {
  border: 0;
}

/* --------------------------------------------------------------------------
   外层容器：窄栏 + 上下留白 + 模块间距
   -------------------------------------------------------------------------- */
.container {
  --py: 4rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4rem;
  max-width: calc(var(--container-prose) + 2rem);
  margin: 0 auto;
  padding: var(--py) 1rem;
}

@media (min-width: 768px) {
  .container {
    --py: 8rem;
    gap: 6rem;
  }
}

/* --------------------------------------------------------------------------
   左上角圆形头像：默认是作者头像，滚动 100px 内或鼠标移上去时换成返回箭头
   -------------------------------------------------------------------------- */
.sticky-back-btn-wrapper {
  position: absolute;
  top: var(--py);
  bottom: var(--py);
  left: 1rem;
  z-index: 40;
  pointer-events: none;
}

.sticky-back-btn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  pointer-events: auto;
}

.sticky-back-button {
  --hover-trigger: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background-color: rgba(82, 130, 146, 0.2);
  -webkit-backdrop-filter: blur(calc(var(--is-scrolled) * 12px));
  backdrop-filter: blur(calc(var(--is-scrolled) * 12px));
  transform: scale(1);
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.3s ease,
    --hover-trigger 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 参考站是 hover 时整颗按钮放大 10%（Solid 里那个 transition-transform duration-300 的壳） */
.sticky-back-button:hover {
  --hover-trigger: 1;
  transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
  .sticky-back-button,
  .back-btn-avatar,
  .back-btn-arrow {
    transition-duration: 0.01ms !important;
  }
}

.back-btn-inner {
  /* 切换进度：滚动（0~100px）与 hover 谁大听谁的 —— 两者都能把头像换成箭头 */
  --swap: max(var(--is-scrolled), var(--hover-trigger));
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 9999px;
}

/* 作者头像：切换时放大并淡出，把圆让给箭头 */
.back-btn-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9999px;
  opacity: calc(1 - var(--swap));
  transform: scale(calc(1 + 0.22 * var(--swap)));
  will-change: opacity, transform;
  transition: opacity 0.24s ease, transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
  /* 头像是装饰，点击一律交给外层链接 */
  pointer-events: none;
  user-select: none;
}

/* 箭头：从头像左侧滑进来，带回弹 */
.back-btn-arrow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 箭头是纯黑（currentColor 取自 body） */
  color: #000;
  opacity: var(--swap);
  transform: translateX(calc(-55% * (1 - var(--swap)))) scale(calc(0.72 + 0.28 * var(--swap)));
  will-change: opacity, transform;
  transition: opacity 0.22s ease, transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.back-btn-arrow svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* 触屏没有 hover：直接给箭头，否则只剩一个头像，看不出能点 */
@media (hover: none) {
  .back-btn-inner {
    --swap: 1;
  }
}

@media (min-width: 768px) {
  .sticky-back-btn-wrapper {
    transform: translateX(calc(var(--is-scrolled) * -1 * (var(--side-gap) + 2.5rem)));
  }

  .sticky-back-btn-container {
    position: sticky;
    top: 2rem;
    width: calc(2rem + 1rem * var(--is-scrolled));
    height: calc(2rem + 1rem * var(--is-scrolled));
  }
}

/* --------------------------------------------------------------------------
   标题区
   -------------------------------------------------------------------------- */
.post-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.avatar-spacer {
  width: 2rem;
  height: 2rem;
  align-self: flex-start;
}

.post-head-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.name {
  display: block;
  margin: 0;
  color: #000;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.post-sub {
  margin: 0;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.25rem;
  /* 参考站的副标题是一行短句，这里同样压成一行，避免长摘要挤乱标题区的节奏 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   封面图
   -------------------------------------------------------------------------- */
.cover {
  margin: 0;
}

.cover a {
  display: block;
  line-height: 0;
}

.cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* 图片未加载完成时的纯色占位底：图一渲染就被盖住，加载慢/失败时也不留白 */
.cover a,
.post-figure-link {
  background-color: #f0f0ee;
  border-radius: 0.5rem;
}

.cover figcaption {
  margin: 0;
  padding-top: 1rem;
  color: var(--neutral-500);
  font-size: 0.75rem;
  line-height: 1.25rem;
}

/* --------------------------------------------------------------------------
   正文 + 右侧目录
   -------------------------------------------------------------------------- */
.post-body-wrap {
  position: relative;
  width: 100%;
}

.toc-container {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  display: none;
  width: calc((min(100vw, 80rem) - var(--container-prose) - 2rem) / 2 - 1rem - var(--side-gap));
  margin-left: var(--side-gap);
  padding-right: 1rem;
  z-index: 10;
}

@media (min-width: 1024px) {
  .toc-container {
    display: block;
  }
}

.toc-inner {
  position: sticky;
  top: 2rem;
  width: max-content;
  max-width: 100%;
  padding-left: 1rem;
}

.toc-content-wrapper {
  position: relative;
}

.toc-progress-timeline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -16px;
  width: 4px;
  overflow: hidden;
  opacity: 0.6;
  background-image: linear-gradient(#e5e5e5 2px, transparent 2px);
  background-size: 100% 8px;
  z-index: 1;
}

.toc-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  background-image: linear-gradient(to bottom, var(--accent-color) 2px, transparent 2px);
  background-size: 100% 8px;
  transition: height 0.1s linear;
}

.toc-sliding-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 0.25rem;
  background-color: rgba(82, 130, 146, 0.2);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: top 0.48s cubic-bezier(0.25, 1.22, 0.45, 1.04),
    height 0.48s cubic-bezier(0.25, 1.22, 0.45, 1.04),
    left 0.48s cubic-bezier(0.25, 1.22, 0.45, 1.04),
    width 0.48s cubic-bezier(0.25, 1.22, 0.45, 1.04), opacity 0.25s ease-out;
}

.toc-sliding-pill.no-transition {
  transition: opacity 0.25s ease-out;
}

.toc-list {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
}

.toc-item {
  position: relative;
  z-index: 1;
  margin: 0;
}

.toc-item.depth-3 {
  padding-left: 0.75rem;
}

.toc-link {
  display: inline-block;
  width: fit-content;
  padding-block: 0.375rem;
  border-radius: 0.5rem;
  color: var(--neutral-600);
  font-size: 0.75rem;
  line-height: 1.375;
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}

.toc-text {
  display: block;
  padding-inline: 0.5rem;
  opacity: 0.3;
  transition: opacity 0.3s, color 0.3s;
}

.toc-link:hover {
  color: var(--neutral-900);
}

.toc-link:hover .toc-text {
  color: var(--accent-color-darker);
}

.toc-link.active {
  color: var(--neutral-900);
}

.toc-link.active .toc-text {
  color: var(--accent-color);
  opacity: 1;
}

.toc-list:hover .toc-text {
  opacity: 1;
}

.toc-list:hover .toc-link:not(:hover):not(.active) {
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   正文排版（对齐参考站的 prose + content 组合）
   -------------------------------------------------------------------------- */
.content {
  --block-gap: 2rem;
  min-width: 0;
}

.content > * {
  margin-top: var(--block-gap) !important;
  margin-bottom: var(--block-gap) !important;
}

.content > :first-child {
  margin-top: 0 !important;
}

.content > :last-child {
  margin-bottom: 0 !important;
}

.prose {
  color: var(--neutral-600);
  font-size: 1rem;
  line-height: 1.75;
}

.prose p {
  margin: 1.25em 0;
}

.prose a {
  color: var(--neutral-900);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose strong {
  color: var(--neutral-900);
  font-weight: 600;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  color: var(--neutral-900);
  font-family: var(--font-stylish);
}

.prose h1 {
  margin: 2em 0 1em;
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.33333;
}

.prose h2 {
  margin: 2em 0 1em;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.75rem;
}

.prose h3 {
  margin: 1.6em 0 0.6em;
  font-size: 1.25em;
  font-weight: 600;
  line-height: 1.6;
}

.prose h4 {
  margin: 1.5em 0 0.5em;
  font-weight: 600;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   未读段落虚化渐显：JS 给首屏以下的段落块加 .reveal，滚动到眼前才变清晰
   （对照参考站「读到哪、清晰到哪」的效果）。类由 JS 添加，禁用 JS、
   读屏器与「减少动态效果」偏好下正文照常显示。
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .content > .reveal {
    filter: blur(6px);
    opacity: 0.55;
    transition: filter 0.55s ease, opacity 0.55s ease;
    will-change: filter, opacity;
  }

  .content > .reveal.is-revealed {
    filter: blur(0);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   标题行：整行宽的锚点，hover 时文字转强调色、右侧浮出「复制链接」图标
   （图标位置/尺寸/动画均按参考站实测：16.875px、margin-left 7.5px、.3s）
   -------------------------------------------------------------------------- */
.heading-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

/* .prose a 的下划线/字重不能带到标题上（选择器要比 .prose a 更具体） */
.prose .heading-link {
  font-weight: inherit;
  text-decoration: none;
}

.prose .heading-link:hover {
  text-decoration: none;
}

.heading-link:hover {
  color: var(--accent-color);
}

.heading-text {
  min-width: 0;
}

.heading-copy {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  margin-left: 0.5rem;
  color: #9ca3af;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, transform 0.2s;
}

.heading-link:hover .heading-copy {
  opacity: 1;
}

.heading-copy.is-copied {
  color: #22c55e;
  opacity: 1;
  transform: scale(1.1);
}

.heading-copy-icon {
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  transition: opacity 0.3s, transform 0.3s;
}

/* 链条图标 */
.heading-copy-share {
  -webkit-mask-image: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'%3E%3Cpath d='M14 11.998C14 9.506 11.683 7 8.857 7H7.143C4.303 7 2 9.238 2 11.998c0 2.378 1.71 4.368 4 4.873a5.3 5.3 0 0 0 1.143.124'/%3E%3Cpath d='M10 11.998c0 2.491 2.317 4.997 5.143 4.997h1.714c2.84 0 5.143-2.237 5.143-4.997c0-2.379-1.71-4.37-4-4.874A5.3 5.3 0 0 0 16.857 7'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'%3E%3Cpath d='M14 11.998C14 9.506 11.683 7 8.857 7H7.143C4.303 7 2 9.238 2 11.998c0 2.378 1.71 4.368 4 4.873a5.3 5.3 0 0 0 1.143.124'/%3E%3Cpath d='M10 11.998c0 2.491 2.317 4.997 5.143 4.997h1.714c2.84 0 5.143-2.237 5.143-4.997c0-2.379-1.71-4.37-4-4.874A5.3 5.3 0 0 0 16.857 7'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* 对勾图标 */
.heading-copy-check {
  -webkit-mask-image: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m5 13 4 4L19 7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m5 13 4 4L19 7'/%3E%3C/svg%3E");
  opacity: 0;
  transform: rotate(-45deg) scale(0.75);
}

.heading-copy.is-copied .heading-copy-share {
  opacity: 0;
  transform: rotate(45deg) scale(0.75);
}

.heading-copy.is-copied .heading-copy-check {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.prose ul,
.prose ol {
  margin: 1.25em 0;
  padding-inline-start: 1.625em;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin: 0.5em 0;
  /* 参考站的 li 额外让出 0.375em（5.625px），圆点与文字的间距就靠它 */
  padding-inline-start: 0.375em;
}

.prose ul > li::marker {
  color: var(--neutral-300);
}

.prose ol > li::marker {
  color: var(--neutral-500);
}

/* 引用块：浅底色卡片 + 左上角一个大引号（参考站 ::before，67.5px / 顶出卡片 18px） */
.prose blockquote {
  position: relative;
  margin: 2em 0;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  background-color: color-mix(in srgb, var(--accent-color) 5%, #fff);
  color: #262626;
  font-style: normal;
  font-weight: 400;
}

.prose blockquote::before {
  content: "\201C";
  position: absolute;
  top: -18px;
  left: 0.75rem;
  z-index: 0;
  color: color-mix(in srgb, var(--accent-color) 25%, #fff);
  font-family: var(--font-stylish);
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
  transition: color 0.3s;
}

.prose blockquote:hover::before {
  color: color-mix(in srgb, var(--accent-color) 40%, #fff);
}

.prose blockquote > * {
  position: relative;
  z-index: 1;
}

/* 参考站的引用块保留段落自身 1.25em 上下边距（文字不贴卡片顶边），
   所以这里不做 first/last-child 归零。 */
.prose blockquote p {
  margin: 1.25em 0;
}

/* 图片：独占一段时由 Figure 包成 figure + figcaption（图注取 alt / title） */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.prose figure.post-figure {
  display: flex;
  flex-direction: column;
  margin: 2em 0;
}

.post-figure-link {
  display: block;
  line-height: 0;
}

.post-figure img {
  display: block;
  width: 100%;
  border-radius: 0.5rem;
}

.post-figure figcaption {
  margin: 0;
  padding-top: 1rem;
  color: var(--neutral-500);
  font-size: 0.75rem;
  line-height: 1.25rem;
}

/* --------------------------------------------------------------------------
   附件卡片：PDF / 压缩包。结构由 AttachmentCard 生成，
   未登录时按钮变成「登录下载」，不暴露附件直链。
   -------------------------------------------------------------------------- */
.post-attachment {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.75rem 0;
  padding: 0.875rem 1rem;
  border: 1px solid var(--neutral-300);
  border-radius: 0.625rem;
  background: #fbfbfa;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.post-attachment:hover {
  border-color: #c2c2bf;
  background: #f7f7f5;
}

.post-attachment-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: rgba(82, 130, 146, 0.1);
  color: var(--accent-color);
}

.post-attachment-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.post-attachment-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.post-attachment-name {
  color: var(--neutral-900);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.375rem;
  overflow-wrap: anywhere;
}

.post-attachment-meta {
  color: var(--neutral-500);
  font-size: 0.75rem;
  line-height: 1.125rem;
}

/* 选择器要比 .prose a 更具体，否则会带上正文链接的下划线与深色 */
.prose .post-attachment-action {
  flex: none;
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.prose .post-attachment-action:hover {
  background: var(--accent-color-darker);
  text-decoration: none;
}

@media (max-width: 480px) {
  .post-attachment {
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
  }
}

/* 分隔线：参考站是一张 100×24 的 SVG（三个 4px 圆点，居中、不重复） */
.prose hr,
.post-divider {
  width: 100%;
  height: 24px;
  margin: 2em 0;
  border: 0;
  opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='24' viewBox='0 0 100 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='12' r='2' fill='%23adb5bd'/%3E%3Ccircle cx='50' cy='12' r='2' fill='%23adb5bd'/%3E%3Ccircle cx='70' cy='12' r='2' fill='%23adb5bd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 50% 50%;
}

.prose code {
  color: var(--neutral-900);
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 600;
}

.prose pre {
  margin: 1.71429em 0;
  padding: 0.857143em 1.14286em;
  border-radius: 0.375rem;
  background-color: #262626;
  color: #ebebeb;
  font-size: 0.875em;
  font-weight: 400;
  line-height: 1.71429;
  overflow-x: auto;
}

.prose pre code {
  color: inherit;
  font-size: 1em;
  font-weight: 400;
}

.prose table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  font-size: 0.875em;
  line-height: 1.71429;
}

/* 窄屏下表格别硬塞：整块横向滚动，列宽不受挤压 */
@media (max-width: 640px) {
  .prose table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.prose thead {
  border-bottom: 1px solid #dedede;
}

.prose th {
  padding: 0.5em 0.75em;
  color: var(--neutral-900);
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
}

.prose tbody tr {
  border-bottom: 1px solid #e5e5e5;
}

.prose td {
  padding: 0.5em 0.75em;
  vertical-align: top;
}

/* 正文末尾的发布时间 */
.published {
  display: block;
  color: var(--mist-500);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* --------------------------------------------------------------------------
   正文与页尾之间的点线分隔
   注意：参考站的 SVG 是一块 100×24 的平铺素材，但用的是 no-repeat + 居中，
   所以整行只出现中间那一组三个点；漏掉 no-repeat 会平铺成满屏点阵。
   （上一版就是漏了这个属性，页尾变成一整排点。）
   -------------------------------------------------------------------------- */
.post-divider {
  margin: 0;
}

/* ==========================================================================
   Apple Music 播放条（内容页顶部，对照 cai.im 的 .apple-music-player）
   尺存来自参考站实测（根字号 15px）：30px 封面 / 15px 内边距 / 15px 间距 /
   48.75px 行高；左右各 -15px 负边距，视觉上比正文宽一圈。
   ========================================================================== */
.music-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1rem;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.3s;
}

.music-player:hover {
  /* 先给老浏览器一个纯色回退，支持 color-mix 的再覆盖成混色 */
  background-color: #f2f7f8;
  background-color: color-mix(in srgb, var(--accent-color) 7%, #fff);
}

.music-player a {
  text-decoration: none;
}

.music-player__art {
  position: relative;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: #f4f4f5;
  overflow: hidden;
  cursor: pointer;
  display: block;
}

.music-player__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.music-player__art-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}

.music-player__art:hover .music-player__art-mask,
.music-player__art:focus-visible .music-player__art-mask,
.music-player.is-playing .music-player__art-mask {
  opacity: 1;
}

.music-player__art-mask svg {
  width: 0.875rem;
  height: 0.875rem;
  transform: translateX(1px);
}

.music-player__icon-pause,
.music-player.is-playing .music-player__icon-play {
  display: none;
}

.music-player.is-playing .music-player__icon-pause {
  display: block;
  transform: none;
}

.music-player__text {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}

.music-player__link {
  display: inline-flex;
  align-items: center;
  /* min-width:0 + overflow 让它在 flex 链里能真正收缩，歌名+歌手名太长时内部省略 */
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  transition: color 0.2s;
}

.music-player__link:hover {
  color: var(--accent-color);
}

.music-player__title {
  /* min-width:0 让它在 flex 里能收缩，否则歌名太长会把整条挤出屏幕 */
  min-width: 0;
  color: #262626;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.music-player__link:hover .music-player__title {
  color: #000;
}

.music-player__artist {
  margin-left: 0.5rem;
  color: #a3a3a3;
  font-size: 0.875rem;
  font-weight: 400;
  white-space: nowrap;
  /* 歌手名太长时收缩省略，不把播放条撑破 */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-player__arrow {
  flex-shrink: 0;
  width: 0.9375rem;
  height: 0.9375rem;
  margin-left: 0.375rem;
  color: #737373;
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity 0.2s, transform 0.2s;
}

.music-player__link:hover .music-player__arrow {
  opacity: 0.6;
  transform: translateX(0);
}

.music-player__time {
  flex-shrink: 0;
  margin-left: 0.25rem;
  color: #a3a3a3;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.music-player.is-playing .music-player__time,
.music-player.has-played .music-player__time {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .music-player__time,
  .music-player__arrow,
  .music-player__art-mask {
    transition: none;
  }
}

/* 仅供读屏，不占位 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   图片查看器（PhotoSwipe v5）
   参考站是白底 + 无按钮，图片按视口等高展示，点击逐级放大，点两侧空白关闭。
   ========================================================================== */
.pswp {
  --pswp-bg: #fff;
  --pswp-root-z-index: 100000;
}

.pswp__bg {
  background: #fff;
}

/* 参考站的查看器没有关闭按钮 / 左右箭头 / 页码：只留白底、图片和图注，
   关闭靠点两侧空白或 Esc，翻页靠滚轮、滑动和方向键。 */
.pswp__button,
.pswp__counter {
  display: none !important;
}

/* 底部图注胶囊 */
.pswp__caption-pill {
  position: fixed;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  max-width: min(90vw, 40rem);
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(23, 23, 23, 0.55);
  color: #fff;
  font-family: var(--font-stylish);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.pswp__caption-pill:empty {
  display: none;
}

/* 放大/复原的鼠标指针提示：PhotoSwipe 只在 imageClickAction 为字符串时加
   .pswp--click-to-zoom，这里用的是自定义函数，所以自己补上。 */
.pswp--zoom-allowed .pswp__img {
  cursor: zoom-in;
}

.pswp--zoomed-in .pswp__img {
  cursor: zoom-out;
}
