/* ════════════════════════════════════════════════════════════════════
   Base — fonts, reset, scrollbar, ::selection, theme-flip plumbing
   ════════════════════════════════════════════════════════════════════ */

/* ── Geist Mono — Cyrillic ─────────────────────────────────────────── */
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116;
}
/* ── Geist Mono — Latin Extended ───────────────────────────────────── */
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
/* ── Geist Mono — Latin ────────────────────────────────────────────── */
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-mono-latin.woff2') format('woff2');
  unicode-range: U+0-7F,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* ── Geist Mono — Fallback metric-override ─────────────────────────── */
@font-face {
  font-family: 'Geist Mono Fallback';
  src: local(Arial);
  ascent-override: 74.67%;
  descent-override: 21.92%;
  line-gap-override: 0.0%;
  size-adjust: 134.59%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Disable native HTML5 drag on every `<img>` by default. Images are
   draggable out-of-the-box; when one happens to overlap or sit near an
   interactive control (e.g. the /cex and /defi position-timeline
   scrubber sits above a breakdown table full of ticker / venue icons),
   a mousedown that lands on the image starts a native drag and the
   control's pointer-events stream is starved — cursor switches to the
   (/) no-drop variant. The dashboard has no use for drag-and-drop of
   images, so flip the default for the whole app. Individual call sites
   can opt back in with explicit `draggable="true"` if ever needed. */
img { -webkit-user-drag: none; user-drag: none; }

html, body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button { font-family: inherit; cursor: pointer; color: inherit; background: none; border: none; }
input, select, textarea { font-family: inherit; color: inherit; }

/* Text selection: faint white tint on dark surfaces, soft Spartan-blue
   tint on light so selected text actually shows up. */
::selection { background: rgba(248, 248, 248, 0.22); }
:root[data-theme="light"] ::selection { background: rgba(40, 80, 148, 0.22); color: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────────────── */
/* Thumb is mixed from the current --foreground so the same rule produces
   a near-white thumb on dark backgrounds (visible against #0d0d0d) and a
   near-black thumb on light backgrounds (visible against #fafafa). The
   previous hardcoded `rgba(248,248,248,.10)` was white-on-white in light
   theme and produced an invisible track — most painfully on the capital-
   calls + fee-slabs grids inside .fund-cc-scroll / .fund-fs-scroll. */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--foreground) 18%, transparent);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--foreground) 36%, transparent);
}
/* Firefox — same intent via the standard property. */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--foreground) 18%, transparent) transparent;
}

/* ════════════════════════════════════════════════════════════════════
   THEME FLIP — auth.js setTheme() handles dark↔light via two paths:
   1. Modern browsers: View Transitions API (atomic crossfade).
   2. Fallback (Firefox today): instant simultaneous flip with all
      transitions suppressed via the `.theme-no-transition` class.
   ════════════════════════════════════════════════════════════════════ */
html.theme-no-transition,
html.theme-no-transition *,
html.theme-no-transition *::before,
html.theme-no-transition *::after {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}

/* Auth-mode body class hides the main shell while login is active */
body.auth-mode .app-shell { display: none; }
body.auth-mode { overflow: hidden; }
