@layer tokens, base, ui, shell, surface;
@layer base {
  /* Base (docs/signal.md): reset, type, focus, scrollbars. No components or layout here. */
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html, body { height: 100%; }
  html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
  body {
    font-family: var(--font-sans);
    font-size: var(--t-13);
    line-height: var(--lh);
    letter-spacing: var(--track-ui);
    color: var(--color-ink);
    background: var(--grad-desk) fixed;
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis-weight: none;
    overflow: hidden; /* one page: each place scrolls on its own */
    overscroll-behavior: none;
  }
  h1, h2, h3, h4 { font-family: var(--font-display); font-weight: var(--w-title); line-height: var(--lh-tight); letter-spacing: var(--track-display); }
  code, kbd, pre, samp { font-family: var(--font-mono); font-size: 0.92em; }
  p { line-height: var(--lh); }
  a { color: inherit; }
  img, video, canvas { display: block; max-width: 100%; }
  svg { display: block; flex-shrink: 0; }
  :where(svg[data-icon]) { stroke-width: var(--icon-stroke); stroke-linecap: var(--icon-cap); stroke-linejoin: var(--icon-join); }

  button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
  button:disabled { cursor: default; }
  input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
  [contenteditable] { outline: none; }
  [hidden] { display: none !important; }

  :focus { outline: none; }
  :focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
  ::placeholder { color: var(--color-ink-faint); opacity: 1; }
  ::selection { background: var(--color-wash); color: inherit; }

  /* Scrollbars: thin, trackless, a faint thumb that firms up on hover. */
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--s-tint-4); background-clip: padding-box; border: 2px solid transparent; border-radius: var(--r-round); }
  ::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--color-ink) 28%, transparent); }
  @supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--s-tint-4) transparent; } }

  /* Controls are controls: a long press neither selects them nor opens a callout. */
  button, [role="tab"], [role="menuitem"], [role="toolbar"] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

  /* iOS zooms into a text control under 16 px; touch screens get 16 px in fields. */
  @media (hover: none), (pointer: coarse) {
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="color"], [data-native-size]),
    textarea:not([data-native-size]), select, [contenteditable="true"]:not([data-native-size]) { font-size: 16px; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  }
}
