/*
  base.css — global reset and base element styling, adapted from Pelton's
  style.css for a browser context (text selection stays on, since this is a web
  app rather than a desktop webview). All values come from tokens.css; no literal
  colors live here.
*/

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background-color: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fz-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#app {
  height: 100%;
  width: 100%;
  /* flex column so each scene root (.scene/.mail/.dash) with flex:1 fills the
     full viewport height — otherwise the grid columns only grow to their content
     and leave dead space (and stub borders) below. */
  display: flex;
  flex-direction: column;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
}

img {
  max-width: 100%;
}

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

a:hover {
  text-decoration: underline;
}

/* selection uses the accent-derived wash. */
::selection {
  background: var(--selection-bg-strong);
}

/* a single, consistent focus ring for keyboard users, using the accent. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius-control);
}

/* thin, theme-aware scrollbars. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
  background-clip: padding-box;
  border: 3px solid transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* reduce motion: freeze animations and transitions when the user (or the OS)
   asks for it. near-zero durations instead of `none` so *end events still fire
   and js waiting on them never hangs. */
:root[data-reduce-motion] *,
:root[data-reduce-motion] *::before,
:root[data-reduce-motion] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !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;
  }
}
