/* ==========================================================================
   Base — reset, typography, focus, scrollbars, small utilities.
   Layout directions avoid physical left/right where practical so a future
   RTL language only needs `dir="rtl"`.
   ========================================================================== */

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

/* The hidden attribute must always win over component display rules
   (.btn etc. set display themselves, which would otherwise beat the UA's
   [hidden] rule and keep "hidden" elements on screen). */
[hidden] { display: none !important; }

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

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 650; }
p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

button:disabled { cursor: default; opacity: 0.45; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

::selection { background: var(--accent-soft); }

/* Theme-adaptive scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* Numbers read as instrumentation: tabular, slightly technical */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.icon { width: 18px; height: 18px; flex: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.flex-spacer { flex: 1 1 auto; }

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