/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background: var(--bg-primary);
  color-scheme: light;
}

/* The mesh, once, fixed to the viewport (background-attachment: fixed does nothing
   on iOS). Nothing between it and the cards may paint a ground, so body and every
   page wrapper stay transparent. */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--page-mesh);
  pointer-events: none;
}

body {
  color: var(--text-primary);
  font-family: var(--font-body);
  /* Proportional, not tabular: Schibsted Grotesk's tabular set widens the
     period and the comma too, so "4.8%" read as "4 . 8%" (2026-10-13).
     Figures that line up in columns use the mono face or opt in. */
  font-variant-numeric: normal;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: var(--hover-bg);
}

/* Input & form styling. :where() keeps this at zero specificity so a field's
   own rule (a transparent input inside a bordered pill, say) wins. */
:where(input[type="text"], input[type="number"], textarea, select) {
  background: var(--surface-input);
  border-color: var(--border2);
  color: var(--text-primary);
}
input[type="text"], input[type="number"], textarea, select {
  transition: border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-soft);
}
/* The rule above is for fields with a border to darken. A native checkbox has
   none, so it takes the ink outline every other control has. */
input:is([type="checkbox"], [type="radio"], [type="range"]):focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Browser defaults fall under 4.5:1 on the well, and Firefox dims them too. */
::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

/* Number inputs — keep clean terminal fields instead of legacy native steppers. */
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* Selection */
::selection { background: var(--accent-selection); }

/* Keyboard focus — one ring language for every control. It is an outline
   because a ring drawn with box-shadow loses to any component that sets its own
   shadow, and that left every .refresh-btn with no focus cue at all. :where()
   keeps specificity at zero so component-level :focus styles still win. */
:where(button, a, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
/* A dialog or the paywall takes focus by script. It is a surface, not a control,
   so it gets no ring around the whole panel. */
:where([tabindex="-1"]):focus-visible {
  outline: none;
}

/* Smooth page transitions */
body { animation: fadeIn 180ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fadeIn { from { opacity: 0.6; } to { opacity: 1; } }
