/* ==========================================================================
   Ran WebAll — WinUI 3 / Fluent 2 个人网站
   Token-first：颜色、字号、间距、圆角、阴影、动效曲线全部来自
   assets/css/tokens.css 中的 Fluent 2 设计令牌，不另起一套视觉体系。
   组件内部样式仍由 Fluent UI Web Components 自己负责。
   ========================================================================== */

html {
  /* Windows 优先的中文回退栈：Segoe UI 负责拉丁字母，微软雅黑负责汉字。 */
  --fontFamilyBase: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  --site-nav-width: 280px;
  --site-titlebar-height: 48px;
  --site-content-max: 1120px;

  height: 100%;
  background: var(--colorNeutralBackground3);
  color: var(--colorNeutralForeground1);
  scrollbar-color: var(--colorScrollbarOverlay) transparent;
}

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

[hidden] {
  display: none !important;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--colorNeutralForeground1);
  font-family: var(--fontFamilyBase);
  font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 模拟 Mica：极浅的品牌色晕染 + 中性渐变，不做重模糊。 */
  background:
    radial-gradient(
      900px 620px at 8% -10%,
      color-mix(in srgb, var(--colorBrandBackground) 9%, transparent),
      transparent 62%
    ),
    radial-gradient(
      760px 560px at 100% 108%,
      color-mix(in srgb, var(--colorBrandForeground2) 7%, transparent),
      transparent 66%
    ),
    linear-gradient(
      150deg,
      var(--colorNeutralBackground3) 0%,
      var(--colorNeutralBackground2) 55%,
      var(--colorNeutralBackground3) 100%
    );
  background-attachment: fixed;
}

::selection {
  color: var(--colorNeutralForeground1);
  background: var(--colorBrandBackground2);
}

/* 主题切换时的轻微过渡：只作用于大面积表面与文字，不干扰组件自身动效 */
body,
.titlebar,
.nav,
.panel,
.entry,
.toolbar,
.empty-state,
.page-foot {
  transition:
    background-color var(--durationNormal) var(--curveEasyEase),
    color var(--durationNormal) var(--curveEasyEase),
    border-color var(--durationNormal) var(--curveEasyEase);
}

:where(a) {
  color: inherit;
  text-decoration: none;
}

:where(button, input) {
  font: inherit;
}

:where(code, kbd) {
  font-family: var(--fontFamilyMonospace);
  font-size: 0.92em;
}

svg {
  display: block;
}

/* 全局键盘焦点：与 Fluent 控件的 2 px 焦点环保持一致。 */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--colorStrokeFocus2);
  outline-offset: 2px;
  border-radius: var(--borderRadiusSmall);
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
  pointer-events: none;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--muted {
  color: var(--colorNeutralForeground3);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -88px;
  left: 12px;
  z-index: 10000;
  padding: 10px 16px;
  border: 1px solid var(--colorNeutralStroke1);
  border-radius: var(--borderRadiusMedium);
  background: var(--colorNeutralBackground1);
  color: var(--colorNeutralForeground1);
  box-shadow: var(--shadow8);
  transition: top var(--durationFaster) var(--curveEasyEase);
}

.skip-link:focus {
  top: 8px;
  outline: 2px solid var(--colorStrokeFocus2);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 4px solid transparent;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorScrollbarOverlay);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  border-width: 3px;
  background-color: var(--colorNeutralForeground3);
}

/* ==========================================================================
   应用外壳：标题栏 + 侧边导航 + 内容区
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--site-nav-width) minmax(0, 1fr);
  grid-template-rows: var(--site-titlebar-height) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

html.nav-compact .app {
  grid-template-columns: 48px minmax(0, 1fr);
}

/* ---- 标题栏 ------------------------------------------------------------- */

.titlebar {
  position: relative;
  z-index: 50;
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1;
  align-items: center;
  gap: var(--spacingHorizontalXS);
  min-width: 0;
  padding: 0 var(--spacingHorizontalS);
  border-bottom: 1px solid color-mix(in srgb, var(--colorNeutralStroke2) 62%, transparent);
  background: color-mix(in srgb, var(--colorNeutralBackground2) 70%, transparent);
  backdrop-filter: blur(36px) saturate(140%);
  -webkit-backdrop-filter: blur(36px) saturate(140%);
}

.titlebar-left,
.titlebar-actions {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.titlebar-actions {
  gap: var(--spacingHorizontalXS);
  margin-inline-start: auto;
}

fluent-button.icon-button {
  width: 32px;
  height: 32px;
}

/* 图标链接：与 fluent-button 的图标按钮保持相同尺寸与状态反馈 */
.icon-button-link {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--borderRadiusMedium);
  color: var(--colorNeutralForeground2);
  transition:
    background-color var(--durationFaster) var(--curveEasyEase),
    color var(--durationFaster) var(--curveEasyEase);
}

.icon-button-link:hover {
  background: var(--colorSubtleBackgroundHover);
  color: var(--colorNeutralForeground1);
}

.icon-button-link:active {
  background: var(--colorSubtleBackgroundPressed);
}

/* 桌面端标题栏已有搜索框，搜索图标只在窄屏出现 */
.search-jump {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--spacingHorizontalS);
  min-width: 0;
  height: 36px;
  margin-inline-start: 4px;
  padding: 0 8px;
  border-radius: var(--borderRadiusMedium);
  transition: background-color var(--durationFaster) var(--curveEasyEase);
}

.brand:hover {
  background: var(--colorSubtleBackgroundHover);
}

.brand:active {
  background: var(--colorSubtleBackgroundPressed);
}

.brand-mark {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 5px;
  border-radius: 7px;
  background: var(--colorBrandBackground);
  box-shadow: var(--shadow2);
}

.brand-mark span {
  border-radius: 1.5px;
  background: var(--colorNeutralForegroundOnBrand);
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(3) {
  opacity: 0.72;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1;
}

.brand-name {
  overflow: hidden;
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase300);
  font-weight: var(--fontWeightSemibold);
  line-height: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-subtitle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--colorNeutralForeground3);
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- 全站搜索 ----------------------------------------------------------- */

.search-shell {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 70;
  width: clamp(240px, 30vw, 420px);
  transform: translateX(-50%);
}

.search-input {
  display: block;
  width: 100%;
  max-width: none;
}

.search-input::part(root) {
  background: color-mix(in srgb, var(--colorNeutralBackground1) 88%, transparent);
}

.search-input::part(label) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 搜索页的输入框同样用占位符 + aria-label，不重复显示可见标签 */
.search-page-field fluent-text-input::part(label) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(420px, calc(100dvh - 96px));
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--colorNeutralStroke2);
  border-radius: var(--borderRadiusXLarge);
  background: var(--colorNeutralBackground1);
  box-shadow: var(--shadow16);
  animation: popover-in var(--durationFast) var(--curveDecelerateMid) both;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--borderRadiusMedium);
  background: transparent;
  color: var(--colorNeutralForeground1);
  text-align: start;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--colorSubtleBackgroundHover);
  outline: none;
}

.search-result:active {
  background: var(--colorSubtleBackgroundPressed);
}

.search-result-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  margin-top: 1px;
  border-radius: var(--borderRadiusMedium);
  background: var(--colorBrandBackground2);
  color: var(--colorBrandForeground2);
}

.search-result-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  line-height: 16px;
}

.search-result-title {
  overflow: hidden;
  font-size: var(--fontSizeBase300);
  font-weight: var(--fontWeightSemibold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result-meta {
  display: -webkit-box;
  overflow: hidden;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-result-more {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid var(--colorNeutralStroke3);
  background: transparent;
  color: var(--colorBrandForeground1);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightSemibold);
  text-align: start;
  cursor: pointer;
}

.search-result-more:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.search-empty {
  padding: 18px 14px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  text-align: center;
}

.search-hint {
  padding: 14px 12px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

/* ---- 侧边导航（NavigationView 组合实现） -------------------------------- */

.nav {
  display: flex;
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  flex-direction: column;
  padding: 8px;
  border-right: 1px solid color-mix(in srgb, var(--colorNeutralStroke2) 56%, transparent);
  background: color-mix(in srgb, var(--colorNeutralBackground1) 34%, transparent);
  backdrop-filter: blur(28px) saturate(130%);
  -webkit-backdrop-filter: blur(28px) saturate(130%);
}

.nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 0 8px;
}

.nav-group + .nav-group {
  margin-top: 6px;
}

.nav-group-label {
  margin: 14px 12px 4px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightSemibold);
  line-height: 16px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--borderRadiusMedium);
  background: transparent;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  line-height: 20px;
  text-align: start;
  cursor: pointer;
  transition:
    background-color var(--durationFaster) var(--curveEasyEase),
    color var(--durationFaster) var(--curveEasyEase);
}

.nav-item::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorBrandBackground);
  content: "";
  opacity: 0;
  transform: scaleY(0.35);
  transition:
    opacity var(--durationFast) var(--curveDecelerateMid),
    transform var(--durationFast) var(--curveDecelerateMid);
}

.nav-item:hover {
  background: var(--colorSubtleBackgroundHover);
  color: var(--colorNeutralForeground2Hover);
}

.nav-item:active {
  background: var(--colorSubtleBackgroundPressed);
}

.nav-item[aria-current="page"] {
  background: var(--colorSubtleBackgroundSelected);
  color: var(--colorNeutralForeground1);
  font-weight: var(--fontWeightSemibold);
}

.nav-item[aria-current="page"]::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
}

.nav-label {
  overflow: hidden;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-chevron {
  margin-inline-start: auto;
  color: var(--colorNeutralForeground3);
  transition: transform var(--durationFast) var(--curveDecelerateMid);
}

.nav-item[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-children {
  display: grid;
  gap: 2px;
  margin: 2px 0 2px;
  padding-inline-start: 28px;
}

.nav-children[hidden] {
  display: none;
}

.nav-children .nav-item {
  height: 36px;
  gap: 10px;
  padding-inline: 10px;
  font-size: var(--fontSizeBase300);
}

.nav-footer {
  flex: 0 0 auto;
  padding-top: 8px;
  border-top: 1px solid var(--colorNeutralStroke3);
}

.nav-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px 4px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 16px;
}

/* 紧凑图标栏 */
html.nav-compact .app .nav {
  padding-inline: 4px;
}

html.nav-compact .app .nav-label,
html.nav-compact .app .nav-group-label,
html.nav-compact .app .nav-chevron,
html.nav-compact .app .nav-meta,
html.nav-compact .app .nav-children {
  display: none;
}

html.nav-compact .app .nav-item {
  justify-content: center;
  width: 40px;
  padding: 0;
  margin-inline: auto;
}

html.nav-compact .app .nav-item::before {
  left: -4px;
}

html.nav-compact .app .nav-footer {
  display: grid;
  justify-items: center;
  gap: 4px;
}

/* 窄屏抽屉 */
.nav-scrim {
  display: none;
}

@media (max-width: 900px) {
  .nav {
    position: fixed;
    top: var(--site-titlebar-height);
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(86vw, 304px);
    border-right: 1px solid var(--colorNeutralStroke1);
    background: color-mix(in srgb, var(--colorNeutralBackground1) 92%, transparent);
    box-shadow: var(--shadow28);
    transform: translateX(-102%);
    visibility: hidden;
    transition:
      transform var(--durationNormal) var(--curveDecelerateMid),
      visibility var(--durationNormal) linear;
  }

  .app.nav-open .nav {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-scrim:not([hidden]) {
    position: fixed;
    inset: var(--site-titlebar-height) 0 0;
    z-index: 75;
    display: block;
    background: color-mix(in srgb, var(--colorNeutralBackgroundInverted) 32%, transparent);
    animation: scrim-in var(--durationFast) linear both;
  }

  @keyframes scrim-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  /* 抽屉里总是展开显示完整标签 */
  html.nav-compact .app .nav-label,
  html.nav-compact .app .nav-group-label,
  html.nav-compact .app .nav-meta {
    display: initial;
  }

  html.nav-compact .app .nav-children {
    display: grid;
  }

  html.nav-compact .app .nav-item {
    justify-content: flex-start;
    width: 100%;
    padding: 0 12px;
    margin-inline: 0;
  }

  html.nav-compact .app .nav-item::before {
    left: 0;
  }

  html.nav-compact .app .nav-footer {
    display: block;
  }
}

/* ---- 内容区 ------------------------------------------------------------- */

.main {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  outline: none;
  scroll-behavior: smooth;
}

.page {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  padding: 32px clamp(20px, 3.2vw, 44px) 0;
}

.page-inner {
  width: 100%;
  max-width: var(--site-content-max);
  margin: 0 auto;
  flex: 1 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacingHorizontalXXL);
  margin-bottom: 24px;
}

.page-head-copy {
  min-width: 0;
}

.page-title {
  margin: 0 0 6px;
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeHero800);
  font-weight: var(--fontWeightSemibold);
  line-height: var(--lineHeightHero800);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.page-lede {
  max-width: 68ch;
  margin: 0;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300);
  text-wrap: pretty;
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacingHorizontalS);
  padding-bottom: 2px;
}

/* ---- 分区与标题 --------------------------------------------------------- */

.section {
  margin-top: 32px;
}

.section:first-child {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacingHorizontalXXL);
  margin-bottom: 14px;
}

.section-title {
  margin: 0 0 2px;
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase500);
  font-weight: var(--fontWeightSemibold);
  line-height: 28px;
  letter-spacing: -0.01em;
}

.section-desc {
  margin: 0;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 4px;
  border-radius: var(--borderRadiusSmall);
  color: var(--colorBrandForeground1);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightSemibold);
  white-space: nowrap;
}

.section-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- 首页 Hero ---------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  margin: 0 calc(clamp(20px, 3.2vw, 44px) * -1);
  padding: 40px clamp(20px, 3.2vw, 44px) 36px;
  border-bottom: 1px solid color-mix(in srgb, var(--colorNeutralStroke2) 55%, transparent);
  background:
    radial-gradient(
      120% 130% at 86% -12%,
      color-mix(in srgb, var(--colorBrandBackground) 13%, transparent),
      transparent 62%
    ),
    linear-gradient(
      102deg,
      color-mix(in srgb, var(--colorBrandBackground) 6%, var(--colorNeutralBackground1)) 0%,
      var(--colorNeutralBackground2) 48%,
      color-mix(in srgb, var(--colorBrandBackground) 4%, var(--colorNeutralBackground2)) 100%
    );
}

.hero-inner {
  display: grid;
  width: 100%;
  max-width: var(--site-content-max);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--colorBrandForeground2);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightSemibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0 0 10px;
  color: var(--colorNeutralForeground1);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: var(--fontWeightSemibold);
  line-height: 1.14;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-lede {
  max-width: 54ch;
  margin: 0;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase400);
  line-height: var(--lineHeightBase400);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacingHorizontalS);
  margin-top: 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacingHorizontalS);
  margin-top: 18px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
}

.hero-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralForeground4);
}

.hero-visual {
  position: relative;
  display: grid;
  min-height: 224px;
  place-items: center;
}

.hero-orbit {
  position: absolute;
  border: 1px dashed color-mix(in srgb, var(--colorBrandForeground2) 40%, transparent);
  border-radius: var(--borderRadiusCircular);
  opacity: 0.7;
}

.hero-orbit--outer {
  width: 232px;
  height: 232px;
}

.hero-orbit--inner {
  width: 164px;
  height: 164px;
  border-style: solid;
  opacity: 0.35;
}

.hero-tile {
  display: grid;
  width: 108px;
  height: 108px;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 22px;
  border-radius: 24px;
  background: var(--colorBrandBackground);
  box-shadow:
    var(--shadow16),
    0 0 0 1px color-mix(in srgb, var(--colorBrandBackground) 40%, transparent);
  transform: rotate(-8deg);
}

.hero-tile span {
  border-radius: 3px;
  background: var(--colorNeutralForegroundOnBrand);
  opacity: 0.9;
}

.hero-tile span:nth-child(2),
.hero-tile span:nth-child(3) {
  opacity: 0.55;
}

.hero-visual-caption {
  position: absolute;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--colorNeutralStroke3);
  border-radius: var(--borderRadiusCircular);
  background: color-mix(in srgb, var(--colorNeutralBackground1) 80%, transparent);
  color: var(--colorNeutralForeground3);
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* ---- 卡片 --------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacingHorizontalM);
}

.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 148px;
  padding: 18px;
  border: 1px solid var(--colorNeutralStroke3);
  border-radius: var(--borderRadiusXLarge);
  background: var(--colorNeutralBackground1);
  transition:
    border-color var(--durationFaster) var(--curveEasyEase),
    box-shadow var(--durationFaster) var(--curveEasyEase),
    background-color var(--durationFaster) var(--curveEasyEase);
}

.link-card:hover {
  border-color: var(--colorNeutralStroke1Hover);
  background: var(--colorNeutralBackground1Hover);
  box-shadow: var(--shadow4);
}

.link-card:active {
  box-shadow: var(--shadow2);
}

.link-card-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: var(--borderRadiusLarge);
  background: var(--colorBrandBackground2);
  color: var(--colorBrandForeground2);
}

.link-card-title {
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase400);
  font-weight: var(--fontWeightSemibold);
  line-height: 22px;
}

.link-card-desc {
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.link-card-foot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--colorBrandForeground1);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightSemibold);
}

/* ---- 面板（设置、关于、空状态容器） ------------------------------------- */

.panel {
  padding: 20px;
  border: 1px solid var(--colorNeutralStroke3);
  border-radius: var(--borderRadiusXLarge);
  background: var(--colorNeutralBackground1);
}

.panel + .panel {
  margin-top: var(--spacingHorizontalM);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacingHorizontalM);
  margin-bottom: 14px;
}

.panel-title {
  margin: 0 0 2px;
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase400);
  font-weight: var(--fontWeightSemibold);
  line-height: 22px;
}

.panel-desc {
  margin: 0;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.panel-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--borderRadiusLarge);
  background: var(--colorNeutralBackground2);
  color: var(--colorBrandForeground1);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacingHorizontalS);
  margin-top: 16px;
}

/* ---- 空状态 ------------------------------------------------------------- */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 24px;
  border: 1px dashed var(--colorNeutralStroke2);
  border-radius: var(--borderRadiusXLarge);
  background: color-mix(in srgb, var(--colorNeutralBackground2) 55%, transparent);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 2px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralBackground1);
  color: var(--colorNeutralForeground3);
  box-shadow: var(--shadow2);
}

.empty-title {
  margin: 0;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  font-weight: var(--fontWeightSemibold);
  line-height: 20px;
}

.empty-desc {
  max-width: 46ch;
  margin: 0;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
  text-wrap: pretty;
}

.empty-action {
  margin-top: 8px;
}

/* ---- 条目列表 ----------------------------------------------------------- */

.entry-list {
  display: grid;
  gap: var(--spacingHorizontalM);
}

.entry {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--colorNeutralStroke3);
  border-radius: var(--borderRadiusXLarge);
  background: var(--colorNeutralBackground1);
  transition:
    border-color var(--durationFaster) var(--curveEasyEase),
    box-shadow var(--durationFaster) var(--curveEasyEase);
}

.entry:hover {
  border-color: var(--colorNeutralStroke1Hover);
  box-shadow: var(--shadow4);
}

.entry-title {
  margin: 0;
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase400);
  font-weight: var(--fontWeightSemibold);
  line-height: 22px;
  text-wrap: pretty;
}

.entry-title a:hover {
  color: var(--colorBrandForeground1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-summary {
  margin: 0;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300);
  text-wrap: pretty;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.entry-meta time {
  white-space: nowrap;
}

.entry-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralForeground4);
}

/* ---- 工具条 / 标签筛选 -------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--spacingHorizontalM);
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--colorNeutralStroke3);
  border-radius: var(--borderRadiusXLarge);
  background: var(--colorNeutralBackground1);
}

.toolbar[hidden] {
  display: none;
}

.toolbar-label {
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 16px;
  white-space: nowrap;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--colorNeutralStroke2);
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralBackground1);
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
  cursor: pointer;
  transition:
    background-color var(--durationFaster) var(--curveEasyEase),
    border-color var(--durationFaster) var(--curveEasyEase),
    color var(--durationFaster) var(--curveEasyEase);
}

.tag-button:hover {
  border-color: var(--colorNeutralStroke1Hover);
  background: var(--colorSubtleBackgroundHover);
}

.tag-button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--colorBrandBackground2);
  color: var(--colorBrandForeground2);
  font-weight: var(--fontWeightSemibold);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralBackground3);
  color: var(--colorNeutralForeground3);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
}

.tag-link:hover {
  background: var(--colorNeutralBackground3);
  color: var(--colorBrandForeground1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-count {
  margin: 0 0 12px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
}

/* ---- 归档 --------------------------------------------------------------- */

.archive-year {
  max-width: 900px;
  margin-top: 28px;
}

.archive-year:first-of-type {
  margin-top: 0;
}

.archive-year-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--colorNeutralStroke3);
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase500);
  font-weight: var(--fontWeightSemibold);
  line-height: 28px;
}

.archive-year-number {
  color: var(--colorNeutralForeground1);
  font: inherit;
}

.archive-year-count {
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  font-weight: var(--fontWeightRegular);
  line-height: 18px;
}

.archive-month {
  margin-top: 16px;
}

.archive-month-title {
  margin: 0 0 8px;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  font-weight: var(--fontWeightSemibold);
  line-height: 20px;
}

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

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--borderRadiusMedium);
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  line-height: 20px;
  transition: background-color var(--durationFaster) var(--curveEasyEase);
}

.archive-item:hover {
  background: var(--colorSubtleBackgroundHover);
  color: var(--colorNeutralForeground1);
}

.archive-item time {
  flex: 0 0 auto;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  font-variant-numeric: tabular-nums;
}

.archive-item-title {
  min-width: 0;
}

.archive-item .tag {
  margin-inline-start: auto;
}

/* ---- 搜索页 ------------------------------------------------------------- */

.search-page-field {
  display: flex;
  gap: var(--spacingHorizontalS);
  margin-bottom: 6px;
}

.search-page-field fluent-text-input {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
}

.search-page-hint {
  margin: 0 0 20px;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

mark {
  padding: 0 2px;
  border-radius: 2px;
  background: var(--colorBrandBackground2);
  color: var(--colorBrandForeground2);
}

/* ---- 设置 --------------------------------------------------------------- */

.settings-stack {
  display: grid;
  gap: var(--spacingHorizontalM);
  max-width: 880px;
}

.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacingHorizontalXXL);
  padding: 14px 0;
  border-bottom: 1px solid var(--colorNeutralStroke3);
}

.setting-row:first-of-type {
  padding-top: 4px;
}

.setting-row:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.setting-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.setting-title {
  color: var(--colorNeutralForeground1);
  font-size: var(--fontSizeBase300);
  font-weight: var(--fontWeightSemibold);
  line-height: 20px;
}

.setting-desc {
  max-width: 60ch;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.setting-control {
  flex: 0 0 auto;
  padding-top: 2px;
}

.choice-grid {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

/* fluent-field + fluent-radio 组成一行选项（官方推荐的标签组合方式） */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: flex-end;
}

.choice-row fluent-field {
  min-width: 0;
}

.theme-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 2px 8px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorNeutralBackground2);
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase200);
  line-height: 16px;
}

.theme-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--borderRadiusCircular);
  background: var(--colorBrandBackground);
}

.field-note {
  margin: 12px 0 0;
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.field-note code {
  padding: 1px 4px;
  border-radius: var(--borderRadiusSmall);
  background: var(--colorNeutralBackground3);
}

.accent-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 强调色样片：方形色块，避免与单选圆点混淆 */
.accent-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid color-mix(in srgb, var(--colorNeutralForeground1) 20%, transparent);
  border-radius: 4px;
  background: var(--swatch, var(--colorBrandBackground));
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--colorNeutralStroke3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row > span {
  color: var(--colorNeutralForeground3);
}

.detail-row strong {
  color: var(--colorNeutralForeground2);
  font-weight: var(--fontWeightSemibold);
  text-align: end;
}

/* ---- 页脚（由 shell.js 注入，随内容滚动） -------------------------------- */

.page-foot {
  width: 100%;
  max-width: var(--site-content-max);
  margin: 40px auto 0;
  padding: 18px 0 calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--colorNeutralStroke3);
  color: var(--colorNeutralForeground3);
  font-size: var(--fontSizeBase200);
  line-height: 18px;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  color: var(--colorNeutralForeground3);
}

.foot-links a:hover {
  color: var(--colorBrandForeground1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- 对话框与消息条 ----------------------------------------------------- */

fluent-dialog::part(dialog) {
  max-width: min(460px, calc(100vw - 32px));
}

fluent-dialog-body::part(content) {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

fluent-dialog-body h2 {
  margin: 0;
  color: var(--colorNeutralForeground1);
  font: inherit;
  font-size: var(--fontSizeBase400);
  font-weight: var(--fontWeightSemibold);
}

.dialog-copy {
  margin: 0;
  color: var(--colorNeutralForeground2);
  font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--spacingHorizontalS);
}

.app-message {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow16);
}

.app-message fluent-button {
  margin-inline-start: 8px;
}

.app-message:not([hidden]) {
  animation: message-in var(--durationFast) var(--curveDecelerateMid) both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- noscript ----------------------------------------------------------- */

.noscript-message {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 300;
  padding: 12px 16px;
  border: 1px solid var(--colorStatusWarningBorder1);
  border-radius: var(--borderRadiusMedium);
  background: var(--colorStatusWarningBackground1);
  color: var(--colorStatusWarningForeground1);
  font-size: var(--fontSizeBase200);
}

/* ==========================================================================
   动效偏好：系统设置 + 站点开关都会写入 --duration* 令牌
   ========================================================================== */

html.reduce-motion {
  --durationUltraFast: 0.01ms;
  --durationFaster: 0.01ms;
  --durationFast: 0.01ms;
  --durationNormal: 0.01ms;
  --durationSlow: 0.01ms;
  --durationSlower: 0.01ms;
  --durationUltraSlow: 0.01ms;
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --durationUltraFast: 0.01ms;
    --durationFaster: 0.01ms;
    --durationFast: 0.01ms;
    --durationNormal: 0.01ms;
    --durationSlow: 0.01ms;
    --durationSlower: 0.01ms;
    --durationUltraSlow: 0.01ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 1180px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) 236px;
  }

  .hero-visual {
    min-height: 200px;
  }

  .hero-orbit--outer {
    width: 196px;
    height: 196px;
  }

  .hero-orbit--inner {
    width: 140px;
    height: 140px;
  }
}

@media (max-width: 1080px) {
  .hero-visual {
    display: none;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .app,
  html.nav-compact .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .main {
    grid-column: 1;
  }

  .search-shell {
    display: none;
  }

  /* 标题栏搜索框隐藏后，用图标按钮进入搜索页 */
  .search-jump {
    display: inline-grid;
  }

  .page {
    padding-top: 24px;
  }

  .brand-subtitle {
    display: none;
  }

  .hero {
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .setting-row {
    flex-direction: column;
    gap: 10px;
  }

  .setting-control {
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-title {
    font-size: var(--fontSizeHero700);
    line-height: var(--lineHeightHero700);
  }

  .hero-actions fluent-button {
    flex: 1 1 auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-field {
    min-width: 0;
  }

  .archive-item {
    flex-wrap: wrap;
  }

  .archive-item .tag {
    margin-inline-start: 0;
  }

  .app-message {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}
