/* 全站可访问性兜底层。
   只放置“兜底”规则：不定义品牌视觉，也不替代组件自身的设计化焦点样式。
   由 base.html（工作台）与 layouts/auth_base.html（登录注册）共同加载，
   因为登录注册页不加载 theme.css，无法复用其中的令牌与规则。 */

/* ── 聚焦态不提供视觉指示 ──
   DESIGN.md §9.2 要求聚焦前后控件外观完全一致：不使用 outline、ring 或焦点专属
   描边、光圈、背景变化。这里作为全站兜底抑制浏览器默认焦点环，并覆盖组件内
   `focus:outline-none` 之类的残留声明（特异性 (0,2,0)，普通规则无法覆盖，故用 !important）。
   模板、JS 与页面样式不得再声明 focus:/focus-visible:/focus-within:/peer-focus*: 视觉类；
   键盘可用性（焦点顺序、弹窗移动与恢复焦点、Escape 关闭）不受影响。 */
:where(a, area, button, input, select, textarea, summary, [tabindex]):focus,
:where(a, area, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
}

/* ── 仅屏幕阅读器可见 ──
   与 Tailwind 的 sr-only 等价的兜底定义：公开官网（public/v2）不加载 Tailwind，
   模板里的 <span class="sr-only"> 缺了这条规则会被直接渲染成可见文本。 */
.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;
}

/* ── 跳到主内容 ──
   平时移出视口，仅在获得键盘焦点时出现在左上角。
   侧栏位于 main 之前，没有这个入口时键盘用户每次都要 Tab 穿越整条导航。 */
.skip-to-content {
  position: fixed;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  box-shadow: 0 10px 25px -12px rgba(15, 23, 42, 0.45);
}

.dark .skip-to-content {
  background: #1e293b;
  color: #e2e8f0;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
  left: 1rem;
  top: 1rem;
}

/* ── 减少动效 ──
   DESIGN.md 要求尊重 prefers-reduced-motion：停止无限循环动画与非必要过渡，
   但保留功能（不隐藏内容、不移除状态变化本身）。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
