/* Base: fonts, resets, typography scale, global utility classes. See docs/DESIGN.md
   "Typography"/"Do's and Don'ts". Dark only, no light theme. */

@font-face {
  font-family: "Geist";
  src: url("/static/vendor/fonts/Geist-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/vendor/fonts/GeistMono-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-line);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-sans);
  margin: 0 0 var(--space-2);
  color: var(--text);
}

h1 {
  font-size: var(--text-h1-size);
  font-weight: var(--text-h1-weight);
  line-height: var(--text-h1-line);
  letter-spacing: var(--text-h1-tracking);
}

h2 {
  font-size: var(--text-h2-size);
  font-weight: var(--text-h2-weight);
  line-height: var(--text-h2-line);
  letter-spacing: var(--text-h2-tracking);
}

h3 {
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  line-height: var(--text-h3-line);
}

p {
  margin: 0 0 var(--space-2);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.mono,
.tabular-nums {
  font-family: var(--font-mono);
  font-feature-settings: var(--tabular-nums);
}

.text-muted {
  color: var(--text-muted);
}

.text-subtle {
  color: var(--text-subtle);
}

.text-primary {
  color: var(--primary);
}

.text-danger {
  color: var(--danger);
}

.text-hot {
  color: var(--stage-hot);
}

.text-caption {
  font-size: var(--text-caption-size);
  line-height: var(--text-caption-line);
  color: var(--text-subtle);
}

.label-caps {
  font-size: var(--text-label-caps-size);
  font-weight: var(--text-label-caps-weight);
  line-height: var(--text-label-caps-line);
  letter-spacing: var(--text-label-caps-tracking);
  text-transform: uppercase;
  color: var(--text-subtle);
}

.error {
  color: var(--danger);
  font-size: var(--text-body-sm-size);
}

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

/* Structural helpers shared by every page (old and new). */

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.section-gap {
  margin-bottom: var(--space-5);
}

.section-gap-top {
  margin-top: var(--space-4);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-4);
}

.table-wrap {
  overflow-x: auto;
}

/* Toggle a DOM subtree by viewport (T28) — used where a mobile layout needs its own markup, not
   just restyled desktop markup (e.g. Token detail's per-window metrics: a table on desktop, a
   card carousel on mobile, see components.css ".window-cards"). */
.mobile-only {
  display: none;
}

@media (max-width: 640px) {
  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

.chart-wrap {
  position: relative;
  height: 220px;
  margin-bottom: var(--space-5);
}

.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-body-sm-size);
  color: var(--text-muted);
}

/* Modifiers for a `.filter-bar` used as a form's trailing action row (a plain table/grid has no
   bottom margin of its own to create the gap `.filter-bar` normally relies on its neighbour for,
   and the row is the card's last child, so it shouldn't add one below itself either). Avoids
   `style=` attributes (CSP `style-src 'self'`, see docs/DESIGN.md "Implementation notes"). */
.filter-bar-end {
  margin-bottom: 0;
}

.form-actions {
  margin-top: var(--space-4);
  margin-bottom: 0;
}

.filter-bar-split {
  justify-content: space-between;
}

.no-margin {
  margin: 0;
}

.filter-bar-nowrap {
  flex-wrap: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  font-size: var(--text-body-sm-size);
  color: var(--text-subtle);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 var(--space-5);
}

.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  vertical-align: -3px;
}

.icon-lg {
  width: 18px;
  height: 18px;
}

@media (max-width: 720px) {
  .chart-wrap {
    height: 180px;
  }
}
