/* ============================================================
   Base — resets, typography, global primitives
   ============================================================ */

*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  letter-spacing: -0.005em;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.92em; }

h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: var(--fw-semibold); letter-spacing: -0.02em; line-height: var(--lh-tight); }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
p { margin: 0; }

::selection { background: var(--brand-500); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: var(--r-full); border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Utility helpers ──────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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; }

.row { display: flex; align-items: center; }
.row-nowrap { flex-wrap: nowrap; }
.align-items-center { align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.gap-7 { gap: var(--s-7); } .gap-8 { gap: var(--s-8); } .gap-10 { gap: var(--s-10); }
.spacer { flex: 1; }
.mt-1 { margin-top: var(--s-1); }
.m-r-1 { margin-right: var(--s-1); }

/* ── Text styles ──────────────────────────────────────── */
.t-mono-xs { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-tertiary); }
.t-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.t-muted { color: var(--text-secondary); }
.t-dim { color: var(--text-tertiary); }
.t-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ── Focus ring ──────────────────────────────────────── */
*:focus { outline: none; }
*:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--r-sm); }

/* ── Layout primitives ───────────────────────────────── */
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.panel-elev {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.divider { height: 1px; background: var(--border-subtle); width: 100%; }
.divider-v { width: 1px; align-self: stretch; background: var(--border-subtle); }

/* ── Scroll area ─────────────────────────────────────── */
.scroll-y { overflow-y: auto; overflow-x: hidden; }

/* ── Responsive helpers ──────────────────────────────── */
/* Use `.hide-on-mobile` to drop secondary chrome on phones, `.show-on-mobile`
   to mount mobile-only affordances (e.g. an action sheet trigger that
   replaces a hidden inline button). The mobile breakpoint here matches
   the shell drawer at 768px in shell.css. */
.hide-on-mobile { display: initial; }
.show-on-mobile { display: none; }
.hide-on-tablet { display: initial; }

@media (max-width: 768px) {
  .hide-on-mobile { display: none !important; }
  .show-on-mobile { display: initial; }
  .show-on-mobile.row { display: flex; }
}
@media (max-width: 1024px) {
  .hide-on-tablet { display: none !important; }
}

/* Stack a `.row` to a column on mobile. Use sparingly — most page layouts
   should use `flex-wrap: wrap` and let the children flow naturally. */
@media (max-width: 768px) {
  .row.stack-on-mobile { flex-direction: column; align-items: stretch; }
}

/* Prevent root horizontal overflow on phones — extra-wide content
   inside `.content` already scrolls vertically; horizontal scroll is
   reserved for explicit `.table-scroll` wrappers.
   `clip` (not `hidden`) so `position: sticky` on descendants like
   `.mkt-nav` still anchors to the viewport — `hidden` here would
   establish a scroll container and silently break every sticky nav. */
html, body { overflow-x: clip; max-width: 100vw; }

/* ── Global animations ───────────────────────────────── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
