/* INFORENT base CSS — the element-level rules every surface shares.
 *
 * Taken from the portal's global CSS (web/index.html), which is the reference
 * design: the portal inlines this region via web/scripts/tokens-sync.mjs, the
 * website imports this file directly, right after tokens.css. Only rules that
 * mean the same on every surface belong here — an app shell's own layout
 * (body height, overflow) stays in the app.
 *
 * Needs tokens.css (every value is a var(--…)).
 */
/* BEGIN base — generic element rules, identical on every INFORENT surface.
   The portal copies this region verbatim; edit it here, never in a copy. */
*, *::before, *::after { box-sizing: border-box; }

/* Form controls and code do not inherit the font from body in the UA sheet —
   both would ignore --ui-font / --mono-font (and every skin that sets them). */
button, input, select, textarea, optgroup { font-family: inherit; }
code, kbd, pre, samp { font-family: var(--mono-font); }

body {
  margin: 0;
  font-family: var(--ui-font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Form fields: soft focus halo replaces the hard outline. */
input, select, textarea {
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Touch devices: iOS zooms in on any focused field below 16px and never zooms
   back out. A hard 16px (iOS's threshold, not a step on the type ramp); never
   "fix" this with maximum-scale / user-scalable=no — that kills pinch zoom. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* Everything else (links, custom buttons, divs): visible keyboard ring. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
/* Buttons keep the outline ring; an inline boxShadow cannot defeat an outline. */
button:focus-visible:not(:disabled) { box-shadow: 0 0 0 3px var(--primary-ring); }

button { transition: filter var(--dur-fast) ease, opacity var(--dur-fast) ease, box-shadow var(--dur-fast) ease; }
button:hover:not(:disabled) { filter: brightness(0.94); }
button:active:not(:disabled) { filter: brightness(0.88); }
/* Disabled is a state, not a faded copy: desaturate, so a solid fill turns into
   a neutral grey slab and a ghost button stays transparent — one rule for all. */
button:disabled { filter: grayscale(1) opacity(0.62); cursor: not-allowed; }

::selection { background: var(--select-bg); color: inherit; }

/* Thin scrollbars in the brand colours. */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }
::-webkit-scrollbar-corner { background: transparent; }

/* Skip link: first in the tab order, off-screen until focused. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1300;
  padding: var(--space-8) var(--space-14);
  background: var(--surface);
  color: var(--text-heading);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: var(--font-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 8px; }

/* Respect the OS "reduce motion" setting. [data-motion="essential"] opts back
   in: a frozen spinner is not a calmer spinner, it is a broken one. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-motion="essential"], [data-motion="essential"] * {
    animation-duration: revert !important;
    animation-iteration-count: revert !important;
  }
}
/* END base */
