/* MarketMind Edge — shared polish layer.
 *
 * Additive only: enhances feel, accessibility, and consistency without
 * overriding any page's layout. Interactive-element rules use :where() (zero
 * specificity) so a page's own styles always win. Relies on the design tokens
 * already declared :root on every Edge page (--accent, --bg, --text, …) with
 * hard-coded fallbacks for safety. Loaded last in <head> on all pages. */

/* ── Crisper type everywhere (3 pages were missing smoothing) ─────────────── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

/* ── Accessible keyboard focus ring (no page had one) ────────────────────── */
/* Only shows for keyboard users (focus-visible), never on mouse click. */
:where(a, button, input, select, textarea, summary, [tabindex], [role="button"]):focus-visible {
  outline: 2px solid var(--accent, #0ea5e9);
  outline-offset: 2px;
  border-radius: 6px;
}
:where(a, button, input, select, textarea, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}

/* ── Branded text selection ──────────────────────────────────────────────── */
::selection { background: rgba(14, 165, 233, 0.30); color: var(--text, #e8edf2); }

/* ── Subtle custom scrollbar (premium feel, both engines) ────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--bg-3, #1a232e) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-3, #1a232e);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-2, rgba(14, 165, 233, 0.40)); background-clip: content-box; }

/* ── Gentle default transition on interactive elements ───────────────────── */
/* Zero-specificity: a page that sets its own transition overrides this. */
:where(a, button, [role="button"], .btn, input, select) {
  transition: color .15s ease, background-color .15s ease, border-color .15s ease,
              box-shadow .15s ease, opacity .15s ease;
}

/* ── Comfortable tap targets on touch devices (controls only, not text links) */
@media (hover: none) and (pointer: coarse) {
  button, input[type="submit"], input[type="button"], [role="button"] { min-height: 44px; }
}

/* ── Respect reduced-motion preference ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
