@layer components {
  /* 页眉：品牌、三个站内入口、GitHub 与主题。没有登录入口。 */
  .site-header { position: sticky; top: 0; z-index: var(--ds-z-sticky); background: var(--ds-header-bg); backdrop-filter: blur(14px); box-shadow: 0 .5px 0 var(--ds-border); }
  .site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
  .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; text-decoration: none; }
  .brand img { width: 32px; height: 32px; }
  .site-nav { display: flex; align-items: center; gap: 4px; margin-inline-start: 16px; }
  .site-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: var(--ds-radius-pill); color: var(--ds-text-secondary); font-size: var(--text-small); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background var(--ds-motion-swift), color var(--ds-motion-swift); }
  .site-nav a:hover { background: var(--ds-on-surface); color: var(--ds-text-primary); }
  .site-nav a[aria-current="page"], .site-nav a[aria-current="location"] { background: var(--ds-selected-surface); color: var(--ds-selected-ink); }
  .header-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

  /* 按钮：实心变体悬停改不透明度，保持色相。 */
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border: 0; border-radius: var(--ds-radius-pill); font-size: var(--text-small); font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; transition: opacity var(--ds-motion-swift), transform var(--ds-motion-swift); }
  .button svg { width: 18px; height: 18px; flex: none; }
  .button--primary { background: var(--ds-brand-primary); color: var(--ds-brand-primary-text); }
  .button--primary:hover { opacity: .8; }
  .button--primary:active { opacity: .7; }
  .button--secondary { background: transparent; color: var(--ds-text-primary); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ds-text-primary) 28%, transparent); }
  .button--secondary:hover { background: var(--ds-on-surface); }
  .button--small { min-height: 40px; padding: 0 16px; }
  .button[aria-disabled="true"], .button:disabled { opacity: .5; cursor: not-allowed; }
  .icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--ds-radius-pill); background: transparent; color: var(--ds-text-secondary); transition: background var(--ds-motion-swift), opacity var(--ds-motion-swift); }
  .icon-button:hover { background: var(--ds-on-surface); color: var(--ds-text-primary); }
  .icon-button svg { width: 20px; height: 20px; }
  .theme-toggle .icon-moon { display: none; }
  html.dark .theme-toggle .icon-sun { display: none; }
  html.dark .theme-toggle .icon-moon { display: block; }

  .site-footer { margin-top: var(--section-gap); padding: 40px 0 56px; box-shadow: 0 -.5px 0 var(--ds-border); color: var(--ds-text-secondary); font-size: var(--text-small); }
  .site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
  .site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
  .site-footer a { text-decoration: none; }
  .site-footer a:hover { color: var(--ds-text-primary); text-decoration: underline; text-underline-offset: 4px; }

  .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--ds-radius-pill); background: var(--ds-selected-wash); color: var(--ds-selected-ink); font-size: var(--text-micro); font-weight: 500; }
}

@media (max-width: 720px) {
  .site-header .wrap { gap: 8px; }
  .site-nav { margin-inline-start: 0; }
  .site-nav a { padding: 0 10px; }
  .site-header .wrap { gap: 4px; }
  .button--github span { display: none; }
  .button--github { width: 40px; padding: 0; }
}
@media (max-width: 480px) {
  .brand span { display: none; }
  .site-nav { margin-inline-start: 4px; }
}
