/* ════════════════════════════════════════════════════════════════════════════
   InterbankOS Terminal · base layer
   ────────────────────────────────────────────────────────────────────────────
   Reset, document defaults, focus management, ambient backdrop. The base
   layer assumes tokens.css has loaded and provides the substrate every
   component sits on.
   ════════════════════════════════════════════════════════════════════════════ */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--paper);
  overflow-x: hidden;
  min-height: 100vh;
  /* Plex Sans has several stylistic alternates worth enabling:
     ss01 — alternate single-story g (improves at body sizes)
     cv11 — alternate ampersand
     Tabular and lining figures by default. */
  font-feature-settings: "tnum", "lnum", "ss01", "cv11";

  /* Ambient iridescent backdrop. Three radial gradients overlaid on a
     white-on-white linear gradient. The colors leak through the
     plexiglass cards without darkening anywhere the page is bare. */
  background-image:
    radial-gradient(ellipse 1200px 800px at 12% -10%, var(--tint-cyan), transparent 55%),
    radial-gradient(ellipse 1000px 700px at 88% 20%, var(--tint-blue), transparent 60%),
    radial-gradient(ellipse 1100px 900px at 50% 110%, var(--tint-mint), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #fbfdfe 50%, #ffffff 100%);
  background-attachment: fixed;
}

button {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

/* Scrollbars — subtle on the page, but always visible enough to find */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-6) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--ink-6);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--ink-5);
}

/* Focus management — always visible on keyboard navigation,
   suppressed during mouse navigation through :focus-visible */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link for keyboard users — invisible until focused */
.skip-link {
  position: fixed;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 10000;
  padding: var(--s-2) var(--s-3);
  background: var(--brand);
  color: white;
  border-radius: var(--r-2);
  font-weight: 500;
  font-size: 13px;
  transform: translateY(calc(-100% - var(--s-4)));
  transition: transform var(--dur-state) var(--ease-out);
}
.skip-link:focus {
  transform: translateY(0);
}

/* Visually-hidden — for accessible labels that must not display visually */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion respects user preference. The plexiglass iridescence
   stops animating but the rest of the interface remains usable. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: var(--dur-hover) !important;
  }
}

body {
  color-scheme: dark;
  background-image:
    radial-gradient(ellipse 900px 640px at 4% -10%, rgba(91, 141, 239, 0.20), transparent 62%),
    radial-gradient(ellipse 720px 520px at 94% 6%, rgba(183, 140, 255, 0.18), transparent 64%),
    radial-gradient(ellipse 900px 680px at 52% 112%, rgba(110, 240, 151, 0.10), transparent 60%),
    linear-gradient(180deg, #050811 0%, #070b16 48%, #050811 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.45 0 0 0 0 0.75 0 0 0 0.30 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}
