/* ----------------------------------------------------------------------------
   base.css — Reset, base element styles, the small utility classes (.muted, .row,
   .stack, .visually-hidden…) and the two full-viewport background layers
   (.starfield canvas + .glow-layer wash).
   Slice 2 of 16 (see css/tokens.css for the full load order).
   ------------------------------------------------------------------------- */
/* ------------------------------------------------------------ base */
* {
  box-sizing: border-box;
}

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

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

body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

h1 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}

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

:focus {
  outline: none;
}

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

/* ------------------------------------------------------------ utilities */
.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.error {
  color: var(--danger-text);
}

.grow {
  flex: 1;
  min-width: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.center {
  display: grid;
  place-items: center;
  height: 60vh;
  text-align: center;
  padding: 0 20px;
}

[hidden] {
  display: none !important;
}

/* Off-screen but still rendered. Used for the file/folder <input>s: Safari (and
   some other engines) refuse to open the native picker for a display:none input,
   so `hidden` would make the "Choose folder" button do nothing. This keeps the
   input in the layout while remaining invisible. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ------------------------------------------------------------ background layers */
/* dash field (js/starfield.js) — bottom layer of the background stack */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  display: block;
}

/* The living light: follows the dash field's ring, breathes with it, and
   brightens as it accelerates.
   PERFORMANCE — while the dash field runs, this div is HIDDEN and the same
   three gradients are painted inside the WebGL canvas (the glow pass in
   js/starfield.js): as a DOM layer it cost a second viewport-sized texture
   and a full-screen alpha blend on every composite. The div remains the
   fallback renderer when the field is off (fx toggle, no WebGL), driven by
   js/ambient.js. In that mode it must never repaint: moving the gradient
   centres or radii re-rasterises three viewport-sized gradients, and an
   animated filter re-runs a colour matrix over every pixel. So the gradients
   are baked at a fixed rest position (see --glow) and all motion goes through
   `transform` and `opacity` — the two properties the compositor animates on
   the GPU with no repaint at all. Keep it that way, and keep the geometry in
   sync with GLOW_GEO / GLOW_RGBA in js/starfield.js. */
.glow-layer {
  content: '';
  position: fixed;
  /* Overscan: ambient.js translates this layer by up to ~half a viewport and
     breathes its scale down to ~0.9 — at inset:0 that pulled the layer's own
     edge into view, and the gradients clipped at that edge painted a hard
     straight cut-off line (worst with the star field off, when this div is
     the glow's only renderer — the WebGL path computes the gradients
     per-pixel and has no edge to show). 25% of margin on every side keeps
     the boundary off-screen through the full motion range. The gradient
     centres in --glow are expressed in this box's coordinates. */
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background: var(--glow);
  transform-origin: 50% 46%;
  /* the gradients' optical centre */
  will-change: transform, opacity;
}

