@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --bg: #f3f1ea;
  --text: #17130f;
  --muted: #6b6259;
  --ink: #26211b;
  --rule: rgba(38, 33, 27, 0.18);
  --card: #15120f;
  --cardText: #f4f0e6;
  --accent: #c1542c;
  --shadow: 0 18px 60px rgba(17, 14, 10, 0.18);
  --shadowHover: 0 24px 80px rgba(17, 14, 10, 0.26);
  --radius: 14px;
  --codeBg: rgba(23, 19, 15, 0.06);
  --codeBorder: rgba(23, 19, 15, 0.1);
  --selectionBg: rgba(193, 84, 44, 0.16);

  --z-base: 0;
  --z-line: 10;
  --z-card: 20;
  --z-progress: 100;
  --z-theme-toggle: 50;

  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-left: max(14px, env(safe-area-inset-left));

  --ease-out: cubic-bezier(0.2, 0.9, 0.2, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #1e1b17;
  --text: #e2dbd0;
  --muted: #968d82;
  --ink: #cfc7ba;
  --rule: rgba(207, 199, 186, 0.14);
  --card: #282420;
  --cardText: #e2dbd0;
  --accent: #d4693a;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
  --shadowHover: 0 24px 80px rgba(0, 0, 0, 0.4);
  --codeBg: rgba(255, 255, 255, 0.06);
  --codeBorder: rgba(255, 255, 255, 0.08);
  --selectionBg: rgba(212, 105, 58, 0.2);
}

::selection {
  background: var(--selectionBg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: "Libre Baskerville", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  min-height: 100%;
}

/* ═══════════════════════════════════════
   入场动画关键帧
   ═══════════════════════════════════════ */

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ruleExpand {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes progressGlow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ═══════════════════════════════════════
   Hero / 封面
   ═══════════════════════════════════════ */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
}

.hero__inner {
  text-align: center;
  will-change: transform, opacity;
}

/* 错落入场动画 */
.hero__issue,
.hero__title,
.hero__rule,
.hero__tagline {
  opacity: 0;
  animation: fadeSlideUp 0.9s var(--ease-out) forwards;
}

.hero__issue {
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  animation-delay: 0.1s;
}

.hero__title {
  margin: 0;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 1.02;
  color: var(--text);
  animation-delay: 0.28s;
}

.hero__rule {
  width: 56px;
  height: 1.5px;
  border: 0;
  background: var(--ink);
  margin: 22px auto 18px;
  animation: ruleExpand 0.7s var(--ease-out) 0.5s forwards;
  opacity: 0;
}

.hero__tagline {
  margin: 0;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(16px, 2vw, 22px);
  color: var(--muted);
  letter-spacing: 0.02em;
  animation-delay: 0.65s;
}



/* ═══════════════════════════════════════
   Post Page / 文章页
   ═══════════════════════════════════════ */

/* 阅读进度条 */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: var(--z-progress);
  transition: width 60ms linear;
  pointer-events: none;
}

.post-page {
  min-height: 100vh;
  padding: 48px 20px 80px;
}

.post {
  max-width: 720px;
  margin: 0 auto;
}

/* 文章头部入场动画 */
.post__back,
.post__title,
.post__meta {
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) forwards;
}

.post__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  padding: 8px 0;
  border: none;
  background: none;
  transition: color 200ms var(--ease-out);
  animation-delay: 0.05s;
}

/* 返回箭头 */
.post__back::before {
  content: "\2190";
  font-size: 15px;
  transition: transform 200ms var(--ease-out);
}

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

.post__back:hover::before {
  transform: translateX(-4px);
}

.post__back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.post__title {
  margin: 32px 0 0;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--text);
  animation-delay: 0.18s;
}

.post__meta {
  margin: 16px 0 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  word-break: break-word;
  animation-delay: 0.3s;
  display: flex;
  align-items: center;
  gap: 0;
}

.post__meta-sep {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--rule);
  margin: 0 12px;
}

.post__reading-time {
  color: var(--muted);
}

/* 标签列表 */
.post__tags {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) 0.38s forwards;
}

.post__tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

/* 文章内容区 */
.post__content {
  margin-top: 36px;
  font-size: 17px;
  line-height: 1.78;
  opacity: 0;
  animation: fadeSlideUp 0.9s var(--ease-out) 0.45s forwards;
}

.post__content p {
  margin: 0 0 22px;
}

/* 首段首字下沉（杂志风格） */
.post__content > p:first-child::first-letter {
  float: left;
  font-family: "Cormorant Garamond", ui-serif, Georgia, serif;
  font-size: 3.6em;
  font-weight: 600;
  line-height: 0.78;
  margin: 0.06em 0.1em 0 -0.02em;
  color: var(--text);
}

/* 文章结尾标记 */
.post__end {
  text-align: center;
  margin: 56px 0 0;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.post__end-mark {
  display: block;
  width: 6px;
  height: 6px;
  background: var(--ink);
  margin: 0 auto 14px;
  transform: rotate(45deg);
}

/* ═══════════════════════════════════════
   Markdown 排版
   ═══════════════════════════════════════ */

.md h2 {
  margin: 48px 0 16px;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.md h3 {
  margin: 36px 0 12px;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.md ul,
.md ol {
  margin: 0 0 22px;
  padding-left: 1.4em;
}

.md li {
  margin: 8px 0;
}

.md li::marker {
  color: var(--muted);
}

.md blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 2px solid var(--ink);
  background: none;
  border-radius: 0;
  color: var(--muted);
  font-style: italic;
  position: relative;
}

.md blockquote p {
  margin: 0;
}

.md a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-thickness 160ms var(--ease-out);
}

.md a:hover {
  text-decoration-thickness: 2px;
}

.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--codeBg);
  border: 1px solid var(--codeBorder);
}

/* 代码块 - 带语言标签 */
.md pre {
  margin: 28px 0;
  padding: 20px 22px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid rgba(230, 234, 240, 0.06);
  overflow-x: auto;
  position: relative;
}

.md pre code {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.65;
  border-radius: 0;
  color: var(--cardText);
}

/* 代码块语言标签（通过 JS 注入） */
.md pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(230, 234, 240, 0.3);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  pointer-events: none;
}

.md hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 36px 0;
}

.md img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 28px 0;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 32, 0.1);
}

.md .katex-display {
  margin: 28px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
}

.md .katex {
  font-size: 1.05em;
}

/* ═══════════════════════════════════════
   Archive / 首页归档网格
   ═══════════════════════════════════════ */

.archive {
  --archive-sidebar-w: 260px;
  --archive-gap: 32px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.archive__heading {
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 28px calc(var(--archive-sidebar-w) + var(--archive-gap));
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.archive__layout {
  display: grid;
  grid-template-columns: var(--archive-sidebar-w) minmax(0, 1fr);
  gap: var(--archive-gap);
  align-items: start;
}

.archive__sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
}

.archive__sidebar-title {
  margin: 0 0 16px;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.archive__tag-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-tag {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px 9px 14px;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition:
    border-color 200ms var(--ease-out),
    color 200ms var(--ease-out),
    background-color 200ms var(--ease-out);
}

.archive-tag:hover {
  color: var(--text);
  background-color: rgba(27, 36, 51, 0.04);
  border-left-color: rgba(27, 36, 51, 0.2);
}

.archive-tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.archive-tag.is-active {
  color: var(--text);
  border-left-color: var(--accent);
  background-color: rgba(44, 111, 186, 0.04);
}

.archive-tag__name {
  font-weight: 600;
}

.archive-tag__count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  opacity: 0.6;
}

.archive-tag.is-active .archive-tag__count {
  color: var(--accent);
  opacity: 0.8;
}

.archive__content {
  min-width: 0;
}

.archive__status-row {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.archive__status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-width: 0;
}

.archive__view-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg);
  flex: 0 0 auto;
}

.archive-view-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color 180ms var(--ease-out),
    background-color 180ms var(--ease-out);
}

.archive-view-btn__icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.archive-view-btn:hover {
  color: var(--text);
}

.archive-view-btn.is-active {
  background: var(--ink);
  color: var(--bg);
}

.archive-view-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.archive__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.archive__grid.is-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.archive__grid.is-list .archive-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "tags tags"
    "title footer";
  align-items: center;
  gap: 10px 14px;
  padding: 16px 18px;
}

.archive__grid.is-list .archive-card__tags {
  grid-area: tags;
  min-height: 0;
}

.archive__grid.is-list .archive-card__title {
  grid-area: title;
  margin: 0;
  font-size: clamp(20px, 2.1vw, 24px);
}

.archive__grid.is-list .archive-card__footer {
  grid-area: footer;
  margin: 0;
  padding: 0;
  border-top: none;
  gap: 8px;
  white-space: nowrap;
}

.archive__grid.is-view-animating .archive-card {
  will-change: transform, opacity;
  pointer-events: none;
}

.archive__grid.is-view-animating .archive-card:hover {
  transform: none;
}

@media (min-width: 1080px) {
  .archive__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.archive-card {
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  transition:
    border-color 280ms var(--ease-out),
    box-shadow 280ms var(--ease-out),
    transform 280ms var(--ease-out);
}

.archive-card[hidden],
.archive-card.is-hidden {
  display: none !important;
}

.archive-card:hover {
  border-color: rgba(27, 36, 51, 0.28);
  box-shadow: 0 8px 32px rgba(10, 14, 20, 0.08);
  transform: translateY(-3px);
}

.archive-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.archive-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}

.archive-card__tag {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--muted);
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.archive-card__title {
  margin: 12px 0 0;
  font-family: "Cormorant Garamond", ui-serif, Georgia, Cambria, "Times New Roman",
    Times, serif;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  flex: 1;
  overflow-wrap: anywhere;
}

.archive-card__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.archive-card__date {
  font-size: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.archive-card__arrow {
  font-size: 15px;
  color: var(--muted);
  transition: color 280ms var(--ease-out), transform 280ms var(--ease-out);
}

.archive-card:hover .archive-card__arrow {
  color: var(--accent);
  transform: translateX(4px);
}

@media (max-width: 860px) {
  .archive {
    --archive-sidebar-w: 1fr;
    --archive-gap: 16px;
  }

  .archive__heading {
    margin-left: 0;
  }

  .archive__layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .archive__sidebar {
    position: static;
    top: auto;
  }

  .archive__sidebar-title {
    margin-bottom: 10px;
    padding-bottom: 0;
    border-bottom: none;
  }

  .archive__tag-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .archive-tag {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 0;
  }

  .archive-tag:hover {
    border-left-color: transparent;
    border-bottom-color: rgba(27, 36, 51, 0.2);
  }

  .archive-tag.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .archive__status-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  .archive__view-switch {
    margin-left: auto;
  }

  .archive__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .archive__grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════
   滚动揭示动画（IntersectionObserver 驱动）
   ═══════════════════════════════════════ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════
   主题切换按钮 + 色相调节条
   ═══════════════════════════════════════ */

/* 主题按钮外层容器（包裹按钮 + 色相条） */
.theme-wrap {
  position: fixed;
  top: var(--safe-top);
  right: var(--safe-right);
  z-index: var(--z-theme-toggle);
  /* 固定宽度 = 按钮大小，不遮挡旁边的语言按钮 */
  width: 36px;
}

.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    background-color 200ms var(--ease-out);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: rgba(27, 36, 51, 0.28);
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: rgba(184, 194, 207, 0.3);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 亮色模式显示月亮，暗色模式显示太阳 */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── 色相调节条 ── */
.hue-panel {
  position: absolute;
  top: 100%;
  right: 0;
  /* padding-top 补充鼠标从按钮滑到面板的间隙热区 */
  padding-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scaleY(0.9);
  transform-origin: top right;
  transition:
    opacity 220ms var(--ease-out),
    visibility 220ms var(--ease-out),
    transform 220ms var(--ease-out);
  pointer-events: none;
}

/* hover 容器或拖动时显示色相条 */
.theme-wrap:hover .hue-panel,
.theme-wrap.is-dragging .hue-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scaleY(1);
  pointer-events: auto;
}

.hue-track {
  position: relative;
  width: 180px;
  height: 8px;
  border-radius: 4px;
  /* 完整色相谱 */
  background: linear-gradient(
    to right,
    hsl(0, 60%, 55%),
    hsl(30, 60%, 55%),
    hsl(60, 60%, 55%),
    hsl(90, 60%, 55%),
    hsl(120, 60%, 55%),
    hsl(150, 60%, 55%),
    hsl(180, 60%, 55%),
    hsl(210, 60%, 55%),
    hsl(240, 60%, 55%),
    hsl(270, 60%, 55%),
    hsl(300, 60%, 55%),
    hsl(330, 60%, 55%),
    hsl(360, 60%, 55%)
  );
  cursor: pointer;
  border: 1px solid var(--rule);
  touch-action: none;
  user-select: none;
}

.hue-thumb {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 14px;
  border-radius: 2px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: box-shadow 120ms ease;
}

.theme-wrap.is-dragging .hue-thumb {
  box-shadow: 0 0 0 3px rgba(44, 111, 186, 0.25), 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* 色相条下方的重置按钮 */
.hue-reset {
  display: block;
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  text-align: right;
  width: 100%;
  transition: color 160ms var(--ease-out);
}

.hue-reset:hover {
  color: var(--text);
}

/* ═══════════════════════════════════════
   语言切换按钮
   ═══════════════════════════════════════ */

.lang-toggle {
  position: fixed;
  top: var(--safe-top);
  right: calc(var(--safe-right) + 44px);
  z-index: var(--z-theme-toggle);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    background-color 200ms var(--ease-out);
}

.lang-toggle:hover {
  color: var(--text);
  border-color: rgba(27, 36, 51, 0.28);
}

[data-theme="dark"] .lang-toggle:hover {
  border-color: rgba(184, 194, 207, 0.3);
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-toggle.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ═══════════════════════════════════════
   Reduced Motion
   ═══════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .hero__issue,
  .hero__title,
  .hero__rule,
  .hero__tagline,
  .post__back,
  .post__title,
  .post__meta,
  .post__tags,
  .post__content {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .post-card {
    transition: none;
  }
  .post-card::before {
    transition: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .archive-card,
  .archive-card__arrow,
  .archive-tag {
    transition: none;
  }

  .archive-card:hover,
  .archive-card:hover .archive-card__arrow {
    transform: none;
  }

  .archive-tag:hover {
    transform: none;
  }

  .hue-panel {
    transition: none;
  }
}

@media (max-width: 860px) {
  .archive__tag-list {
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .archive__tag-list::-webkit-scrollbar {
    display: none;
  }

  .archive-tag {
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: 100svh;
    padding: 78px var(--safe-right) 26px var(--safe-left);
  }

  .hero__title {
    font-size: clamp(36px, 12vw, 56px);
    line-height: 1.06;
  }

  .hero__tagline {
    font-size: clamp(15px, 4.2vw, 19px);
  }

  .archive {
    padding: 18px var(--safe-right) 36px var(--safe-left);
  }

  .theme-wrap,
  .lang-toggle {
    width: 40px;
    height: 40px;
  }

  .theme-toggle,
  .lang-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .lang-toggle {
    right: calc(var(--safe-right) + 50px);
  }

  .post-page {
    padding: 78px var(--safe-right) 56px var(--safe-left);
  }

  .post__title {
    margin-top: 22px;
    font-size: clamp(34px, 11vw, 46px);
    line-height: 1.08;
  }

  .post__meta {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .post__meta-sep {
    display: none;
  }

  .post__content {
    margin-top: 30px;
    font-size: 16px;
    line-height: 1.74;
  }

  .md pre {
    margin: 24px 0;
    padding: 16px 16px;
    border-radius: 8px;
  }
}

.post__credit {
  margin: 12px 0 0;
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: 11px;
}

.post__credit a {
  color: inherit;
  text-underline-offset: 2px;
}

.site-credit {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 45;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(6px);
}

.site-credit a {
  color: inherit;
  text-underline-offset: 2px;
}

body.is-home .site-credit {
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease-smooth);
}

body.is-home.has-archive-visible .site-credit {
  opacity: 1;
  pointer-events: auto;
}

/* 首页：给固定底栏留出视觉缓冲区 */
body.is-home main {
  padding-bottom: 84px;
}

@media (max-width: 860px) {
  body.is-home main {
    padding-bottom: 96px;
  }
}
