/* ==========================================================================
   Base layer — element defaults, typography rhythm, accessibility floor.
   Component classes live in components.css; nothing here is component aware.
   ========================================================================== */

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

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

body {
  margin: 0;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* Display face is used with restraint: page titles, stat values, modal
   headings. Everything else stays in Inter so dense tables stay readable. */
h1, h2, h3, .font-display {
  font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
  letter-spacing: -0.018em;
}

/* Instrument readouts. Job numbers, serials, voltages, capacities and money
   all share one face so the eye can scan a column without re-anchoring. */
.readout,
.tabular {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.num { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------------
   Accessibility floor
   ------------------------------------------------------------------------- */

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

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 200;
  transform: translateY(-200%);
  border-radius: var(--gt-radius-sm);
  background: rgb(var(--gt-primary));
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  transition: transform var(--gt-dur) var(--gt-ease);
}
.skip-link:focus { transform: translateY(0); }

/* One focus treatment for the entire product. Focus is always visible for
   keyboard users and never shown for pointer users. */
:focus-visible {
  outline: 2px solid rgb(var(--gt-primary));
  outline-offset: 2px;
  border-radius: var(--gt-radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

@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;
  }
}

/* -------------------------------------------------------------------------
   Scrollbars — thin and recessive, so dense tables do not gain visual weight
   from their own chrome.
   ------------------------------------------------------------------------- */

* { scrollbar-width: thin; scrollbar-color: rgb(var(--gt-hairline)) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgb(var(--gt-hairline));
  border: 3px solid transparent;
  border-radius: var(--gt-radius-full);
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgb(var(--gt-faint) / 0.6); background-clip: content-box; }

/* -------------------------------------------------------------------------
   Form element resets — Tailwind's CDN build ships no forms plugin, so the
   shared field appearance is defined once here.
   ------------------------------------------------------------------------- */

input, select, textarea, button { font: inherit; color: inherit; }

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

input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }

::placeholder { color: rgb(var(--gt-faint)); opacity: 1; }

/* Autofill in Chrome paints an opaque yellow box that breaks the dark theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: rgb(var(--gt-ink));
  -webkit-box-shadow: 0 0 0 1000px rgb(var(--gt-surface)) inset;
  caret-color: rgb(var(--gt-ink));
}

/* -------------------------------------------------------------------------
   Selection & misc
   ------------------------------------------------------------------------- */

::selection { background: rgb(var(--gt-primary) / 0.18); color: rgb(var(--gt-ink)); }

[hidden] { display: none !important; }

[data-tooltip] { position: relative; }

img, svg, video, canvas { display: block; max-width: 100%; }

hr { border: 0; border-top: 1px solid rgb(var(--gt-hairline)); margin: 0; }

code, kbd, samp {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 0.9em;
}

/* -------------------------------------------------------------------------
   Shared keyframes
   ------------------------------------------------------------------------- */

@keyframes gt-fade-in   { from { opacity: 0 } to { opacity: 1 } }
@keyframes gt-fade-out  { from { opacity: 1 } to { opacity: 0 } }
@keyframes gt-rise      { from { opacity: 0; transform: translateY(8px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes gt-sink      { from { opacity: 1; transform: none } to { opacity: 0; transform: translateY(6px) scale(.99) } }
@keyframes gt-slide-in-right { from { transform: translateX(100%) } to { transform: none } }
@keyframes gt-slide-out-right { from { transform: none } to { transform: translateX(100%) } }
@keyframes gt-shimmer   { 100% { transform: translateX(100%) } }
@keyframes gt-spin      { to { transform: rotate(360deg) } }
@keyframes gt-pulse-soft { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }

/* The boot rail charges cell-by-cell — the app's signature motif, used once
   at launch and never repeated as decoration. */
@keyframes gt-charge {
  0%, 100% { background: rgb(var(--gt-hairline)); transform: scaleY(.72) }
  45%      { background: rgb(var(--gt-charge));   transform: scaleY(1) }
}
