/* Claude 风格工作台 · 基础层
   来源：dsh-claude-style@1e7acc5b 的 theme/chrome.css、docs/STYLE.md。 */

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: calc(var(--text-ui) + var(--page-scale, 0px));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--link);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

input,
textarea {
  background: transparent;
  border: 0;
  outline: 0;
  min-width: 0;
}

textarea {
  resize: none;
}

::selection {
  background: var(--selection);
  color: var(--selection-ink);
}

:root[data-window-blur="true"] ::selection {
  background: #c7c7c6;
  color: #000000;
}

/* 键盘焦点：宿主自己的焦点环，不使用强调色 */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* 滚动条：上游的鼠标滚轴尺寸与颜色 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* 滚动条只在需要时出现，避免长对话里常驻一条深色轨道 */
.scroll-thin {
  scrollbar-gutter: stable;
}
.scroll-thin:not(:hover):not(:focus-within)::-webkit-scrollbar-thumb {
  background: transparent;
}

/* 屏幕阅读器专用 */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 跳过导航 */
.skip {
  position: fixed;
  left: 12px;
  top: -48px;
  z-index: var(--layer-takeover);
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  padding: 8px 12px;
  font-size: 13px;
  transition: top var(--timing-feedback);
}
.skip:focus {
  top: 12px;
}

/* 通用图标 */
.aw-svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.8;
}
.sz-14 {
  width: 14px;
  height: 14px;
}
.sz-18 {
  width: 18px;
  height: 18px;
}
.sz-20 {
  width: 20px;
  height: 20px;
}

/* 原生控件保留语义，外观由 .aw-select / select 样式绘制 */
select {
  appearance: none;
}

/* 文字不能被长内容顶破 */
.min0 {
  min-width: 0;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
/* 并列的几段信息只靠间距分开，不用分隔符号（见 core.mjs 的 setParts）。 */
.parts > span + span {
  margin-left: 0.5em;
}
.hidden,
[hidden] {
  display: none !important;
}

/* 减少动效 */
@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;
  }
}
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* ---------- 滑动高亮 ----------
   上游 shared/sliding-pill.css：motion.mjs 量出选中项的盒子写进 --pill-*，
   这里在控件上画一块底并在之后每次切换时滑过去（240ms glide）。
   外观（底色、圆角、阴影）由各控件自己的样式表给；控件本身需要 position: relative，
   子项需要 position: relative + z-index 压在这块底之上。 */
[data-pill]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--pill-w, 0px);
  height: var(--pill-h, 0px);
  transform: translate(var(--pill-x, 0px), var(--pill-y, 0px));
  pointer-events: none;
  transition: transform var(--dur-slide) var(--ease-glide),
    width var(--dur-slide) var(--ease-glide), height var(--dur-slide) var(--ease-glide),
    background-color var(--timing-feedback);
}

/* ---------- 视图进场 ----------
   上游 shared/motion.css 的 surface-in：新出现的页从下方 4px 淡入。
   motion.mjs 的 playEnter 只在真正切换时打上 data-enter，动画结束即撤掉，
   静止时不留 transform（不给长列表多一层合成）。 */
[data-enter] {
  animation: view-enter var(--dur-move) var(--ease-settle) backwards;
}
@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
